Skip to content

Commit

Permalink
auto merge of #8869 : alexcrichton/rust/issue-8847-fix-unused, r=huonw
Browse files Browse the repository at this point in the history
Closes #8847
  • Loading branch information
bors committed Aug 30, 2013
2 parents 0ac3e02 + 6409f6b commit f914253
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2585,11 +2585,13 @@ impl Resolver {
debug!("(resolving glob import) ... for value target");
dest_import_resolution.value_target =
Some(Target(containing_module, name_bindings));
dest_import_resolution.value_id = id;
}
if name_bindings.defined_in_public_namespace(TypeNS) {
debug!("(resolving glob import) ... for type target");
dest_import_resolution.type_target =
Some(Target(containing_module, name_bindings));
dest_import_resolution.type_id = id;
}
};

Expand Down
84 changes: 84 additions & 0 deletions src/test/compile-fail/lint-unused-import-tricky-globs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[deny(unused_imports)];

mod A {
pub fn p() {}
}
mod B {
pub fn p() {}
}

mod C {
pub fn q() {}
}
mod D {
pub fn q() {}
}

mod E {
pub fn r() {}
}
mod F {
pub fn r() {}
}

mod G {
pub fn s() {}
pub fn t() {}
}
mod H {
pub fn s() {}
}

mod I {
pub fn u() {}
pub fn v() {}
}
mod J {
pub fn u() {}
pub fn v() {}
}

mod K {
pub fn w() {}
}
mod L {
pub fn w() {}
}

mod m {
use A::p; //~ ERROR: unused import
use B::p;
use C::q; //~ ERROR: unused import
use D::*;
use E::*; //~ ERROR: unused import
use F::r;
use G::*;
use H::*;
use I::*;
use J::v;
use K::*; //~ ERROR: unused import
use L::*;

#[main]
fn my_main() {
p();
q();
r();
s();
t();
u();
v();
w();
}
}

0 comments on commit f914253

Please sign in to comment.