Skip to content

Commit 6dfed31

Browse files
committed
Improve error message for E0659 if the source is not available
1 parent 5fd3a5c commit 6dfed31

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ impl<'a> Resolver<'a> {
11781178

11791179
fn binding_description(&self, b: &NameBinding<'_>, ident: Ident, from_prelude: bool) -> String {
11801180
let res = b.res();
1181-
if b.span.is_dummy() {
1181+
if b.span.is_dummy() || self.session.source_map().span_to_snippet(b.span).is_err() {
11821182
// These already contain the "built-in" prefix or look bad with it.
11831183
let add_built_in =
11841184
!matches!(b.res(), Res::NonMacroAttr(..) | Res::PrimTy(..) | Res::ToolMod);

0 commit comments

Comments
 (0)