Mark newtype constructors as used in the Coercible solver (#10347)
Currently, newtype constructors are not marked as used when they are
accessed under the hood by uses of coerce
, as described in #10347 (closed).
This fixes #10347 (closed) by co-opting the tcg_keep
field of TcGblEnv
to track uses of newtype constructors in the Coercible
solver.
See Note [Tracking unused binding and imports]
in TcRnTypes
.
Since #10347 (closed) is fixed, I was able to simplify the code in TcDeriv
slightly, as the hack described in
Note [Newtype deriving and unused constructors]
is no longer necessary.