closures in dead code are no longer borrowchecked #140583
Labels
A-borrow-checker
Area: The borrow checker
C-bug
Category: This is a bug.
P-critical
Critical priority
regression-from-stable-to-nightly
Performance or correctness regression from stable to nightly.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I minimized this code from a
compile_fail
doctest that started compiling in nightly even though it didn't in stable. I appended a minified (probably not minimal) example below.Replacing
todo!()
with5
for example causes it to fail to compile on nightly as well. Therefore I'm not quite sure whether this really counts as a regresssion, it does not seem to be planned / mentioned anywhere though.cargo bisect-rustc
points to d4f880f, merge of #138499 (nightly 2025-04-09).Code
I tried this code:
I expected to see this happen:
Instead, this happened: compiled successfully
Version it worked on
It most recently worked on: Rust 1.86, Rust 1.87 Beta.7, Rust Nightly 2025-04-08
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: