Deny imports after non-item statements.
This commit is contained in:
parent
5e07f5a792
commit
2d17a33878
4 changed files with 26 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue