Re: [rust-dev] Help needed writing idiomatic rust to pass sequences of strings around

2014-03-24 Thread Phil Dawes
To complete my understanding: is there a reason a 'sufficiently smart compiler' in the future couldn't do this conversion implicitly? I.e. if a function takes a borrowed reference to a container of pointers, could the compiler ignore what type of pointers they are (because they won't be going out

Re: [rust-dev] Help needed writing idiomatic rust to pass sequences of strings around

2014-03-24 Thread Huon Wilson
It would be necessary (but not sufficient*) for them to have the same in-memory representation, and currently ~str and str don't. ~str is `*{ length: uint, capacity: uint, data... }`, a pointer to a vector with the length and capacity stored inline, i.e. one word; str is just `{ data: *u8,

[rust-dev] Vector length specified by enum

2014-03-24 Thread Richo Healey
Hi List, First off, this came up today when I started on a set of rust bindings for libgit2. I skimmed around, but if anyone else is working on the same thing, let's combine effort. To my point: I'm writing bindings by hand instead of using bindgen for now to get a better feel for rust. I

Re: [rust-dev] How do I pass -march down to llvm from rustc?

2014-03-24 Thread Alex Crichton
You are right in that the __morestack function is a requirement from enabling segmented stacks in LLVM. While we no longer use truly segmented stacks, we still use the segmented stack prologue in order to detect stack overflow. This is a crucial piece of infrastructure for rust code used to ensure

Re: [rust-dev] Vector length specified by enum

2014-03-24 Thread Patrick Walton
On 3/24/14 2:45 AM, Richo Healey wrote: I get a compile error: src/repository.rs:24:17: 24:54 error: expected constant expr for vector length: non-constant path in constant expr src/repository.rs:24 cvar_cache: [GitCvarValue, .. GIT_CVAR_CACHE_MAX] // git_cvar_value

Re: [rust-dev] Vector length specified by enum

2014-03-24 Thread Josh Matthews
Nope; we can't use casts of enum values in type signatures. This is discussed in https://github.com/mozilla/rust/issues/5873 . Cheers, Josh On 24 March 2014 11:26, Patrick Walton pcwal...@mozilla.com wrote: On 3/24/14 2:45 AM, Richo Healey wrote: I get a compile error:

Re: [rust-dev] Which installation options are actually required?

2014-03-24 Thread Brian Anderson
Thanks, Ben. Sounds like I'm going to need to rethink a few things to make sure --libdir works sanely. I can imagine how it may work correctly right now from a source-only installer. rustc may need some tweaks to make it work more generally. On 03/22/2014 11:49 AM, Ben Noordhuis wrote: On

Re: [rust-dev] Goto statement missing

2014-03-24 Thread Daniel Micay
On 23/03/14 03:09 PM, Erick Tryzelaar wrote: I've been thinking of a couple alternatives that could make us as fast as a c state machine. The simplest night be to leverage the fact that llvm can optimize certain recursive function calls into tail calls, and lower those into jumps. If we go

Re: [rust-dev] Vector length specified by enum

2014-03-24 Thread Richo Healey
On 24/03/14 12:32 -0400, Josh Matthews wrote: Nope; we can't use casts of enum values in type signatures. This is discussed in https://github.com/mozilla/rust/issues/5873 . Cheers, Josh I continued messing with this last night. Yurume on IRC rightfully pointed out that having the MAX as a

Re: [rust-dev] Vector length specified by enum

2014-03-24 Thread comex
On Mon, Mar 24, 2014 at 7:32 PM, Richo Healey ri...@psych0tik.net wrote: let vec: [u8, .. FooBar::size()]; Potentially with parens ommittted, to convey that there's no runtime computation? Not sure if it matters, but another thing one might want to use in a constant expression is sizeof,