Auto merge of #120919 - oli-obk:impl_polarity, r=compiler-errors
Merge `impl_polarity` and `impl_trait_ref` queries Hopefully this is perf neutral. I want to finish https://github.com/rust-lang/rust/pull/120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
This commit is contained in:
commit
d26b417112
22 changed files with 156 additions and 131 deletions
|
@ -560,20 +560,22 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// Before we create the generic parameters and everything, first
|
||||
// consider a "quick reject". This avoids creating more types
|
||||
// and so forth that we need to.
|
||||
let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap();
|
||||
if !drcx.args_may_unify(obligation_args, impl_trait_ref.skip_binder().args) {
|
||||
let impl_trait_header = self.tcx().impl_trait_header(impl_def_id).unwrap();
|
||||
if !drcx
|
||||
.args_may_unify(obligation_args, impl_trait_header.skip_binder().trait_ref.args)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if self.reject_fn_ptr_impls(
|
||||
impl_def_id,
|
||||
obligation,
|
||||
impl_trait_ref.skip_binder().self_ty(),
|
||||
impl_trait_header.skip_binder().trait_ref.self_ty(),
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.infcx.probe(|_| {
|
||||
if let Ok(_args) = self.match_impl(impl_def_id, impl_trait_ref, obligation) {
|
||||
if let Ok(_args) = self.match_impl(impl_def_id, impl_trait_header, obligation) {
|
||||
candidates.vec.push(ImplCandidate(impl_def_id));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue