diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-05-20 16:50:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-20 16:50:39 +0200 |
| commit | 42ed69c756c1124ff1e63d4a551b39ff774d8316 (patch) | |
| tree | 8769742d275da739b6b3c6a9b749f120eaf14982 /compiler/rustc_pattern_analysis/src/errors.rs | |
| parent | 7e3af744bbb9a2a4d64e6c9a1c31eea9fb7ab273 (diff) | |
| parent | db1ac980818078ce3fb49b8cf0607464126da199 (diff) | |
| download | rust-42ed69c756c1124ff1e63d4a551b39ff774d8316.tar.gz rust-42ed69c756c1124ff1e63d4a551b39ff774d8316.zip | |
Rollup merge of #141236 - jagunter:issue-140823, r=compiler-errors
Resolved issue with mismatched types triggering ICE in certain scenarios ## Background The function `annotate_mut_binding_to_immutable_binding` called in `emit_coerce_suggestions` performs a type comparison between the `expected` and `found` types from `ExpectedFound` in the `TypeError`. This can fail if the `found` type contains a region variable that's been rolled back. ## What is being changed? This updates `annotate_mut_binding_to_immutable_binding` to use `expr_ty` and `expected` from the parent function instead of the types from the `TypeError`. This sidesteps the issue of using `found` from `TypeError` which may leak lingering inference region variables. This does change the diagnostic behavior to _only_ support cases where the expected outermost type is `&T`, but that seems to be the intended functionality. Also fixed the example in the `annotate_mut_binding_to_immutable_binding` rustdocs. r? rust-lang/types Fixes #140823
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
