-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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 Rust 2024: Rescope temporary lifetimes with respect to else
#124085
Open
1 of 9 tasks
Labels
A-edition-2024
Area: The 2024 edition
C-tracking-issue
Category: A tracking issue for an RFC or an unstable feature.
S-tracking-impl-incomplete
Status: The implementation is incomplete.
S-tracking-needs-documentation
Status: Needs documentation.
S-tracking-ready-to-stabilize
Status: This is ready to stabilize; it may need a stabilization report and a PR
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Comments
traviscross
added
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
C-tracking-issue
Category: A tracking issue for an RFC or an unstable feature.
A-edition-2024
Area: The 2024 edition
labels
Apr 17, 2024
@rustbot claim |
Update: #107251 has been repurposed for this edition change. |
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
traviscross
added
the
S-tracking-design-concerns
Status: There are blocking ❌ design concerns.
label
Jun 11, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Aug 25, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Aug 29, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 1, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 5, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 12, 2024
…r=jieyouxu Rescope temp lifetime in if-let into IfElse with migration lint Tracking issue rust-lang#124085 This PR shortens the temporary lifetime to cover only the pattern matching and consequent branch of a `if let`. At the expression location, means that the lifetime is shortened from previously the deepest enclosing block or statement in Edition 2021. This warrants an Edition change. Coming with the Edition change, this patch also implements an edition lint to warn about the change and a safe rewrite suggestion to preserve the 2021 semantics in most cases. Related to rust-lang#103108. Related crater runs: rust-lang#129466.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 13, 2024
…r=jieyouxu Rescope temp lifetime in if-let into IfElse with migration lint Tracking issue rust-lang#124085 This PR shortens the temporary lifetime to cover only the pattern matching and consequent branch of a `if let`. At the expression location, means that the lifetime is shortened from previously the deepest enclosing block or statement in Edition 2021. This warrants an Edition change. Coming with the Edition change, this patch also implements an edition lint to warn about the change and a safe rewrite suggestion to preserve the 2021 semantics in most cases. Related to rust-lang#103108. Related crater runs: rust-lang#129466.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 14, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 14, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 16, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 17, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 17, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 17, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 17, 2024
…er-run, r=<try> [CRATER RUN DO NOT MERGE] Let chain lint crater run Tracked by rust-lang#124085 Related to rust-lang#107251 cc `@jieyouxu` for review context cc `@traviscross` for edition tracking There is one unresolved issue that `cargo fix --edition` does not emit `if-let-rescope` lint. Details in rust-lang/cargo#14447. Note that this patch is assuming that the feature gate `if_let_rescope` is always on just for this crater run.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Sep 30, 2024
…ope-lint, r=jieyouxu Preserve brackets around if-lets and skip while-lets r? `@jieyouxu` Tracked by rust-lang#124085 Fresh out of rust-lang#129466, we have discovered 9 crates that the lint did not successfully migrate because the span of `if let` includes the surrounding brackets `(..)` like the following, which surprised me a bit. ```rust if (if let .. { .. } else { .. }) { // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // the span somehow includes the surrounding brackets } ``` There is one crate that failed the migration because some suggestion spans cross the macro expansion boundaries. Surely there is no way to patch them with `match` rewrite. To handle this case, we will instead require all spans to be tested for admissibility as suggestion spans. Besides, there are 4 false negative cases discovered with desugared-`while let`. We don't need to lint them, because the `else` branch surely contains exactly one statement because the drop order is not changed whatsoever in this case. ```rust while let Some(value) = droppy().get() { .. } // is desugared into loop { if let Some(value) = droppy().get() { .. } else { break; // here can be nothing observable in this block } } ``` I believe this is the one and only false positive that I have found. I think we have finally nailed all the corner cases this time.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 30, 2024
Rollup merge of rust-lang#131035 - dingxiangfei2009:tweak-if-let-rescope-lint, r=jieyouxu Preserve brackets around if-lets and skip while-lets r? `@jieyouxu` Tracked by rust-lang#124085 Fresh out of rust-lang#129466, we have discovered 9 crates that the lint did not successfully migrate because the span of `if let` includes the surrounding brackets `(..)` like the following, which surprised me a bit. ```rust if (if let .. { .. } else { .. }) { // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // the span somehow includes the surrounding brackets } ``` There is one crate that failed the migration because some suggestion spans cross the macro expansion boundaries. Surely there is no way to patch them with `match` rewrite. To handle this case, we will instead require all spans to be tested for admissibility as suggestion spans. Besides, there are 4 false negative cases discovered with desugared-`while let`. We don't need to lint them, because the `else` branch surely contains exactly one statement because the drop order is not changed whatsoever in this case. ```rust while let Some(value) = droppy().get() { .. } // is desugared into loop { if let Some(value) = droppy().get() { .. } else { break; // here can be nothing observable in this block } } ``` I believe this is the one and only false positive that I have found. I think we have finally nailed all the corner cases this time.
traviscross
added
S-tracking-ready-to-stabilize
Status: This is ready to stabilize; it may need a stabilization report and a PR
S-tracking-impl-incomplete
Status: The implementation is incomplete.
and removed
S-tracking-impl-incomplete
Status: The implementation is incomplete.
S-tracking-design-concerns
Status: There are blocking ❌ design concerns.
S-tracking-needs-migration-lint
Status: This item needs a migration lint.
labels
Oct 11, 2024
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
C-tracking-issue
Category: A tracking issue for an RFC or an unstable feature.
S-tracking-impl-incomplete
Status: The implementation is incomplete.
S-tracking-needs-documentation
Status: Needs documentation.
S-tracking-ready-to-stabilize
Status: This is ready to stabilize; it may need a stabilization report and a PR
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
This is a tracking issue for shortening the scope of temporary lifetimes in
if-let
blocks to end beforeelse
. E.g.: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
if_let_rescope
for Edition 2024 #131154Unresolved Questions
TODO.
Related
Implementation history
The text was updated successfully, but these errors were encountered: