Skip to content

Commit 765e5a1

Browse files
committed
---
yaml --- r: 216933 b: refs/heads/stable c: 5c05278 h: refs/heads/master i: 216931: 87f3b59 v: v3
1 parent 9cab720 commit 765e5a1

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,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 69a5c379dfbfdb17319eab061bef554845eca407
32+
refs/heads/stable: 5c05278fecf9b7d4ff64fe374fb5b4598908d064
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

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