Skip to content

Commit

Permalink
Include import name in import shadowing error messages.
Browse files Browse the repository at this point in the history
This partially alleviates the confusing behavior in issue #16597
  • Loading branch information
bkoropoff committed Aug 19, 2014
1 parent eaf810a commit e0cfe10
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/librustc/middle/resolve.rs
Expand Up @@ -2820,9 +2820,10 @@ impl<'a> Resolver<'a> {
.contains_key(&name) {
match import_resolution.type_target {
Some(ref target) if !target.shadowable => {
self.session.span_err(import_span,
"import conflicts with imported \
crate in this module");
let msg = format!("import `{}` conflicts with imported \
crate in this module",
token::get_name(name).get());
self.session.span_err(import_span, msg.as_slice());
}
Some(_) | None => {}
}
Expand All @@ -2843,9 +2844,10 @@ impl<'a> Resolver<'a> {
match *name_bindings.value_def.borrow() {
None => {}
Some(ref value) => {
self.session.span_err(import_span,
"import conflicts with value \
in this module");
let msg = format!("import `{}` conflicts with value \
in this module",
token::get_name(name).get());
self.session.span_err(import_span, msg.as_slice());
match value.value_span {
None => {}
Some(span) => {
Expand All @@ -2865,9 +2867,10 @@ impl<'a> Resolver<'a> {
match *name_bindings.type_def.borrow() {
None => {}
Some(ref ty) => {
self.session.span_err(import_span,
"import conflicts with type in \
this module");
let msg = format!("import `{}` conflicts with type in \
this module",
token::get_name(name).get());
self.session.span_err(import_span, msg.as_slice());
match ty.type_span {
None => {}
Some(span) => {
Expand Down

0 comments on commit e0cfe10

Please sign in to comment.