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_hir_analysis/src | |
| 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_hir_analysis/src')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs index 5e595488ea7..968f38cf05d 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs @@ -1257,14 +1257,12 @@ pub fn prohibit_assoc_item_constraint( }; // Now emit the suggestion - if let Ok(suggestion) = tcx.sess.source_map().span_to_snippet(removal_span) { - e.span_suggestion_verbose( - removal_span, - format!("consider removing this associated item {}", constraint.kind.descr()), - suggestion, - Applicability::MaybeIncorrect, - ); - } + e.span_suggestion_verbose( + removal_span, + format!("consider removing this associated item {}", constraint.kind.descr()), + "", + Applicability::MaybeIncorrect, + ); }; // Suggest replacing the associated item binding with a generic argument. @@ -1340,11 +1338,13 @@ pub fn prohibit_assoc_item_constraint( format!("<{lifetimes}{type_with_constraints}>"), ) }; - let suggestions = - vec![param_decl, (constraint.span, format!("{}", matching_param.name))]; + let suggestions = vec![ + param_decl, + (constraint.span.with_lo(constraint.ident.span.hi()), String::new()), + ]; err.multipart_suggestion_verbose( - format!("declare the type parameter right after the `impl` keyword"), + "declare the type parameter right after the `impl` keyword", suggestions, Applicability::MaybeIncorrect, ); |
