-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Allow storing format_args!()
in variable
#140748
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
base: master
Are you sure you want to change the base?
Conversation
4971602
to
d261de6
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Allow storing format_args!() in variable Fixes rust-lang#92698 Tracking issue for super let: rust-lang#139076 This change allows: ```rust let name = "world"; let f = format_args!("hello {name}!"); println!("{f}"); ``` This will need an FCP. This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this. (This was also the motivation for merging rust-lang#139114.) > [!NOTE] > This PR causes many subtle changes in diagnostics output. Most of those are good. Some of those are bad. I've collected all the bad ones in the last commit. Those still need fixing. Marking this PR as draft. (This is a second version of rust-lang#139135)
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (beb8d4e): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @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.4%, secondary -0.2%)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 0.1%, secondary 2.4%)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 sizeResults (primary 0.1%, secondary 0.1%)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.
Bootstrap: 770.356s -> 770.437s (0.01%) |
7742371
to
a1bd412
Compare
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
☔ The latest upstream changes (presumably #142550) made this pull request unmergeable. Please resolve the merge conflicts. |
This uses `super let` to allow let f = format_args!("Hello {}", world); println!("{f}"); to work.
We no longer error in this case!
This message is no longer generated. This is probably a good thing. The relevant span is entirely in user code, and "format_args_nl" is an implementation detail with a name that isn't even public.
Diagnostics should know that the `&` for arguments in format_args!() come from the macro expansion rather than from the original source.
a1bd412
to
ae3bfda
Compare
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.
Following the discussion in https://github.com/rust-lang/rust/pull/142543/files/6ff3713e0fc60146a36774b447204677ab7b8d5a#r2149545623, instead of fully removing this test, could you replace it with the one I suggested in #142543 (comment) or modify tests/ui/nll/issue-54556-used-vs-unused-tails.rs
to add it there.
That would be very appreciated but not 'required' since it's more important to get your PR merged in the first place :) Urgau or I can simply re-add a test as a follow-up, no problem.
☔ The latest upstream changes (presumably #142613) made this pull request unmergeable. Please resolve the merge conflicts. |
Fixes #92698
Tracking issue for super let: #139076
Tracking issue for format_args: #99012
This change allows:
This will need an FCP.
This implementation makes use of
super let
, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have a way of expressing temporary lifetimes like this, since the (stable)pin!()
macro needs this too. (This was also the motivation for merging #139114.)(This is a second version of #139135)