-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Simplify universal impl trait lowering #97598
Simplify universal impl trait lowering #97598
Conversation
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 @spastorino! I left a few questions.
/// Treat `impl Trait` as shorthand for a new universal generic parameter. | ||
/// Example: `fn foo(x: impl Debug)`, where `impl Debug` is conceptually | ||
/// equivalent to a fresh universal parameter like `fn foo<T: Debug>(x: T)`. | ||
/// | ||
/// Newly generated parameters should be inserted into the given `Vec`. | ||
Universal(&'b mut Vec<hir::GenericParam<'a>>, &'b mut Vec<hir::WherePredicate<'a>>, LocalDefId), | ||
Universal(LocalDefId), |
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 this LocalDefId
always equal to self.current_hir_id_owner
, or can there be a mismatch?
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 think so but maybe worth checking. Do you think I should check that in this PR? or should we leave this for a followup?
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.
Ok for follow-up.
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.
Ok, I've just checked this and yes, it's always equal. We are always creating Universal
passing self.current_hir_id_owner
to it.
@@ -290,18 +293,6 @@ enum ImplTraitPosition { | |||
ImplReturn, | |||
} | |||
|
|||
impl<'a> ImplTraitContext<'_, 'a> { | |||
fn reborrow<'this>(&'this mut self) -> ImplTraitContext<'this, 'a> { |
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.
🎉
Co-authored-by: Camille Gillot <[email protected]>
This comment has been minimized.
This comment has been minimized.
793aca9
to
67deaf9
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 15a82d6 with merge 769c5ef1e28f2107770e476529d9aa7305a01e2c... |
☀️ Try build successful - checks-actions |
Queued 769c5ef1e28f2107770e476529d9aa7305a01e2c with parent 8256e97, future comparison URL. |
Finished benchmarking commit (769c5ef1e28f2107770e476529d9aa7305a01e2c): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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. @bors rollup=never Footnotes |
@bors r+ |
📌 Commit 15a82d6 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (42bcd41): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Closes #96644
r? @cjgillot