diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-09 10:51:29 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-09 15:28:04 +1100 |
| commit | afbe167fbb683fc1ed1c7577ab2eaa12cc44a6bf (patch) | |
| tree | ad32818d90f37017dc6bca3c39bea287c8b4c4af /compiler/rustc_trait_selection | |
| parent | 18f751df6adc6342ee0814dd6bc36bf867ff0029 (diff) | |
| download | rust-afbe167fbb683fc1ed1c7577ab2eaa12cc44a6bf.tar.gz rust-afbe167fbb683fc1ed1c7577ab2eaa12cc44a6bf.zip | |
Avoid some `tls::with` calls.
These are in places where a `tcx` is easily obtained.
Diffstat (limited to 'compiler/rustc_trait_selection')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 59aef52910e..2b543520198 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -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 |
