Skip to content

Commit c8dca27

Browse files
committed
More accurate span for type parameter suggestion
After the change to diff suggestion output, the change is only noticeable with color: the `K` in `tests/ui/generics/impl-block-params-declared-in-wrong-spot-issue-113073.rs` is no longer marked as red.
1 parent 3c111c1 commit c8dca27

File tree

1 file changed

+5
-3
lines changed
  • compiler/rustc_hir_analysis/src/hir_ty_lowering

1 file changed

+5
-3
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,11 +1338,13 @@ pub fn prohibit_assoc_item_constraint(
13381338
format!("<{lifetimes}{type_with_constraints}>"),
13391339
)
13401340
};
1341-
let suggestions =
1342-
vec![param_decl, (constraint.span, format!("{}", matching_param.name))];
1341+
let suggestions = vec![
1342+
param_decl,
1343+
(constraint.span.with_lo(constraint.ident.span.hi()), String::new()),
1344+
];
13431345

13441346
err.multipart_suggestion_verbose(
1345-
format!("declare the type parameter right after the `impl` keyword"),
1347+
"declare the type parameter right after the `impl` keyword",
13461348
suggestions,
13471349
Applicability::MaybeIncorrect,
13481350
);

0 commit comments

Comments
 (0)