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
6 changes: 6 additions & 0 deletions src/librustc_resolve/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ impl<'a, 'b> Visitor for UnusedImportCheckVisitor<'a, 'b> {
}

ViewPathList(_, ref list) => {
if list.len() == 0 {
self.unused_imports
.entry(item.id)
.or_insert_with(NodeMap)
.insert(item.id, item.span);
}
for i in list {
self.check_import(item.id, i.node.id, i.span);
}
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-28388-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

// Prefix in imports with empty braces should be resolved and checked privacy, stability, etc.

use foo::{}; //~ ERROR failed to resolve. Maybe a missing `extern crate foo;`?
use foo::{};
//~^ ERROR failed to resolve. Maybe a missing `extern crate foo;`?
//~| NOTE foo

fn main() {}
3 changes: 2 additions & 1 deletion src/test/compile-fail/issue-28388-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mod m {
mod n {}
}

use m::n::{}; //~ ERROR module `n` is private
use m::n::{};
//~^ ERROR module `n` is private

fn main() {}
3 changes: 2 additions & 1 deletion src/test/compile-fail/issue-28388-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

extern crate lint_stability;

use lint_stability::UnstableStruct::{}; //~ ERROR use of unstable library feature 'test_feature'
use lint_stability::UnstableStruct::{};
//~^ ERROR use of unstable library feature 'test_feature'
use lint_stability::StableStruct::{}; // OK

fn main() {}
2 changes: 2 additions & 0 deletions src/test/compile-fail/lint-unused-imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use bar::c::cc as cal;

use std::mem::*; // shouldn't get errors for not using
// everything imported
use std::fmt::{};
//~^ ERROR unused import: `use std::fmt::{};`

// Should get errors for both 'Some' and 'None'
use std::option::Option::{Some, None};
Expand Down