@@ -2,41 +2,14 @@ error[E0605]: non-primitive cast: `&dyn Foo<i32>` as `&dyn Bar<u32>`
2
2
--> $DIR/type-checking-test-2.rs:19:13
3
3
|
4
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 `&dyn Bar<u32>`
5
+ | ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
19
6
20
7
error[E0605]: non-primitive cast: `&dyn Foo<u32>` as `&dyn Bar<_>`
21
- --> $DIR/type-checking-test-2.rs:25 :13
8
+ --> $DIR/type-checking-test-2.rs:24 :13
22
9
|
23
10
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 `&dyn Bar<_>`
11
+ | ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
38
12
39
- error: aborting due to 4 previous errors
13
+ error: aborting due to 2 previous errors
40
14
41
- Some errors have detailed explanations: E0277, E0605.
42
- For more information about an error, try `rustc --explain E0277`.
15
+ For more information about this error, try `rustc --explain E0605`.
0 commit comments