-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add check for [T;N]
/usize
mismatch in astconv
#80538
Conversation
673227d
to
2445da2
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
2445da2
to
68fa1ac
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.
thanks ❤️
can you also add a test for [u8; 1 + 2]
? We probably want to always recommend using braces for now as especially for complex expressions the error recovery when they are missing is fairly hard.
68fa1ac
to
a544286
Compare
4885728
to
029ff3f
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
ad6ad28
to
7091cf7
Compare
thanks 👍 @bors r+ rollup |
📌 Commit 54883e0 has been approved by |
Rollup of 12 pull requests Successful merges: - rust-lang#80442 (Mention Arc::make_mut and Rc::make_mut in the documentation of Cow) - rust-lang#80533 (bootstrap: clippy fixes) - rust-lang#80538 (Add check for `[T;N]`/`usize` mismatch in astconv) - rust-lang#80612 (Remove reverted change from relnotes) - rust-lang#80627 (Builder: Warn if test file does not exist) - rust-lang#80637 (Use Option::filter instead of open-coding it) - rust-lang#80643 (Move variable into the only branch where it is relevant) - rust-lang#80656 (Fixed documentation error for `std::hint::spin_loop`) - rust-lang#80666 (Fix missing link for "fully qualified syntax") - rust-lang#80672 (./x.py clippy: allow the most noisy lints) - rust-lang#80677 (doc -- list edit for consistency) - rust-lang#80696 (make sure that promoteds which fail to evaluate in dead const code behave correctly) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@JulianKnodt @lcnr it seems this change was responsible for a moderate performance regression (and a minor perf gain). You can see the results in #80798 where we reverted this PR and ran the perf suite. The regression was in the |
@@ -203,7 +213,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { | |||
// We expected a lifetime argument, but got a type or const | |||
// argument. That means we're inferring the lifetimes. | |||
substs.push(ctx.inferred_kind(None, param, infer_args)); | |||
force_infer_lt = Some(arg); | |||
force_infer_lt = Some((arg, param)); |
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.
is it possible that this loop is a lot hotter than I expected so storing arg with param here is quite costly?
Other than that i really don't know waht could be causing the perf regression.
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.
I agree that this would be the most likely cause, it could be that the type for param for deeply-nested-async stuff is huge and thus takes up a lot of space on the stack, so even if it's not hot it might just be causing a lot more cache misses
edit: these are refs, so the size shouldn't matter, ignore above
Would it be good to change this to an index instead? I don't remember where the param was coming from at the moment
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.
It seems possible that this increases the size of force_infer_lt enough that it becomes stored on the stack instead of a register, I guess, but it's pretty odd that it would cause any problems (still just two pointers vs one). An index would still be a usize so should be equally costly I'd expect.
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.
I added a print to the inner body, and during compilation it appears that the body is hit at least 1.5M times, so I guess that's fairly hot?
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.
you mean during the compilation of the compiler itself? so during ./x.py build --stage 2
or just while building std?
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.
I was running ./x.py test src/test/ui
, but it got to compiling stage 1 artifacts and I quit out
Helps clarify the issue in #80506
by adding a specific check for mismatches between [T;N] and usize.
r? @lcnr