We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3373f65 + 498ef20 commit ccdb320Copy full SHA for ccdb320
src/librustc/diagnostics.rs
@@ -256,6 +256,28 @@ trait Foo {
256
}
257
```
258
259
+### The trait cannot contain associated constants
260
+
261
+Just like static functions, associated constants aren't stored on the method
262
+table. If the trait or any subtrait contain an associated constant, they cannot
263
+be made into an object.
264
265
+```compile_fail,E0038
266
+trait Foo {
267
+ const X: i32;
268
+}
269
270
+impl Foo {}
271
+```
272
273
+A simple workaround is to use a helper method instead:
274
275
276
277
+ fn x(&self) -> i32;
278
279
280
281
### The trait cannot use `Self` as a type parameter in the supertrait listing
282
283
This is similar to the second sub-error, but subtler. It happens in situations
0 commit comments