Skip to content

Commit 7a7411c

Browse files
committed
---
yaml --- r: 205039 b: refs/heads/tmp c: 69a5c37 h: refs/heads/master i: 205037: 3af5aeb 205035: 280dedd 205031: e88ae98 205023: 778c038 v: v3
1 parent 086328b commit 7a7411c

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
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: f0213d8ffb128a16f94af7ee985dc61484596163
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 168615f869ea560aa95e12a3c043c19110368be6
35+
refs/heads/tmp: 69a5c379dfbfdb17319eab061bef554845eca407
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: f0ac7e04e647381e2bb87de1f3d0b108acb24d06
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

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