Tuesday, 15 March 2011

Conditional compilation in Rust? -



Conditional compilation in Rust? -

i have been using 0.10 , setup build of nightly experiment box , friends.

now have code 0.10 using ~str , code pre0.11 using string because of to_owned beingness obsolete. thought this:

#[cfg(rust_version = "0.10")] fn my_old_func() -> option<~str> { } #[cfg(not(rust_version = "0.10")] fn my_old_func() -> option<string> { }

and pass --cfg rust_version:0.11 during compilation. compiler still chokes on removed ~ operator. there way have code works under both 0.10 , yet unreleased 0.11 using conditional compilation or other mechanism?

i guess fall using cpp , #ifdef seems stepping out of rust mindset.

no, there nil can this.

our typical recommendation not utilize 0.10 stick nightlies.

rust

No comments:

Post a Comment