Deny imports after non-item statements.

This commit is contained in:
Eduard Burtescu 2015-01-13 11:39:05 +02:00
parent 5e07f5a792
commit 2d17a33878
4 changed files with 26 additions and 3 deletions

View file

@ -14,4 +14,5 @@ fn main() {
let bar = 5;
//~^ ERROR declaration of `bar` shadows an enum variant or unit-like struct in scope
use foo::bar;
//~^ ERROR imports are not allowed after non-item statements
}

View file

@ -9,11 +9,12 @@
// except according to those terms.
mod bar {
pub fn foo() -> uint { 42 }
pub fn foo() -> bool { true }
}
fn main() {
let foo = |&:| 5u;
let foo = |&:| false;
use bar::foo;
assert_eq!(foo(), 5u);
//~^ ERROR imports are not allowed after non-item statements
assert_eq!(foo(), false);
}