Closed
Description
$ rustc -Vv
rustc 1.1.0-nightly (e5394240a 2015-05-14) (built 2015-05-14)
binary: rustc
commit-hash: e5394240a295650b567aa406b4a0e1e3a6749a5f
commit-date: 2015-05-14
build-date: 2015-05-14
host: x86_64-unknown-linux-gnu
release: 1.1.0-nightly
$ echo 'fn i_am_b() {}' > b.rs
$ echo '#[cfg_attr(foo, path="b.rs")] mod c; fn main() {}' > a.rs
$ rustc a.rs --cfg foo
a.rs:2:5: 2:6 error: file not found for module `c`
a.rs:2 mod c;
^
a.rs:2:5: 2:6 help: name the file either c.rs or c/mod.rs inside the directory ""
$ echo 'fn i_am_c() {}' > c.rs
$ rustc a.rs --cfg foo
c.rs:1:1: 1:15 warning: function is never used: `i_am_c`, #[warn(dead_code)] on by default
c.rs:1 fn i_am_c() {}
^~~~~~~~~~~~~~
a.rs:1:17: 1:29 warning: unused attribute, #[warn(unused_attributes)] on by default
a.rs:1 #[cfg_attr(foo, path="b.rs")]
^~~~~~~~~~~~
This occurs because #[cfg_attr]
is processed at phase 2 (configure and expand) but #[path]
is done at phase 1 (parse).