-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Replace tcx.mk_trait_ref
with TraitRef::new
#110806
Conversation
In rust `new`-ish functions are usually the first ones in an `impl` block
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred in engine.rs, potentially modifying the public API of |
This comment has been minimized.
This comment has been minimized.
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
ty::Binder::dummy( | ||
tcx.mk_trait_ref(goal.predicate.def_id(), [self_ty, generator.resume_ty()]), | ||
) | ||
ty::Binder::dummy(ty::TraitRef::new( |
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.
ty::TraitRef::new
starts getting pretty verbose, maybe we should start with some use ty::TraitRef;
? unsure about the types opinion on that
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 don't have an opinion here and expect the same for most (if not all) types members 😁 afaik we tend to already not have a consistent approach to which parts of ty
to import
d4e2cf7
to
c727edc
Compare
This comment has been minimized.
This comment has been minimized.
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.
some nits and further cleanup ideas
feel free to implement whichever ones you want
after that r=me
please relabel once this is ready for the final review + merge 😁 @rustbot author |
(or just r+ it yourself 😁 ) |
…::Binber::dummy` calls
I've substantially changed everything with the review suggestions, so @rustbot ready |
This comment has been minimized.
This comment has been minimized.
One day I'll stop forgetting to fix |
Please don't land, see comment. |
@@ -1207,6 +1207,18 @@ impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for Binder<'tcx, TraitRef | |||
} | |||
} | |||
|
|||
impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for TraitRef<'tcx> { | |||
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> PolyTraitPredicate<'tcx> { | |||
ty::Binder::dummy(self).to_predicate(tcx) |
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.
Nope, this is not a change we should merge (or the impl below).
In fact, I would be in favor of some explicit negative impl here just so we can slap a big comment on this so nobody tries to make the positive impl again.
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.
Can you explain what is wrong in this impl?
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.
Ah, I see: #110806 (comment)
@bors r+ rollup=iffy |
☀️ Test successful - checks-actions |
Finished benchmarking commit (6f8c055): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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: 656.223s -> 655.069s (-0.18%) |
Replace `tcx.mk_trait_ref` with `TraitRef::new` First step in implementing rust-lang/compiler-team#616 r? `@lcnr`
First step in implementing rust-lang/compiler-team#616
r? @lcnr