Skip to content

Commit f914253

Browse files
committed
auto merge of #8869 : alexcrichton/rust/issue-8847-fix-unused, r=huonw
Closes #8847
2 parents 0ac3e02 + 6409f6b commit f914253

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

src/librustc/middle/resolve.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,11 +2585,13 @@ impl Resolver {
25852585
debug!("(resolving glob import) ... for value target");
25862586
dest_import_resolution.value_target =
25872587
Some(Target(containing_module, name_bindings));
2588+
dest_import_resolution.value_id = id;
25882589
}
25892590
if name_bindings.defined_in_public_namespace(TypeNS) {
25902591
debug!("(resolving glob import) ... for type target");
25912592
dest_import_resolution.type_target =
25922593
Some(Target(containing_module, name_bindings));
2594+
dest_import_resolution.type_id = id;
25932595
}
25942596
};
25952597

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[deny(unused_imports)];
12+
13+
mod A {
14+
pub fn p() {}
15+
}
16+
mod B {
17+
pub fn p() {}
18+
}
19+
20+
mod C {
21+
pub fn q() {}
22+
}
23+
mod D {
24+
pub fn q() {}
25+
}
26+
27+
mod E {
28+
pub fn r() {}
29+
}
30+
mod F {
31+
pub fn r() {}
32+
}
33+
34+
mod G {
35+
pub fn s() {}
36+
pub fn t() {}
37+
}
38+
mod H {
39+
pub fn s() {}
40+
}
41+
42+
mod I {
43+
pub fn u() {}
44+
pub fn v() {}
45+
}
46+
mod J {
47+
pub fn u() {}
48+
pub fn v() {}
49+
}
50+
51+
mod K {
52+
pub fn w() {}
53+
}
54+
mod L {
55+
pub fn w() {}
56+
}
57+
58+
mod m {
59+
use A::p; //~ ERROR: unused import
60+
use B::p;
61+
use C::q; //~ ERROR: unused import
62+
use D::*;
63+
use E::*; //~ ERROR: unused import
64+
use F::r;
65+
use G::*;
66+
use H::*;
67+
use I::*;
68+
use J::v;
69+
use K::*; //~ ERROR: unused import
70+
use L::*;
71+
72+
#[main]
73+
fn my_main() {
74+
p();
75+
q();
76+
r();
77+
s();
78+
t();
79+
u();
80+
v();
81+
w();
82+
}
83+
}
84+

0 commit comments

Comments
 (0)