Print token::Interpolated with token stream pretty printing. - #125174
Conversation
a397a90 to
f7ce1ac
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…, r=<try> Print `token::Interpolated` with token stream pretty printing. r? `@ghost`
ca35330 to
9c693ad
Compare
|
Full details are in the individual commits. @dtolnay has agreed to update the A crater run should be done before this merges, to make sure the Performance is unlikely to be affected, but let's confirm that: |
This comment has been minimized.
This comment has been minimized.
…, r=<try> Print `token::Interpolated` with token stream pretty printing. This is a step towards removing `token::Interpolated` (rust-lang#124141). It unavoidably changes the output of the `stringify!` macro, generally for the better. r? `@petrochenkov`
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
While I can see how this PR is a necessary step toward removing
This is the opposite of what I expect, and I consider
#[macro_export]
macro_rules! ensure {
($cond:expr) => {
if let false = $cond {
return Err($crate::err_msg(format!("{}", stringify!($cond))));
}
};
}Some changes picked up by https://github.com/dtolnay/anyhow's test suite from this PR: - Error::msg::<<str as ToOwned>::Owned>.t(1) == 2
+ Error ::msg ::<< str as ToOwned >::Owned >.t (1) == 2
- f::<1>() != ()
+ f ::<1 >() != ()
- f::<-1>() != ()
+ f ::<- 1 >() != ()
- E::U::<> > E::U::<u8>
+ E ::U ::<> > E ::U ::<u8 >
- E::U::<u8> > E::U
+ E ::U ::<u8 > > E ::U
- b\"hmm\"[1] == b'c'
+ b\"hmm\" [1] == b'c'
- result? == 2
+ result ? == 2
- f as for<'a> fn() as usize * 0 != 0
+ f as for<'a > fn() as usize * 0 != 0
- &0 as &dyn EqDebug<i32, Assoc = bool> != &0
+ &0 as &dyn EqDebug <i32, Assoc = bool > != &0
- PhantomData as PhantomData<<i32 as ToOwned>::Owned> != PhantomData
+ PhantomData as PhantomData << i32 as ToOwned >::Owned > != PhantomData
- 0 as int!(...) != 0
+ 0 as int !(...) != 0
- 0 as int![...] != 0
+ 0 as int ![...] != 0
- 0 as int! { ... } != 0
+ 0 as int ! { ... } != 0
- if let -1..=1 = 0 { 0 } else { 1 } == 1
+ if let -1 ..=1 = 0 { 0 } else { 1 } == 1 |
|
Finished benchmarking commit (e07dc21): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking 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 a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary 0.2%, secondary -5.0%)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.3%, 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 669.726s -> 668.949s (-0.12%) |
We can discuss what "more capable" means, but there are cases visible in the
How do I run that suite? I tried |
|
AFAICT this is the |
|
Minimal repro: macro_rules! repro {
($foo:ident $colons:tt $bar:ident) => {
stringify_expr!($foo $colons $bar)
};
}
macro_rules! stringify_expr {
($expr:expr) => {
stringify!($expr)
};
}
fn main() {
println!("{}", repro!(foo::bar));
}- foo::bar
+ foo ::bar |
commented
Jun 11, 2024
commented
Jun 11, 2024
commented
Jun 11, 2024
|
☀️ Test successful - checks-actions |
commented
Jun 12, 2024
|
Finished benchmarking commit (d0227c6): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults (secondary 2.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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 676.994s -> 678.403s (0.21%) |
commented
Jun 20, 2024
|
@nnethercote @petrochenkov I didn't see any discussion of the perf regressions seen here. It seems like most libc benchmarks were negatively impacted while no other benchmarks were. I'm not quite sure why that would be. |
|
I'm a little surprised, I wouldn't have thought pretty-printing was on the performance critical path for anything. The new code could be slightly slower. The fact that it's a single benchmark, and small regressions, makes me not too worried. And the relevant code ( @rustbot label: +perf-regression-triaged |
This is a step towards removing
token::Interpolated(#124141). It unavoidably changes the output of thestringify!macro, generally for the better.r? @petrochenkov