Skip to content

Commit d035598

Browse files
committed
---
yaml --- r: 210630 b: refs/heads/try c: 5c05278 h: refs/heads/master v: v3
1 parent 3f6aee2 commit d035598

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 69a5c379dfbfdb17319eab061bef554845eca407
5+
refs/heads/try: 5c05278fecf9b7d4ff64fe374fb5b4598908d064
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/librustc_resolve/resolve_imports.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
897897
match target {
898898
Some(ref target) if target.shadowable != Shadowable::Always => {
899899
use syntax::ast_map::NodeItem;
900+
900901
let ns_word = match namespace {
901902
TypeNS => "type",
902903
ValueNS => "value",
@@ -907,19 +908,10 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
907908
&token::get_name(name));
908909
let use_id = import_resolution.id(namespace);
909910
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;
911+
// item is syntax::ast::Item;
914912
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?
919-
if let Some(sp) = target.bindings.span_for_namespace(namespace) {
920-
span_note!(self.resolver.session, sp,
921-
"definition of {} `{}` here",
922-
ns_word, token::get_name(name));
913+
"previous import of `{}` here",
914+
token::get_name(name));
923915
}
924916
}
925917
Some(_) | None => {}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313

1414
mod sub1 {
15-
fn foo() {} // Implementation 1
15+
fn foo() {} // implementation 1
1616
}
1717

1818
mod sub2 {
19-
fn foo() {} // Implementation 2
19+
fn foo() {} // implementation 2
2020
}
2121

22-
use sub1::foo; //~ NOTE first imported here
23-
use sub2::foo; //~ ERROR a value named `foo` has already been imported in this module [E0252]
22+
use sub1::foo; //~ note previous import of `foo` here
23+
use sub2::foo; //~ error a value named `foo` has already been imported in this module [e0252]
2424

2525
fn main() {}

0 commit comments

Comments
 (0)