title: Rust is not honoring a custom cfg feature flag for conditional compilation
body: <p>I'm trying to use rust's conditional compilation feature and it is not working at all.   I'm attempting to use this to toggle between a default library and a different one, using the <code>cfg</code> to re-export one of two different submodules depending on if the feature flag is set or not.   The code:</p>
  
  <p>lib.rs:</p>
  
  <pre><code>pub mod ffi;
  #[cfg(ffiv1)]
  mod ffiv1;
  #[cfg(not(ffiv1))]
  mod ffiv2;
  
  #[test]
  fn test_ffi_struct() {
      let _fs = ffi::FFIStruct{ x: 42};
  }
  
  
  #[cfg(ffiv1)]
  #[test]
  fn test_v1() {
      println!("v1 enabled");
  }
  </code></pre>
  
  <p>ffi.rs:</p>
  
  <pre><code>//re-export as ffi::FFIStruct
  #[cfg(ffiv1)]
  pub use ffiv1::FFIStruct;
  
  #[cfg(not(ffiv1))]
  pub use ffiv2::FFIStruct;
  </code></pre>
  
  <p>ffiv1.rs:</p>
  
  <pre><code>pub struct FFIStruct {
      pub x: i32,
      y: IShouldFail
  }
  </code></pre>
  
  <p>ffiv2.rs:</p>
  
  <pre><code>pub struct FFIStruct {
     pub x: i64
  }
  </code></pre>
  
  <p>Cargo.toml:</p>
  
  <pre><code>[features]
  ffiv1 = []
  </code></pre>
  
  <p>With the default <code>cargo build</code>/<code>test</code>, this builds and works as expected, everything is ok.</p>
  
  <p>With <code>cargo build  --features ffiv1</code>, it behaves as no feature flags were passed at all.   Running <code>cargo</code> with --verbose shows <code>--cfg 'feature="ffiv1"'</code> going to <code>rustc</code>.</p>
  
  <p>I would expect the compilation to fail on the undefined symbol <code>IShouldFail</code> in ffiv1.rs.  (and the extra test to run if it compiled).</p>
  
  <p>What is wrong here?</p>