Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl<'a, 'ra, 'tcx> UnusedImportCheckVisitor<'a, 'ra, 'tcx> {
ast::UseTreeKind::Simple(Some(ident)) => {
if ident.name == kw::Underscore
&& !matches!(
self.r.current_owner.import_res[&id].type_ns,
self.r.current_owner.import_res.get(&id).and_then(|res| res.type_ns),
Some(Res::Def(DefKind::Trait | DefKind::TraitAlias, _))
)
{
Expand Down
9 changes: 9 additions & 0 deletions tests/ui/imports/unused-import-issue-163294.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ edition: 2015

#![deny(unused_imports)]

pub use core as _;
//~^ ERROR unresolved import `core`
//~^^ ERROR unused import: `core as _`

fn main() {}
23 changes: 23 additions & 0 deletions tests/ui/imports/unused-import-issue-163294.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error[E0432]: unresolved import `core`
--> $DIR/unused-import-issue-163294.rs:5:9
|
LL | pub use core as _;
| ----^^^^^
| |
| no `core` in the root

error: unused import: `core as _`
--> $DIR/unused-import-issue-163294.rs:5:9
|
LL | pub use core as _;
| ^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/unused-import-issue-163294.rs:3:9
|
LL | #![deny(unused_imports)]
| ^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0432`.
Loading