-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-bugCategory: This is a bug.Category: This is a bug.F-gen_blocks`gen {}` expressions that produce `Iterator`s`gen {}` expressions that produce `Iterator`sI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-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
//@compile-flags: --edition=2024 -Zmir-enable-passes=+Inline -Zmir-enable-passes=+ReferencePropagation -Zlint-mir
#![feature(gen_blocks)]
gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
yield y;
z;
}
pub fn main() {
let z = 3;
let mut iter = foo(&1, &2, &z);
assert_eq !(iter.next(), Some(&3))
}Meta
rustc --version --verbose:
rustc 1.94.0-nightly (ba86c0460 2025-12-06)
binary: rustc
commit-hash: ba86c0460b0233319e01fd789a42a7276eade805
commit-date: 2025-12-06
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.5
Error output
warning: unused variable: `x`
--> code.rs:2:20
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
warning: path statement with no effect
--> code.rs:4:3
|
4 | z;
| ^^
|
= note: `#[warn(path_statements)]` (part of `#[warn(unused)]`) on by default
warning: 2 warnings emitted
Backtrace
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass ReferencePropagation) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass SimplifyLocals-before-const-prop) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass SimplifyLocals-after-value-numbering) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass MatchBranchSimplification) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass SingleUseConsts) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass SimplifyConstCondition-after-const-prop) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass SimplifyComparisonIntegral) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass SimplifyConstCondition-final) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass RemoveNoopLandingPads) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass SimplifyCfg-final) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass CopyProp) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass SimplifyLocals-final) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass AddCallGuards) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after pass PreCodegen) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ code[4f42]::main)) (after phase change to runtime-optimized) at bb7[1]:
encountered `((_2 as variant#3).0: &i32) = copy (_2.2: &i32)` statement with overlapping memory
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:106:34 - disabled backtrace
--> code.rs:2:44
|
2 | gen fn foo<'a, 'b>(x: &'a i32, y: &'b i32, z: &'b i32) -> &'b i32 {
| ^
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: please make sure that you have updated to the latest nightly
note: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2025-12-07T22_59_17-462340.txt` to your bug report
note: compiler flags: -Z mir-enable-passes=+Inline -Z mir-enable-passes=+ReferencePropagation -Z lint-mir
query stack during panic:
end of query stack
Metadata
Metadata
Assignees
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-bugCategory: This is a bug.Category: This is a bug.F-gen_blocks`gen {}` expressions that produce `Iterator`s`gen {}` expressions that produce `Iterator`sI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-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.