mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Avoid some tls::with
calls.
These are in places where a `tcx` is easily obtained.
This commit is contained in:
parent
18f751df6a
commit
afbe167fbb
@ -54,7 +54,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
|
||||
|
||||
trace!(
|
||||
"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))
|
||||
);
|
||||
|
||||
|
@ -203,12 +203,10 @@ impl CanonicalizeMode 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(|tcx| {
|
||||
tcx.sess.delay_span_bug(
|
||||
rustc_span::DUMMY_SP,
|
||||
&format!("unexpected region in query response: `{:?}`", r),
|
||||
);
|
||||
});
|
||||
canonicalizer.tcx.sess.delay_span_bug(
|
||||
rustc_span::DUMMY_SP,
|
||||
&format!("unexpected region in query response: `{:?}`", r),
|
||||
);
|
||||
r
|
||||
}
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ impl<'tcx, 'a> GeneratorData<'tcx, 'a> {
|
||||
// obligation
|
||||
fn get_from_await_ty<F>(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
visitor: AwaitsVisitor,
|
||||
hir: map::Map<'tcx>,
|
||||
ty_matches: F,
|
||||
@ -134,9 +135,7 @@ impl<'tcx, 'a> GeneratorData<'tcx, 'a> {
|
||||
.unwrap_or_else(|| {
|
||||
bug!(
|
||||
"node_type: no type for node {}",
|
||||
ty::tls::with(|tcx| tcx
|
||||
.hir()
|
||||
.node_to_string(await_expr.hir_id))
|
||||
tcx.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 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);
|
||||
|
||||
// The generator interior types share the same binders
|
||||
|
Loading…
Reference in New Issue
Block a user