Turn deprecation lint legacy_imports into a hard error
This commit is contained in:
parent
935a2f12b2
commit
d1b027421e
9 changed files with 35 additions and 160 deletions
|
|
@ -10,23 +10,17 @@
|
|||
|
||||
// Test that `fn foo::bar::{self}` only imports `bar` in the type namespace.
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
mod foo {
|
||||
pub fn f() { }
|
||||
}
|
||||
use foo::f::{self};
|
||||
//~^ ERROR `self` no longer imports values
|
||||
//~| WARN hard error
|
||||
use foo::f::{self}; //~ ERROR unresolved import `foo::f`
|
||||
|
||||
mod bar {
|
||||
pub fn baz() {}
|
||||
pub mod baz {}
|
||||
}
|
||||
use bar::baz::{self};
|
||||
//~^ ERROR `self` no longer imports values
|
||||
//~| WARN hard error
|
||||
|
||||
fn main() {
|
||||
baz();
|
||||
baz(); //~ ERROR expected function, found module `baz`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
mod bar {
|
||||
|
|
@ -18,9 +16,7 @@ mod bar {
|
|||
mod baz {
|
||||
use *;
|
||||
use bar::*;
|
||||
fn f(_: Foo) {}
|
||||
//~^ ERROR `Foo` is ambiguous
|
||||
//~| WARN hard error in a future release
|
||||
fn f(_: Foo) {} //~ ERROR `Foo` is ambiguous
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,21 @@
|
|||
error: `Foo` is ambiguous
|
||||
--> $DIR/rfc-1560-warning-cycle.rs:21:17
|
||||
error[E0659]: `Foo` is ambiguous
|
||||
--> $DIR/rfc-1560-warning-cycle.rs:19:17
|
||||
|
|
||||
LL | use *;
|
||||
| - `Foo` could refer to the name imported here
|
||||
LL | use bar::*;
|
||||
| ------ `Foo` could also refer to the name imported here
|
||||
LL | fn f(_: Foo) {}
|
||||
LL | fn f(_: Foo) {} //~ ERROR `Foo` is ambiguous
|
||||
| ^^^
|
||||
|
|
||||
= note: #[deny(legacy_imports)] on by default
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #38260 <https://github.com/rust-lang/rust/issues/38260>
|
||||
note: `Foo` could refer to the name imported here
|
||||
--> $DIR/rfc-1560-warning-cycle.rs:17:13
|
||||
|
|
||||
LL | use *;
|
||||
| ^
|
||||
note: `Foo` could also refer to the name imported here
|
||||
--> $DIR/rfc-1560-warning-cycle.rs:18:13
|
||||
|
|
||||
LL | use bar::*;
|
||||
| ^^^^^^
|
||||
= note: consider adding an explicit import of `Foo` to disambiguate
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0659`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue