Auto merge of #50760 - petrochenkov:legimp, r=nikomatsakis
Turn deprecation lint `legacy_imports` into a hard error Closes https://github.com/rust-lang/rust/issues/38260 The lint was introduced in Dec 2016, then made deny-by-default in Jun 2017 when crater run found 0 regressions caused by it. This lint requires some not entirely trivial amount of import resolution logic that (surprisingly or not) interacts with `feature(use_extern_macros)` (https://github.com/rust-lang/rust/issues/35896), so it would be desirable to remove it before stabilizing `use_extern_macros`. In particular, this PR fixes the failing example in https://github.com/rust-lang/rust/issues/50725 (but not the whole issue, `use std::panic::{self}` still can cause other undesirable errors when `use_extern_macros` is enabled).
This commit is contained in:
commit
ef8ee64774
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