Rollup merge of #89001 - jackh726:binder-cleanup, r=nikomatsakis
Be explicit about using Binder::dummy This is somewhat of a late followup to the binder refactor PR. It removes `ToPredicate` and `ToPolyTraitImpls` that hide the use of `Binder::dummy`. While this does make code a bit more verbose, it allows us be more careful about where we create binders. Another alternative here might be to add a new trait `ToBinder` or something with a `dummy()` fn. Which could still allow grepping but allows doing something like `trait_ref.dummy()` (but I also wonder if longer-term, it would be better to be even more explicit with a `bind_with_vars(ty::List::empty())` *but* that's not clear yet. r? ``@nikomatsakis``
This commit is contained in:
commit
ee2e97c416
34 changed files with 127 additions and 121 deletions
|
@ -27,7 +27,7 @@ use rustc_hir::lang_items::LangItem;
|
|||
use rustc_infer::infer::resolve::OpportunisticRegionResolver;
|
||||
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder};
|
||||
use rustc_middle::ty::subst::Subst;
|
||||
use rustc_middle::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, WithConstness};
|
||||
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, WithConstness};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
@ -1028,7 +1028,7 @@ fn normalize_to_error<'a, 'tcx>(
|
|||
cause: ObligationCause<'tcx>,
|
||||
depth: usize,
|
||||
) -> NormalizedTy<'tcx> {
|
||||
let trait_ref = projection_ty.trait_ref(selcx.tcx()).to_poly_trait_ref();
|
||||
let trait_ref = ty::Binder::dummy(projection_ty.trait_ref(selcx.tcx()));
|
||||
let trait_obligation = Obligation {
|
||||
cause,
|
||||
recursion_depth: depth,
|
||||
|
@ -1290,7 +1290,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
|
|||
|
||||
// If we are resolving `<T as TraitRef<...>>::Item == Type`,
|
||||
// start out by selecting the predicate `T as TraitRef<...>`:
|
||||
let poly_trait_ref = obligation.predicate.trait_ref(selcx.tcx()).to_poly_trait_ref();
|
||||
let poly_trait_ref = ty::Binder::dummy(obligation.predicate.trait_ref(selcx.tcx()));
|
||||
let trait_obligation = obligation.with(poly_trait_ref.to_poly_trait_predicate());
|
||||
let _ = selcx.infcx().commit_if_ok(|_| {
|
||||
let impl_source = match selcx.select(&trait_obligation) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue