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

Revert write! and writeln! to late drop temporaries #99689

Merged
merged 4 commits into from
Jul 28, 2022

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Jul 24, 2022

Closes (on master, but not on beta) #99684 by reverting the write! and writeln! parts of #96455.

argument position before
#94868
after
#94868
after
#96455
after
this PR
desired
(unimplementable)
write!($tmp, "…", …) ⸺late ⸺late early⸺ ⸺late ⸺late
write!(…, "…", $tmp) ⸺late ⸺late early⸺ ⸺late early⸺
writeln!($tmp, "…", …) ⸺late ⸺late early⸺ ⸺late ⸺late
writeln!(…, "…", $tmp) ⸺late ⸺late early⸺ ⸺late early⸺
print!("…", $tmp) ⸺late ⸺late early⸺ early⸺ early⸺
println!("…", $tmp) early⸺ ⸺late early⸺ early⸺ early⸺
eprint!("…", $tmp) ⸺late ⸺late early⸺ early⸺ early⸺
eprintln!("…", $tmp) early⸺ ⸺late early⸺ early⸺ early⸺
panic!("…", $tmp) early⸺ early⸺ early⸺ early⸺ early⸺

"Late drop" refers to dropping temporaries at the nearest semicolon outside of the macro invocation.

"Early drop" refers to dropping temporaries inside of the macro invocation.

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 24, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jul 24, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 24, 2022
@dtolnay dtolnay added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 24, 2022
@dtolnay dtolnay added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 24, 2022
@Mark-Simulacrum
Copy link
Member

r=me, but we may want a T-libs-api FCP here? It seems like a minimal fix to the regressions, not sure if this was already discussed in some capacity. Will leave that up to you, @dtolnay :)

@Mark-Simulacrum Mark-Simulacrum added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 28, 2022
@dtolnay
Copy link
Member Author

dtolnay commented Jul 28, 2022

I think they'll agree with me that regressing async-std's write macro is worth fixing. I don't think anyone knows any other way to fix it today, without language change, sadly.

There is room for someone to suggest (see table at top) reverting even more of the macros to "late" than necessary, but:

(@rust-lang/libs-api)

@bors r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Jul 28, 2022

📌 Commit ffab6bf has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 28, 2022
@joshtriplett
Copy link
Member

@dtolnay We discussed it in the meeting yesterday, and yeah, the revert seems reasonable to avoid a regression.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 28, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#99628 (add more docs regarding ideographic numbers)
 - rust-lang#99689 (Revert `write!` and `writeln!` to late drop temporaries)
 - rust-lang#99807 (Fix PermissionDenied UI tests on WSL)
 - rust-lang#99817 (rustdoc: remove Clean trait impls for more items)
 - rust-lang#99851 (Fix small typo in Cargo.toml comment)
 - rust-lang#99856 (fix: remove fake no_dead_strip for osx)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 48efd30 into rust-lang:master Jul 28, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 28, 2022
@m-ou-se m-ou-se added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Aug 3, 2022
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.64.0, 1.63.0 Aug 5, 2022
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 5, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 5, 2022
…mulacrum

[beta] Rollup of beta backports

Includes the following PRs:

*  rustc-docs: Be less specific about the representation of +bundle rust-lang#100074
*  Fix backwards-compatibility check for tests with +whole-archive rust-lang#100068
*  Revert write! and writeln! to late drop temporaries rust-lang#99689
*  Upgrade indexmap and thorin-dwp to use hashbrown 0.12 rust-lang#99251
*  rustdoc: avoid inlining modules with duplicate names rust-lang#99738

r? `@ghost`
@dtolnay dtolnay deleted the write branch August 8, 2022 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants