Skip to content

Commit 94b2561

Browse files
committed
---
yaml --- r: 216935 b: refs/heads/stable c: db9d018 h: refs/heads/master i: 216933: 765e5a1 216931: 87f3b59 216927: 8479ac7 v: v3
1 parent 9dc5995 commit 94b2561

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
@@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 372c69d8d293985ad3bffbe5c5e527dc37e90169
32+
refs/heads/stable: db9d01842450fe07f77ca97d9a68d105366f407e
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/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/stable/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)