We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
with_tlv
1 parent f7b3e39 commit 18f751dCopy full SHA for 18f751d
compiler/rustc_middle/src/lib.rs
@@ -34,6 +34,7 @@
34
#![feature(get_mut_unchecked)]
35
#![feature(if_let_guard)]
36
#![feature(iter_from_generator)]
37
+#![feature(local_key_cell_methods)]
38
#![feature(negative_impls)]
39
#![feature(never_type)]
40
#![feature(extern_types)]
compiler/rustc_middle/src/ty/context/tls.rs
@@ -89,9 +89,8 @@ mod tlv {
89
/// This is used to set the pointer to the new `ImplicitCtxt`.
90
#[inline]
91
pub(super) fn with_tlv<F: FnOnce() -> R, R>(value: *const (), f: F) -> R {
92
- let old = get_tlv();
93
- let _reset = rustc_data_structures::OnDrop(move || TLV.with(|tlv| tlv.set(old)));
94
- TLV.with(|tlv| tlv.set(value));
+ let old = TLV.replace(value);
+ let _reset = rustc_data_structures::OnDrop(move || TLV.set(old));
95
f()
96
}
97
0 commit comments