You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: tests/ui/associated-consts/associated-const-in-trait.stderr
+16-1
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,21 @@ LL | const N: usize;
13
13
| ^ ...because it contains this associated `const`
14
14
= help: consider moving `N` to another trait
15
15
16
-
error: aborting due to 1 previous error
16
+
error[E0038]: the trait `Trait` cannot be made into an object
17
+
--> $DIR/associated-const-in-trait.rs:9:29
18
+
|
19
+
LL | const fn n() -> usize { Self::N }
20
+
| ^^^^ `Trait` cannot be made into an object
21
+
|
22
+
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>
23
+
--> $DIR/associated-const-in-trait.rs:4:11
24
+
|
25
+
LL | trait Trait {
26
+
| ----- this trait cannot be made into an object...
27
+
LL | const N: usize;
28
+
| ^ ...because it contains this associated `const`
29
+
= help: consider moving `N` to another trait
30
+
31
+
error: aborting due to 2 previous errors
17
32
18
33
For more information about this error, try `rustc --explain E0038`.
0 commit comments