Re: [rust-dev] Optimizing pattern bindings to not copy anything at runtime

2014-04-24 Thread Patrick Walton
On 4/23/14 7:09 PM, Niko Matsakis wrote: If we just made y a pointer to x, we'd be in trouble. Well, not if the mutation to x is also done by making it a pointer to the scratch space occupied by `something_else()`. Patrick ___ Rust-dev mailing

Re: [rust-dev] A small announcement for zinc, the bare metal rust stack

2014-04-24 Thread Ben Gamari
Vladimir Pouzanov farcal...@gmail.com writes: There is a number of options on the memory side of things. I feel that stack usage could be estimated a bit more simply with rust and it's __morestack support, so that it would be possible to run a few threads with preemptive scheduling

Re: [rust-dev] A small announcement for zinc, the bare metal rust stack

2014-04-24 Thread Vladimir Pouzanov
On Thu, Apr 24, 2014 at 9:01 AM, Ben Gamari bgam...@gmail.com wrote: Unfortunately this replaces the ugly possibility of unpredictable crashes with the slightly less ugly possiblity of unpredictable deadlocks if we run out of stack in the middle of execution. Perhaps threads could be

[rust-dev] Self and self in trait definitions

2014-04-24 Thread Mario Sopena Novales
Hi everyone, I've been learning Rust for the last couple of weeks and I'm quite excited with it. My experience is mainly in C and Rust feels like a nice improvement. Thank you for the hard work! I've recently found this bit of the tutorial:

Re: [rust-dev] A small announcement for zinc, the bare metal rust stack

2014-04-24 Thread Ben Gamari
Vladimir Pouzanov farcal...@gmail.com writes: On Thu, Apr 24, 2014 at 9:01 AM, Ben Gamari bgam...@gmail.com wrote: Unfortunately this replaces the ugly possibility of unpredictable crashes with the slightly less ugly possiblity of unpredictable deadlocks if we run out of stack in the middle

[rust-dev] Rust .so that looks like a C .so

2014-04-24 Thread Henri Sivonen
The documentation for the FFI seems focused on using C code in a program whose main() is in Rust. Can Rust be used for implementing a shared library that implements a C ABI for use by programs whose main() is not in Rust (i.e. the caller sees a C ABI and doesn't know about Rust)? If yes, can a C

Re: [rust-dev] Rust .so that looks like a C .so

2014-04-24 Thread Stéphane Wirtel
On 24 Apr 2014, at 13:16, Henri Sivonen wrote: The documentation for the FFI seems focused on using C code in a program whose main() is in Rust. Can Rust be used for implementing a shared library that implements a C ABI for use by programs whose main() is not in Rust (i.e. the caller sees a C

Re: [rust-dev] Rust .so that looks like a C .so

2014-04-24 Thread Flaper87
2014-04-24 13:20 GMT+02:00 Stéphane Wirtel steph...@wirtel.be: On 24 Apr 2014, at 13:16, Henri Sivonen wrote: The documentation for the FFI seems focused on using C code in a program whose main() is in Rust. Can Rust be used for implementing a shared library that implements a C ABI for use

Re: [rust-dev] Rust .so that looks like a C .so

2014-04-24 Thread György Andrasek
https://github.com/Jurily/rust-c-example `#[no_mangle] extern C foo() { ... }` When you expose a C API, you need to observe the C rules: function names must be globally unique. You have to write the headers yourself. Taking and releasing ownership of C data needs some magic, but it's doable.

Re: [rust-dev] Rust .so that looks like a C .so

2014-04-24 Thread Mahmut Bulut
I think that on windows because of name manglings in __cdecl it is not possible? Or it is? Mahmut Bulut On 24 Apr 2014, at 14:16, Henri Sivonen hsivo...@hsivonen.fi wrote: The documentation for the FFI seems focused on using C code in a program whose main() is in Rust. Can Rust be

Re: [rust-dev] Rust .so that looks like a C .so

2014-04-24 Thread György Andrasek
http://static.rust-lang.org/doc/master/guide-ffi.html#foreign-calling-conventions I forgot about `extern system`, sorry :) ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Optimizing pattern bindings to not copy anything at runtime

2014-04-24 Thread Bill Myers
Nice, but why isn't the LLVM optimizer removing the move? Is it lack of proper alias analysis? Sounds like that is a separate issue worth pursuing. The remaining, more difficult, issue is initialization of aggregate data structures via constructor functions, which still involves a bunch of

Re: [rust-dev] Optimizing pattern bindings to not copy anything at runtime

2014-04-24 Thread Patrick Walton
On 4/24/14 8:16 AM, Bill Myers wrote: Nice, but why isn't the LLVM optimizer removing the move? Is it lack of proper alias analysis? Sounds like that is a separate issue worth pursuing. LLVM's MemCpyOptimizer is pretty badly ordered in the pipeline and needs to be rewritten. In any case, I

Re: [rust-dev] Removing ~foo

2014-04-24 Thread Clark Gaebel
Bonus: BoxT, OwnT, HeapT would play nicer with allocators (in terms of syntax) than ~T. On Thu, Apr 24, 2014 at 11:52 AM, Bill Myers bill_my...@outlook.com wrote: Something like this will work, yes. It'll probably look more like: Box::new(*x) This will be described in some of the

Re: [rust-dev] Removing ~foo

2014-04-24 Thread Bill Myers
Something like this will work, yes. It'll probably look more like: Box::new(*x) This will be described in some of the RFCs that are coming up soon. Awesome! We should really get rid of the ~T syntax in favor of FooT (where Foo = Box, Own, Heap, etc.), since it is deceptively simple

[rust-dev] Error: cannot borrow `***test` as mutable because it is also borrowed as immutable in match

2014-04-24 Thread Philippe Delrieu
Hello, I have a problem in my code and I can't find a solution. I develop a test case that generate the same error. Any idea? use std::vec::Vec; use std::rc::Rc; use std::cell::RefCell; struct Test; impl Test { fn match_fn'a('a self) -Option'a Test { None } fn

Re: [rust-dev] Error: cannot borrow `***test` as mutable because it is also borrowed as immutable in match

2014-04-24 Thread Artella Coding
Hi, the following modified program seems to work (I am using rustc 0.11-pre-nightly (d35804e 2014-04-18 00:01:22 -0700) : ** use std::vec::Vec; use std::rc::Rc; use std::cell::RefCell; struct Test; impl Test { fn match_fn'a('a self)

Re: [rust-dev] A small announcement for zinc, the bare metal rust stack

2014-04-24 Thread Ben Gamari
Ben Gamari bgam...@gmail.com writes: Vladimir Pouzanov farcal...@gmail.com writes: ... My current idea is to make dedicated pools that could hold a compile-time configurable number of objects of same size, e.g. an IncomingPacketPool that can hold up to 3 frames where one frame is 128 bytes