On 04/23/2013 02:03 PM, John Clements wrote:
Okay, I'm having no luck getting local folks upset about this, so I'm going to 
phrase it as a polite request:

It appears to me that there's a common Rust idiom of using

#[cfg(stage0)]
OLD CODE
#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
NEW CODE

The problem with this is that if you try to compile this code from the command 
line, using, e.g.:

rustc syntax.rc

… it fails, because no stageN flag was supplied.

It appears to me that this problem has a straightforward solution, using 
new(ish) syntax. Rather than the above, it appears we can now write:

#[cfg(stage0)]
OLD CODE
#[cfg(not(stage0))]
NEW CODE


… which, besides being shorter, works when no config flag is supplied. This is 
especially vital to those of us who use

rust test syntax.rc

…as part of their development cycle.

If I'm wrong, let me know. If I'm not wrong, consider using this form in the 
future….

Will do!
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to