-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Run borrowck tests on BIDs and emit tail-expr-drop-order lints for violations #134523
Run borrowck tests on BIDs and emit tail-expr-drop-order lints for violations #134523
Conversation
beada15
to
054769b
Compare
compiler/rustc_borrowck/src/lib.rs
Outdated
@@ -994,6 +997,23 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> { | |||
} | |||
} | |||
|
|||
fn maybe_polonius_borrows_in_scope<'s>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this mention polonius at all? why isn't this just called borrows_in_scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's.
I am tucking the comment into this function, too.
@bors try |
…t-2, r=<try> Run borrowck tests on BIDs and emit tail-expr-drop-order lints for violations Fix rust-lang#132861 r? `@nikomatsakis` cc `@compiler-errors` This patch enlarges the scope where the `tail-expr-drop-order` lint applies, so that all locals involved in tail expressions are inspected. This is necessary to run borrow-checking to capture the cases where it used to compile under Edition 2021 but is not going to pass borrow-checking from Edition 2024 onwards. The way it works is to inspect each BID against the set of borrows that are still live. If the local involved in BID has a borrow index which happens to be live as well at the location of this BID statement, in the future this will be a borrow-checking violation. The lint will fire in this case.
I have prepared the following craterbot message.
Shall we double-check and give this a go afterwards? Big thanks! |
🔒 Error: you're not allowed to interact with this bot. 🔑 If you are a member of the Rust team and need access, add yourself to the whitelist. |
…-run, r=<try> Crater run for `tail-expr-drop-order` This is experiment for rust-lang#134523
☀️ Try build successful - checks-actions |
A perf run shouldn't show anything since this shouldn't be enabled by default. However, some of these previous PRs have been unexpected regressions, let's check. @rust-timer build 9b5e8b1 |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (9b5e8b1): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.8%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 769.451s -> 768.407s (-0.14%) |
@craterbot run start=master#11663cd3bfefef7d34e8f0892c250bf698049392+rustflags=-Dtail-expr-drop-order end=try#9b5e8b16bd1c4acf4cf8e6880368314cf021a987+rustflags=-Dtail-expr-drop-order mode=build-only |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
I ran https://github.com/Skgland/Crater-Analysis to classify the 31091 contain 85 failures appear to be due to running out of disk space, Full report
|
0a77622
to
2daeb51
Compare
potential violations
Co-authored-by: Rémy Rakic <[email protected]>
1c69947
to
c55eefe
Compare
@bors r=nikomatsakis |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a580b5c): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -3.1%, secondary -2.7%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -2.2%, secondary -2.8%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 763.722s -> 763.382s (-0.04%) |
@@ -1149,6 +1161,61 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> { | |||
error_reported | |||
} | |||
|
|||
/// Through #123739, backward incompatible drops (BIDs) are introduced. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dingxiangfei2009 A tiny late nit. I have just learned from this comment what BID
stand for. Is it a commonly used acronym? I wasn't able to find it using a search engine. Could only find it disentangled here.
(thanks @lqd for the pointing me here)
Hey @apiraino. BID is a shorthand that is unfortunately not well
documented yet. It refers to backward-incompatible drop statements
generated exclusively when edition migration is run. It is defined in
https://github.com/rust-lang/rust/blob/b6b8361bce8561fb8786ad33ca1abfdf4bc487b6/compiler/rustc_middle/src/mir/syntax.rs#L440.
It does not have any semantic significance other than being a hint that
lints can rely on and can be treated safely as a NOP.
apiraino ***@***.***> schrieb am Do. 9. Jan. 2025 um 11:59:
… ***@***.**** commented on this pull request.
------------------------------
In compiler/rustc_borrowck/src/lib.rs
<#134523 (comment)>:
> @@ -1149,6 +1161,61 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
error_reported
}
+ /// Through #123739, backward incompatible drops (BIDs) are introduced.
@dingxiangfei2009 <https://github.com/dingxiangfei2009> A tiny late nit.
I have just learned from this comment what BID stand for. Is it a
commonly used acronym? I wasn't able to find it using a search engine.
Could only find it disentangled here.
(thanks @lqd <https://github.com/lqd> for the pointing me here)
—
Reply to this email directly, view it on GitHub
<#134523 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUQYWEBU5TDZMHSSFVD4ED2JZJCXAVCNFSM6AAAAABT5MVGIKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKMZZGYYDAMZQGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
note for t-release if the backport is approved: the backport will likely not apply cleanly due to landing after #133858. I hit similar conflicts when doing a revert, so the conflicting pieces will be present and fixed in #135263. (But if there are issues, dingxiangfei/errs/I should be able to prepare it for you.) |
[beta] stage0 bump and backports - bump stage0 to 1.84.0 - Run borrowck tests on BIDs and emit tail-expr-drop-order lints for violations rust-lang#134523 r? cuviper
Fix #132861
r? @nikomatsakis
cc @compiler-errors
This patch enlarges the scope where the
tail-expr-drop-order
lint applies, so that all locals involved in tail expressions are inspected. This is necessary to run borrow-checking to capture the cases where it used to compile under Edition 2021 but is not going to pass borrow-checking from Edition 2024 onwards.The way it works is to inspect each BID against the set of borrows that are still live. If the local involved in BID has a borrow index which happens to be live as well at the location of this BID statement, in the future this will be a borrow-checking violation. The lint will fire in this case.