1 error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>`
2 --> $DIR/type-checking-test-1.rs:17:13
4 LL | let _ = x as &dyn Bar<_>; // Ambiguous
5 | ^^^^^^^^^^^^^^^^ invalid cast
7 help: consider borrowing the value
9 LL | let _ = &x as &dyn Bar<_>; // Ambiguous
12 error[E0277]: the trait bound `&dyn Foo: Bar<_>` is not satisfied
13 --> $DIR/type-checking-test-1.rs:17:13
15 LL | let _ = x as &dyn Bar<_>; // Ambiguous
16 | ^ the trait `Bar<_>` is not implemented for `&dyn Foo`
18 = note: required for the cast to the object type `dyn Bar<_>`
20 error: aborting due to 2 previous errors
22 Some errors have detailed explanations: E0277, E0605.
23 For more information about an error, try `rustc --explain E0277`.