Reset rustc's scoped TLS state during unwinding.
2af39b7
Opened by Eduard-Mihai Burtescu at
This should only happen in the event of an ICE, but right now, if a Drop implementation (for e.g. a field in Session) would try to access, say, the TLS_TCX, it would use-after-free the global TyCtxt.
Isn't this disallowed by the
LocalKeyrequirement that a key's "initializer cannot recursively depend on itself"? To be fair, that wording was only added to the documentation recently.Joshua Liebow-Feeser at 2018-01-07 08:40:34
@joshlf We use
thread_localto hold a raw pointer in aCellin order to do scoped TLS, the actual usage ofLocalKeyitself is trivial, it's what we do with the pointer that matters.Eduard-Mihai Burtescu at 2018-01-07 12:56:15