Skip to content

Commit 448eb37

Browse files
committed
introduce a Coerce predicate
1 parent b3f8d74 commit 448eb37

File tree

24 files changed

+247
-60
lines changed

24 files changed

+247
-60
lines changed

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,35 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
926926
);
927927
}
928928

929+
/// Processes a `Coerce` predicate from the fulfillment context.
930+
/// This is NOT the preferred way to handle coercion, which is to
931+
/// invoke `FnCtxt::coerce` or a similar method (see `coercion.rs`).
932+
///
933+
/// This method here is actually a fallback that winds up being
934+
/// invoked when `FnCtxt::coerce` encounters unresolved type variables
935+
/// and records a coercion predicate. Presently, this method is equivalent
936+
/// to `subtype_predicate` -- that is, "coercing" `a` to `b` winds up
937+
/// actually requiring `a <: b`. This is of course a valid coercion,
938+
/// but it's not as flexible as `FnCtxt::coerce` would be.
939+
///
940+
/// (We may refactor this in the future, but there are a number of
941+
/// practical obstacles. Among other things, `FnCtxt::coerce` presently
942+
/// records adjustments that are required on the HIR in order to perform
943+
/// the coercion, and we don't currently have a way to manage that.)
944+
pub fn coerce_predicate(
945+
&self,
946+
cause: &ObligationCause<'tcx>,
947+
param_env: ty::ParamEnv<'tcx>,
948+
predicate: ty::PolyCoercePredicate<'tcx>,
949+
) -> Option<InferResult<'tcx, ()>> {
950+
let subtype_predicate = predicate.map_bound(|p| ty::SubtypePredicate {
951+
a_is_expected: false, // when coercing from `a` to `b`, `b` is expected
952+
a: p.a,
953+
b: p.b,
954+
});
955+
self.subtype_predicate(cause, param_env, subtype_predicate)
956+
}
957+
929958
pub fn subtype_predicate(
930959
&self,
931960
cause: &ObligationCause<'tcx>,

compiler/rustc_infer/src/infer/outlives/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn explicit_outlives_bounds<'tcx>(
2121
ty::PredicateAtom::Projection(..)
2222
| ty::PredicateAtom::Trait(..)
2323
| ty::PredicateAtom::Subtype(..)
24+
| ty::PredicateAtom::Coerce(..)
2425
| ty::PredicateAtom::WellFormed(..)
2526
| ty::PredicateAtom::ObjectSafe(..)
2627
| ty::PredicateAtom::ClosureKind(..)

compiler/rustc_infer/src/traits/util.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ impl Elaborator<'tcx> {
162162
// Currently, we do not "elaborate" predicates like `X <: Y`,
163163
// though conceivably we might.
164164
}
165+
ty::PredicateAtom::Coerce(..) => {
166+
// Currently, we do not "elaborate" predicates like `X -> Y`,
167+
// though conceivably we might.
168+
}
165169
ty::PredicateAtom::Projection(..) => {
166170
// Nothing to elaborate in a projection predicate.
167171
}

compiler/rustc_lint/src/builtin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
15681568
ObjectSafe(..) |
15691569
ClosureKind(..) |
15701570
Subtype(..) |
1571+
Coerce(..) |
15711572
ConstEvaluatable(..) |
15721573
ConstEquate(..) |
15731574
TypeWellFormedFromEnv(..) => continue,

