Skip to content

Commit 050afc9

Browse files
committed
---
yaml --- r: 208346 b: refs/heads/snap-stage3 c: db9d018 h: refs/heads/master v: v3
1 parent d0ec73d commit 050afc9

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 372c69d8d293985ad3bffbe5c5e527dc37e90169
4+
refs/heads/snap-stage3: db9d01842450fe07f77ca97d9a68d105366f407e
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc_resolve/resolve_imports.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,6 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
896896

897897
match target {
898898
Some(ref target) if target.shadowable != Shadowable::Always => {
899-
use syntax::ast_map::NodeItem;
900-
901899
let ns_word = match namespace {
902900
TypeNS => "type",
903901
ValueNS => "value",
@@ -907,12 +905,11 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
907905
in this module", ns_word,
908906
&token::get_name(name));
909907
let use_id = import_resolution.id(namespace);
910-
if let NodeItem(item) = self.resolver.ast_map.get(use_id) {
911-
// item is syntax::ast::Item;
912-
span_note!(self.resolver.session, item.span,
913-
"previous import of `{}` here",
914-
token::get_name(name));
915-
}
908+
let item = self.resolver.ast_map.expect_item(use_id);
909+
// item is syntax::ast::Item;
910+
span_note!(self.resolver.session, item.span,
911+
"previous import of `{}` here",
912+
token::get_name(name));
916913
}
917914
Some(_) | None => {}
918915
}

branches/snap-stage3/src/test/compile-fail/double-import.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -10,6 +10,8 @@
1010
#![feature(no_std)]
1111
#![no_std]
1212

13+
// This tests that conflicting imports shows both `use` lines
14+
// when reporting the error.
1315

1416
mod sub1 {
1517
fn foo() {} // implementation 1

0 commit comments

Comments
 (0)