]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/trait-upcasting/type-checking-test-1.stderr
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
[rust.git] / tests / ui / traits / trait-upcasting / type-checking-test-1.stderr
1 error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>`
2   --> $DIR/type-checking-test-1.rs:16:13
3    |
4 LL |     let _ = x as &dyn Bar<_>; // Ambiguous
5    |             ^^^^^^^^^^^^^^^^ invalid cast
6    |
7 help: consider borrowing the value
8    |
9 LL |     let _ = &x as &dyn Bar<_>; // Ambiguous
10    |             +
11
12 error[E0277]: the trait bound `&dyn Foo: Bar<_>` is not satisfied
13   --> $DIR/type-checking-test-1.rs:16:13
14    |
15 LL |     let _ = x as &dyn Bar<_>; // Ambiguous
16    |             ^ the trait `Bar<_>` is not implemented for `&dyn Foo`
17    |
18    = note: required for the cast from `&dyn Foo` to the object type `dyn Bar<_>`
19
20 error: aborting due to 2 previous errors
21
22 Some errors have detailed explanations: E0277, E0605.
23 For more information about an error, try `rustc --explain E0277`.