compiler/rustc_middle/src/ty/flags.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ impl FlagComputation {
236236
self.add_ty(a);
237237
self.add_ty(b);
238238
}
239+
ty::PredicateAtom::Coerce(ty::CoercePredicate { a, b }) => {
240+
self.add_ty(a);
241+
self.add_ty(b);
242+
}
239243
ty::PredicateAtom::Projection(ty::ProjectionPredicate { projection_ty, ty }) => {
240244
self.add_projection_ty(projection_ty);
241245
self.add_ty(ty);

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,8 +1208,22 @@ pub enum PredicateAtom<'tcx> {
12081208
ClosureKind(DefId, SubstsRef<'tcx>, ClosureKind),
12091209

12101210
/// `T1 <: T2`
1211+
///
1212+
/// This obligation is created most often when we have two
1213+
/// unresolved type variables and hence don't have enough
1214+
/// information to process the subtyping obligation yet.
12111215
Subtype(SubtypePredicate<'tcx>),
12121216

1217+
/// `T1` coerced to `T2`
1218+
///
1219+
/// Like a subtyping obligation, thi sis created most often
1220+
/// when we have two unresolved type variables and hence
1221+
/// don't have enough information to process the coercion
1222+
/// obligation yet. At the moment, we actually process coercions
1223+
/// very much like subtyping and don't handle the full coercion
1224+
/// logic.
1225+
Coerce(CoercePredicate<'tcx>),
1226+
12131227
/// Constant initializer must evaluate successfully.
12141228
ConstEvaluatable(ty::WithOptConstParam<DefId>, SubstsRef<'tcx>),
12151229

@@ -1362,6 +1376,9 @@ pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate<Ty<'tcx>, ty::Region<'t
13621376
pub type PolyRegionOutlivesPredicate<'tcx> = ty::Binder<RegionOutlivesPredicate<'tcx>>;
13631377
pub type PolyTypeOutlivesPredicate<'tcx> = ty::Binder<TypeOutlivesPredicate<'tcx>>;
13641378

1379+
/// Encodes that `a` must be a subtype of `b`. The `a_is_expected` flag indicates
1380+
/// whether the `a` type is the type that we should label as "expected" when
1381+
/// presenting user diagnostics.
13651382
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
13661383
#[derive(HashStable, TypeFoldable)]
13671384
pub struct SubtypePredicate<'tcx> {
@@ -1371,6 +1388,15 @@ pub struct SubtypePredicate<'tcx> {
13711388
}
13721389
pub type PolySubtypePredicate<'tcx> = ty::Binder<SubtypePredicate<'tcx>>;
13731390

1391+
/// Encodes that we have to coerce *from* the `a` type to the `b` type.
1392+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
1393+
#[derive(HashStable, TypeFoldable)]
1394+
pub struct CoercePredicate<'tcx> {
1395+
pub a: Ty<'tcx>,
1396+
pub b: Ty<'tcx>,
1397+
}
1398+
pub type PolyCoercePredicate<'tcx> = ty::Binder<CoercePredicate<'tcx>>;
1399+
13741400
/// This kind of predicate has no *direct* correspondent in the
13751401
/// syntax, but it roughly corresponds to the syntactic forms:
13761402
///
@@ -1508,6 +1534,7 @@ impl<'tcx> Predicate<'tcx> {
15081534
PredicateAtom::Trait(t, _) => Some(ty::Binder::bind(t.trait_ref)),
15091535
PredicateAtom::Projection(..)
15101536
| PredicateAtom::Subtype(..)
1537+
| PredicateAtom::Coerce(..)
15111538
| PredicateAtom::RegionOutlives(..)
15121539
| PredicateAtom::WellFormed(..)
15131540
| PredicateAtom::ObjectSafe(..)
@@ -1525,6 +1552,7 @@ impl<'tcx> Predicate<'tcx> {
15251552
PredicateAtom::Trait(..)
15261553
| PredicateAtom::Projection(..)
15271554
| PredicateAtom::Subtype(..)
1555+
| PredicateAtom::Coerce(..)
15281556
| PredicateAtom::RegionOutlives(..)
15291557
| PredicateAtom::WellFormed(..)
15301558
| PredicateAtom::ObjectSafe(..)

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,6 +2003,10 @@ define_print_and_forward_display! {
20032003
p!(print(self.a), " <: ", print(self.b))
20042004
}
20052005

2006+
ty::CoercePredicate<'tcx> {
2007+
p!(print(self.a), " -> ", print(self.b))
2008+
}
2009+
20062010
ty::TraitPredicate<'tcx> {
20072011
p!(print(self.trait_ref.self_ty()), ": ",
20082012
print(self.trait_ref.print_only_trait_path()))
@@ -2040,6 +2044,7 @@ define_print_and_forward_display! {
20402044
p!(print(data))
20412045
}
20422046
ty::PredicateAtom::Subtype(predicate) => p!(print(predicate)),
2047+
ty::PredicateAtom::Coerce(predicate) => p!(print(predicate)),
20432048
ty::PredicateAtom::RegionOutlives(predicate) => p!(print(predicate)),
20442049
ty::PredicateAtom::TypeOutlives(predicate) => p!(print(predicate)),
20452050
ty::PredicateAtom::Projection(predicate) => p!(print(predicate)),

compiler/rustc_middle/src/ty/structural_impls.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ impl fmt::Debug for ty::PredicateAtom<'tcx> {
247247
a.fmt(f)
248248
}
249249
ty::PredicateAtom::Subtype(ref pair) => pair.fmt(f),
250+
ty::PredicateAtom::Coerce(ref pair) => pair.fmt(f),
250251
ty::PredicateAtom::RegionOutlives(ref pair) => pair.fmt(f),
251252
ty::PredicateAtom::TypeOutlives(ref pair) => pair.fmt(f),
252253
ty::PredicateAtom::Projection(ref pair) => pair.fmt(f),
@@ -447,6 +448,13 @@ impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> {
447448
}
448449
}
449450

451+
impl<'a, 'tcx> Lift<'tcx> for ty::CoercePredicate<'a> {
452+
type Lifted = ty::CoercePredicate<'tcx>;
453+
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<ty::CoercePredicate<'tcx>> {
454+
tcx.lift((self.a, self.b)).map(|(a, b)| ty::CoercePredicate { a, b })
455+
}
456+
}
457+
450458
impl<'tcx, A: Copy + Lift<'tcx>, B: Copy + Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate<A, B> {
451459
type Lifted = ty::OutlivesPredicate<A::Lifted, B::Lifted>;
452460
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
@@ -499,6 +507,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::PredicateAtom<'a> {
499507
tcx.lift(data).map(|data| ty::PredicateAtom::Trait(data, constness))
500508
}
501509
ty::PredicateAtom::Subtype(data) => tcx.lift(data).map(ty::PredicateAtom::Subtype),
510+
ty::PredicateAtom::Coerce(data) => tcx.lift(data).map(ty::PredicateAtom::Coerce),
502511
ty::PredicateAtom::RegionOutlives(data) => {
503512
tcx.lift(data).map(ty::PredicateAtom::RegionOutlives)
504513
}

compiler/rustc_mir/src/transform/check_consts/validation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ impl Validator<'mir, 'tcx> {
397397
ty::PredicateAtom::ClosureKind(..) => {
398398
bug!("closure kind predicate on function: {:#?}", predicate)
399399
}
400-
ty::PredicateAtom::Subtype(_) => {
401-
bug!("subtype predicate on function: {:#?}", predicate)
400+
ty::PredicateAtom::Subtype(_) | ty::PredicateAtom::Coerce(_) => {
401+
bug!("subtype/coerce predicate on function: {:#?}", predicate)
402402
}
403403
ty::PredicateAtom::Trait(pred, constness) => {
404404
if Some(pred.def_id()) == tcx.lang_items().sized_trait() {

compiler/rustc_trait_selection/src/opaque_types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,7 @@ crate fn required_region_bounds(
12651265
ty::PredicateAtom::Projection(..)
12661266
| ty::PredicateAtom::Trait(..)
12671267
| ty::PredicateAtom::Subtype(..)
1268+
| ty::PredicateAtom::Coerce(..)
12681269
| ty::PredicateAtom::WellFormed(..)
12691270
| ty::PredicateAtom::ObjectSafe(..)
12701271
| ty::PredicateAtom::ClosureKind(..)

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
532532
span_bug!(span, "subtype requirement gave wrong error: `{:?}`", predicate)
533533
}
534534

535+
ty::PredicateAtom::Coerce(predicate) => {
536+
// Errors for Coerce predicates show up as
537+
// `FulfillmentErrorCode::CodeSubtypeError`,
538+
// not selection error.
539+
span_bug!(span, "coerce requirement gave wrong error: `{:?}`", predicate)
540+
}
541+
535542
ty::PredicateAtom::RegionOutlives(predicate) => {
536543
let predicate = bound_predicate.rebind(predicate);
537544
let predicate = self.resolve_vars_if_possible(predicate);

compiler/rustc_trait_selection/src/traits/fulfill.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
373373
| ty::PredicateAtom::ObjectSafe(_)
374374
| ty::PredicateAtom::ClosureKind(..)
375375
| ty::PredicateAtom::Subtype(_)
376+
| ty::PredicateAtom::Coerce(_)
376377
| ty::PredicateAtom::ConstEvaluatable(..)
377378
| ty::PredicateAtom::ConstEquate(..) => {
378379
let pred = infcx.replace_bound_vars_with_placeholders(binder);
@@ -487,6 +488,31 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
487488
}
488489
}
489490

491+
ty::PredicateAtom::Coerce(coerce) => {
492+
match self.selcx.infcx().coerce_predicate(
493+
&obligation.cause,
494+
obligation.param_env,
495+
Binder::dummy(coerce),
496+
) {
497+
None => {
498+
// None means that both are unresolved.
499+
pending_obligation.stalled_on = vec![
500+
TyOrConstInferVar::maybe_from_ty(coerce.a).unwrap(),
501+
TyOrConstInferVar::maybe_from_ty(coerce.b).unwrap(),
502+
];
503+
ProcessResult::Unchanged
504+
}
505+
Some(Ok(ok)) => ProcessResult::Changed(mk_pending(ok.obligations)),
506+
Some(Err(err)) => {
507+
let expected_found = ExpectedFound::new(false, coerce.a, coerce.b);
508+
ProcessResult::Error(FulfillmentErrorCode::CodeSubtypeError(
509+
expected_found,
510+
err,
511+
))
512+
}
513+
}
514+
}
515+
490516
ty::PredicateAtom::ConstEvaluatable(def_id, substs) => {
491517
match const_evaluatable::is_const_evaluatable(
492518
self.selcx.infcx(),

compiler/rustc_trait_selection/src/traits/object_safety.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ fn predicate_references_self(
306306
| ty::PredicateAtom::RegionOutlives(..)
307307
| ty::PredicateAtom::ClosureKind(..)
308308
| ty::PredicateAtom::Subtype(..)
309+
| ty::PredicateAtom::Coerce(..)
309310
| ty::PredicateAtom::ConstEvaluatable(..)
310311
| ty::PredicateAtom::ConstEquate(..)
311312
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => None,
@@ -334,6 +335,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
334335
}
335336
ty::PredicateAtom::Projection(..)
336337
| ty::PredicateAtom::Subtype(..)
338+
| ty::PredicateAtom::Coerce(..)
337339
| ty::PredicateAtom::RegionOutlives(..)
338340
| ty::PredicateAtom::WellFormed(..)
339341
| ty::PredicateAtom::ObjectSafe(..)

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,22 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
474474
}
475475
}
476476

477+
ty::PredicateAtom::Coerce(p) => {
478+
let p = bound_predicate.rebind(p);
479+
// Does this code ever run?
480+
match self.infcx.coerce_predicate(&obligation.cause, obligation.param_env, p) {
481+
Some(Ok(InferOk { mut obligations, .. })) => {
482+
self.add_depth(obligations.iter_mut(), obligation.recursion_depth);
483+
self.evaluate_predicates_recursively(
484+
previous_stack,
485+
obligations.into_iter(),
486+
)
487+
}
488+
Some(Err(_)) => Ok(EvaluatedToErr),
489+
None => Ok(EvaluatedToAmbig),
490+
}
491+
}
492+
477493
ty::PredicateAtom::WellFormed(arg) => match wf::obligations(
478494
self.infcx,
479495
obligation.param_env,

compiler/rustc_trait_selection/src/traits/wf.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ pub fn predicate_obligations<'a, 'tcx>(
127127
wf.compute(a.into());
128128
wf.compute(b.into());
129129
}
130+
ty::PredicateAtom::Coerce(ty::CoercePredicate { a, b }) => {
131+
wf.compute(a.into());
132+
wf.compute(b.into());
133+
}
130134
ty::PredicateAtom::ConstEvaluatable(def, substs) => {
131135
let obligations = wf.nominal_obligations(def.did, substs);
132136
wf.out.extend(obligations);

compiler/rustc_traits/src/chalk/lowering.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::InEnvironment<chalk_ir::Goal<RustInterner<'
114114
| ty::PredicateAtom::ObjectSafe(..)
115115
| ty::PredicateAtom::ClosureKind(..)
116116
| ty::PredicateAtom::Subtype(..)
117+
| ty::PredicateAtom::Coerce(..)
117118
| ty::PredicateAtom::ConstEvaluatable(..)
118119
| ty::PredicateAtom::ConstEquate(..) => bug!("unexpected predicate {}", predicate),
119120
};
@@ -201,6 +202,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData<RustInterner<'tcx>>> for ty::Predi
201202
// some of these in terms of chalk operations.
202203
ty::PredicateAtom::ClosureKind(..)
203204
| ty::PredicateAtom::Subtype(..)
205+
| ty::PredicateAtom::Coerce(..)
204206
| ty::PredicateAtom::ConstEvaluatable(..)
205207
| ty::PredicateAtom::ConstEquate(..) => {
206208
chalk_ir::GoalData::All(chalk_ir::Goals::empty(interner))
@@ -604,6 +606,7 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_ir::QuantifiedWhereClause<RustInterner<'
604606
ty::PredicateAtom::ObjectSafe(..)
605607
| ty::PredicateAtom::ClosureKind(..)
606608
| ty::PredicateAtom::Subtype(..)
609+
| ty::PredicateAtom::Coerce(..)
607610
| ty::PredicateAtom::ConstEvaluatable(..)
608611
| ty::PredicateAtom::ConstEquate(..)
609612
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => {
@@ -727,6 +730,7 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_solve::rust_ir::QuantifiedInlineBound<Ru
727730
| ty::PredicateAtom::ObjectSafe(..)
728731
| ty::PredicateAtom::ClosureKind(..)
729732
| ty::PredicateAtom::Subtype(..)
733+
| ty::PredicateAtom::Coerce(..)
730734
| ty::PredicateAtom::ConstEvaluatable(..)
731735
| ty::PredicateAtom::ConstEquate(..)
732736
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => {

compiler/rustc_traits/src/implied_outlives_bounds.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ fn compute_implied_outlives_bounds<'tcx>(
9999
&ty::PredicateKind::Atom(atom) => match atom {
100100
ty::PredicateAtom::Trait(..)
101101
| ty::PredicateAtom::Subtype(..)
102+
| ty::PredicateAtom::Coerce(..)
102103
| ty::PredicateAtom::Projection(..)
103104
| ty::PredicateAtom::ClosureKind(..)
104105
| ty::PredicateAtom::ObjectSafe(..)

compiler/rustc_traits/src/normalize_erasing_regions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ fn not_outlives_predicate(p: &ty::Predicate<'tcx>) -> bool {
4848
| ty::PredicateAtom::ObjectSafe(..)
4949
| ty::PredicateAtom::ClosureKind(..)
5050
| ty::PredicateAtom::Subtype(..)
51+
| ty::PredicateAtom::Coerce(..)
5152
| ty::PredicateAtom::ConstEvaluatable(..)
5253
| ty::PredicateAtom::ConstEquate(..)
5354
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => true,

compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
778778
Some((ty::Binder::bind(data).to_poly_trait_ref(), obligation))
779779
}
780780
ty::PredicateAtom::Subtype(..) => None,
781+
ty::PredicateAtom::Coerce(..) => None,
781782
ty::PredicateAtom::RegionOutlives(..) => None,
782783
ty::PredicateAtom::TypeOutlives(..) => None,
783784
ty::PredicateAtom::WellFormed(..) => None,

compiler/rustc_typeck/src/check/method/probe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
807807
}
808808
}
809809
ty::PredicateAtom::Subtype(..)
810+
| ty::PredicateAtom::Coerce(..)
810811
| ty::PredicateAtom::Projection(..)
811812
| ty::PredicateAtom::RegionOutlives(..)
812813
| ty::PredicateAtom::WellFormed(..)

compiler/rustc_typeck/src/impl_wf_check/min_specialization.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ fn trait_predicate_kind<'tcx>(
403403
| ty::PredicateAtom::Projection(_)
404404
| ty::PredicateAtom::WellFormed(_)
405405
| ty::PredicateAtom::Subtype(_)
406+
| ty::PredicateAtom::Coerce(_)
406407
| ty::PredicateAtom::ObjectSafe(_)
407408
| ty::PredicateAtom::ClosureKind(..)
408409
| ty::PredicateAtom::ConstEvaluatable(..)

compiler/rustc_typeck/src/outlives/explicit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
5656
| ty::PredicateAtom::ObjectSafe(..)
5757
| ty::PredicateAtom::ClosureKind(..)
5858
| ty::PredicateAtom::Subtype(..)
59+
| ty::PredicateAtom::Coerce(..)
5960
| ty::PredicateAtom::ConstEvaluatable(..)
6061
| ty::PredicateAtom::ConstEquate(..)
6162
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => (),

src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ impl<'a> Clean<Option<WherePredicate>> for ty::Predicate<'a> {
499499
ty::PredicateAtom::Projection(pred) => Some(pred.clean(cx)),
500500

501501
ty::PredicateAtom::Subtype(..)
502+
| ty::PredicateAtom::Coerce(..)
502503
| ty::PredicateAtom::WellFormed(..)
503504
| ty::PredicateAtom::ObjectSafe(..)
504505
| ty::PredicateAtom::ClosureKind(..)

0 commit comments

Comments
 (0)