Skip to content

Commit c754aa5

Browse files
committed
---
yaml --- r: 206741 b: refs/heads/beta c: 69a5c37 h: refs/heads/master i: 206739: 9968597 v: v3
1 parent 950b241 commit c754aa5

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
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: 168615f869ea560aa95e12a3c043c19110368be6
32+
refs/heads/beta: 69a5c379dfbfdb17319eab061bef554845eca407
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

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