Skip to content

Commit

Permalink
Avoid false positive unused_extern_crates.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Oct 25, 2016
1 parent 04ca378 commit 0d30325
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ impl<'b> Resolver<'b> {
legacy_imports: LegacyMacroImports,
allow_shadowing: bool) {
let import_macro = |this: &mut Self, name, ext: Rc<_>, span| {
this.used_crates.insert(module.def_id().unwrap().krate);
if let SyntaxExtension::NormalTT(..) = *ext {
this.macro_names.insert(name);
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/lint-unused-extern-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ extern crate rand; // no error, the use marks it as used

extern crate lint_unused_extern_crate as other; // no error, the use * marks it as used

#[macro_use] extern crate core; // no error, the `#[macro_use]` marks it as used

#[allow(unused_imports)]
use rand::isaac::IsaacRng;

Expand Down

0 comments on commit 0d30325

Please sign in to comment.