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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
15
+
|
16
+
= help: consider moving `A` to another trait
17
+
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>
18
+
--> $DIR/gat-in-trait-path.rs:6:10
19
+
|
20
+
LL | trait Foo {
21
+
| --- this trait cannot be made into an object...
22
+
LL | type A<'a> where Self: 'a;
23
+
| ^ ...because it contains the generic associated type `A`
24
+
25
+
error: aborting due to previous error; 1 warning emitted
11
26
27
+
For more information about this error, try `rustc --explain E0038`.
| ^^^^^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
15
+
|
16
+
= help: consider moving `Y` to another trait
17
+
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>
18
+
--> $DIR/issue-67510-pass.rs:5:10
19
+
|
20
+
LL | trait X {
21
+
| - this trait cannot be made into an object...
22
+
LL | type Y<'a>;
23
+
| ^ ...because it contains the generic associated type `Y`
24
+
25
+
error: aborting due to previous error; 1 warning emitted
11
26
27
+
For more information about this error, try `rustc --explain E0038`.
Copy file name to clipboardexpand all lines: src/test/ui/generic-associated-types/issue-76535.stderr
+35-2
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,39 @@ help: use angle brackets to add missing lifetime argument
23
23
LL | type SubType<'a><'a>: SubTrait;
24
24
| ^^^^
25
25
26
-
error: aborting due to previous error; 1 warning emitted
26
+
error[E0038]: the trait `SuperTrait` cannot be made into an object
27
+
--> $DIR/issue-76535.rs:38:14
28
+
|
29
+
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
30
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
31
+
|
32
+
= help: consider moving `SubType` to another trait
33
+
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>
34
+
--> $DIR/issue-76535.rs:7:10
35
+
|
36
+
LL | pub trait SuperTrait {
37
+
| ---------- this trait cannot be made into an object...
38
+
LL | type SubType<'a>: SubTrait;
39
+
| ^^^^^^^ ...because it contains the generic associated type `SubType`
40
+
41
+
error[E0038]: the trait `SuperTrait` cannot be made into an object
42
+
--> $DIR/issue-76535.rs:38:57
43
+
|
44
+
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
45
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
46
+
|
47
+
= help: consider moving `SubType` to another trait
48
+
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>
49
+
--> $DIR/issue-76535.rs:7:10
50
+
|
51
+
LL | pub trait SuperTrait {
52
+
| ---------- this trait cannot be made into an object...
53
+
LL | type SubType<'a>: SubTrait;
54
+
| ^^^^^^^ ...because it contains the generic associated type `SubType`
55
+
= note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn SuperTrait<SubType = SubStruct<'_>>>>` for `Box<SuperStruct>`
56
+
= note: required by cast to type `Box<dyn SuperTrait<SubType = SubStruct<'_>>>`
57
+
58
+
error: aborting due to 3 previous errors; 1 warning emitted
27
59
28
-
For more information about this error, try `rustc --explain E0107`.
60
+
Some errors have detailed explanations: E0038, E0107.
61
+
For more information about an error, try `rustc --explain E0038`.
Copy file name to clipboardexpand all lines: src/test/ui/generic-associated-types/issue-78671.stderr
+18-2
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,22 @@ help: use angle brackets to add missing type argument
14
14
LL | type Member<T><T>;
15
15
| ^^^
16
16
17
-
error: aborting due to previous error
17
+
error[E0038]: the trait `CollectionFamily` cannot be made into an object
18
+
--> $DIR/issue-78671.rs:9:25
19
+
|
20
+
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
21
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` cannot be made into an object
22
+
|
23
+
= help: consider moving `Member` to another trait
24
+
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>
25
+
--> $DIR/issue-78671.rs:5:10
26
+
|
27
+
LL | trait CollectionFamily {
28
+
| ---------------- this trait cannot be made into an object...
29
+
LL | type Member<T>;
30
+
| ^^^^^^ ...because it contains the generic associated type `Member`
31
+
32
+
error: aborting due to 2 previous errors
18
33
19
-
For more information about this error, try `rustc --explain E0107`.
34
+
Some errors have detailed explanations: E0038, E0107.
35
+
For more information about an error, try `rustc --explain E0038`.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object
22
+
|
23
+
= help: consider moving `VRefCont` to another trait
24
+
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>
25
+
--> $DIR/issue-79422.rs:21:10
26
+
|
27
+
LL | trait MapLike<K, V> {
28
+
| ------- this trait cannot be made into an object...
29
+
LL | type VRefCont<'a>: RefCont<'a, V>;
30
+
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
31
+
32
+
error[E0038]: the trait `MapLike` cannot be made into an object
18
33
--> $DIR/issue-79422.rs:43:13
19
34
|
20
35
LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
21
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn RefCont`, found reference
36
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object
37
+
|
38
+
= help: consider moving `VRefCont` to another trait
39
+
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>
= note: required for the cast to the object type `dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>`
42
+
LL | trait MapLike<K, V> {
43
+
| ------- this trait cannot be made into an object...
44
+
LL | type VRefCont<'a>: RefCont<'a, V>;
45
+
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
46
+
= note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>>` for `Box<BTreeMap<u8, u8>>`
47
+
= note: required by cast to type `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>`
26
48
27
-
error: aborting due to 2 previous errors
49
+
error: aborting due to 3 previous errors
28
50
29
-
Some errors have detailed explanations: E0107, E0271.
30
-
For more information about an error, try `rustc --explain E0107`.
51
+
Some errors have detailed explanations: E0038, E0107.
52
+
For more information about an error, try `rustc --explain E0038`.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` cannot be made into an object
6
+
|
7
+
= help: consider moving `Item` to another trait
8
+
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>
9
+
--> $DIR/trait-objects.rs:5:10
10
+
|
11
+
LL | trait StreamingIterator {
12
+
| ----------------- this trait cannot be made into an object...
13
+
LL | type Item<'a> where Self: 'a;
14
+
| ^^^^ ...because it contains the generic associated type `Item`
15
+
16
+
error: aborting due to previous error
17
+
18
+
For more information about this error, try `rustc --explain E0038`.
0 commit comments