fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.9 KiB72 linesraw
1error[E0308]: mismatched types
2  --> $DIR/dst-bad-coercions.rs:14:17
3   |
4LL |     let y: &S = x;
5   |                 ^ expected &S, found *-ptr
6   |
7   = note: expected type `&S`
8              found type `*const S`
9
10error[E0308]: mismatched types
11  --> $DIR/dst-bad-coercions.rs:15:21
12   |
13LL |     let y: &dyn T = x;
14   |                     ^
15   |                     |
16   |                     expected &dyn T, found *-ptr
17   |                     help: consider borrowing here: `&x`
18   |
19   = note: expected type `&dyn T`
20              found type `*const S`
21
22error[E0308]: mismatched types
23  --> $DIR/dst-bad-coercions.rs:19:17
24   |
25LL |     let y: &S = x;
26   |                 ^ expected &S, found *-ptr
27   |
28   = note: expected type `&S`
29              found type `*mut S`
30
31error[E0308]: mismatched types
32  --> $DIR/dst-bad-coercions.rs:20:21
33   |
34LL |     let y: &dyn T = x;
35   |                     ^
36   |                     |
37   |                     expected &dyn T, found *-ptr
38   |                     help: consider borrowing here: `&x`
39   |
40   = note: expected type `&dyn T`
41              found type `*mut S`
42
43error[E0308]: mismatched types
44  --> $DIR/dst-bad-coercions.rs:23:25
45   |
46LL |     let x: &mut dyn T = &S;
47   |                         ^^ types differ in mutability
48   |
49   = note: expected type `&mut dyn T`
50              found type `&S`
51
52error[E0308]: mismatched types
53  --> $DIR/dst-bad-coercions.rs:24:25
54   |
55LL |     let x: *mut dyn T = &S;
56   |                         ^^ types differ in mutability
57   |
58   = note: expected type `*mut dyn T`
59              found type `&S`
60
61error[E0308]: mismatched types
62  --> $DIR/dst-bad-coercions.rs:25:21
63   |
64LL |     let x: *mut S = &S;
65   |                     ^^ types differ in mutability
66   |
67   = note: expected type `*mut S`
68              found type `&S`
69
70error: aborting due to 7 previous errors
71
72For more information about this error, try `rustc --explain E0308`.