rust/compiler/rustc_parse
Matthias Krüger 97bacad9c2
Rollup merge of #114256 - Urgau:fix-issue-114180, r=WaffleLapkin
Fix invalid suggestion for mismatched types in closure arguments

This PR fixes the invalid suggestion for mismatched types in closure arguments.

The invalid suggestion came from a wrongly created span in the parser for closure arguments that don't have a type specified. Specifically, the span in this case was the last token span, but in the case of tuples, the span represented the last parenthesis instead of the whole tuple, which is fixed by taking the more accurate span of the pattern.

There is one unfortunate downside of this fix, it worsens even more the diagnostic for mismatched types in closure args without an explicit type. This happens because there is no correct span for implied inferred type. I tried also fixing this but it's a rabbit hole.

Fixes https://github.com/rust-lang/rust/issues/114180
2023-07-30 20:36:35 +02:00
..
src Rollup merge of #114256 - Urgau:fix-issue-114180, r=WaffleLapkin 2023-07-30 20:36:35 +02:00
Cargo.toml
messages.ftl Auto merge of #114028 - Centri3:ternary-operator, r=compiler-errors 2023-07-29 16:45:29 +00:00