Skip to content

Commit b0112cd

Browse files
committed
---
yaml --- r: 206742 b: refs/heads/beta c: 5c05278 h: refs/heads/master v: v3
1 parent c754aa5 commit b0112cd

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
@@ -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: 69a5c379dfbfdb17319eab061bef554845eca407
32+
refs/heads/beta: 5c05278fecf9b7d4ff64fe374fb5b4598908d064
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: 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/beta/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)