|
1 | 1 | error[E0308]: mismatched types
|
2 | 2 | --> $DIR/diverging-place-match.rs:4:5
|
3 | 3 | |
|
4 |
| -LL | fn make_up_a_value<T>() -> T { |
5 |
| - | - expected this type parameter |
6 | 4 | LL | / unsafe {
|
7 | 5 | LL | |
|
8 | 6 | LL | | let x: *const ! = 0 as _;
|
9 | 7 | LL | | let _: ! = *x;
|
10 | 8 | LL | | // Since `*x` "diverges" in HIR, but doesn't count as a read in MIR, this
|
11 | 9 | LL | | // is unsound since we act as if it diverges but it doesn't.
|
12 | 10 | LL | | }
|
13 |
| - | |_____^ expected type parameter `T`, found `()` |
| 11 | + | |_____^ expected `!`, found `()` |
14 | 12 | |
|
15 |
| - = note: expected type parameter `T` |
16 |
| - found unit type `()` |
| 13 | + = note: expected type `!` |
| 14 | + found unit type `()` |
17 | 15 |
|
18 |
| -error: aborting due to 1 previous error |
| 16 | +error[E0308]: mismatched types |
| 17 | + --> $DIR/diverging-place-match.rs:14:5 |
| 18 | + | |
| 19 | +LL | / unsafe { |
| 20 | +LL | | |
| 21 | +LL | | let x: *const ! = 0 as _; |
| 22 | +LL | | let _ = *x; |
| 23 | +LL | | } |
| 24 | + | |_____^ expected `!`, found `()` |
| 25 | + | |
| 26 | + = note: expected type `!` |
| 27 | + found unit type `()` |
| 28 | + |
| 29 | +error[E0308]: mismatched types |
| 30 | + --> $DIR/diverging-place-match.rs:25:21 |
| 31 | + | |
| 32 | +LL | let _: () = *x; |
| 33 | + | -- ^^ expected `()`, found `!` |
| 34 | + | | |
| 35 | + | expected due to this |
| 36 | + | |
| 37 | + = note: expected unit type `()` |
| 38 | + found type `!` |
| 39 | + |
| 40 | +error[E0308]: mismatched types |
| 41 | + --> $DIR/diverging-place-match.rs:22:5 |
| 42 | + | |
| 43 | +LL | / unsafe { |
| 44 | +LL | | |
| 45 | +LL | | let x: *const ! = 0 as _; |
| 46 | +LL | | let _: () = *x; |
| 47 | +LL | | |
| 48 | +LL | | } |
| 49 | + | |_____^ expected `!`, found `()` |
| 50 | + | |
| 51 | + = note: expected type `!` |
| 52 | + found unit type `()` |
| 53 | + |
| 54 | +error[E0308]: mismatched types |
| 55 | + --> $DIR/diverging-place-match.rs:31:5 |
| 56 | + | |
| 57 | +LL | / unsafe { |
| 58 | +LL | | |
| 59 | +LL | | let x: *const ! = 0 as _; |
| 60 | +LL | | match *x { _ => {} }; |
| 61 | +LL | | } |
| 62 | + | |_____^ expected `!`, found `()` |
| 63 | + | |
| 64 | + = note: expected type `!` |
| 65 | + found unit type `()` |
| 66 | + |
| 67 | +error[E0308]: mismatched types |
| 68 | + --> $DIR/diverging-place-match.rs:39:5 |
| 69 | + | |
| 70 | +LL | / unsafe { |
| 71 | +LL | | |
| 72 | +LL | | let x: *const (!, ()) = 0 as _; |
| 73 | +LL | | let _ = (*x).0; |
| 74 | +LL | | // ^ I think this is still UB, but because of the inbounds projection. |
| 75 | +LL | | } |
| 76 | + | |_____^ expected `!`, found `()` |
| 77 | + | |
| 78 | + = note: expected type `!` |
| 79 | + found unit type `()` |
| 80 | + |
| 81 | +error: aborting due to 6 previous errors |
19 | 82 |
|
20 | 83 | For more information about this error, try `rustc --explain E0308`.
|
0 commit comments