Skip to content

Commit 086328b

Browse files
committed
---
yaml --- r: 205038 b: refs/heads/tmp c: 168615f h: refs/heads/master v: v3
1 parent 3af5aeb commit 086328b

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
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: 74648b5d647526e421d5015417968b64c1900512
35+
refs/heads/tmp: 168615f869ea560aa95e12a3c043c19110368be6
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: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
618618
namespace_name,
619619
name_bindings.def_for_namespace(namespace));
620620
self.check_for_conflicting_import(
621-
&import_resolution.target_for_namespace(namespace),
621+
&import_resolution,
622622
directive.span,
623623
target,
624624
namespace);
@@ -755,7 +755,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
755755
// Continue.
756756
}
757757
Some(ref value_target) => {
758-
self.check_for_conflicting_import(&dest_import_resolution.value_target,
758+
self.check_for_conflicting_import(&dest_import_resolution,
759759
import_directive.span,
760760
*ident,
761761
ValueNS);
@@ -767,7 +767,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
767767
// Continue.
768768
}
769769
Some(ref type_target) => {
770-
self.check_for_conflicting_import(&dest_import_resolution.type_target,
770+
self.check_for_conflicting_import(&dest_import_resolution,
771771
import_directive.span,
772772
*ident,
773773
TypeNS);
@@ -885,32 +885,29 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
885885

886886
/// Checks that imported names and items don't have the same name.
887887
fn check_for_conflicting_import(&mut self,
888-
target: &Option<Target>,
888+
import_resolution: &ImportResolution,
889889
import_span: Span,
890890
name: Name,
891891
namespace: Namespace) {
892+
let target = import_resolution.target_for_namespace(namespace);
892893
debug!("check_for_conflicting_import: {}; target exists: {}",
893894
&token::get_name(name),
894895
target.is_some());
895896

896-
match *target {
897+
match target {
897898
Some(ref target) if target.shadowable != Shadowable::Always => {
898-
let msg = format!("a {} named `{}` has already been imported \
899-
in this module",
900-
match namespace {
901-
TypeNS => "type",
902-
ValueNS => "value",
903-
},
899+
let ns_word = match namespace {
900+
TypeNS => "type",
901+
ValueNS => "value",
902+
};
903+
span_err!(self.resolver.session, import_span, E0252,
904+
"a {} named `{}` has already been imported \
905+
in this module", ns_word,
904906
&token::get_name(name));
905-
span_err!(self.resolver.session, import_span, E0252, "{}", &msg[..]);
906907
if let Some(sp) = target.bindings.span_for_namespace(namespace) {
907908
span_note!(self.resolver.session, sp,
908909
"first import of {} `{}` here",
909-
match namespace {
910-
TypeNS => "type",
911-
ValueNS => "value",
912-
},
913-
token::get_name(name));
910+
ns_word, token::get_name(name));
914911
} else {
915912
span_note!(self.resolver.session, import_span, "I can't find where it was previously imported");
916913
}

0 commit comments

Comments
 (0)