diff options
| author | Brian Koropoff <bkoropoff@gmail.com> | 2014-08-19 00:07:30 -0700 |
|---|---|---|
| committer | Brian Koropoff <bkoropoff@gmail.com> | 2014-08-19 00:08:44 -0700 |
| commit | e0cfe10aad151211fdb6fedaad44334400a37d06 (patch) | |
| tree | 8c43437730ef93e183826e89ee9ce6449fe7b4d5 | |
| parent | eaf810a219b136fff67e75840ad3c5efde9ae1e5 (diff) | |
| download | rust-e0cfe10aad151211fdb6fedaad44334400a37d06.tar.gz rust-e0cfe10aad151211fdb6fedaad44334400a37d06.zip | |
Include import name in import shadowing error messages.
This partially alleviates the confusing behavior in issue #16597
| -rw-r--r-- | src/librustc/middle/resolve.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index bd779b865d6..b3389cbef64 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -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 => {} } @@ -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) => { @@ -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) => { |
