Auto merge of #147143 - estebank:verbose-ret-type, r=fee1-dead

Make replacement suggestion `_` in type verbose

```
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
  --> $DIR/in-signature.rs:6:21
   |
LL | fn arr_fn() -> [u8; _] {
   |                     ^ not allowed in type signatures
   |
help: replace with the correct return type
   |
LL - fn arr_fn() -> [u8; _] {
LL + fn arr_fn() -> [u8; 3] {
   |
```
This commit is contained in:
bors
2025-09-30 05:48:32 +00:00
16 changed files with 258 additions and 150 deletions

View File

@@ -1140,7 +1140,7 @@ fn recover_infer_ret_ty<'tcx>(
// recursive function definition to leak out into the fn sig.
let mut recovered_ret_ty = None;
if let Some(suggestable_ret_ty) = ret_ty.make_suggestable(tcx, false, None) {
diag.span_suggestion(
diag.span_suggestion_verbose(
infer_ret_ty.span,
"replace with the correct return type",
suggestable_ret_ty,
@@ -1152,7 +1152,7 @@ fn recover_infer_ret_ty<'tcx>(
tcx.param_env(def_id),
ret_ty,
) {
diag.span_suggestion(
diag.span_suggestion_verbose(
infer_ret_ty.span,
"replace with an appropriate return type",
sugg,