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

Make [e]println macros eagerly drop temporaries (for backport) #96490

Merged
merged 2 commits into from
May 1, 2022

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Apr 27, 2022

This PR extracts the subset of #96455 which is only the parts necessary for fixing the 1.61-beta regressions in #96434.

My larger PR #96455 contains a few other changes relative to the pre-#94868 behavior; those are not necessary to backport into 1.61.

argument position before #94868 after #94868 after this PR
write!($tmp, "…", …) 😡 😡 😡
write!(…, "…", $tmp) 😡 😡 😡
writeln!($tmp, "…", …) 😡 😡 😡
writeln!(…, "…", $tmp) 😡 😡 😡
print!("…", $tmp) 😡 😡 😡
println!("…", $tmp) 😺 😡 😺
eprint!("…", $tmp) 😡 😡 😡
eprintln!("…", $tmp) 😺 😡 😺
panic!("…", $tmp) 😺 😺 😺

@rust-highfive
Copy link
Collaborator

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 r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs to request review from a libs-api team reviewer. 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

@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 Apr 27, 2022
@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(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 Apr 27, 2022
@dtolnay dtolnay added beta-nominated Nominated for backporting to the compiler in the beta channel. 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 Apr 27, 2022
@m-ou-se m-ou-se added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2022
@dtolnay
Copy link
Member Author

dtolnay commented Apr 29, 2022

Untagging S-waiting-on-fcp. This is effectively a revert of a small part of #94868. I believe this can safely go in master and beta without waiting on the FCP to expire, to resolve the regression currently affecting beta and make upcoming beta crater runs more useful. If the FCP were to fail (seems unlikely right now from the other thread), we can easily redo the change that this is reverting.

@dtolnay dtolnay added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. labels Apr 29, 2022
@Mark-Simulacrum
Copy link
Member

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Apr 30, 2022

📌 Commit 3a8f81a has been approved by Mark-Simulacrum

@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. labels Apr 30, 2022
@Mark-Simulacrum Mark-Simulacrum added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Apr 30, 2022
@Mark-Simulacrum
Copy link
Member

Unilaterally beta-accepting -- seems like a small patch with clear revert results.

@bors
Copy link
Contributor

bors commented May 1, 2022

⌛ Testing commit 3a8f81a with merge 0fea468750757c429009469d37343e98bfa68eea...

@bors
Copy link
Contributor

bors commented May 1, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 1, 2022
@rust-log-analyzer

This comment has been minimized.

@dtolnay
Copy link
Member Author

dtolnay commented May 1, 2022

@bors r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented May 1, 2022

📌 Commit e2d4c7b has been approved by Mark-Simulacrum

@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. labels May 1, 2022
@bors
Copy link
Contributor

bors commented May 1, 2022

⌛ Testing commit e2d4c7b with merge 61469b6...

@bors
Copy link
Contributor

bors commented May 1, 2022

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 61469b6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 1, 2022
@bors bors merged commit 61469b6 into rust-lang:master May 1, 2022
@rustbot rustbot added this to the 1.62.0 milestone May 1, 2022
@dtolnay dtolnay deleted the writetmpbackport branch May 1, 2022 06:11
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (61469b6): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

ehuss pushed a commit to ehuss/rust that referenced this pull request May 4, 2022
…lacrum

Make [e]println macros eagerly drop temporaries (for backport)

This PR extracts the subset of rust-lang#96455 which is only the parts necessary for fixing the 1.61-beta regressions in rust-lang#96434.

My larger PR rust-lang#96455 contains a few other changes relative to the pre-rust-lang#94868 behavior; those are not necessary to backport into 1.61.

argument position | before rust-lang#94868 | after rust-lang#94868 | after this PR
--- |:---:|:---:|:---:
`write!($tmp, "…", …)` | :rage: | :rage: | :rage:
`write!(…, "…", $tmp)` | :rage: | :rage: | :rage:
`writeln!($tmp, "…", …)` | :rage: | :rage: | :rage:
`writeln!(…, "…", $tmp)` | :rage: | :rage: | :rage:
`print!("…", $tmp)` | :rage: | :rage: | :rage:
`println!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat:
`eprint!("…", $tmp)` | :rage: | :rage: | :rage:
`eprintln!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat:
`panic!("…", $tmp)` | :smiley_cat: | :smiley_cat: | :smiley_cat:
@ehuss ehuss mentioned this pull request May 4, 2022
@ehuss ehuss modified the milestones: 1.62.0, 1.61.0 May 4, 2022
@ehuss ehuss removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label May 4, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2022
[beta] Beta backports

* Revert diagnostic duplication and accidental stabilization rust-lang#96516
* Revert "Re-export core::ffi types from std::ffi" rust-lang#96492
* Make [e]println macros eagerly drop temporaries (for backport) rust-lang#96490
* Revert "impl From<&[T; N]> and From<&mut [T; N]> for Vec<T>" rust-lang#96489
* Cargo:
    * move workspace inheritance unstable docs to the correct place (rust-lang/cargo#10616)
($($arg:tt)*) => {
$crate::io::_print($crate::format_args_nl!($($arg)*))
};
($($arg:tt)*) => {{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the back and forth here, it might be worth adding a comment that explains why a double brace is used?

MabezDev pushed a commit to esp-rs/rust that referenced this pull request May 17, 2022
…lacrum

Make [e]println macros eagerly drop temporaries (for backport)

This PR extracts the subset of rust-lang#96455 which is only the parts necessary for fixing the 1.61-beta regressions in rust-lang#96434.

My larger PR rust-lang#96455 contains a few other changes relative to the pre-rust-lang#94868 behavior; those are not necessary to backport into 1.61.

argument position | before rust-lang#94868 | after rust-lang#94868 | after this PR
--- |:---:|:---:|:---:
`write!($tmp, "…", …)` | :rage: | :rage: | :rage:
`write!(…, "…", $tmp)` | :rage: | :rage: | :rage:
`writeln!($tmp, "…", …)` | :rage: | :rage: | :rage:
`writeln!(…, "…", $tmp)` | :rage: | :rage: | :rage:
`print!("…", $tmp)` | :rage: | :rage: | :rage:
`println!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat:
`eprint!("…", $tmp)` | :rage: | :rage: | :rage:
`eprintln!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat:
`panic!("…", $tmp)` | :smiley_cat: | :smiley_cat: | :smiley_cat:
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. merged-by-bors This PR was explicitly merged by bors. 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.