You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// main.rsexternmod aux;fnmain(){let x = aux::Foo;match x {
aux::Foo => println("Foo == Foo"),
_ => println("Foo != Foo")}}
produces the expected output: Foo == Foo
But after changing aux.rs to
#[crate_type = "lib"];pubstaticFoo:uint = 2;
and recompiling only aux.rs, the output is Foo != Foo
This is because rustc is too eager and replaces the match pattern aux::Foo with 1 at compile-time. That works until we change aux::Foo. Because x gets its value at runtime, it becomes 2 and doesn't fit the first match arm.