[rust-dev] To build libstd as separate library

2014-03-30 Thread Alexander Stavonin
Hi! I’m trying to build libstd like separate library (long term goal is Rust + libstd in kernel drivers). So, I made a copy of lib std and compiling it: num/int_macros.rs:231:1: 231:19 error: failed to find an implementation of trait kinds::Copy for int num/int_macros.rs:231 impl Int for $T

Re: [rust-dev] To build libstd as separate library

2014-03-30 Thread Alexander Stavonin
Best regards, Alexander On 30 Mar 2014, at 16:02, Daniel Micay danielmi...@gmail.com wrote: On 30/03/14 08:00 AM, Alexander Stavonin wrote: Hi! I’m trying to build libstd like separate library (long term goal is Rust + libstd in kernel drivers). So, I made a copy of lib std and compiling

Re: [rust-dev] To build libstd as separate library

2014-03-30 Thread Alexander Stavonin
Fixed. —cfg stage0 should be used. Best regards, Alexander www.sysdev.me On 30 Mar 2014, at 16:17, Alexander Stavonin a.stavo...@gmail.com wrote: I’ve latest night build version of rustic: libstd: rustc -v rustc 0.10-pre-nightly (ff64381 2014

[rust-dev] static mut and owning pointers

2014-01-28 Thread Alexander Stavonin
Hi all! I’m not sure is it an error or static mut variables misunderstanding from my side. The source: struct MyStruct { val: int } static mut global_data: Option~MyStruct = None; fn test_call() { unsafe { match global_data { Some(data) = { println!(We have data

Re: [rust-dev] 0.9 prerelease testing

2014-01-09 Thread Alexander Stavonin
FYI. Apple doesn't remove GDB in 10.9. They has removed symlink for it So, you can find GDB in /Applications/Xcode.app/Contents/Developer/usr/libexec/gdb/gdb-i386-apple-darwin and create symlink manually. Best, Alex 2014/1/9 Jack Moffitt j...@metajack.im We've got a little 0.9 release

Re: [rust-dev] 0.9 prerelease testing

2014-01-09 Thread Alexander Stavonin
at an older Xcode (say, Xcode 4.6)? -Kevin On Jan 9, 2014, at 4:04 AM, Alexander Stavonin a.stavo...@gmail.com wrote: FYI. Apple doesn't remove GDB in 10.9. They has removed symlink for it So, you can find GDB in /Applications/Xcode.app/Contents/Developer/usr/libexec/gdb/gdb-i386-apple

[rust-dev] Rust in OSX kernel

2013-12-18 Thread Alexander Stavonin
Hi, I ported rust.ko to OSX. Maybe it'll be interesting for somebody https://github.com/astavonin/RustyKext ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Rust-dev Digest, Vol 37, Issue 25

2013-07-09 Thread Alexander Stavonin
Brian, thank you for explanation. But, in that case I have one more question. If PipeBytePort is unsendable any more, how bidirectional, pipe_stream based communication could be organised? Best regards, Alexander. 2013/7/8 rust-dev-requ...@mozilla.org Message: 1 Date: Mon, 08 Jul 2013

Re: [rust-dev] flatpipes question

2013-07-08 Thread Alexander Stavonin
, but I'd like to learn, and I'd like to help when I can. According to the tutorial, both chan and port should be sendable types that can be transferred to the task's closure. I'm interested in what's going on here as well. On Sun, Jul 7, 2013 at 1:49 PM, Alexander Stavonin a.stavo

[rust-dev] Do we have shared ports?

2013-05-28 Thread Alexander Stavonin
Hi! As I know, As I know, we have SharedChan mechanism which can be used for many clients - server communications. But how can I send response from server to many clients? This is not commonly used case, and looks like there is no such mechanism or I've missed something? Best regards, Alexander.

[rust-dev] Shared 2 Owned

2013-04-23 Thread Alexander Stavonin
Hi all, I'm really confused. What's about Shared 2 Owned conversions? This one looks ugly, nevertheless works: let a = @5; let b = *a; let c = ~b; io::println(fmt!(%?, %?, %?, a, b, c)); @5, 5, ~5 But what about arrays? let a = @[5]; let b = *a; let c = ~b; error: type @[VI0] cannot

Re: [rust-dev] Shared 2 Owned

2013-04-23 Thread Alexander Stavonin
Second response not about deep copy but about simplifying deep copy operation. Actually, I understood the reason of deep-copy-only conversions immediately after sending the question. And big source code overhead from nothing means: we almost always have to write conversion manually rather than do

[rust-dev] Main idea of DuplexStream

2013-04-21 Thread Alexander Stavonin
I'm trying to understand the idea of DuplexStream. First of all, it can't be used for cross-task communications: 13 let value = gen_data(); 14 let (server, client) = DuplexStream(); 15 16 do task::spawn { 17 let val: ~[uint] = server.recv(); 18

[rust-dev] Passing managed value to task

2013-04-19 Thread Alexander Stavonin
Do we have any possibility to do something like this or only owned values can be send? 11 fn task_with_shared_pointers() { 12 let value = @[1, 2, 3, 4, 5]; 13 let (server_chan, server_port) = stream(); 14 15 do task::spawn { 16 let val: @[uint] = server_chan.recv();

[rust-dev] Range vector initialization

2013-04-15 Thread Alexander Stavonin
I always thought that it is possible to write next code: let box_box = ~[1 .. 5]; And obtain the vector with [1, 2, 3, 4, 5], but it doesn't works. What is the simplest way to do it? ___ Rust-dev mailing list Rust-dev@mozilla.org

Re: [rust-dev] Crossplatform compatibility

2013-04-12 Thread Alexander Stavonin
jar...@webkit.org On Thu, Apr 11, 2013 at 2:58 PM, Alexander Stavonin a.stavo...@gmail.comwrote: Hi! I'm going to create Rust installation package for Mac OS X. Right now you can find the installer there: http://www.sysdev.me/public/RustInstaller.pkg.zip But... I've build the installer

[rust-dev] Crossplatform compatibility

2013-04-11 Thread Alexander Stavonin
Hi! I'm going to create Rust installation package for Mac OS X. Right now you can find the installer there: http://www.sysdev.me/public/RustInstaller.pkg.zip But... I've build the installer on 10.8 and when I'm running it on 10.7 result is: Segmentation fault: 11 Is it possible to build Rust

[rust-dev] Sorting generics

2013-02-02 Thread Alexander Stavonin
Hi, I'm not sure it is an defect or failure to fully understand from my side. I'd like to sort an array. Unfortunately, it is not easy to understand which sort function should be used, but looks like quick_sort3 is good enough. Than: 1 extern mod std; 2 use std::sort::*; 3 4 fn

[rust-dev] Autiincrement values in loops

2013-02-01 Thread Alexander Stavonin
Have we a pretty looks solution for auto incrementation counters during loops? I mean something like C/C++ style for loop.I found an example in the manual 10.5 For loops but it looks ugly with counter outside the loop. Is it only way for solving problem? Thanks.

Re: [rust-dev] Autiincrement values in loops

2013-02-01 Thread Alexander Stavonin
I guess, the solution will not work for -1 … -10 On Feb 1, 2013, at 9:37 PM, Simon Sapin simon.sa...@exyr.org wrote: Le 01/02/2013 13:28, Alexander Stavonin a écrit : Thanks, it better than nothing, but… It works only for i++; how can I write /i += 2 /or /i--/? The range() function is very

Re: [rust-dev] trait and lifetime

2013-02-01 Thread Alexander Stavonin
Thank you! But I still can not compile it: 1 pub trait TupleValT { 2 pub pure fn _1(self) - self/T; 3 pub pure fn _2(self) - self/T; 4 } 5 6 impl T(T, T): TupleValT { 7 pure fn _1(self) - self/T { 8 let (a, _) = self;

Re: [rust-dev] trait and lifetime

2013-02-01 Thread Alexander Stavonin
to a tuple, not a tuple. Niko Alexander Stavonin wrote: Thank you! But I still can not compile it: 1 pub trait TupleValT { 2 pub pure fn _1(self) - self/T; 3 pub pure fn _2(self) - self/T; 4 } 5 6 impl T(T, T): TupleValT { 7 pure fn _1(self) - self

Re: [rust-dev] trait and lifetime

2013-02-01 Thread Alexander Stavonin
(a, _) = self; test.rs:9 a test.rs:10 } error: aborting due to previous error Did I miss something? On Feb 2, 2013, at 9:08 AM, Niko Matsakis n...@alum.mit.edu wrote: You need let (a, _) = *self or let (a, _) = self. self is a pointer to a tuple, not a tuple. Niko Alexander

[rust-dev] Tuples and to_str()

2013-01-31 Thread Alexander Stavonin
I'm trying to convert tuple of uints to string using to_str() module like this: io::println((1,2).to_string()); Looks like it should work as to_str has implementation for (A, B), but: test.rs:11 io::println((1,2).to_string()); ^~ error: aborting

Re: [rust-dev] Tuples and to_str()

2013-01-31 Thread Alexander Stavonin
Yes, you're right, just typo.Thanks! 2013/2/1 Andrew Rink andrewr...@gmail.com Hi Alexander Looks like a typo. The function your code calls is to_string() instead of to_str(). Tried the statements below and both worked: io::println(fmt!(%s, (1,2).to_str()));

[rust-dev] trait and lifetime

2013-01-31 Thread Alexander Stavonin
I want to add function like _1(), _2(), etc for Rust tuple. Unfortunately I do not understand how to tell compiler lifetime of returning result in case of `trait` pub trait TupleValT { pub pure fn _1() - T; pub pure fn _2() - T; } impl T(T, T): TupleValT { pure fn _1() - T {

[rust-dev] Reflection system

2012-07-10 Thread Alexander Stavonin
I've found mentions of Reflection system in Doc detailed release notes, unfortunatly the explanation is totally unclear for me. After that, I found reflect-visit-data.rs file, which was not too helpfull. Is it possible to clarify Reflection system description, provide some use cases, etc?

[rust-dev] Usage of 'copy' keyword

2012-07-05 Thread Alexander Stavonin
Can someone give a good enough explanation of 'copy' keyword usage? I can't find it neither in documentation nor tutorial. Regards, Alexander. ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Usage of 'copy' keyword

2012-07-05 Thread Alexander Stavonin
Sorry, my fault. I've found everything. 2012/7/6 Alexander Stavonin a.stavo...@gmail.com Can someone give a good enough explanation of 'copy' keyword usage? I can't find it neither in documentation nor tutorial. Regards, Alexander. ___ Rust-dev

[rust-dev] Strange info inside output

2012-05-01 Thread Alexander Stavonin
Am I right that this information is type of memory leak report? If it is true, is it possible to find time of memory allocation? Information example: - - (28 bytes from 0x7fbb9b415320) +0 +4 +8 +c0 4 8 c + 1c 1e 1f

Re: [rust-dev] Testing facility and shared data

2012-05-01 Thread Alexander Stavonin
Unfortunately, I didn't caught your idea with with_fixture :( I have next situation, may be you have an idea how to fix it: I need to allocate unique TCP ports numbers for each test. In case of C/C++ solution is extreamly easy: create singleton or static variable and just atomically increase

Re: [rust-dev] Testing facility and shared data

2012-05-01 Thread Alexander Stavonin
I suppose that singleton tasks is the only way in this case. At least because of current testing facilities are usefull just for unit testing, but not for complex module testing, and in case of complex test cases we need to share some information between components. Also it will be needed in

[rust-dev] String constans

2012-04-22 Thread Alexander Stavonin
Do you have a plan to adding string constans? Or are you proposing some other way for creating string constants? string_const.rs:3:18: 3:24 error: string constants are not supported string_const.rs:3 const NAME: str = sting; ^~ error: aborting due to

Re: [rust-dev] Functions overloading

2012-04-18 Thread Alexander Stavonin
Stefan, I understood you idea but I have problem with compilation. fn_overloading.rs:31:34: 31:80 error: method `to_input` has an incompatible type: type parameter vs int fn_overloading.rs:31 impl t of to_inputt for int { fn to_input() - inputint { ret val(self); } }

Re: [rust-dev] How to allocate record on memory?

2012-04-17 Thread Alexander Stavonin
It this the only way to create record in memory? May be someone has better ideas. fn mk_mem_objT() - *T { libc::malloc(sys::size_of::T()) as *T } unsafe fn mk_mem_copy_of_objT(src: T) - *T { let size = sys::size_of::T(); let dst = libc::malloc(size); libc::memcpy(dst,

Re: [rust-dev] How to allocate record on memory?

2012-04-17 Thread Alexander Stavonin
I need unmanaged, C-compatibe structure on heap which will not be autodeleted in any cases. I don't *really* understand what you are trying to do, but I think you have two choices: (1) A call to libc::malloc, like you showed in your later mail. (2) Allocate the type as a @T and then use

[rust-dev] How to join together C and Rust code?

2012-04-16 Thread Alexander Stavonin
Is it possible to include into the one crate as Rust as C code? ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

[rust-dev] How to allocate record on memory?

2012-04-16 Thread Alexander Stavonin
I have a C function with void* argument wich will be passed to callback and I want to pass Rust record as the argument. The question is, how to allocate record on memory but not on the stack? I've tried a lot of different ways, but with same result: in callback function record data looked as

[rust-dev] Functions overloading

2012-04-12 Thread Alexander Stavonin
What's about function overloading? Something like this: fn foo(val: int) { io::println(int); } fn foo(val: str) { io::println(str); } fn main() { foo(1); foo(test); } But :( main.rs:3:0: 5:1 error: duplicate definition of foo main.rs:3 fn foo(val: int) { main.rs:4

[rust-dev] Alignment and tuples

2012-04-12 Thread Alexander Stavonin
I'm confused, how it is possible? type tuple_type1 = (u64, u32, u16); type tuple_type2 = (u8, u32, u16); fn main() { io::println(#fmt(size of tuple_type1 = %u, size of tuple_type2 = %u, sys::size_of::tuple_type1(), sys::size_of::tuple_type2())); io::println(#fmt(align of

Re: [rust-dev] Functions overloading

2012-04-12 Thread Alexander Stavonin
I suppose this style is less confused. foo(i(10)); foo(s(test)); than this one, at least for passing parameters to a function. 10.foo(); test.foo(); 13 апреля 2012 г. 14:00 пользователь Niko Matsakis n...@alum.mit.eduнаписал: On 4/12/12 9:30 PM, Alexander Stavonin wrote

Re: [rust-dev] crate_type = lib and testing

2012-04-11 Thread Alexander Stavonin
Hi, Brian I can't reproduce error with segmentation faults any more, and I suppose that were my mistake because of bad understanding of Rust. The issue were in the re_get_supported_methods (line 40, vec::map(cstrs) {|cstr| str::unsafe::from_c_str(cstr) }) function in revent.rs.

[rust-dev] sizeof type

2012-04-10 Thread Alexander Stavonin
Hi, I have a type which will be bind to appropriate C structure: type test_type = { val1 : i16; val2 : i32; } How could I get size of the test_type? How could I provide an information about alignment of the test_type? Regards, Alexander. ___

[rust-dev] **libc::c_char to ???

2012-04-10 Thread Alexander Stavonin
Hi all, it's again me. I have a C function returns array of null terminated strings. And I need to convert it to an Rust string type. C function declaration: const char** func(); Rust code: native mod c { fn func() - **libc::c_char; } #[test] fn test_func() { let results =