Avoid some tls::with
calls.
These are in places where a `tcx` is easily obtained.
This commit is contained in:
parent
18f751df6a
commit
afbe167fbb
3 changed files with 8 additions and 11 deletions
|
@ -54,7 +54,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
|
||||||
|
|
||||||
trace!(
|
trace!(
|
||||||
"eval_body_using_ecx: pushing stack frame for global: {}{}",
|
"eval_body_using_ecx: pushing stack frame for global: {}{}",
|
||||||
with_no_trimmed_paths!(ty::tls::with(|tcx| tcx.def_path_str(cid.instance.def_id()))),
|
with_no_trimmed_paths!(ecx.tcx.def_path_str(cid.instance.def_id())),
|
||||||
cid.promoted.map_or_else(String::new, |p| format!("::promoted[{:?}]", p))
|
cid.promoted.map_or_else(String::new, |p| format!("::promoted[{:?}]", p))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -203,12 +203,10 @@ impl CanonicalizeMode for CanonicalizeQueryResponse {
|
||||||
// rust-lang/rust#57464: `impl Trait` can leak local
|
// rust-lang/rust#57464: `impl Trait` can leak local
|
||||||
// scopes (in manner violating typeck). Therefore, use
|
// scopes (in manner violating typeck). Therefore, use
|
||||||
// `delay_span_bug` to allow type error over an ICE.
|
// `delay_span_bug` to allow type error over an ICE.
|
||||||
ty::tls::with(|tcx| {
|
canonicalizer.tcx.sess.delay_span_bug(
|
||||||
tcx.sess.delay_span_bug(
|
rustc_span::DUMMY_SP,
|
||||||
rustc_span::DUMMY_SP,
|
&format!("unexpected region in query response: `{:?}`", r),
|
||||||
&format!("unexpected region in query response: `{:?}`", r),
|
);
|
||||||
);
|
|
||||||
});
|
|
||||||
r
|
r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,7 @@ impl<'tcx, 'a> GeneratorData<'tcx, 'a> {
|
||||||
// obligation
|
// obligation
|
||||||
fn get_from_await_ty<F>(
|
fn get_from_await_ty<F>(
|
||||||
&self,
|
&self,
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
visitor: AwaitsVisitor,
|
visitor: AwaitsVisitor,
|
||||||
hir: map::Map<'tcx>,
|
hir: map::Map<'tcx>,
|
||||||
ty_matches: F,
|
ty_matches: F,
|
||||||
|
@ -134,9 +135,7 @@ impl<'tcx, 'a> GeneratorData<'tcx, 'a> {
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
bug!(
|
bug!(
|
||||||
"node_type: no type for node {}",
|
"node_type: no type for node {}",
|
||||||
ty::tls::with(|tcx| tcx
|
tcx.hir().node_to_string(await_expr.hir_id)
|
||||||
.hir()
|
|
||||||
.node_to_string(await_expr.hir_id))
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -2351,7 +2350,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
|
|
||||||
let mut interior_or_upvar_span = None;
|
let mut interior_or_upvar_span = None;
|
||||||
|
|
||||||
let from_awaited_ty = generator_data.get_from_await_ty(visitor, hir, ty_matches);
|
let from_awaited_ty = generator_data.get_from_await_ty(self.tcx, visitor, hir, ty_matches);
|
||||||
debug!(?from_awaited_ty);
|
debug!(?from_awaited_ty);
|
||||||
|
|
||||||
// The generator interior types share the same binders
|
// The generator interior types share the same binders
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue