Skip to content

Commit 4f8a3ff

Browse files
Rollup merge of #151035 - issue-150693-closure-arg-suggestion, r=jieyouxu
Don't suggest replacing closure parameter with type name When a closure has an inferred parameter type like `|ch|` and the expected type differs in borrowing (e.g., `char` vs `&char`), the suggestion would incorrectly propose `|char|` instead of something valid like `|ch: char|`. This happened because the code couldn't walk explicit `&` references in the HIR when the type is inferred, and fell back to replacing the entire parameter span with the expected type name. Fix by only emitting the suggestion when we can properly identify the `&` syntax to remove. Fixes rust-lang/rust#150693
2 parents a266f50 + d97bcf9 commit 4f8a3ff

0 file changed

File tree

    0 commit comments

    Comments
     (0)