Rollup merge of #77421 - petrochenkov:globtravel, r=nagisa

Revert "resolve: Avoid "self-confirming" import resolutions in one more case"

And remove the assert that https://github.com/rust-lang/rust/pull/70236 tried to avoid instead.

Closes https://github.com/rust-lang/rust/issues/74556.
This commit is contained in:
Jonas Schievink 2020-10-03 00:31:16 +02:00 committed by GitHub
commit 23408de992
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 16 deletions

View file

@ -1,5 +1,4 @@
// check-pass
// Minimized case from #62767.
mod m {
pub enum Same {
Same,
@ -8,8 +7,22 @@ mod m {
use m::*;
// The variant `Same` introduced by this import is not considered when resolving the prefix
// `Same::` during import validation (issue #62767).
use Same::Same;
// The variant `Same` introduced by this import is also considered when resolving the prefix
// `Same::` during import validation to avoid effects similar to time travel (#74556).
use Same::Same; //~ ERROR unresolved import `Same`
// Case from #74556.
mod foo {
pub mod bar {
pub mod bar {
pub fn foobar() {}
}
}
}
use foo::*;
use bar::bar; //~ ERROR unresolved import `bar::bar`
//~| ERROR inconsistent resolution for an import
use bar::foobar;
fn main() {}

View file

@ -0,0 +1,21 @@
error: inconsistent resolution for an import
--> $DIR/issue-62767.rs:24:5
|
LL | use bar::bar;
| ^^^^^^^^
error[E0432]: unresolved import `Same`
--> $DIR/issue-62767.rs:12:5
|
LL | use Same::Same;
| ^^^^ `Same` is a variant, not a module
error[E0432]: unresolved import `bar::bar`
--> $DIR/issue-62767.rs:24:5
|
LL | use bar::bar;
| ^^^^^^^^ no `bar` in `foo::bar::bar`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0432`.