mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00

This taints the typeck results with errors if a `continue` is found not pointing to a loop, which fixes an ICE. A few things were going wrong here. First, since this wasn't caught in typeck, we'd end up building the THIR and then running liveness lints on ill-formed HIR. Since liveness assumes all `continue`s point to loops, it wasn't setting a live node for the `continue`'s destination. However, the fallback for this was faulty; it would create a new live node to represent the erroneous state after the analysis's RWU table had already been built. This would ICE if the new live node was used in operations, such as merging results from the arms of a match. I've removed this error-recovery since it was buggy, and we should really catch bad labels before liveness. I've also replaced an outdated comment about when liveness lints are run. At this point, I think the call to `check_liveness` could be moved elsewhere, but if it can be run when the typeck results are tainted by errors, it'll need some slight refactoring so it can bail out in that case. In lieu of that, I've added an assertion.
44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
error[E0670]: `async fn` is not permitted in Rust 2015
|
|
--> $DIR/continue-pointing-to-block-ice-113379.rs:4:1
|
|
|
|
|
LL | async fn f999() -> Vec<usize> {
|
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
|
|
|
|
= help: pass `--edition 2024` to `rustc`
|
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
|
|
|
error[E0601]: `main` function not found in crate `continue_pointing_to_block_ice_113379`
|
|
--> $DIR/continue-pointing-to-block-ice-113379.rs:11:2
|
|
|
|
|
LL | }
|
|
| ^ consider adding a `main` function to `$DIR/continue-pointing-to-block-ice-113379.rs`
|
|
|
|
error[E0696]: `continue` pointing to a labeled block
|
|
--> $DIR/continue-pointing-to-block-ice-113379.rs:8:9
|
|
|
|
|
LL | / 'b: {
|
|
LL | |
|
|
LL | | continue 'b;
|
|
| | ^^^^^^^^^^^ labeled blocks cannot be `continue`'d
|
|
LL | |
|
|
LL | | }
|
|
| |_____- labeled block the `continue` points to
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/continue-pointing-to-block-ice-113379.rs:6:5
|
|
|
|
|
LL | / 'b: {
|
|
LL | |
|
|
LL | | continue 'b;
|
|
LL | |
|
|
LL | | }
|
|
| |_____^ expected `Vec<usize>`, found `()`
|
|
|
|
|
= note: expected struct `Vec<usize>`
|
|
found unit type `()`
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
Some errors have detailed explanations: E0308, E0601, E0670, E0696.
|
|
For more information about an error, try `rustc --explain E0308`.
|