File tree Expand file tree Collapse file tree 3 files changed +22
-10
lines changed
compiler/rustc_hir_analysis/src/hir_ty_lowering Expand file tree Collapse file tree 3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ fn generic_arg_mismatch_err(
73
73
let param_name = tcx. hir_ty_param_name ( param_local_id) ;
74
74
let param_type = tcx. type_of ( param. def_id ) . instantiate_identity ( ) ;
75
75
if param_type. is_suggestable ( tcx, false ) {
76
- err. span_suggestion (
76
+ err. span_suggestion_verbose (
77
77
tcx. def_span ( src_def_id) ,
78
78
"consider changing this type parameter to a const parameter" ,
79
79
format ! ( "const {param_name}: {param_type}" ) ,
Original file line number Diff line number Diff line change @@ -51,9 +51,13 @@ error[E0747]: type provided when a constant was expected
51
51
--> $DIR/invalid-const-arguments.rs:10:19
52
52
|
53
53
LL | impl<N> Foo for B<N> {}
54
- | - ^
55
- | |
56
- | help: consider changing this type parameter to a const parameter: `const N: u8`
54
+ | ^
55
+ |
56
+ help: consider changing this type parameter to a const parameter
57
+ |
58
+ LL - impl<N> Foo for B<N> {}
59
+ LL + impl<const N: u8> Foo for B<N> {}
60
+ |
57
61
58
62
error[E0747]: unresolved item provided when a constant was expected
59
63
--> $DIR/invalid-const-arguments.rs:14:32
Original file line number Diff line number Diff line change @@ -2,17 +2,25 @@ error[E0747]: type provided when a constant was expected
2
2
--> $DIR/kind_mismatch.rs:11:38
3
3
|
4
4
LL | impl<K> ContainsKey<K> for KeyHolder<K> {}
5
- | - ^
6
- | |
7
- | help: consider changing this type parameter to a const parameter: `const K: u8`
5
+ | ^
6
+ |
7
+ help: consider changing this type parameter to a const parameter
8
+ |
9
+ LL - impl<K> ContainsKey<K> for KeyHolder<K> {}
10
+ LL + impl<const K: u8> ContainsKey<K> for KeyHolder<K> {}
11
+ |
8
12
9
13
error[E0747]: type provided when a constant was expected
10
14
--> $DIR/kind_mismatch.rs:11:21
11
15
|
12
16
LL | impl<K> ContainsKey<K> for KeyHolder<K> {}
13
- | - ^
14
- | |
15
- | help: consider changing this type parameter to a const parameter: `const K: u8`
17
+ | ^
18
+ |
19
+ help: consider changing this type parameter to a const parameter
20
+ |
21
+ LL - impl<K> ContainsKey<K> for KeyHolder<K> {}
22
+ LL + impl<const K: u8> ContainsKey<K> for KeyHolder<K> {}
23
+ |
16
24
17
25
error: aborting due to 2 previous errors
18
26
You can’t perform that action at this time.
0 commit comments