Skip to content

Commit c5b700a

Browse files
committed
WIP: add new predicate kind
1 parent 41981d1 commit c5b700a

File tree

15 files changed

+31
-6
lines changed

15 files changed

+31
-6
lines changed

compiler/rustc_feature/src/unstable.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,9 @@ declare_features! (
211211
(internal, custom_mir, "1.65.0", None),
212212
/// Outputs useful `assert!` messages
213213
(unstable, generic_assert, "1.63.0", None),
214-
<<<<<<< HEAD
215-
/// Allows using the #[rustc_intrinsic] attribute.
216-
=======
217214
/// Allow declaring an impl as unstable.
218215
(internal, impl_stability, "CURRENT_RUSTC_VERSION", None),
219-
/// Allows using the `rust-intrinsic`'s "ABI".
220-
>>>>>>> bde3d4141a1 (Add a no-op feature gate)
216+
/// Allows using the #[rustc_intrinsic] attribute.
221217
(internal, intrinsics, "1.0.0", None),
222218
/// Allows using `#[lang = ".."]` attribute for linking items to special compiler logic.
223219
(internal, lang_items, "1.0.0", None),

compiler/rustc_middle/src/ty/predicate.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ impl<'tcx> Predicate<'tcx> {
132132
| PredicateKind::Clause(ClauseKind::TypeOutlives(_))
133133
| PredicateKind::Clause(ClauseKind::Projection(_))
134134
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
135+
| PredicateKind::Clause(ClauseKind::UnstableImpl) // TODO: is this fine...?
135136
| PredicateKind::DynCompatible(_)
136137
| PredicateKind::Subtype(_)
137138
| PredicateKind::Coerce(_)
@@ -647,6 +648,7 @@ impl<'tcx> Predicate<'tcx> {
647648
PredicateKind::Clause(ClauseKind::Projection(..))
648649
| PredicateKind::Clause(ClauseKind::HostEffect(..))
649650
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
651+
| PredicateKind::Clause(ClauseKind::UnstableImpl)
650652
| PredicateKind::NormalizesTo(..)
651653
| PredicateKind::AliasRelate(..)
652654
| PredicateKind::Subtype(..)
@@ -668,6 +670,7 @@ impl<'tcx> Predicate<'tcx> {
668670
PredicateKind::Clause(ClauseKind::Trait(..))
669671
| PredicateKind::Clause(ClauseKind::HostEffect(..))
670672
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
673+
| PredicateKind::Clause(ClauseKind::UnstableImpl)
671674
| PredicateKind::NormalizesTo(..)
672675
| PredicateKind::AliasRelate(..)
673676
| PredicateKind::Subtype(..)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,6 +3251,7 @@ define_print! {
32513251
ty::ClauseKind::ConstEvaluatable(ct) => {
32523252
p!("the constant `", print(ct), "` can be evaluated")
32533253
}
3254+
ty::ClauseKind::UnstableImpl => p!("unstable impl"),
32543255
}
32553256
}
32563257

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ where
557557
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
558558
self.compute_const_arg_has_type_goal(Goal { param_env, predicate: (ct, ty) })
559559
}
560+
ty::PredicateKind::Clause(ty::ClauseKind::UnstableImpl) => todo!(),
560561
ty::PredicateKind::Subtype(predicate) => {
561562
self.compute_subtype_goal(Goal { param_env, predicate })
562563
}
@@ -585,7 +586,8 @@ where
585586
}),
586587
ty::PredicateKind::Ambiguous => {
587588
self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
588-
}
589+
},
590+
589591
}
590592
} else {
591593
self.enter_forall(kind, |ecx, kind| {

compiler/rustc_smir/src/rustc_smir/convert/ty.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,9 @@ impl<'tcx> Stable<'tcx> for ty::ClauseKind<'tcx> {
647647
ClauseKind::HostEffect(..) => {
648648
todo!()
649649
}
650+
ClauseKind::UnstableImpl => {
651+
todo!()
652+
}
650653
}
651654
}
652655
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
638638
}
639639
}
640640

641+
ty::PredicateKind::Clause(ty::ClauseKind::UnstableImpl) => todo!(), // TODO: is this for error reporting?
642+
641643
// Errors for `ConstEvaluatable` predicates show up as
642644
// `SelectionError::ConstEvalFailure`,
643645
// not `Unimplemented`.

compiler/rustc_trait_selection/src/traits/auto_trait.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
798798
// FIXME(generic_const_exprs): you can absolutely add this as a where clauses
799799
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
800800
| ty::PredicateKind::Coerce(..)
801+
| ty::PredicateKind::Clause(ty::ClauseKind::UnstableImpl)
801802
| ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(..)) => {}
802803
ty::PredicateKind::Ambiguous => return false,
803804
};

compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ fn predicate_references_self<'tcx>(
238238
// FIXME(generic_const_exprs): this can mention `Self`
239239
| ty::ClauseKind::ConstEvaluatable(..)
240240
| ty::ClauseKind::HostEffect(..)
241+
| ty::ClauseKind::UnstableImpl
241242
=> None,
242243
}
243244
}
@@ -278,6 +279,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
278279
| ty::ClauseKind::ConstArgHasType(_, _)
279280
| ty::ClauseKind::WellFormed(_)
280281
| ty::ClauseKind::ConstEvaluatable(_)
282+
| ty::ClauseKind::UnstableImpl
281283
| ty::ClauseKind::HostEffect(..) => false,
282284
})
283285
}

compiler/rustc_trait_selection/src/traits/fulfill.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
404404
ty::PredicateKind::AliasRelate(..) => {
405405
bug!("AliasRelate is only used by the new solver")
406406
}
407+
ty::PredicateKind::Clause(ty::ClauseKind::UnstableImpl) => todo!(), // TODO: not sure what will happen here.
407408
},
408409
Some(pred) => match pred {
409410
ty::PredicateKind::Clause(ty::ClauseKind::Trait(data)) => {
@@ -761,6 +762,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
761762
}
762763
}
763764
}
765+
ty::PredicateKind::Clause(ty::ClauseKind::UnstableImpl) => todo!(),
764766
},
765767
}
766768
}

compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>(
110110
| ty::PredicateKind::ConstEquate(..)
111111
| ty::PredicateKind::Ambiguous
112112
| ty::PredicateKind::NormalizesTo(..)
113+
| ty::PredicateKind::Clause(ty::ClauseKind::UnstableImpl)
113114
| ty::PredicateKind::AliasRelate(..) => {}
114115

115116
// We need to search through *all* WellFormed predicates

0 commit comments

Comments
 (0)