1
+ error[E0403]: the name `N` is already used for a generic parameter in this item's generic parameters
2
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:18
3
+ |
4
+ LL | trait Trait<const N: Trait = bar> {
5
+ | - first use of `N`
6
+ ...
7
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
8
+ | ^ already used
9
+
1
10
error[E0425]: cannot find value `bar` in this scope
2
11
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:30
3
12
|
4
13
LL | trait Trait<const N: Trait = bar> {
5
14
| ^^^ not found in this scope
6
15
16
+ error[E0423]: expected value, found builtin type `u32`
17
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:29
18
+ |
19
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
20
+ | ^^^ not a value
21
+
22
+ error[E0425]: cannot find value `bar` in this scope
23
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:26:9
24
+ |
25
+ LL | bar
26
+ | ^^^ not found in this scope
27
+
7
28
warning: trait objects without an explicit `dyn` are deprecated
8
29
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
9
30
|
@@ -46,6 +67,84 @@ LL | trait Trait<const N: Trait = bar> {
46
67
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47
68
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
48
69
70
+ error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
71
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:12
72
+ |
73
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
74
+ | ^^^^^^^^^^^^^^^^^^^^
75
+
76
+ warning: trait objects without an explicit `dyn` are deprecated
77
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
78
+ |
79
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
80
+ | ^^^^^
81
+ |
82
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
83
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
84
+ help: if this is an object-safe trait, use `dyn`
85
+ |
86
+ LL | fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
87
+ | +++
88
+
89
+ warning: trait objects without an explicit `dyn` are deprecated
90
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:44
91
+ |
92
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
93
+ | ^^^^^
94
+ |
95
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
96
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
97
+ help: if this is an object-safe trait, use `dyn`
98
+ |
99
+ LL | fn fnc<const N: Trait = u32>(&self) -> dyn Trait {
100
+ | +++
101
+
102
+ warning: trait objects without an explicit `dyn` are deprecated
103
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
104
+ |
105
+ LL | trait Trait<const N: Trait = bar> {
106
+ | ^^^^^
107
+ |
108
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
109
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
110
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
111
+ help: if this is an object-safe trait, use `dyn`
112
+ |
113
+ LL | trait Trait<const N: dyn Trait = bar> {
114
+ | +++
115
+
116
+ error[E0038]: the trait `Trait` cannot be made into an object
117
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
118
+ |
119
+ LL | trait Trait<const N: Trait = bar> {
120
+ | ^^^^^ `Trait` cannot be made into an object
121
+ |
122
+ note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
123
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
124
+ |
125
+ LL | trait Trait<const N: Trait = bar> {
126
+ | ----- this trait cannot be made into an object...
127
+ ...
128
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
129
+ | ^^^ ...because method `fnc` has generic type parameters
130
+ = help: consider moving `fnc` to another trait
131
+
132
+ error[E0038]: the trait `Trait` cannot be made into an object
133
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
134
+ |
135
+ LL | trait Trait<const N: Trait = bar> {
136
+ | ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
137
+ |
138
+ note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
139
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
140
+ |
141
+ LL | trait Trait<const N: Trait = bar> {
142
+ | ----- this trait cannot be made into an object...
143
+ ...
144
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
145
+ | ^^^ ...because method `fnc` has generic type parameters
146
+ = help: consider moving `fnc` to another trait
147
+
49
148
error: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
50
149
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
51
150
|
@@ -54,7 +153,76 @@ LL | trait Trait<const N: Trait = bar> {
54
153
|
55
154
= note: the only supported types are integers, `bool` and `char`
56
155
57
- error: aborting due to 4 previous errors; 1 warning emitted
156
+ error: associated item referring to unboxed trait object for its own trait
157
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:44
158
+ |
159
+ LL | trait Trait<const N: Trait = bar> {
160
+ | ----- in this trait
161
+ ...
162
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
163
+ | ^^^^^
164
+ |
165
+ help: you might have meant to use `Self` to refer to the implementing type
166
+ |
167
+ LL | fn fnc<const N: Trait = u32>(&self) -> Self {
168
+ | ~~~~
169
+
170
+ warning: trait objects without an explicit `dyn` are deprecated
171
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
172
+ |
173
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
174
+ | ^^^^^
175
+ |
176
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
177
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
178
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
179
+ help: if this is an object-safe trait, use `dyn`
180
+ |
181
+ LL | fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
182
+ | +++
183
+
184
+ error[E0038]: the trait `Trait` cannot be made into an object
185
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
186
+ |
187
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
188
+ | ^^^^^ `Trait` cannot be made into an object
189
+ |
190
+ note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
191
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
192
+ |
193
+ LL | trait Trait<const N: Trait = bar> {
194
+ | ----- this trait cannot be made into an object...
195
+ ...
196
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
197
+ | ^^^ ...because method `fnc` has generic type parameters
198
+ = help: consider moving `fnc` to another trait
199
+
200
+ error[E0038]: the trait `Trait` cannot be made into an object
201
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
202
+ |
203
+ LL | trait Trait<const N: Trait = bar> {
204
+ | ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
205
+ |
206
+ note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
207
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
208
+ |
209
+ LL | trait Trait<const N: Trait = bar> {
210
+ | ----- this trait cannot be made into an object...
211
+ ...
212
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
213
+ | ^^^ ...because method `fnc` has generic type parameters
214
+ = help: consider moving `fnc` to another trait
215
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
216
+
217
+ error: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
218
+ --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
219
+ |
220
+ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
221
+ | ^^^^^
222
+ |
223
+ = note: the only supported types are integers, `bool` and `char`
224
+
225
+ error: aborting due to 14 previous errors; 5 warnings emitted
58
226
59
- Some errors have detailed explanations: E0391, E0425.
60
- For more information about an error, try `rustc --explain E0391 `.
227
+ Some errors have detailed explanations: E0038, E0391, E0403, E0423 , E0425.
228
+ For more information about an error, try `rustc --explain E0038 `.
0 commit comments