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

This reverts commit b20bce8ce5.

It retains the test added in that commit as a check-pass test, intended to
prevent future (unintentional) regressions.
This commit is contained in:
Mark Rousskov 2020-11-05 15:16:12 -05:00
parent b1d9f31e04
commit ae4f80b4be
3 changed files with 16 additions and 26 deletions

View file

@ -1,3 +1,5 @@
// check-pass
// Minimized case from #62767.
mod m {
pub enum Same {
@ -9,7 +11,7 @@ use m::*;
// 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`
use Same::Same;
// Case from #74556.
mod foo {
@ -21,8 +23,8 @@ mod foo {
}
use foo::*;
use bar::bar; //~ ERROR unresolved import `bar::bar`
//~| ERROR inconsistent resolution for an import
use bar::bar;
use bar::foobar;
fn main() {}

View file

@ -1,21 +0,0 @@
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`.