-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-traits[RETIRED] Working group: Traits[RETIRED] Working group: Traits
Description
Currently we have a setup where we have an enum Goal:
rust/src/librustc/traits/mod.rs
Lines 296 to 304 in ac287ed
| #[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:
rust/src/librustc/traits/mod.rs
Line 306 in ac287ed
| 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
GoaltoGoalKind - Add a type alias
Goal<'tcx> = &'tcx GoalKind<'tcx> - And thus change
Goals<'tcx>to a slice of interned refs.
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-traits[RETIRED] Working group: Traits[RETIRED] Working group: Traits