-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tracking Issue for RFC 3606: Drop temporaries in tail expressions before local variables #123739
Open
6 of 13 tasks
Labels
A-edition-2024
Area: The 2024 edition
B-RFC-approved
Blocker: Approved by a merged RFC but not yet implemented.
C-tracking-issue
Category: A tracking issue for an RFC or an unstable feature.
F-shorter_tail_lifetimes
`#![feature(shorter_tail_lifetimes)]`
S-tracking-needs-documentation
Status: Needs documentation.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Comments
traviscross
added
C-tracking-issue
Category: A tracking issue for an RFC or an unstable feature.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
A-edition-2024
Area: The 2024 edition
labels
Apr 10, 2024
@rustbot claim |
(assigning self as lang team liason to ensure things progress here for 2024 edition) |
traviscross
added
F-shorter_tail_lifetimes
`#![feature(shorter_tail_lifetimes)]`
B-RFC-approved
Blocker: Approved by a merged RFC but not yet implemented.
labels
May 6, 2024
traviscross
added
S-tracking-impl-incomplete
Status: The implementation is incomplete.
S-tracking-needs-migration-lint
Status: This item needs a migration lint.
S-tracking-needs-documentation
Status: Needs documentation.
labels
May 21, 2024
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 14, 2024
…fetime, r=estebank,davidtwco Place tail expression behind terminating scope This PR implements rust-lang#123739 so that we can do further experiments in nightly. A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following. ```rust match into_async_iter($iter_expr) { ref mut iter => match unsafe { Pin::unchecked_new(iter) } { ... } } ```
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Jun 19, 2024
…fetime, r=estebank,davidtwco Place tail expression behind terminating scope This PR implements rust-lang#123739 so that we can do further experiments in nightly. A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following. ```rust match into_async_iter($iter_expr) { ref mut iter => match unsafe { Pin::unchecked_new(iter) } { ... } } ```
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Jun 19, 2024
…fetime, r=estebank,davidtwco Place tail expression behind terminating scope This PR implements rust-lang#123739 so that we can do further experiments in nightly. A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following. ```rust match into_async_iter($iter_expr) { ref mut iter => match unsafe { Pin::unchecked_new(iter) } { ... } } ```
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 19, 2024
Rollup merge of rust-lang#125293 - dingxiangfei2009:tail-expr-temp-lifetime, r=estebank,davidtwco Place tail expression behind terminating scope This PR implements rust-lang#123739 so that we can do further experiments in nightly. A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following. ```rust match into_async_iter($iter_expr) { ref mut iter => match unsafe { Pin::unchecked_new(iter) } { ... } } ```
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Aug 20, 2024
…op-order, r=jieyouxu Lint on tail expr drop order change in Edition 2024 This lint warns users to consider extra discretion on the effect of a transposed drop order arising from Edition 2024, which involves temporaries in tail expression location with significant drop implementation. cc `@traviscross` Tracking: - rust-lang#123739
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Aug 21, 2024
Rollup merge of rust-lang#128662 - dingxiangfei2009:lint-tail-expr-drop-order, r=jieyouxu Lint on tail expr drop order change in Edition 2024 This lint warns users to consider extra discretion on the effect of a transposed drop order arising from Edition 2024, which involves temporaries in tail expression location with significant drop implementation. cc `@traviscross` Tracking: - rust-lang#123739
This was referenced Aug 26, 2024
traviscross
added
S-tracking-ready-to-stabilize
Status: This is ready to stabilize; it may need a stabilization report and a PR
and removed
S-tracking-impl-incomplete
Status: The implementation is incomplete.
S-tracking-needs-migration-lint
Status: This item needs a migration lint.
labels
Aug 27, 2024
This comment was marked as resolved.
This comment was marked as resolved.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 8, 2024
…t-2, r=<try> Reduce false positives of tail-expr-drop-order from consumed values (attempt #2) r? `@nikomatsakis` Tracked by rust-lang#123739. Related to rust-lang#129864 but not replacing, yet. Related to rust-lang#130836. This is an implementation of the approach suggested in the [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/temporary.20drop.20order.20changes). A new MIR statement `BackwardsIncompatibleDrop` is added to the MIR syntax. The lint now works by inspecting possibly live move paths before at the `BackwardsIncompatibleDrop` location and the actual drop under the current edition, which should be one before Edition 2024 in practice.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 12, 2024
…t-2, r=<try> Reduce false positives of tail-expr-drop-order from consumed values (attempt #2) r? `@nikomatsakis` Tracked by rust-lang#123739. Related to rust-lang#129864 but not replacing, yet. Related to rust-lang#130836. This is an implementation of the approach suggested in the [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/temporary.20drop.20order.20changes). A new MIR statement `BackwardsIncompatibleDrop` is added to the MIR syntax. The lint now works by inspecting possibly live move paths before at the `BackwardsIncompatibleDrop` location and the actual drop under the current edition, which should be one before Edition 2024 in practice.
fmease
added a commit
to fmease/rust
that referenced
this issue
Oct 23, 2024
…-tail-lifetimes, r=lcnr Stabilize shorter-tail-lifetimes Close rust-lang#131445 Tracked by rust-lang#123739 We found a test case `tests/ui/drop/drop_order.rs` that had not been covered by the change. The test fixture is fixed now with the correct expectation.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 24, 2024
…-tail-lifetimes, r=lcnr Stabilize shorter-tail-lifetimes Close rust-lang#131445 Tracked by rust-lang#123739 We found a test case `tests/ui/drop/drop_order.rs` that had not been covered by the change. The test fixture is fixed now with the correct expectation.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 24, 2024
Rollup merge of rust-lang#131983 - dingxiangfei2009:stabilize-shorter-tail-lifetimes, r=lcnr Stabilize shorter-tail-lifetimes Close rust-lang#131445 Tracked by rust-lang#123739 We found a test case `tests/ui/drop/drop_order.rs` that had not been covered by the change. The test fixture is fixed now with the correct expectation.
traviscross
removed
the
S-tracking-ready-to-stabilize
Status: This is ready to stabilize; it may need a stabilization report and a PR
label
Oct 29, 2024
hlinnaka
added a commit
to neondatabase/neon
that referenced
this issue
Nov 3, 2024
Compiling with nightly rust compiler, I'm getting a lot of errors like this: error: `if let` assigns a shorter lifetime since Edition 2024 --> proxy/src/auth/backend/jwt.rs:226:16 | 226 | if let Some(permit) = self.try_acquire_permit() { | ^^^^^^^^^^^^^^^^^^^------------------------- | | | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 <rust-lang/rust#124085> help: the value is now dropped here in Edition 2024 --> proxy/src/auth/backend/jwt.rs:241:13 | 241 | } else { | ^ note: the lint level is defined here --> proxy/src/lib.rs:8:5 | 8 | rust_2024_compatibility | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(if_let_rescope)]` implied by `#[deny(rust_2024_compatibility)]` and this: error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 --> proxy/src/auth/backend/jwt.rs:376:18 | 369 | let client = Client::builder() | ------ these values have significant drop implementation and will observe changes in drop order under Edition 2024 ... 376 | map: DashMap::default(), | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #123739 <rust-lang/rust#123739> = note: `#[deny(tail_expr_drop_order)]` implied by `#[deny(rust_2024_compatibility)]` They are caused by the `rust_2024_compatibility` lint option. When we actually switch to the 2024 edition, it makes sense to go through all these and check that the drop order changes don't break anything, but in the meanwhile, there's no easy way to avoid these errors. Disable it, to allow compiling with nightly again.
hlinnaka
added a commit
to neondatabase/neon
that referenced
this issue
Nov 3, 2024
Compiling with nightly rust compiler, I'm getting a lot of errors like this: error: `if let` assigns a shorter lifetime since Edition 2024 --> proxy/src/auth/backend/jwt.rs:226:16 | 226 | if let Some(permit) = self.try_acquire_permit() { | ^^^^^^^^^^^^^^^^^^^------------------------- | | | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 <rust-lang/rust#124085> help: the value is now dropped here in Edition 2024 --> proxy/src/auth/backend/jwt.rs:241:13 | 241 | } else { | ^ note: the lint level is defined here --> proxy/src/lib.rs:8:5 | 8 | rust_2024_compatibility | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(if_let_rescope)]` implied by `#[deny(rust_2024_compatibility)]` and this: error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 --> proxy/src/auth/backend/jwt.rs:376:18 | 369 | let client = Client::builder() | ------ these values have significant drop implementation and will observe changes in drop order under Edition 2024 ... 376 | map: DashMap::default(), | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #123739 <rust-lang/rust#123739> = note: `#[deny(tail_expr_drop_order)]` implied by `#[deny(rust_2024_compatibility)]` They are caused by the `rust_2024_compatibility` lint option. When we actually switch to the 2024 edition, it makes sense to go through all these and check that the drop order changes don't break anything, but in the meanwhile, there's no easy way to avoid these errors. Disable it, to allow compiling with nightly again.
hlinnaka
added a commit
to neondatabase/neon
that referenced
this issue
Nov 4, 2024
Compiling with nightly rust compiler, I'm getting a lot of errors like this: error: `if let` assigns a shorter lifetime since Edition 2024 --> proxy/src/auth/backend/jwt.rs:226:16 | 226 | if let Some(permit) = self.try_acquire_permit() { | ^^^^^^^^^^^^^^^^^^^------------------------- | | | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 <rust-lang/rust#124085> help: the value is now dropped here in Edition 2024 --> proxy/src/auth/backend/jwt.rs:241:13 | 241 | } else { | ^ note: the lint level is defined here --> proxy/src/lib.rs:8:5 | 8 | rust_2024_compatibility | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(if_let_rescope)]` implied by `#[deny(rust_2024_compatibility)]` and this: error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 --> proxy/src/auth/backend/jwt.rs:376:18 | 369 | let client = Client::builder() | ------ these values have significant drop implementation and will observe changes in drop order under Edition 2024 ... 376 | map: DashMap::default(), | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #123739 <rust-lang/rust#123739> = note: `#[deny(tail_expr_drop_order)]` implied by `#[deny(rust_2024_compatibility)]` They are caused by the `rust_2024_compatibility` lint option. When we actually switch to the 2024 edition, it makes sense to go through all these and check that the drop order changes don't break anything, but in the meanwhile, there's no easy way to avoid these errors. Disable it, to allow compiling with nightly again.
conradludgate
pushed a commit
to neondatabase/neon
that referenced
this issue
Nov 4, 2024
Compiling with nightly rust compiler, I'm getting a lot of errors like this: error: `if let` assigns a shorter lifetime since Edition 2024 --> proxy/src/auth/backend/jwt.rs:226:16 | 226 | if let Some(permit) = self.try_acquire_permit() { | ^^^^^^^^^^^^^^^^^^^------------------------- | | | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 <rust-lang/rust#124085> help: the value is now dropped here in Edition 2024 --> proxy/src/auth/backend/jwt.rs:241:13 | 241 | } else { | ^ note: the lint level is defined here --> proxy/src/lib.rs:8:5 | 8 | rust_2024_compatibility | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(if_let_rescope)]` implied by `#[deny(rust_2024_compatibility)]` and this: error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 --> proxy/src/auth/backend/jwt.rs:376:18 | 369 | let client = Client::builder() | ------ these values have significant drop implementation and will observe changes in drop order under Edition 2024 ... 376 | map: DashMap::default(), | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #123739 <rust-lang/rust#123739> = note: `#[deny(tail_expr_drop_order)]` implied by `#[deny(rust_2024_compatibility)]` They are caused by the `rust_2024_compatibility` lint option. When we actually switch to the 2024 edition, it makes sense to go through all these and check that the drop order changes don't break anything, but in the meanwhile, there's no easy way to avoid these errors. Disable it, to allow compiling with nightly again.
github-merge-queue bot
pushed a commit
to neondatabase/neon
that referenced
this issue
Nov 8, 2024
Compiling with nightly rust compiler, I'm getting a lot of errors like this: error: `if let` assigns a shorter lifetime since Edition 2024 --> proxy/src/auth/backend/jwt.rs:226:16 | 226 | if let Some(permit) = self.try_acquire_permit() { | ^^^^^^^^^^^^^^^^^^^------------------------- | | | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 <rust-lang/rust#124085> help: the value is now dropped here in Edition 2024 --> proxy/src/auth/backend/jwt.rs:241:13 | 241 | } else { | ^ note: the lint level is defined here --> proxy/src/lib.rs:8:5 | 8 | rust_2024_compatibility | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(if_let_rescope)]` implied by `#[deny(rust_2024_compatibility)]` and this: error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 --> proxy/src/auth/backend/jwt.rs:376:18 | 369 | let client = Client::builder() | ------ these values have significant drop implementation and will observe changes in drop order under Edition 2024 ... 376 | map: DashMap::default(), | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #123739 <rust-lang/rust#123739> = note: `#[deny(tail_expr_drop_order)]` implied by `#[deny(rust_2024_compatibility)]` They are caused by the `rust_2024_compatibility` lint option. When we actually switch to the 2024 edition, it makes sense to go through all these and check that the drop order changes don't break anything, but in the meanwhile, there's no easy way to avoid these errors. Disable it, to allow compiling with nightly again. Co-authored-by: Arpad Müller <[email protected]>
github-merge-queue bot
pushed a commit
to neondatabase/neon
that referenced
this issue
Nov 8, 2024
Compiling with nightly rust compiler, I'm getting a lot of errors like this: error: `if let` assigns a shorter lifetime since Edition 2024 --> proxy/src/auth/backend/jwt.rs:226:16 | 226 | if let Some(permit) = self.try_acquire_permit() { | ^^^^^^^^^^^^^^^^^^^------------------------- | | | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 <rust-lang/rust#124085> help: the value is now dropped here in Edition 2024 --> proxy/src/auth/backend/jwt.rs:241:13 | 241 | } else { | ^ note: the lint level is defined here --> proxy/src/lib.rs:8:5 | 8 | rust_2024_compatibility | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(if_let_rescope)]` implied by `#[deny(rust_2024_compatibility)]` and this: error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 --> proxy/src/auth/backend/jwt.rs:376:18 | 369 | let client = Client::builder() | ------ these values have significant drop implementation and will observe changes in drop order under Edition 2024 ... 376 | map: DashMap::default(), | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #123739 <rust-lang/rust#123739> = note: `#[deny(tail_expr_drop_order)]` implied by `#[deny(rust_2024_compatibility)]` They are caused by the `rust_2024_compatibility` lint option. When we actually switch to the 2024 edition, it makes sense to go through all these and check that the drop order changes don't break anything, but in the meanwhile, there's no easy way to avoid these errors. Disable it, to allow compiling with nightly again. Co-authored-by: Arpad Müller <[email protected]>
conradludgate
pushed a commit
to neondatabase/neon
that referenced
this issue
Nov 8, 2024
Compiling with nightly rust compiler, I'm getting a lot of errors like this: error: `if let` assigns a shorter lifetime since Edition 2024 --> proxy/src/auth/backend/jwt.rs:226:16 | 226 | if let Some(permit) = self.try_acquire_permit() { | ^^^^^^^^^^^^^^^^^^^------------------------- | | | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 <rust-lang/rust#124085> help: the value is now dropped here in Edition 2024 --> proxy/src/auth/backend/jwt.rs:241:13 | 241 | } else { | ^ note: the lint level is defined here --> proxy/src/lib.rs:8:5 | 8 | rust_2024_compatibility | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[deny(if_let_rescope)]` implied by `#[deny(rust_2024_compatibility)]` and this: error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 --> proxy/src/auth/backend/jwt.rs:376:18 | 369 | let client = Client::builder() | ------ these values have significant drop implementation and will observe changes in drop order under Edition 2024 ... 376 | map: DashMap::default(), | ^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 = note: for more information, see issue #123739 <rust-lang/rust#123739> = note: `#[deny(tail_expr_drop_order)]` implied by `#[deny(rust_2024_compatibility)]` They are caused by the `rust_2024_compatibility` lint option. When we actually switch to the 2024 edition, it makes sense to go through all these and check that the drop order changes don't break anything, but in the meanwhile, there's no easy way to avoid these errors. Disable it, to allow compiling with nightly again. Co-authored-by: Arpad Müller <[email protected]>
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Nov 11, 2024
…in-let-block-works, r=jieyouxu Ensure that tail expr receive lifetime extension cc `@jieyouxu` `@traviscross` It just came to me that we should add a test to make sure that we honor the contract from the temporary lifetime rule rust-lang#121346. We should continue to implement this rule in Edition 2021 onward and shorter tail expression lifetime should not override it. This is a small PR to improve our assurance and establish a stronger contract. Tracked by rust-lang#123739
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Nov 11, 2024
Rollup merge of rust-lang#129627 - dingxiangfei2009:ensure-tail-expr-in-let-block-works, r=jieyouxu Ensure that tail expr receive lifetime extension cc `@jieyouxu` `@traviscross` It just came to me that we should add a test to make sure that we honor the contract from the temporary lifetime rule rust-lang#121346. We should continue to implement this rule in Edition 2021 onward and shorter tail expression lifetime should not override it. This is a small PR to improve our assurance and establish a stronger contract. Tracked by rust-lang#123739
mati865
pushed a commit
to mati865/rust
that referenced
this issue
Nov 12, 2024
…in-let-block-works, r=jieyouxu Ensure that tail expr receive lifetime extension cc `@jieyouxu` `@traviscross` It just came to me that we should add a test to make sure that we honor the contract from the temporary lifetime rule rust-lang#121346. We should continue to implement this rule in Edition 2021 onward and shorter tail expression lifetime should not override it. This is a small PR to improve our assurance and establish a stronger contract. Tracked by rust-lang#123739
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-edition-2024
Area: The 2024 edition
B-RFC-approved
Blocker: Approved by a merged RFC but not yet implemented.
C-tracking-issue
Category: A tracking issue for an RFC or an unstable feature.
F-shorter_tail_lifetimes
`#![feature(shorter_tail_lifetimes)]`
S-tracking-needs-documentation
Status: Needs documentation.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
This is a tracking issue for the RFC 3606: Drop temporaries in tail expressions before local variables
The feature gate for the issue is
#![feature(shorter_tail_lifetimes)]
.About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
shorter_tail_lifetime
#131445Unresolved Questions
warn-by-default
about these cases in older editions, or only warn when upgrading to Rust 2024?Related
cc @nikomatsakis @m-ou-se
The text was updated successfully, but these errors were encountered: