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: >> 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 cvar_cache[GIT_CVAR_CACHE_MAX]; >> >> This seems to me like it should work. The value of that enum is a >> compile and >> (if I'm reading the docs surrounding enums correctly) run time constant. >> > > Can you use `[GitCvarValue, ..GIT_CVAR_CACHE_MAX as uint]`? > > Patrick > > > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev >
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev