diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-06-06 23:53:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-06 23:53:17 +0200 |
| commit | 4ce2db5b31fcf7a40aa6f7cbb466c8387905cf47 (patch) | |
| tree | 007bd0b0d6920817550de0b13370f123d9702725 /compiler | |
| parent | 93ca0af08ca056e9e38d172e9b224d1e607a8e99 (diff) | |
| parent | 35cb28b7cfd2659bb1ac5ebed026694770199d0d (diff) | |
| download | rust-4ce2db5b31fcf7a40aa6f7cbb466c8387905cf47.tar.gz rust-4ce2db5b31fcf7a40aa6f7cbb466c8387905cf47.zip | |
Rollup merge of #142043 - estebank:const-suggestion, r=wesleywiser
Verbose suggestion to make param `const`
```
error[E0747]: type provided when a constant was expected
--> $DIR/invalid-const-arguments.rs:10:19
|
LL | impl<N> Foo for B<N> {}
| ^
|
help: consider changing this type parameter to a const parameter
|
LL - impl<N> Foo for B<N> {}
LL + impl<const N: u8> Foo for B<N> {}
|
```
Part of rust-lang/rust#141973.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs index 21f0f9648ea..3a26b8331f8 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs @@ -73,7 +73,7 @@ fn generic_arg_mismatch_err( let param_name = tcx.hir_ty_param_name(param_local_id); let param_type = tcx.type_of(param.def_id).instantiate_identity(); if param_type.is_suggestable(tcx, false) { - err.span_suggestion( + err.span_suggestion_verbose( tcx.def_span(src_def_id), "consider changing this type parameter to a const parameter", format!("const {param_name}: {param_type}"), |
