- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Description
A perf regression was introduced by #104846, #104846 (comment)
Right now we are moving (moderately large) Clauses around. What we often do in the compiler is to wrap such types in a newtype and an Interned (see ty::Ty, ty::Predicate and ty::Const) for examples. So what we could do is do the same thing with Clause. It does mean every time we match on it we need to add and call something like the kind method on Ty and Predicate to get at the inner Clause. There's also some naming issues, as you can't have both the interned type and the inner type be called ty::Clause. One solution could be to publicly reexport all Clause variants from the clause module, so we can write clause::Trait instead of Clause::Trait, and then rename the current Clause enum to ClauseKind. After that the Clause name is free again for use by the wrapper type.
each of these steps could be a separate PR, but should at least be a separate commit for easy review and rebases.
The plan again in a more structured manner (where each step is a commit):
-  (E-easy) reexportClause's variants from theclausemodule and change all uses ofClause::Footoclause::Fooand import theclausemodule where necessary.
-  (E-medium) renameClausetoClauseKindand add the wrapper type calledClause, addClauseto thedirect_interners!macro invocation, usemk_clauseat all sites that createClauses, add akindmethod to the newClausetype, callkindat each site that matches onClauseKindvariants.