Skip to content

Commit 3ff68b7

Browse files
committed
---
yaml --- r: 208343 b: refs/heads/snap-stage3 c: 69a5c37 h: refs/heads/master i: 208341: 73de721 208339: 9787d6d 208335: 348bb30 v: v3
1 parent abf9cdc commit 3ff68b7

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
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: 168615f869ea560aa95e12a3c043c19110368be6
4+
refs/heads/snap-stage3: 69a5c379dfbfdb17319eab061bef554845eca407
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: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ 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;
899900
let ns_word = match namespace {
900901
TypeNS => "type",
901902
ValueNS => "value",
@@ -904,12 +905,21 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
904905
"a {} named `{}` has already been imported \
905906
in this module", ns_word,
906907
&token::get_name(name));
908+
let use_id = import_resolution.id(namespace);
909+
if let NodeItem(item) = self.resolver.ast_map.get(use_id) {
910+
// Assert item.node is ItemUse
911+
// I feel like this should maybe mention the type,
912+
// as it's otherwise a bit of work to look up...
913+
// use syntax::ast::Item;
914+
span_note!(self.resolver.session, item.span,
915+
"Previously import of {} `{}` here",
916+
ns_word, token::get_name(name));
917+
}
918+
// Also showing the definition is reasonable?
907919
if let Some(sp) = target.bindings.span_for_namespace(namespace) {
908920
span_note!(self.resolver.session, sp,
909-
"first import of {} `{}` here",
921+
"definition of {} `{}` here",
910922
ns_word, token::get_name(name));
911-
} else {
912-
span_note!(self.resolver.session, import_span, "I can't find where it was previously imported");
913923
}
914924
}
915925
Some(_) | None => {}

0 commit comments

Comments
 (0)