Skip to content

Commit 15f97ac

Browse files
committed
Correctly track the source of imports with the same name
1 parent 84233c0 commit 15f97ac

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

src/libcore/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use old_iter;
2222
use iterator::Iterator;
2323
use kinds::Copy;
2424
use libc;
25-
use old_iter::{BaseIter, CopyableIter};
25+
use old_iter::CopyableIter;
2626
use option::{None, Option, Some};
2727
use ptr::to_unsafe_ptr;
2828
use ptr;

src/librustc/middle/resolve.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,10 @@ pub impl Resolver {
18181818
debug!("(building import directive) bumping \
18191819
reference");
18201820
resolution.outstanding_references += 1;
1821+
1822+
// the source of this name is different now
1823+
resolution.privacy = privacy;
1824+
resolution.id = id;
18211825
}
18221826
None => {
18231827
debug!("(building import directive) creating new");
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
// Regression test for issue #6633
14+
15+
use foo::name::name; //~ ERROR: unused import
16+
use foo::name;
17+
18+
pub mod foo {
19+
pub mod name {
20+
pub type a = int;
21+
pub mod name {
22+
pub type a = float;
23+
}
24+
}
25+
}
26+
27+
fn bar() -> name::a { 1 }
28+
29+
fn main(){}

0 commit comments

Comments
 (0)