-
Notifications
You must be signed in to change notification settings - Fork 13.4k
closures in dead code are no longer borrowchecked #140583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Comments
cc @lcnr on the bisection in case this was not intentional |
todo!()
suppresses borrow check error
The following no longer errors fn main() {
todo!();
|| {
let x = String::new();
drop(x);
drop(x)
};
} |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 2, 2025
Loading
Loading status checks…
borrowck nested items in dead code fixes rust-lang#140583 r? `@compiler-errors`
github-actions bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this issue
May 8, 2025
borrowck nested items in dead code fixes rust-lang/rust#140583 r? `@compiler-errors`
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this issue
May 10, 2025
borrowck nested items in dead code fixes rust-lang/rust#140583 r? `@compiler-errors`
lnicola
pushed a commit
to lnicola/rust-analyzer
that referenced
this issue
May 20, 2025
borrowck nested items in dead code fixes rust-lang/rust#140583 r? `@compiler-errors`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: