-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
Rescope temp lifetime in let-chain into IfElse #107251
base: master
Are you sure you want to change the base?
Rescope temp lifetime in let-chain into IfElse #107251
Conversation
r? @oli-obk (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
cc @est31 I have tested this branch on several of my repositories that I am working on and nothing obvious has broken. Shall we have a crater run? |
@bors try |
⌛ Trying commit 003f3cd8d3cecb9b20f5105400499741c936e92a with merge ece70b22820429ebf0c6d388c32356a14c58fc2f... |
☀️ Try build successful - checks-actions |
003f3cd
to
dbbdd0c
Compare
I have updated the failing tests to show the effect of this change. |
This comment has been minimized.
This comment has been minimized.
dbbdd0c
to
e2db1e6
Compare
This comment has been minimized.
This comment has been minimized.
e2db1e6
to
92550dd
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@craterbot run mode=build-and-test |
👌 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
|
@nikomatsakis thanks for the response and thanks for the discussion in the lang team. I will try to make a writeup the next rainy weekend I encounter (I'm sure there will be one soon, this is the season for the rains in my area ☔). Some preliminary comments: I think it's great to have an RFC about a general effort to limit lifetimes, as I'm sure there is more potential about too long lifetimes. But I don't think we should block let chains on this greater effort. I regularly encounter cases where I'm writing nested if's where let chains would have allowed me to collapse a level. Given that this change is smaller in scope than the RFC, we might get away way more easily with not doing this in an edition bump. Side note: regarding your blog post, I recently touched Go, and wanted to to specify an |
☔ The latest upstream changes (presumably #113970) made this pull request unmergeable. Please resolve the merge conflicts. |
@rustbot labels +I-lang-nominated Let's discuss to confirm that we do not want to use Rust 2024 for this, as had been discussed above. |
@rustbot labels -I-lang-nominated We discussed this in the lang meeting today. The consensus was that we'd like this to land in nightly with a feature gate. After that, we'd like to see the result of crater runs and some analysis of the migration story so we can consider landing this in an edition. This may also call for an RFC. |
I am going to propose |
882adea
to
3d420e9
Compare
This comment has been minimized.
This comment has been minimized.
3d420e9
to
8f1a6fc
Compare
I am thinking of running a crater experiment with |
I don't think a crater experiment would be helpful here if the code is just for edition 2024. There is practically no crate out there with edition 2024. Forcing code onto edition 2024 will give problems as well because 2018 code will then also have the 2021 warnings and even more different for 2015 code. |
If your goal is to see what would fail with the feature enabled, the best thing to do is to temporarily modify your PR to make it always enabled. Essentially change it to something like |
8f1a6fc
to
969f56b
Compare
25a9024
to
c13eb60
Compare
…rater-runner, r=<try> [Crater run experiment] let-chain rescoping Please do not merge this PR. This is only for crater run experimentation. I would like to nominate a crater run for rust-lang#107251 assuming that the feature gate is always on. Through this experiment, we hope to collect breakage in the wild. We would focus on both compilation errors and test errors that this edition change can lead to, if users are targeting Edition 2024 and writing code assuming the old semantics unknowingly. I realise that some tests may not work well if an edition switch happens. I am fixing them in the main PR.
c13eb60
to
880e027
Compare
@rustbot labels +I-lang-nominated This PR is about shortening, over an edition, the scope of temporary lifetimes in if-let scrutinees so that they end before the We last discussed this on 2023-10-25. We had some questions about the migration story here and specific asks for further analysis. Since then, Ding has done a crater run: And on the basis of that, has assembled a report analyzing the results and discussing the migration strategy: Let's nominate to discuss. |
@rustbot labels -I-lang-nominated We discussed this in the lang call this week. @dingxiangfei2009: We'd like to see either a sketch (or an implementation) of what a semantics-preserving machine-applicable migration lint would look like, or we'd like to hear a specific argument about why such a semantics-preserving approach is not needed. The context here is that we're worried about silent changes to behavior that would not be caught by crater, and we'd either like a semantics-preserving solution that makes that a non-issue or to be convinced that we don't need to worry about that. |
This is a proposal born out of #103108 as a potential answer to #104843.
Three tests are failing from this.
The first two tests fail because of the change of drop order as intended by this PR. The third test is because the program compiles instead.