Skip to content

Commit 8c78fd2

Browse files
committed
Use more appropriate tls::with_* methods in some places.
1 parent d93277b commit 8c78fd2

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/librustc_infer/infer/canonical/canonicalizer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
199199
// rust-lang/rust#57464: `impl Trait` can leak local
200200
// scopes (in manner violating typeck). Therefore, use
201201
// `delay_span_bug` to allow type error over an ICE.
202-
ty::tls::with_context(|c| {
203-
c.tcx.sess.delay_span_bug(
202+
ty::tls::with(|tcx| {
203+
tcx.sess.delay_span_bug(
204204
rustc_span::DUMMY_SP,
205205
&format!("unexpected region in query response: `{:?}`", r),
206206
);

src/librustc_middle/mir/interpret/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ impl From<ErrorHandled> for InterpErrorInfo<'_> {
242242

243243
impl<'tcx> From<InterpError<'tcx>> for InterpErrorInfo<'tcx> {
244244
fn from(kind: InterpError<'tcx>) -> Self {
245-
let capture_backtrace = tls::with_context_opt(|ctxt| {
246-
if let Some(ctxt) = ctxt {
247-
*Lock::borrow(&ctxt.tcx.sess.ctfe_backtrace)
245+
let capture_backtrace = tls::with_opt(|tcx| {
246+
if let Some(tcx) = tcx {
247+
*Lock::borrow(&tcx.sess.ctfe_backtrace)
248248
} else {
249249
CtfeBacktrace::Disabled
250250
}

src/librustc_middle/ty/query/job.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ pub unsafe fn handle_deadlock() {
2222
thread::spawn(move || {
2323
tls::enter_context(icx, |_| {
2424
rustc_ast::attr::SESSION_GLOBALS.set(ast_session_globals, || {
25-
rustc_span::SESSION_GLOBALS.set(span_session_globals, || {
26-
tls::with_context(|icx| deadlock(icx.tcx, &registry))
27-
})
25+
rustc_span::SESSION_GLOBALS
26+
.set(span_session_globals, || tls::with(|tcx| deadlock(tcx, &registry)))
2827
});
2928
})
3029
});

0 commit comments

Comments
 (0)