6a454edce9
The TargetMachine may be referencing data in the context. In particular, at least the GlobalISel instruction selector stored in the TM may reference a TrackedMDNode DebugLoc that destruction of the TargetMachine will try to untrack.
The codegen
crate contains the code to convert from MIR into LLVM IR,
and then from LLVM IR into machine code. In general it contains code
that runs towards the end of the compilation process.
For more information about how codegen works, see the rustc dev guide.