Rollup merge of #118514 - Enselic:ice-probe, r=cjgillot

rustc_hir_typeck: Fix ICE when probing for non-ASCII function alternative

Closes #118499

Apparently triggered by https://github.com/rust-lang/rust/pull/118381
This commit is contained in:
Matthias Krüger 2023-12-02 16:58:40 +01:00 committed by GitHub
commit c0f37fa5cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -1799,9 +1799,10 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
.iter() .iter()
.find(|cand| self.matches_by_doc_alias(cand.def_id)) .find(|cand| self.matches_by_doc_alias(cand.def_id))
.map(|cand| cand.name) .map(|cand| cand.name)
}) });
.unwrap(); Ok(best_name.and_then(|best_name| {
Ok(applicable_close_candidates.into_iter().find(|method| method.name == best_name)) applicable_close_candidates.into_iter().find(|method| method.name == best_name)
}))
} }
}) })
} }

View File

@ -1,4 +1,7 @@
fn main() { fn main() {
// There shall be no suggestions here. In particular not `Ok`. // There shall be no suggestions here. In particular not `Ok`.
let _ = ; //~ ERROR cannot find value `读文` in this scope let _ = ; //~ ERROR cannot find value `读文` in this scope
let f = 0f32; // Important line to make this an ICE regression test
(f); //~ ERROR cannot find function `读文` in this scope
} }

View File

@ -4,6 +4,12 @@ error[E0425]: cannot find value `读文` in this scope
LL | let _ = 读文; LL | let _ = 读文;
| ^^^^ not found in this scope | ^^^^ not found in this scope
error: aborting due to 1 previous error error[E0425]: cannot find function `读文` in this scope
--> $DIR/non_ascii_ident.rs:6:5
|
LL | 读文(f);
| ^^^^ not found in this scope
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`. For more information about this error, try `rustc --explain E0425`.