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

+1
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

+3
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

+1
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

+3
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

+11
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

+3
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

+4
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

+3
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

+1
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

+4
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`,

compiler/rustc_trait_selection/src/traits/fulfill.rs

+7
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
362362
&mut pending_obligation.stalled_on,
363363
)
364364
}
365+
ty::PredicateKind::NotTrait(_trait_ref, _constness) => {
366+
todo!("yaahc")
367+
}
365368
ty::PredicateKind::Projection(data) => {
366369
let project_obligation = obligation.with(binder.rebind(data));
367370

@@ -398,6 +401,10 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
398401
)
399402
}
400403

404+
ty::PredicateKind::NotTrait(_data, _) => {
405+
todo!("yaahc")
406+
}
407+
401408
ty::PredicateKind::RegionOutlives(data) => {
402409
match infcx.region_outlives_predicate(&obligation.cause, Binder::dummy(data)) {
403410
Ok(()) => ProcessResult::Changed(vec![]),

compiler/rustc_trait_selection/src/traits/object_safety.rs

+6
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ fn predicate_references_self(
284284
// In the case of a trait predicate, we can skip the "self" type.
285285
if data.trait_ref.substs[1..].iter().any(has_self_ty) { Some(sp) } else { None }
286286
}
287+
ty::PredicateKind::NotTrait(ref _data, _) => {
288+
todo!("yaahc")
289+
}
287290
ty::PredicateKind::Projection(ref data) => {
288291
// And similarly for projections. This should be redundant with
289292
// the previous check because any projection should have a
@@ -334,6 +337,9 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
334337
ty::PredicateKind::Trait(ref trait_pred, _) => {
335338
trait_pred.def_id() == sized_def_id && trait_pred.self_ty().is_param(0)
336339
}
340+
ty::PredicateKind::NotTrait(ref _trait_pred, _) => {
341+
todo!("yaahc")
342+
}
337343
ty::PredicateKind::Projection(..)
338344
| ty::PredicateKind::Subtype(..)
339345
| ty::PredicateKind::RegionOutlives(..)

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

+4
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
461461
self.evaluate_trait_predicate_recursively(previous_stack, obligation)
462462
}
463463

464+
ty::PredicateKind::NotTrait(_t, _) => {
465+
todo!("yaahc")
466+
}
467+
464468
ty::PredicateKind::Subtype(p) => {
465469
let p = bound_predicate.rebind(p);
466470
// Does this code ever run?

compiler/rustc_trait_selection/src/traits/wf.rs

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ pub fn predicate_obligations<'a, 'tcx>(
110110
ty::PredicateKind::Trait(t, _) => {
111111
wf.compute_trait_ref(&t.trait_ref, Elaborate::None);
112112
}
113+
ty::PredicateKind::NotTrait(_t, _) => {
114+
todo!("yaahc")
115+
}
113116
ty::PredicateKind::RegionOutlives(..) => {}
114117
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty, _reg)) => {
115118
wf.compute(ty.into());

compiler/rustc_traits/src/chalk/lowering.rs

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::InEnvironment<chalk_ir::Goal<RustInterner<'
9090
ty::PredicateKind::Trait(predicate, _) => chalk_ir::DomainGoal::FromEnv(
9191
chalk_ir::FromEnv::Trait(predicate.trait_ref.lower_into(interner)),
9292
),
93+
ty::PredicateKind::NotTrait(_predicate, _) => todo!("yaahc"),
9394
ty::PredicateKind::RegionOutlives(predicate) => chalk_ir::DomainGoal::Holds(
9495
chalk_ir::WhereClause::LifetimeOutlives(chalk_ir::LifetimeOutlives {
9596
a: predicate.0.lower_into(interner),
@@ -142,6 +143,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData<RustInterner<'tcx>>> for ty::Predi
142143
chalk_ir::WhereClause::Implemented(predicate.trait_ref.lower_into(interner)),
143144
))
144145
}
146+
ty::PredicateKind::NotTrait(_predicate, _) => todo!("yaahc"),
145147
ty::PredicateKind::RegionOutlives(predicate) => {
146148
chalk_ir::GoalData::DomainGoal(chalk_ir::DomainGoal::Holds(
147149
chalk_ir::WhereClause::LifetimeOutlives(chalk_ir::LifetimeOutlives {
@@ -572,6 +574,7 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_ir::QuantifiedWhereClause<RustInterner<'
572574
ty::PredicateKind::Trait(predicate, _) => {
573575
Some(chalk_ir::WhereClause::Implemented(predicate.trait_ref.lower_into(interner)))
574576
}
577+
ty::PredicateKind::NotTrait(_predicate, _) => todo!("yaahc"),
575578
ty::PredicateKind::RegionOutlives(predicate) => {
576579
Some(chalk_ir::WhereClause::LifetimeOutlives(chalk_ir::LifetimeOutlives {
577580
a: predicate.0.lower_into(interner),
@@ -708,6 +711,7 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_solve::rust_ir::QuantifiedInlineBound<Ru
708711
predicate.trait_ref.lower_into(interner),
709712
),
710713
)),
714+
ty::PredicateKind::NotTrait(_predicate, _) => todo!("yaahc"),
711715
ty::PredicateKind::Projection(predicate) => Some(chalk_ir::Binders::new(
712716
binders,
713717
chalk_solve::rust_ir::InlineBound::AliasEqBound(predicate.lower_into(interner)),

compiler/rustc_traits/src/implied_outlives_bounds.rs

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ fn compute_implied_outlives_bounds<'tcx>(
105105
| ty::PredicateKind::ConstEvaluatable(..)
106106
| ty::PredicateKind::ConstEquate(..)
107107
| ty::PredicateKind::TypeWellFormedFromEnv(..) => vec![],
108+
ty::PredicateKind::NotTrait(..) => todo!("yaahc"),
108109
ty::PredicateKind::WellFormed(arg) => {
109110
wf_args.push(arg);
110111
vec![]

compiler/rustc_traits/src/normalize_erasing_regions.rs

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ fn normalize_after_erasing_regions<'tcx, T: TypeFoldable<'tcx> + PartialEq + Cop
5959
fn not_outlives_predicate(p: &ty::Predicate<'tcx>) -> bool {
6060
match p.kind().skip_binder() {
6161
ty::PredicateKind::RegionOutlives(..) | ty::PredicateKind::TypeOutlives(..) => false,
62+
ty::PredicateKind::NotTrait(..) => todo!("yaahc"),
6263
ty::PredicateKind::Trait(..)
6364
| ty::PredicateKind::Projection(..)
6465
| ty::PredicateKind::WellFormed(..)

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

+3
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
796796
ty::PredicateKind::Trait(data, _) => {
797797
Some((bound_predicate.rebind(data).to_poly_trait_ref(), obligation))
798798
}
799+
ty::PredicateKind::NotTrait(_data, _) => {
800+
todo!("yaahc")
801+
}
799802
ty::PredicateKind::Subtype(..) => None,
800803
ty::PredicateKind::RegionOutlives(..) => None,
801804
ty::PredicateKind::TypeOutlives(..) => None,

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

+3
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
840840
_ => None,
841841
}
842842
}
843+
ty::PredicateKind::NotTrait(_trait_predicate, _) => {
844+
todo!("yaahc")
845+
}
843846
ty::PredicateKind::Subtype(..)
844847
| ty::PredicateKind::Projection(..)
845848
| ty::PredicateKind::RegionOutlives(..)

compiler/rustc_typeck/src/impl_wf_check/min_specialization.rs

+3
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ fn trait_predicate_kind<'tcx>(
397397
ty::PredicateKind::Trait(pred, hir::Constness::NotConst) => {
398398
Some(tcx.trait_def(pred.def_id()).specialization_kind)
399399
}
400+
ty::PredicateKind::NotTrait(_pred, _) => {
401+
todo!("yaahc")
402+
}
400403
ty::PredicateKind::Trait(_, hir::Constness::Const)
401404
| ty::PredicateKind::RegionOutlives(_)
402405
| ty::PredicateKind::TypeOutlives(_)

compiler/rustc_typeck/src/outlives/explicit.rs

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
5050
)
5151
}
5252

53+
ty::PredicateKind::NotTrait(..) => todo!("yaahc"),
54+
5355
ty::PredicateKind::Trait(..)
5456
| ty::PredicateKind::Projection(..)
5557
| ty::PredicateKind::WellFormed(..)

src/librustdoc/clean/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ impl<'a> Clean<Option<WherePredicate>> for ty::Predicate<'a> {
347347
let bound_predicate = self.kind();
348348
match bound_predicate.skip_binder() {
349349
ty::PredicateKind::Trait(pred, _) => Some(bound_predicate.rebind(pred).clean(cx)),
350+
ty::PredicateKind::NotTrait(_pred, _) => todo!("yaahc"),
350351
ty::PredicateKind::RegionOutlives(pred) => pred.clean(cx),
351352
ty::PredicateKind::TypeOutlives(pred) => pred.clean(cx),
352353
ty::PredicateKind::Projection(pred) => Some(pred.clean(cx)),

src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ pub fn is_min_const_fn(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, msrv: Option<&Ru
5757
_ => continue,
5858
}
5959
},
60+
ty::PredicateKind::NotTrait(_pred, _) => todo!("yaahc"),
6061
}
6162
}
6263
match predicates.parent {

0 commit comments

Comments
 (0)