diff options
| author | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-11-27 18:42:49 +0100 |
|---|---|---|
| committer | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-11-27 18:42:49 +0100 |
| commit | 6dfed31c4313c1eee7b1aa155e0761c5cdf7f128 (patch) | |
| tree | 3dbbfb16c5d04a0ddd51d1a00842c30d6b239a34 | |
| parent | 5fd3a5c7c175f228afaf5fc6ff00c177b83d8055 (diff) | |
| download | rust-6dfed31c4313c1eee7b1aa155e0761c5cdf7f128.tar.gz rust-6dfed31c4313c1eee7b1aa155e0761c5cdf7f128.zip | |
Improve error message for `E0659` if the source is not available
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 2e4cb4ff727..6a13627a563 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1178,7 +1178,7 @@ impl<'a> Resolver<'a> { fn binding_description(&self, b: &NameBinding<'_>, ident: Ident, from_prelude: bool) -> String { let res = b.res(); - if b.span.is_dummy() { + if b.span.is_dummy() || self.session.source_map().span_to_snippet(b.span).is_err() { // These already contain the "built-in" prefix or look bad with it. let add_built_in = !matches!(b.res(), Res::NonMacroAttr(..) | Res::PrimTy(..) | Res::ToolMod); |
