Use more appropriate tls::with_*
methods in some places.
This commit is contained in:
parent
d93277b915
commit
8c78fd234b
@ -199,8 +199,8 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
|
||||
// rust-lang/rust#57464: `impl Trait` can leak local
|
||||
// scopes (in manner violating typeck). Therefore, use
|
||||
// `delay_span_bug` to allow type error over an ICE.
|
||||
ty::tls::with_context(|c| {
|
||||
c.tcx.sess.delay_span_bug(
|
||||
ty::tls::with(|tcx| {
|
||||
tcx.sess.delay_span_bug(
|
||||
rustc_span::DUMMY_SP,
|
||||
&format!("unexpected region in query response: `{:?}`", r),
|
||||
);
|
||||
|
@ -242,9 +242,9 @@ impl From<ErrorHandled> for InterpErrorInfo<'_> {
|
||||
|
||||
impl<'tcx> From<InterpError<'tcx>> for InterpErrorInfo<'tcx> {
|
||||
fn from(kind: InterpError<'tcx>) -> Self {
|
||||
let capture_backtrace = tls::with_context_opt(|ctxt| {
|
||||
if let Some(ctxt) = ctxt {
|
||||
*Lock::borrow(&ctxt.tcx.sess.ctfe_backtrace)
|
||||
let capture_backtrace = tls::with_opt(|tcx| {
|
||||
if let Some(tcx) = tcx {
|
||||
*Lock::borrow(&tcx.sess.ctfe_backtrace)
|
||||
} else {
|
||||
CtfeBacktrace::Disabled
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ pub unsafe fn handle_deadlock() {
|
||||
thread::spawn(move || {
|
||||
tls::enter_context(icx, |_| {
|
||||
rustc_ast::attr::SESSION_GLOBALS.set(ast_session_globals, || {
|
||||
rustc_span::SESSION_GLOBALS.set(span_session_globals, || {
|
||||
tls::with_context(|icx| deadlock(icx.tcx, ®istry))
|
||||
})
|
||||
rustc_span::SESSION_GLOBALS
|
||||
.set(span_session_globals, || tls::with(|tcx| deadlock(tcx, ®istry)))
|
||||
});
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user