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
+14-27
Original file line number
Diff line number
Diff line change
@@ -4,53 +4,40 @@ error[E0606]: casting `*const dyn A` as `*const dyn B` is invalid
4
4
LL | let b: *const dyn B = a as _;
5
5
| ^^^^^^
6
6
|
7
-
= note: vtable kinds may not match
7
+
= note: the trait objects may have different vtables
8
8
9
-
error[E0308]: mismatched types
9
+
error[E0606]: casting `*const dyn Trait<X>` as `*const dyn Trait<Y>` is invalid
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
-
| ^^^^^^ expected `X`, found `Y`
13
+
| ^^^^^^
14
14
|
15
-
= note: expected trait object `dyn Trait<X>`
16
-
found trait object `dyn Trait<Y>`
17
-
= help: `dyn Trait<Y>` 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
15
+
= note: the trait objects may have different vtables
18
16
19
-
error[E0308]: mismatched types
17
+
error[E0606]: casting `*const (dyn Trait<X> + 'static)` as `*const dyn Trait<T>` is invalid
= help: `dyn Trait<T>` 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
23
+
= note: the trait objects may have different vtables
30
24
31
-
error[E0308]: mismatched types
25
+
error[E0606]: casting `*const (dyn Trait<T> + 'static)` as `*const dyn Trait<X>` is invalid
= help: `dyn Trait<X>` 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
31
+
= note: the trait objects may have different vtables
43
32
44
-
error[E0308]: mismatched types
33
+
error[E0606]: casting `*mut (dyn Assocked<Assoc = u8> + 'static)` as `*mut (dyn Assocked<Assoc = u32> + 'static)` is invalid
error[E0606]: casting `*const dyn Trait<u8, u8>` as `*const dyn Trait<u8, u16>` is invalid
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
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
5
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
|
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
7
+
= note: the trait objects may have different vtables
10
8
11
9
error: aborting due to 1 previous error
12
10
13
-
For more information about this error, try `rustc --explain E0308`.
11
+
For more information about this error, try `rustc --explain E0606`.
0 commit comments