Skip to content

Commit db9d018

Browse files
committed
Fixed some nits
1 parent 372c69d commit db9d018

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/librustc_resolve/resolve_imports.rs

+5-8
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
}

src/test/compile-fail/double-import.rs

+3-1
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)