diff options
| author | bors <bors@rust-lang.org> | 2024-07-18 06:11:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-18 06:11:35 +0000 |
| commit | 52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6 (patch) | |
| tree | 29470eed894270e4f81716b839c190806fdf0099 /compiler/rustc_parse/src/parser | |
| parent | 4bb2f278617e5498ac9a4776d3e1268154c500c5 (diff) | |
| parent | 77e5bbf3412a6e5d4defb3445c729dc457cd1fc0 (diff) | |
| download | rust-52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6.tar.gz rust-52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6.zip | |
Auto merge of #127898 - matthiaskrgr:rollup-lkkpoui, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #127077 (Make language around `ToOwned` for `BorrowedFd` more precise) - #127783 (Put the dots back in RTN pretty printing) - #127787 (Migrate `atomic-lock-free` to `rmake`) - #127810 (Rename `tcx` to `cx` in `rustc_type_ir`) - #127878 (Fix associated item removal suggestion) - #127886 (Accurate `use` rename suggestion span) - #127888 (More accurate span for type parameter suggestion) - #127889 (More accurate span for anonymous argument suggestion) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 0da7fefe6ed..2fe3ab56146 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -2240,11 +2240,11 @@ impl<'a> Parser<'a> { } _ => { // Otherwise, try to get a type and emit a suggestion. - if let Some(ty) = pat.to_ty() { + if let Some(_) = pat.to_ty() { err.span_suggestion_verbose( - pat.span, + pat.span.shrink_to_lo(), "explicitly ignore the parameter name", - format!("_: {}", pprust::ty_to_string(&ty)), + "_: ".to_string(), Applicability::MachineApplicable, ); err.note(rfc_note); @@ -2256,7 +2256,7 @@ impl<'a> Parser<'a> { // `fn foo(a, b) {}`, `fn foo(a<x>, b<y>) {}` or `fn foo(usize, usize) {}` if first_param { - err.span_suggestion( + err.span_suggestion_verbose( self_span, "if this is a `self` type, give it a parameter name", self_sugg, @@ -2266,14 +2266,14 @@ impl<'a> Parser<'a> { // Avoid suggesting that `fn foo(HashMap<u32>)` is fixed with a change to // `fn foo(HashMap: TypeName<u32>)`. if self.token != token::Lt { - err.span_suggestion( + err.span_suggestion_verbose( param_span, "if this is a parameter name, give it a type", param_sugg, Applicability::HasPlaceholders, ); } - err.span_suggestion( + err.span_suggestion_verbose( type_span, "if this is a type, explicitly ignore the parameter name", type_sugg, |
