diff options
| author | Michael Goulet <michael@errs.io> | 2022-12-27 05:09:33 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-12-27 05:09:43 +0000 |
| commit | 9e2536b9389f56386d7f722b403d9730911ee811 (patch) | |
| tree | dae25ca9289c652c2f0977bbd2de35f319d1db1d /src/test/ui | |
| parent | 564435f20a740d9d95180f3a053aec36feed765d (diff) | |
Note alternative import candidates in nested use tree
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/imports/bad-import-in-nested.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/imports/bad-import-in-nested.stderr | 25 |
2 files changed, 38 insertions, 4 deletions
diff --git a/src/test/ui/imports/bad-import-in-nested.rs b/src/test/ui/imports/bad-import-in-nested.rs index 5ab0d3d60c9..2e95480ad41 100644 --- a/src/test/ui/imports/bad-import-in-nested.rs +++ b/src/test/ui/imports/bad-import-in-nested.rs @@ -1,14 +1,27 @@ +// edition: 2021 + #![allow(unused)] mod A { pub(crate) type AA = (); + pub(crate) type BB = (); + + mod A2 { + use super::{super::C::D::AA, AA as _}; + //~^ ERROR unresolved import + } } -mod C {} +mod C { + pub mod D {} +} mod B { use crate::C::{self, AA}; - //~^ ERROR unresolved import `crate::C::AA` + //~^ ERROR unresolved import + + use crate::{A, C::BB}; + //~^ ERROR unresolved import } fn main() {} diff --git a/src/test/ui/imports/bad-import-in-nested.stderr b/src/test/ui/imports/bad-import-in-nested.stderr index a107048d579..855b1e637e9 100644 --- a/src/test/ui/imports/bad-import-in-nested.stderr +++ b/src/test/ui/imports/bad-import-in-nested.stderr @@ -1,9 +1,30 @@ +error[E0432]: unresolved import `super::super::C::D::AA` + --> $DIR/bad-import-in-nested.rs:10:21 + | +LL | use super::{super::C::D::AA, AA as _}; + | ^^^^^^^^^^^^^^^ no `AA` in `C::D` + | + = note: consider importing this type alias instead: + crate::A::AA + error[E0432]: unresolved import `crate::C::AA` - --> $DIR/bad-import-in-nested.rs:10:26 + --> $DIR/bad-import-in-nested.rs:20:26 | LL | use crate::C::{self, AA}; | ^^ no `AA` in `C` + | + = note: consider importing this type alias instead: + crate::A::AA + +error[E0432]: unresolved import `crate::C::BB` + --> $DIR/bad-import-in-nested.rs:23:20 + | +LL | use crate::{A, C::BB}; + | ^^^^^ no `BB` in `C` + | + = note: consider importing this type alias instead: + crate::A::BB -error: aborting due to previous error +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0432`. |
