Skip to content

Commit 249bd61

Browse files
committed
Change WellFormed/FromEnv::Normalize to WellFormed/FromEnv::ProjectionEq
1 parent 91eda35 commit 249bd61

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

src/fold/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ macro_rules! enum_fold {
405405
enum_fold!(PolarizedTraitRef[] { Positive(a), Negative(a) });
406406
enum_fold!(ParameterKind[T,L] { Ty(a), Lifetime(a) } where T: Fold, L: Fold);
407407
enum_fold!(DomainGoal[] { Implemented(a), ProjectionEq(a), Normalize(a), UnselectedNormalize(a), WellFormed(a), FromEnv(a), InScope(a) });
408-
enum_fold!(WellFormed[] { Ty(a), TraitRef(a), Normalize(a) });
409-
enum_fold!(FromEnv[] { Ty(a), TraitRef(a), Normalize(a) });
408+
enum_fold!(WellFormed[] { Ty(a), TraitRef(a), ProjectionEq(a) });
409+
enum_fold!(FromEnv[] { Ty(a), TraitRef(a), ProjectionEq(a) });
410410
enum_fold!(LeafGoal[] { EqGoal(a), DomainGoal(a) });
411411
enum_fold!(Constraint[] { LifetimeEq(a, b) });
412412
enum_fold!(Goal[] { Quantified(qkind, subgoal), Implies(wc, subgoal), And(g1, g2), Not(g), Leaf(wc),

src/ir/debug.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl Debug for WellFormed {
202202
let value: &Debug = match *self {
203203
WellFormed::Ty(ref t) => t,
204204
WellFormed::TraitRef(ref t) => t,
205-
WellFormed::Normalize(ref t) => t,
205+
WellFormed::ProjectionEq(ref t) => t,
206206
};
207207
write!(fmt, "WellFormed({:?})", value)
208208
}
@@ -213,7 +213,7 @@ impl Debug for FromEnv {
213213
let value: &Debug = match *self {
214214
FromEnv::Ty(ref t) => t,
215215
FromEnv::TraitRef(ref t) => t,
216-
FromEnv::Normalize(ref t) => t,
216+
FromEnv::ProjectionEq(ref t) => t,
217217
};
218218
write!(fmt, "FromEnv({:?})", value)
219219
}

src/ir/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ impl DomainGoal {
476476
crate fn into_well_formed_clause(self) -> DomainGoal {
477477
match self {
478478
DomainGoal::Implemented(tr) => DomainGoal::WellFormed(WellFormed::TraitRef(tr)),
479-
DomainGoal::Normalize(n) => DomainGoal::WellFormed(WellFormed::Normalize(n)),
479+
DomainGoal::ProjectionEq(n) => DomainGoal::WellFormed(WellFormed::ProjectionEq(n)),
480480
goal => goal,
481481
}
482482
}
@@ -485,7 +485,7 @@ impl DomainGoal {
485485
crate fn into_from_env_clause(self) -> DomainGoal {
486486
match self {
487487
DomainGoal::Implemented(tr) => DomainGoal::FromEnv(FromEnv::TraitRef(tr)),
488-
DomainGoal::Normalize(n) => DomainGoal::FromEnv(FromEnv::Normalize(n)),
488+
DomainGoal::ProjectionEq(n) => DomainGoal::FromEnv(FromEnv::ProjectionEq(n)),
489489
goal => goal,
490490
}
491491
}
@@ -521,7 +521,7 @@ pub struct EqGoal {
521521
pub enum WellFormed {
522522
Ty(Ty),
523523
TraitRef(TraitRef),
524-
Normalize(Normalize),
524+
ProjectionEq(ProjectionEq),
525525
}
526526

527527
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
@@ -547,7 +547,7 @@ pub enum WellFormed {
547547
pub enum FromEnv {
548548
Ty(Ty),
549549
TraitRef(TraitRef),
550-
Normalize(Normalize),
550+
ProjectionEq(ProjectionEq),
551551
}
552552

553553
/// Proves that the given projection **normalizes** to the given

src/lower/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,9 @@ impl ir::AssociatedTyDatum {
14681468
// `Normalize(<T as Foo>::Assoc -> U)`
14691469
let normalize = ir::Normalize { projection: projection.clone(), ty: ty.clone() };
14701470

1471+
// `ProjectionEq(<T as Foo>::Assoc = U)`
1472+
let projection_eq = ir::ProjectionEq { projection: projection.clone(), ty };
1473+
14711474
// forall<T> {
14721475
// ProjectionEq(<T as Foo>::Assoc = U) :-
14731476
// Normalize(<T as Foo>::Assoc -> U)
@@ -1476,10 +1479,7 @@ impl ir::AssociatedTyDatum {
14761479
implication: ir::Binders {
14771480
binders: binders.clone(),
14781481
value: ir::ProgramClauseImplication {
1479-
consequence: ir::ProjectionEq {
1480-
projection: projection.clone(),
1481-
ty,
1482-
}.cast(),
1482+
consequence: projection_eq.clone().cast(),
14831483
conditions: vec![normalize.clone().cast()],
14841484
},
14851485
},
@@ -1492,16 +1492,16 @@ impl ir::AssociatedTyDatum {
14921492
//
14931493
// forall<T> {
14941494
// WellFormed(T: Foo<Assoc = U>) :-
1495-
// WellFormed(T: Foo), Normalize(<T as Foo>::Assoc -> U)
1495+
// WellFormed(T: Foo), ProjectionEq(<T as Foo>::Assoc = U)
14961496
// }
14971497
clauses.push(ir::ProgramClause {
14981498
implication: ir::Binders {
14991499
binders: binders.clone(),
15001500
value: ir::ProgramClauseImplication {
1501-
consequence: ir::WellFormed::Normalize(normalize.clone()).cast(),
1501+
consequence: ir::WellFormed::ProjectionEq(projection_eq.clone()).cast(),
15021502
conditions: vec![
1503-
normalize.clone().cast(),
1504-
ir::WellFormed::TraitRef(trait_ref.clone()).cast()
1503+
ir::WellFormed::TraitRef(trait_ref.clone()).cast(),
1504+
projection_eq.clone().cast()
15051505
],
15061506
}
15071507
}
@@ -1517,22 +1517,22 @@ impl ir::AssociatedTyDatum {
15171517
binders: binders.clone(),
15181518
value: ir::ProgramClauseImplication {
15191519
consequence: ir::FromEnv::TraitRef(trait_ref).cast(),
1520-
conditions: vec![ir::FromEnv::Normalize(normalize.clone()).cast()],
1520+
conditions: vec![ir::FromEnv::ProjectionEq(projection_eq.clone()).cast()],
15211521
},
15221522
}
15231523
});
15241524

15251525
// And the other one being:
15261526
//
15271527
// forall<T> {
1528-
// Normalize(<T as Foo>::Assoc -> U) :- FromEnv(T: Foo<Assoc = U>)
1528+
// ProjectionEq(<T as Foo>::Assoc = U) :- FromEnv(T: Foo<Assoc = U>)
15291529
// }
15301530
clauses.push(ir::ProgramClause {
15311531
implication: ir::Binders {
15321532
binders: binders,
15331533
value: ir::ProgramClauseImplication {
1534-
consequence: normalize.clone().cast(),
1535-
conditions: vec![ir::FromEnv::Normalize(normalize).cast()],
1534+
consequence: projection_eq.clone().cast(),
1535+
conditions: vec![ir::FromEnv::ProjectionEq(projection_eq).cast()],
15361536
},
15371537
}
15381538
});

src/zip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ enum_zip!(DomainGoal {
224224
InScope,
225225
});
226226
enum_zip!(LeafGoal { DomainGoal, EqGoal });
227-
enum_zip!(WellFormed { Ty, TraitRef, Normalize });
228-
enum_zip!(FromEnv { Ty, TraitRef, Normalize });
227+
enum_zip!(WellFormed { Ty, TraitRef, ProjectionEq });
228+
enum_zip!(FromEnv { Ty, TraitRef, ProjectionEq });
229229

230230
// Annoyingly, Goal cannot use `enum_zip` because some variants have
231231
// two parameters, and I'm too lazy to make the macro account for the

0 commit comments

Comments
 (0)