1
Fork 0

Add bound_explicit_item_bounds and bound_item_bounds

This commit is contained in:
Jack Huey 2022-05-10 22:28:50 -04:00
parent 0247faed29
commit 91afd02632
11 changed files with 120 additions and 76 deletions

View file

@ -1849,10 +1849,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
// Future::Output
let item_def_id = self.tcx.associated_item_def_ids(future_trait)[0];
let bounds = self.tcx.explicit_item_bounds(*def_id);
let bounds = self.tcx.bound_explicit_item_bounds(*def_id);
for (predicate, _) in bounds {
let predicate = EarlyBinder(*predicate).subst(self.tcx, substs);
for predicate in bounds.transpose_iter().map(|e| e.map_bound(|(p, _)| *p)) {
let predicate = predicate.subst(self.tcx, substs);
let output = predicate
.kind()
.map_bound(|kind| match kind {

View file

@ -9,7 +9,7 @@ use rustc_middle::traits::ObligationCause;
use rustc_middle::ty::fold::BottomUpFolder;
use rustc_middle::ty::subst::{GenericArgKind, Subst};
use rustc_middle::ty::{
self, EarlyBinder, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable, TypeVisitor,
self, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable, TypeVisitor,
};
use rustc_span::Span;
@ -561,11 +561,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
obligations = self.at(&cause, param_env).eq(prev, hidden_ty)?.obligations;
}
let item_bounds = tcx.explicit_item_bounds(def_id);
let item_bounds = tcx.bound_explicit_item_bounds(def_id);
for (predicate, _) in item_bounds {
for predicate in item_bounds.transpose_iter().map(|e| e.map_bound(|(p, _)| *p)) {
debug!(?predicate);
let predicate = EarlyBinder(*predicate).subst(tcx, substs);
let predicate = predicate.subst(tcx, substs);
let predicate = predicate.fold_with(&mut BottomUpFolder {
tcx,