-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-loop_matchwhen you match up with someone and they really throw you for a loopwhen you match up with someone and they really throw you for a loopI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
#![allow(incomplete_features)]
#![feature(loop_match)]
#![crate_type = "lib"]
fn test(mut state: u8) {
const bar: u8 = 2_u8;
#[loop_match]
loop {
state = 'blk: {
match state {
0 => {
#[const_continue]
break 'blk const { 4 + 5 };
}
_ => unreachable!(),
}
}
}
}
Meta
rustc --version --verbose
:
rustc 1.90.0-nightly (430d6eddf 2025-07-25)
binary: rustc
commit-hash: 430d6eddfc6a455ca4a0137c0822a982cccd3b2b
commit-date: 2025-07-25
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.8
Error output
error[E0391]: cycle detected when building MIR for `test`
--> loop_match_cycle.rs:12:32
|
12 | break 'blk const { 4 + 5 };
| ^^^^^^^^^^^^^^^
|
note: ...which requires evaluating type-level constant...
--> loop_match_cycle.rs:12:38
|
12 | break 'blk const { 4 + 5 };
| ^^^^^^^^^
note: ...which requires const-evaluating + checking `test::{constant#0}`...
--> loop_match_cycle.rs:12:38
|
12 | break 'blk const { 4 + 5 };
| ^^^^^^^^^
note: ...which requires caching mir of `test::{constant#0}` for CTFE...
--> loop_match_cycle.rs:12:38
|
12 | break 'blk const { 4 + 5 };
| ^^^^^^^^^
note: ...which requires elaborating drops for `test::{constant#0}`...
--> loop_match_cycle.rs:12:38
|
12 | break 'blk const { 4 + 5 };
| ^^^^^^^^^
note: ...which requires borrow-checking `test`...
--> loop_match_cycle.rs:5:1
|
5 | fn test(mut state: u8) {
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `test`...
--> loop_match_cycle.rs:5:1
|
5 | fn test(mut state: u8) {
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires checking if `test` contains FFI-unwind calls...
--> loop_match_cycle.rs:5:1
|
5 | fn test(mut state: u8) {
| ^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires building MIR for `test`, completing the cycle
note: cycle used when unsafety-checking `test`
--> loop_match_cycle.rs:5:1
|
5 | fn test(mut state: u8) {
| ^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0391`.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-loop_matchwhen you match up with someone and they really throw you for a loopwhen you match up with someone and they really throw you for a loopI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.