Skip to content
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
2 of 13 tasks
traviscross opened this issue Apr 10, 2024 · 2 comments
Open
2 of 13 tasks
Assignees
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-impl-incomplete Status: The implementation is incomplete. S-tracking-needs-documentation Status: Needs documentation. S-tracking-needs-migration-lint Status: This item needs a migration lint. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@traviscross
Copy link
Contributor

traviscross commented Apr 10, 2024

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

Unresolved Questions

  • How uncommon are the situations where this change could affect existing code?
  • How advanced should the edition lint and migration be?
  • Can we make sure a lint catches the cases with unsafe code that could result in undefined behaviour?

Related

cc @nikomatsakis @m-ou-se

@traviscross 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
@dingxiangfei2009
Copy link
Contributor

@rustbot claim

@pnkfelix
Copy link
Member

(assigning self as lang team liason to ensure things progress here for 2024 edition)

@traviscross 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 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) } {
    ...
  }
}
```
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-impl-incomplete Status: The implementation is incomplete. S-tracking-needs-documentation Status: Needs documentation. S-tracking-needs-migration-lint Status: This item needs a migration lint. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants