]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/trait-upcasting/type-checking-test-2.stderr
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / traits / trait-upcasting / type-checking-test-2.stderr
1 error[E0605]: non-primitive cast: `&dyn Foo<i32>` as `&dyn Bar<u32>`
2   --> $DIR/type-checking-test-2.rs:19: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:19:13
14    |
15 LL |     let _ = x as &dyn Bar<u32>; // Error
16    |             ^ the trait `Bar<u32>` is not implemented for `&dyn Foo<i32>`
17    |
18    = note: required for the cast from `&dyn Foo<i32>` to the object type `dyn Bar<u32>`
19
20 error[E0605]: non-primitive cast: `&dyn Foo<u32>` as `&dyn Bar<_>`
21   --> $DIR/type-checking-test-2.rs:25: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:25:13
33    |
34 LL |     let a = x as &dyn Bar<_>; // Ambiguous
35    |             ^ the trait `Bar<_>` is not implemented for `&dyn Foo<u32>`
36    |
37    = note: required for the cast from `&dyn Foo<u32>` to the object type `dyn Bar<_>`
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`.