diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2025-07-10 20:20:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-10 20:20:40 -0400 |
| commit | 58e5c2629d0fc1c20d2f7d56dad974c34c461880 (patch) | |
| tree | 08ec17d0df88562fce7d96ccf5c30191eadb3b39 /compiler/rustc_pattern_analysis/src/errors.rs | |
| parent | 44f40e95d5637ba74c2fc9cd701ea4ba3b69977b (diff) | |
| parent | d6924441cd2b49678fcaf7cdee4e4a0263b7bdbf (diff) | |
| download | rust-58e5c2629d0fc1c20d2f7d56dad974c34c461880.tar.gz rust-58e5c2629d0fc1c20d2f7d56dad974c34c461880.zip | |
Rollup merge of #143742 - estebank:borrow-suggestion, r=compiler-errors
Rework borrowing suggestions to use `Expr` instead of just `Span` In the suggestion machinery for borrowing expressions and types, always use the available obligation `Span` to find the appropriate `Expr` to perform appropriateness checks no the `ExprKind` instead of on the textual snippet corresponding to the `Span`. (We were already doing this, but only for a subset of cases.) This now better handles situations where parentheses and `<>` are needed for correct syntax (`&(foo + bar)`, `(&foo).bar()`, `<&Foo>::bar()`, etc.). Unify the logic for the case where `&` *and* `&mut` are appropriate with the logic for only one of those cases. (Instead of having two branches for emitting the suggestion, we now have a single one, using `Diag::multipart_suggestions` always.) Handle the case when `S::foo()` should have been `<&S>::foo()` (instead of suggesting the prior `&S::foo()`. Fix rust-lang/rust#143393. Make `Diag::multipart_suggestions` always verbose. CC rust-lang/rust#141973.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
