Hi folks,

I'm currently trying to how conditional compiling in rust
actually works. I was under the impression that

    #[cfg(feature = "foo")]

behaves pretty much like an #ifdef, but for the subsequent
syntactical block, so instead of

    #ifdef ENABLE_FOO
    fn ... {
    }
    #endif

you istead write

    #[cfg(feature = "foo")]
    fn ... {
    }

BUT: there're lots of cases, where this doesn't seem to work, eg.
with if statements. An 'if cfg!(feature = "foo")' doesn't work for
me, as lots of types in the disabled code pathes won't exist at all.
Similar w/ 'use' statements, parameter lists, match statements, ...

background: I'm currently trying to trim down Servo, as it doesn't
compile on 32bit system (don't have an 64bit environment right now)
and I'd like to get rid of lots of things (eg. bluetooth, gamepad, etc)
anyways.


--mtx
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to