diff options
| author | Theo Belaire <theo.belaire@gmail.com> | 2015-04-30 22:46:15 -0400 |
|---|---|---|
| committer | Theo Belaire <theo.belaire@gmail.com> | 2015-05-01 11:37:38 -0400 |
| commit | db9d01842450fe07f77ca97d9a68d105366f407e (patch) | |
| tree | cac6b9c221c167f278a1e027adb765b7afebcbf8 | |
| parent | 372c69d8d293985ad3bffbe5c5e527dc37e90169 (diff) | |
Fixed some nits
| -rw-r--r-- | src/librustc_resolve/resolve_imports.rs | 13 | ||||
| -rw-r--r-- | src/test/compile-fail/double-import.rs | 4 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index e731e8a5ce2..91eb068e845 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -896,8 +896,6 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { match target { Some(ref target) if target.shadowable != Shadowable::Always => { - use syntax::ast_map::NodeItem; - let ns_word = match namespace { TypeNS => "type", ValueNS => "value", @@ -907,12 +905,11 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { in this module", ns_word, &token::get_name(name)); let use_id = import_resolution.id(namespace); - if let NodeItem(item) = self.resolver.ast_map.get(use_id) { - // item is syntax::ast::Item; - span_note!(self.resolver.session, item.span, - "previous import of `{}` here", - token::get_name(name)); - } + let item = self.resolver.ast_map.expect_item(use_id); + // item is syntax::ast::Item; + span_note!(self.resolver.session, item.span, + "previous import of `{}` here", + token::get_name(name)); } Some(_) | None => {} } diff --git a/src/test/compile-fail/double-import.rs b/src/test/compile-fail/double-import.rs index e564d39f80d..cbf13c0a559 100644 --- a/src/test/compile-fail/double-import.rs +++ b/src/test/compile-fail/double-import.rs @@ -1,4 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -10,6 +10,8 @@ #![feature(no_std)] #![no_std] +// This tests that conflicting imports shows both `use` lines +// when reporting the error. mod sub1 { fn foo() {} // implementation 1 |
