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/cast/ptr-to-trait-obj-different-args.stderr
+23-22
Original file line number
Diff line number
Diff line change
@@ -6,47 +6,48 @@ LL | let b: *const dyn B = a as _;
6
6
|
7
7
= note: vtable kinds may not match
8
8
9
-
error[E0277]: the trait bound `dyn Trait<X>: Unsize<dyn Trait<Y>>` is not satisfied
9
+
error[E0308]: mismatched types
10
10
--> $DIR/ptr-to-trait-obj-different-args.rs:21:34
11
11
|
12
12
LL | let y: *const dyn Trait<Y> = x as _;
13
-
| ^^^^^^ the trait `Unsize<dyn Trait<Y>>` is not implemented for `dyn Trait<X>`
13
+
| ^^^^^^ expected `X`, found `Y`
14
14
|
15
-
= note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
15
+
= note: expected trait object `dyn Trait<X>`
16
+
found trait object `dyn Trait<Y>`
16
17
17
-
error[E0277]: the trait bound `dyn Trait<X>: Unsize<dyn Trait<T>>` is not satisfied
| ^^^^^^ the trait `Unsize<dyn Trait<T>>` is not implemented for `dyn Trait<X>`
24
+
| ^^^^^^ expected `X`, found type parameter `T`
22
25
|
23
-
= note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
24
-
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
| ^^^^^^ the trait `Unsize<dyn Trait<X>>` is not implemented for `dyn Trait<T>`
34
-
|
35
-
= note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
36
-
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
error[E0277]: the trait bound `dyn Assocked<Assoc = u8>: Unsize<dyn Assocked<Assoc = u32>>` is not satisfied
41
+
error[E0308]: mismatched types
42
42
--> $DIR/ptr-to-trait-obj-different-args.rs:36:5
43
43
|
44
44
LL | x as _
45
-
| ^^^^^^ the trait `Unsize<dyn Assocked<Assoc = u32>>` is not implemented for `dyn Assocked<Assoc = u8>`
45
+
| ^^^^^^ expected `u8`, found `u32`
46
46
|
47
-
= note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
error[E0277]: the trait bound `dyn Trait<u8, u8>: Unsize<dyn Trait<u8, u16>>` is not satisfied
1
+
error[E0308]: mismatched types
2
2
--> $DIR/upcast_soundness_bug.rs:59:13
3
3
|
4
4
LL | let p = p as *const dyn Trait<u8, u16>; // <- this is bad!
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unsize<dyn Trait<u8, u16>>` is not implemented for `dyn Trait<u8, u8>`
5
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
6
6
|
7
-
= note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
7
+
= note: expected trait object `dyn Trait<u8, u8>`
8
+
found trait object `dyn Trait<u8, u16>`
9
+
= help: `dyn Trait<u8, u16>` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well
8
10
9
11
error: aborting due to 1 previous error
10
12
11
-
For more information about this error, try `rustc --explain E0277`.
13
+
For more information about this error, try `rustc --explain E0308`.
0 commit comments