]>
Commit | Line | Data |
---|---|---|
94222f64 XL |
1 | error[E0605]: non-primitive cast: `&dyn Foo<i32>` as `&dyn Bar<u32>` |
2 | --> $DIR/type-checking-test-2.rs:20:13 | |
3 | | | |
4 | LL | let _ = x as &dyn Bar<u32>; // Error | |
5 | | ^^^^^^^^^^^^^^^^^^ invalid cast | |
6 | | | |
7 | help: consider borrowing the value | |
8 | | | |
9 | LL | let _ = &x as &dyn Bar<u32>; // Error | |
10 | | + | |
11 | ||
12 | error[E0277]: the trait bound `&dyn Foo<i32>: Bar<u32>` is not satisfied | |
13 | --> $DIR/type-checking-test-2.rs:20:13 | |
14 | | | |
15 | LL | let _ = x as &dyn Bar<u32>; // Error | |
16 | | ^ the trait `Bar<u32>` is not implemented for `&dyn Foo<i32>` | |
17 | | | |
064997fb | 18 | = note: required for the cast from `&dyn Foo<i32>` to the object type `dyn Bar<u32>` |
94222f64 XL |
19 | |
20 | error[E0605]: non-primitive cast: `&dyn Foo<u32>` as `&dyn Bar<_>` | |
21 | --> $DIR/type-checking-test-2.rs:26:13 | |
22 | | | |
23 | LL | let a = x as &dyn Bar<_>; // Ambiguous | |
24 | | ^^^^^^^^^^^^^^^^ invalid cast | |
25 | | | |
26 | help: consider borrowing the value | |
27 | | | |
28 | LL | let a = &x as &dyn Bar<_>; // Ambiguous | |
29 | | + | |
30 | ||
31 | error[E0277]: the trait bound `&dyn Foo<u32>: Bar<_>` is not satisfied | |
32 | --> $DIR/type-checking-test-2.rs:26:13 | |
33 | | | |
34 | LL | let a = x as &dyn Bar<_>; // Ambiguous | |
35 | | ^ the trait `Bar<_>` is not implemented for `&dyn Foo<u32>` | |
36 | | | |
064997fb | 37 | = note: required for the cast from `&dyn Foo<u32>` to the object type `dyn Bar<_>` |
94222f64 XL |
38 | |
39 | error: aborting due to 4 previous errors | |
40 | ||
41 | Some errors have detailed explanations: E0277, E0605. | |
42 | For more information about an error, try `rustc --explain E0277`. |