Skip to content

Commit d51eeef

Browse files
authored
Rollup merge of rust-lang#91298 - FabianWolff:issue-91028-source-avail, r=cjgillot
Improve error message for `E0659` if the source is not available Fixes rust-lang#91028. The fix is similar to those in rust-lang#89233 and rust-lang#87088. With this change, instead of the dangling ``` note: `Option` could also refer to the enum defined here ``` I get ``` note: `Option` could also refer to an enum from prelude ``` If the standard library source code _is_ available, the output does not change.
2 parents b64951f + 6dfed31 commit d51eeef

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)