Skip to content

Commit 93856e5

Browse files
committed
Add NotTrait PredicateKind
1 parent 7f9ab03 commit 93856e5

File tree

23 files changed

+73
-0
lines changed

23 files changed

+73
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub fn explicit_outlives_bounds<'tcx>(
2727
| ty::PredicateKind::ConstEvaluatable(..)
2828
| ty::PredicateKind::ConstEquate(..)
2929
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None,
30+
ty::PredicateKind::NotTrait(..) => todo!("yaahc"),
3031
ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(r_a, r_b)) => {
3132
Some(OutlivesBound::RegionSubRegion(r_b, r_a))
3233
}

compiler/rustc_infer/src/traits/util.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ impl Elaborator<'tcx> {
146146

147147
self.stack.extend(obligations);
148148
}
149+
ty::PredicateKind::NotTrait(_data, _) => {
150+
todo!("yaahc")
151+
}
149152
ty::PredicateKind::WellFormed(..) => {
150153
// Currently, we do not elaborate WF predicates,
151154
// although we easily could.

compiler/rustc_lint/src/builtin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
15811581
for &(predicate, span) in predicates.predicates {
15821582
let predicate_kind_name = match predicate.kind().skip_binder() {
15831583
Trait(..) => "Trait",
1584+
NotTrait(..) => todo!("yaahc"),
15841585
TypeOutlives(..) |
15851586
RegionOutlives(..) => "Lifetime",
15861587

compiler/rustc_middle/src/ty/flags.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ impl FlagComputation {
219219
ty::PredicateKind::Trait(trait_pred, _constness) => {
220220
self.add_substs(trait_pred.trait_ref.substs);
221221
}
222+
ty::PredicateKind::NotTrait(_trait_pred, _constness) => {
223+
todo!("yaahc")
224+
}
222225
ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => {
223226
self.add_region(a);
224227
self.add_region(b);

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,15 @@ pub enum PredicateKind<'tcx> {
437437
/// `const fn foobar<Foo: Bar>() {}`).
438438
Trait(TraitPredicate<'tcx>, Constness),
439439

440+
/// Corresponds to `where Foo: !Bar<A, B, C>`. `Foo` here would be
441+
/// the `Self` type of the trait reference and `A`, `B`, and `C`
442+
/// would be the type parameters.
443+
///
444+
/// A trait predicate will have `Constness::Const` if it originates
445+
/// from a bound on a `const fn` without the `?const` opt-out (e.g.,
446+
/// `const fn foobar<Foo: Bar>() {}`).
447+
NotTrait(TraitPredicate<'tcx>, Constness),
448+
440449
/// `where 'a: 'b`
441450
RegionOutlives(RegionOutlivesPredicate<'tcx>),
442451

@@ -770,6 +779,7 @@ impl<'tcx> Predicate<'tcx> {
770779
PredicateKind::Trait(t, constness) => {
771780
Some(ConstnessAnd { constness, value: predicate.rebind(t.trait_ref) })
772781
}
782+
PredicateKind::NotTrait(..) => todo!("yaahc"),
773783
PredicateKind::Projection(..)
774784
| PredicateKind::Subtype(..)
775785
| PredicateKind::RegionOutlives(..)
@@ -787,6 +797,7 @@ impl<'tcx> Predicate<'tcx> {
787797
let predicate = self.kind();
788798
match predicate.skip_binder() {
789799
PredicateKind::TypeOutlives(data) => Some(predicate.rebind(data)),
800+
PredicateKind::NotTrait(..) => todo!("yaahc"),
790801
PredicateKind::Trait(..)
791802
| PredicateKind::Projection(..)
792803
| PredicateKind::Subtype(..)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,6 +2197,9 @@ define_print_and_forward_display! {
21972197
}
21982198
p!(print(data))
21992199
}
2200+
ty::PredicateKind::NotTrait(ref _data, _constness) => {
2201+
todo!("yaahc")
2202+
}
22002203
ty::PredicateKind::Subtype(predicate) => p!(print(predicate)),
22012204
ty::PredicateKind::RegionOutlives(predicate) => p!(print(predicate)),
22022205
ty::PredicateKind::TypeOutlives(predicate) => p!(print(predicate)),

compiler/rustc_middle/src/ty/structural_impls.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ impl fmt::Debug for ty::PredicateKind<'tcx> {
180180
}
181181
a.fmt(f)
182182
}
183+
ty::PredicateKind::NotTrait(ref _a, _constness) => todo!("yaahc"),
183184
ty::PredicateKind::Subtype(ref pair) => pair.fmt(f),
184185
ty::PredicateKind::RegionOutlives(ref pair) => pair.fmt(f),
185186
ty::PredicateKind::TypeOutlives(ref pair) => pair.fmt(f),
@@ -422,6 +423,9 @@ impl<'a, 'tcx> Lift<'tcx> for ty::PredicateKind<'a> {
422423
ty::PredicateKind::Trait(data, constness) => {
423424
tcx.lift(data).map(|data| ty::PredicateKind::Trait(data, constness))
424425
}
426+
ty::PredicateKind::NotTrait(_data, _constness) => {
427+
todo!("yaahc")
428+
}
425429
ty::PredicateKind::Subtype(data) => tcx.lift(data).map(ty::PredicateKind::Subtype),
426430
ty::PredicateKind::RegionOutlives(data) => {
427431
tcx.lift(data).map(ty::PredicateKind::RegionOutlives)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ impl Validator<'mir, 'tcx> {
445445
_ => continue,
446446
}
447447
}
448+
ty::PredicateKind::NotTrait(_pred, _constness) => {
449+
todo!("yaahc")
450+
}
448451
}
449452
}
450453
match predicates.parent {

compiler/rustc_trait_selection/src/opaque_types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ crate fn required_region_bounds(
12001200
| ty::PredicateKind::ConstEvaluatable(..)
12011201
| ty::PredicateKind::ConstEquate(..)
12021202
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None,
1203+
ty::PredicateKind::NotTrait(..) => todo!("yaahc"),
12031204
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ref t, ref r)) => {
12041205
// Search for a bound of the form `erased_self_ty
12051206
// : 'a`, but be wary of something like `for<'a>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
517517
err
518518
}
519519

520+
ty::PredicateKind::NotTrait(_trait_predicate, _) => {
521+
todo!("yaahc")
522+
}
523+
520524
ty::PredicateKind::Subtype(predicate) => {
521525
// Errors for Subtype predicates show up as
522526
// `FulfillmentErrorCode::CodeSubtypeError`,

0 commit comments

Comments
 (0)