Currently we have a setup where we have an enum Goal:
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
|
pub enum Goal<'tcx> { |
|
Implies(Clauses<'tcx>, &'tcx Goal<'tcx>), |
|
And(&'tcx Goal<'tcx>, &'tcx Goal<'tcx>), |
|
Not(&'tcx Goal<'tcx>), |
|
DomainGoal(DomainGoal<'tcx>), |
|
Quantified(QuantifierKind, ty::Binder<&'tcx Goal<'tcx>>), |
|
CannotProve, |
|
} |
This enum contains interned goals (&'tcx Goal<'tcx>). We also have slices of goals:
|
pub type Goals<'tcx> = &'tcx Slice<Goal<'tcx>>; |
This works ok as long as we pass around Goal<'tcx> enum values. But I suspect we might rather pass around pointers to interned goals, rather like Ty<'tcx> is a reference. This would also allow us to do cheap equality testing, hashing and so forth if we cared to.
Therefore, we probably ought to:
- Rename the enum
Goal to GoalKind
- Add a type alias
Goal<'tcx> = &'tcx GoalKind<'tcx>
- And thus change
Goals<'tcx> to a slice of interned refs.
Currently we have a setup where we have an enum
Goal:rust/src/librustc/traits/mod.rs
Lines 296 to 304 in ac287ed
This enum contains interned goals (
&'tcx Goal<'tcx>). We also have slices of goals:rust/src/librustc/traits/mod.rs
Line 306 in ac287ed
This works ok as long as we pass around
Goal<'tcx>enum values. But I suspect we might rather pass around pointers to interned goals, rather likeTy<'tcx>is a reference. This would also allow us to do cheap equality testing, hashing and so forth if we cared to.Therefore, we probably ought to:
GoaltoGoalKindGoal<'tcx> = &'tcx GoalKind<'tcx>Goals<'tcx>to a slice of interned refs.