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
+3
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ LL | let y: *const dyn Trait<Y> = x as _;
14
14
|
15
15
= note: expected trait object `dyn Trait<X>`
16
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
17
18
18
19
error[E0308]: mismatched types
19
20
--> $DIR/ptr-to-trait-obj-different-args.rs:27:34
@@ -25,6 +26,7 @@ LL | let _: *const dyn Trait<T> = x as _;
25
26
|
26
27
= note: expected trait object `dyn Trait<X>`
27
28
found trait object `dyn Trait<T>`
29
+
= 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
28
30
29
31
error[E0308]: mismatched types
30
32
--> $DIR/ptr-to-trait-obj-different-args.rs:28:34
@@ -37,6 +39,7 @@ LL | let _: *const dyn Trait<X> = t as _;
37
39
|
38
40
= note: expected trait object `dyn Trait<T>`
39
41
found trait object `dyn Trait<X>`
42
+
= 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
Copy file name to clipboardexpand all lines: tests/ui/coercion/coerce-expect-unsized-ascribed.stderr
+4
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,7 @@ LL | let _ = type_ascribe!(Box::new( if true { false } else { true }), Box<d
42
42
|
43
43
= note: expected struct `Box<dyn Debug>`
44
44
found struct `Box<bool>`
45
+
= help: `bool` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well
45
46
46
47
error[E0308]: mismatched types
47
48
--> $DIR/coerce-expect-unsized-ascribed.rs:16:27
@@ -51,6 +52,7 @@ LL | let _ = type_ascribe!(Box::new( match true { true => 'a', false => 'b'
51
52
|
52
53
= note: expected struct `Box<dyn Debug>`
53
54
found struct `Box<char>`
55
+
= help: `char` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well
= help: `bool` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well
= help: `char` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well
0 commit comments