Uh oh!
There was an error while loading. Please reload this page.
Specialize ToString implementation for fmt::Arguments - #111168
Conversation
rustbot
commented
May 3, 2023
(rustbot has picked a reviewer for you, use r? to override) |
rustbot
commented
May 3, 2023
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
DaniPopes
commented
May 3, 2023
@rustbot label +T-libs-api -T-libs |
Mark-Simulacrum
commented
May 6, 2023
What is the user-visible impact of this specialization? Naively it seems like it should just be an internal optimization? @rustbot author |
DaniPopes
commented
May 6, 2023
Having generic This is somewhat how I found that it was not specialized: enumError{Custom(String),}implError{// or T: ToStringfnnew<T: std::fmt::Display>(t:T) -> Self{Self::Custom(t.to_string())}}fnmain(){let stuff = 1234;let _a = Error::new(stuff);let _b = Error::new(format_args!("Format args: {stuff}"));let _c = Error::new(format!("Format: {stuff}"));let _d = Error::new("Str");}Using |
Mark-Simulacrum
commented
May 6, 2023
When I say user visible I mean e.g. a test case that would fail before this change, but works after, or similar. If this is purely about performance then that's generally easier to land, as it's not something we would be blocked on reverting if we decide to go a different path in the future. |
DaniPopes
commented
May 6, 2023
DaniPopes
commented
May 10, 2023
@rustbot review |
Mark-Simulacrum
commented
May 18, 2023
bors
commented
May 18, 2023
Rollup of 7 pull requests Successful merges: - rust-lang#110884 (Support RISC-V unaligned-scalar-mem target feature) - rust-lang#111160 (Update serde in workspace and non-synced dependencies) - rust-lang#111168 (Specialize ToString implementation for fmt::Arguments) - rust-lang#111527 (add examples of port 0 binding behavior) - rust-lang#111561 (Include better context for "already exists" error in compiletest) - rust-lang#111633 (Avoid `&format("...")` calls in error message code.) - rust-lang#111679 (Remove libs message about ACPs from triagebot) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Generates far fewer instructions by formatting into a String with
fmt::formatdirectly instead of going through thefmt::Displayimpl. This change is insta-stable.