Closed
Description
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 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
toGoalKind
- Add a type alias
Goal<'tcx> = &'tcx GoalKind<'tcx>
- And thus change
Goals<'tcx>
to a slice of interned refs.