Skip to content

Commit e1d731c

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 119e5d5 commit e1d731c

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -1340,11 +1340,13 @@ pub fn prohibit_assoc_item_constraint(
13401340
format!("<{lifetimes}{type_with_constraints}>"),
13411341
)
13421342
};
1343-
let suggestions =
1344-
vec![param_decl, (constraint.span, format!("{}", matching_param.name))];
1343+
let suggestions = vec![
1344+
param_decl,
1345+
(constraint.span.with_lo(constraint.ident.span.hi()), String::new()),
1346+
];
13451347

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

0 commit comments

Comments
 (0)