diff options
Diffstat (limited to 'compiler/rustc_hir_analysis/src/check')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/dropck.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/mod.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/wfcheck.rs | 22 | 
3 files changed, 31 insertions, 19 deletions
| diff --git a/compiler/rustc_hir_analysis/src/check/dropck.rs b/compiler/rustc_hir_analysis/src/check/dropck.rs index e0b465bab16..d04d8ca2c32 100644 --- a/compiler/rustc_hir_analysis/src/check/dropck.rs +++ b/compiler/rustc_hir_analysis/src/check/dropck.rs @@ -183,19 +183,27 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>( let predicate = predicate.kind(); let p = p.kind(); match (predicate.skip_binder(), p.skip_binder()) { - (ty::PredicateKind::Trait(a), ty::PredicateKind::Trait(b)) => { - relator.relate(predicate.rebind(a), p.rebind(b)).is_ok() - } - (ty::PredicateKind::Projection(a), ty::PredicateKind::Projection(b)) => { - relator.relate(predicate.rebind(a), p.rebind(b)).is_ok() - } + ( + ty::PredicateKind::Clause(ty::Clause::Trait(a)), + ty::PredicateKind::Clause(ty::Clause::Trait(b)), + ) => relator.relate(predicate.rebind(a), p.rebind(b)).is_ok(), + ( + ty::PredicateKind::Clause(ty::Clause::Projection(a)), + ty::PredicateKind::Clause(ty::Clause::Projection(b)), + ) => relator.relate(predicate.rebind(a), p.rebind(b)).is_ok(), ( ty::PredicateKind::ConstEvaluatable(a), ty::PredicateKind::ConstEvaluatable(b), ) => relator.relate(predicate.rebind(a), predicate.rebind(b)).is_ok(), ( - ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_a, lt_a)), - ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_b, lt_b)), + ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate( + ty_a, + lt_a, + ))), + ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate( + ty_b, + lt_b, + ))), ) => { relator.relate(predicate.rebind(ty_a), p.rebind(ty_b)).is_ok() && relator.relate(predicate.rebind(lt_a), p.rebind(lt_b)).is_ok() diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index 2fdfdd77256..29255472a25 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -309,7 +309,7 @@ fn bounds_from_generic_predicates<'tcx>( debug!("predicate {:?}", predicate); let bound_predicate = predicate.kind(); match bound_predicate.skip_binder() { - ty::PredicateKind::Trait(trait_predicate) => { + ty::PredicateKind::Clause(ty::Clause::Trait(trait_predicate)) => { let entry = types.entry(trait_predicate.self_ty()).or_default(); let def_id = trait_predicate.def_id(); if Some(def_id) != tcx.lang_items().sized_trait() { @@ -318,7 +318,7 @@ fn bounds_from_generic_predicates<'tcx>( entry.push(trait_predicate.def_id()); } } - ty::PredicateKind::Projection(projection_pred) => { + ty::PredicateKind::Clause(ty::Clause::Projection(projection_pred)) => { projections.push(bound_predicate.rebind(projection_pred)); } _ => {} diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index d23c41ed690..8171a2ab270 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -462,12 +462,16 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe let mut unsatisfied_bounds: Vec<_> = required_bounds .into_iter() .filter(|clause| match clause.kind().skip_binder() { - ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => { + ty::PredicateKind::Clause(ty::Clause::RegionOutlives(ty::OutlivesPredicate( + a, + b, + ))) => { !region_known_to_outlive(tcx, gat_hir, param_env, &FxIndexSet::default(), a, b) } - ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(a, b)) => { - !ty_known_to_outlive(tcx, gat_hir, param_env, &FxIndexSet::default(), a, b) - } + ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate( + a, + b, + ))) => !ty_known_to_outlive(tcx, gat_hir, param_env, &FxIndexSet::default(), a, b), _ => bug!("Unexpected PredicateKind"), }) .map(|clause| clause.to_string()) @@ -599,8 +603,9 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>( })); // The predicate we expect to see. (In our example, // `Self: 'me`.) - let clause = - ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_param, region_param)); + let clause = ty::PredicateKind::Clause(ty::Clause::TypeOutlives( + ty::OutlivesPredicate(ty_param, region_param), + )); let clause = tcx.mk_predicate(ty::Binder::dummy(clause)); bounds.insert(clause); } @@ -636,9 +641,8 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>( name: region_b_param.name, })); // The predicate we expect to see. - let clause = ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate( - region_a_param, - region_b_param, + let clause = ty::PredicateKind::Clause(ty::Clause::RegionOutlives( + ty::OutlivesPredicate(region_a_param, region_b_param), )); let clause = tcx.mk_predicate(ty::Binder::dummy(clause)); bounds.insert(clause); | 
