Skip to content

Commit daae919

Browse files
committed
Overhaul the intravisit::Map trait.
First of all, note that `Map` has three different relevant meanings. - The `intravisit::Map` trait. - The `map::Map` struct. - The `NestedFilter::Map` associated type. The `intravisit::Map` trait is impl'd twice. - For `!`, where the methods are all unreachable. - For `map::Map`, which gets HIR stuff from the `TyCtxt`. As part of getting rid of `map::Map`, this commit changes `impl intravisit::Map for map::Map` to `impl intravisit::Map for TyCtxt`. It's fairly straightforward except various things are renamed, because the existing names would no longer have made sense. - `trait intravisit::Map` becomes `trait intravisit::HirTyCtxt`, so named because it gets some HIR stuff from a `TyCtxt`. - `NestedFilter::Map` assoc type becomes `NestedFilter::MaybeTyCtxt`, because it's always `!` or `TyCtxt`. - `Visitor::nested_visit_map` becomes `Visitor::maybe_tcx`. I deliberately made the new trait and associated type names different to avoid the old `type Map: Map` situation, which I found confusing. We now have `type MaybeTyCtxt: HirTyCtxt`.
1 parent ca89998 commit daae919

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+208
-210
lines changed

Diff for: compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
348348
expr: Option<&'hir hir::Expr<'hir>>,
349349
pat: Option<&'hir hir::Pat<'hir>>,
350350
parent_pat: Option<&'hir hir::Pat<'hir>>,
351-
hir: rustc_middle::hir::map::Map<'hir>,
351+
tcx: TyCtxt<'hir>,
352352
}
353353
impl<'hir> Visitor<'hir> for ExpressionFinder<'hir> {
354354
type NestedFilter = OnlyBodies;
355355

356-
fn nested_visit_map(&mut self) -> Self::Map {
357-
self.hir
356+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
357+
self.tcx
358358
}
359359

360360
fn visit_expr(&mut self, e: &'hir hir::Expr<'hir>) {
@@ -396,7 +396,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
396396
expr: None,
397397
pat: None,
398398
parent_pat: None,
399-
hir,
399+
tcx: self.infcx.tcx,
400400
};
401401
finder.visit_expr(expr);
402402
if let Some(span) = span
@@ -2455,7 +2455,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
24552455
let body_expr = tcx.hir_body(body_id).value;
24562456

24572457
struct ClosureFinder<'hir> {
2458-
hir: rustc_middle::hir::map::Map<'hir>,
2458+
tcx: TyCtxt<'hir>,
24592459
borrow_span: Span,
24602460
res: Option<(&'hir hir::Expr<'hir>, &'hir hir::Closure<'hir>)>,
24612461
/// The path expression with the `borrow_span` span
@@ -2464,8 +2464,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
24642464
impl<'hir> Visitor<'hir> for ClosureFinder<'hir> {
24652465
type NestedFilter = OnlyBodies;
24662466

2467-
fn nested_visit_map(&mut self) -> Self::Map {
2468-
self.hir
2467+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
2468+
self.tcx
24692469
}
24702470

24712471
fn visit_expr(&mut self, ex: &'hir hir::Expr<'hir>) {
@@ -2491,7 +2491,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
24912491

24922492
// Find the closure that most tightly wraps `capture_kind_span`
24932493
let mut finder =
2494-
ClosureFinder { hir, borrow_span: capture_kind_span, res: None, error_path: None };
2494+
ClosureFinder { tcx, borrow_span: capture_kind_span, res: None, error_path: None };
24952495
finder.visit_expr(body_expr);
24962496
let Some((closure_expr, closure)) = finder.res else { return };
24972497

Diff for: compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ impl<'tcx> BorrowExplanation<'tcx> {
256256

257257
impl<'hir> rustc_hir::intravisit::Visitor<'hir> for FindLetExpr<'hir> {
258258
type NestedFilter = rustc_middle::hir::nested_filter::OnlyBodies;
259-
fn nested_visit_map(&mut self) -> Self::Map {
260-
self.tcx.hir()
259+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
260+
self.tcx
261261
}
262262
fn visit_expr(&mut self, expr: &'hir hir::Expr<'hir>) {
263263
if let hir::ExprKind::If(cond, _conseq, _alt)

Diff for: compiler/rustc_borrowck/src/diagnostics/move_errors.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_hir::intravisit::Visitor;
77
use rustc_hir::{self as hir, CaptureBy, ExprKind, HirId, Node};
88
use rustc_middle::bug;
99
use rustc_middle::mir::*;
10-
use rustc_middle::ty::{self, Ty};
10+
use rustc_middle::ty::{self, Ty, TyCtxt};
1111
use rustc_mir_dataflow::move_paths::{LookupResult, MovePathIndex};
1212
use rustc_span::{BytePos, ExpnKind, MacroKind, Span};
1313
use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
@@ -690,7 +690,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
690690
/// make it bind by reference instead (if possible)
691691
struct BindingFinder<'tcx> {
692692
typeck_results: &'tcx ty::TypeckResults<'tcx>,
693-
hir: rustc_middle::hir::map::Map<'tcx>,
693+
tcx: TyCtxt<'tcx>,
694694
/// Input: the span of the pattern we're finding bindings in
695695
pat_span: Span,
696696
/// Input: the spans of the bindings we're providing suggestions for
@@ -709,8 +709,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
709709
impl<'tcx> Visitor<'tcx> for BindingFinder<'tcx> {
710710
type NestedFilter = rustc_middle::hir::nested_filter::OnlyBodies;
711711

712-
fn nested_visit_map(&mut self) -> Self::Map {
713-
self.hir
712+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
713+
self.tcx
714714
}
715715

716716
fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) -> Self::Result {
@@ -782,7 +782,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
782782
let typeck_results = self.infcx.tcx.typeck(self.mir_def_id());
783783
let mut finder = BindingFinder {
784784
typeck_results,
785-
hir,
785+
tcx: self.infcx.tcx,
786786
pat_span,
787787
binding_spans,
788788
found_pat: false,

Diff for: compiler/rustc_hir/src/intravisit.rs

+34-32
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! within one another.
1919
//! - Example: Examine each expression to look for its type and do some check or other.
2020
//! - How: Implement `intravisit::Visitor` and override the `NestedFilter` type to
21-
//! `nested_filter::OnlyBodies` (and implement `nested_visit_map`), and use
21+
//! `nested_filter::OnlyBodies` (and implement `maybe_tcx`), and use
2222
//! `tcx.hir().visit_all_item_likes_in_crate(&mut visitor)`. Within your
2323
//! `intravisit::Visitor` impl, implement methods like `visit_expr()` (don't forget to invoke
2424
//! `intravisit::walk_expr()` to keep walking the subparts).
@@ -30,7 +30,7 @@
3030
//! - Example: Lifetime resolution, which wants to bring lifetimes declared on the
3131
//! impl into scope while visiting the impl-items, and then back out again.
3232
//! - How: Implement `intravisit::Visitor` and override the `NestedFilter` type to
33-
//! `nested_filter::All` (and implement `nested_visit_map`). Walk your crate with
33+
//! `nested_filter::All` (and implement `maybe_tcx`). Walk your crate with
3434
//! `tcx.hir().walk_toplevel_module(visitor)` invoked on `tcx.hir().krate()`.
3535
//! - Pro: Visitor methods for any kind of HIR node, not just item-like things.
3636
//! - Pro: Preserves nesting information
@@ -106,41 +106,43 @@ impl<'a> FnKind<'a> {
106106
}
107107
}
108108

109-
/// An abstract representation of the HIR `rustc_middle::hir::map::Map`.
110-
pub trait Map<'hir> {
109+
/// HIR things retrievable from `TyCtxt`, avoiding an explicit dependence on
110+
/// `TyCtxt`. The only impls are for `!` (where these functions are never
111+
/// called) and `TyCtxt` (in `rustc_middle`).
112+
pub trait HirTyCtxt<'hir> {
111113
/// Retrieves the `Node` corresponding to `id`.
112114
fn hir_node(&self, hir_id: HirId) -> Node<'hir>;
113-
fn body(&self, id: BodyId) -> &'hir Body<'hir>;
114-
fn item(&self, id: ItemId) -> &'hir Item<'hir>;
115-
fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir>;
116-
fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem<'hir>;
117-
fn foreign_item(&self, id: ForeignItemId) -> &'hir ForeignItem<'hir>;
115+
fn hir_body(&self, id: BodyId) -> &'hir Body<'hir>;
116+
fn hir_item(&self, id: ItemId) -> &'hir Item<'hir>;
117+
fn hir_trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir>;
118+
fn hir_impl_item(&self, id: ImplItemId) -> &'hir ImplItem<'hir>;
119+
fn hir_foreign_item(&self, id: ForeignItemId) -> &'hir ForeignItem<'hir>;
118120
}
119121

120-
// Used when no map is actually available, forcing manual implementation of nested visitors.
121-
impl<'hir> Map<'hir> for ! {
122+
// Used when no tcx is actually available, forcing manual implementation of nested visitors.
123+
impl<'hir> HirTyCtxt<'hir> for ! {
122124
fn hir_node(&self, _: HirId) -> Node<'hir> {
123125
unreachable!();
124126
}
125-
fn body(&self, _: BodyId) -> &'hir Body<'hir> {
127+
fn hir_body(&self, _: BodyId) -> &'hir Body<'hir> {
126128
unreachable!();
127129
}
128-
fn item(&self, _: ItemId) -> &'hir Item<'hir> {
130+
fn hir_item(&self, _: ItemId) -> &'hir Item<'hir> {
129131
unreachable!();
130132
}
131-
fn trait_item(&self, _: TraitItemId) -> &'hir TraitItem<'hir> {
133+
fn hir_trait_item(&self, _: TraitItemId) -> &'hir TraitItem<'hir> {
132134
unreachable!();
133135
}
134-
fn impl_item(&self, _: ImplItemId) -> &'hir ImplItem<'hir> {
136+
fn hir_impl_item(&self, _: ImplItemId) -> &'hir ImplItem<'hir> {
135137
unreachable!();
136138
}
137-
fn foreign_item(&self, _: ForeignItemId) -> &'hir ForeignItem<'hir> {
139+
fn hir_foreign_item(&self, _: ForeignItemId) -> &'hir ForeignItem<'hir> {
138140
unreachable!();
139141
}
140142
}
141143

142144
pub mod nested_filter {
143-
use super::Map;
145+
use super::HirTyCtxt;
144146

145147
/// Specifies what nested things a visitor wants to visit. By "nested
146148
/// things", we are referring to bits of HIR that are not directly embedded
@@ -155,7 +157,7 @@ pub mod nested_filter {
155157
/// See the comments at [`rustc_hir::intravisit`] for more details on the overall
156158
/// visit strategy.
157159
pub trait NestedFilter<'hir> {
158-
type Map: Map<'hir>;
160+
type MaybeTyCtxt: HirTyCtxt<'hir>;
159161

160162
/// Whether the visitor visits nested "item-like" things.
161163
/// E.g., item, impl-item.
@@ -171,10 +173,10 @@ pub mod nested_filter {
171173
///
172174
/// Use this if you are only walking some particular kind of tree
173175
/// (i.e., a type, or fn signature) and you don't want to thread a
174-
/// HIR map around.
176+
/// `tcx` around.
175177
pub struct None(());
176178
impl NestedFilter<'_> for None {
177-
type Map = !;
179+
type MaybeTyCtxt = !;
178180
const INTER: bool = false;
179181
const INTRA: bool = false;
180182
}
@@ -199,18 +201,18 @@ use nested_filter::NestedFilter;
199201
/// to monitor future changes to `Visitor` in case a new method with a
200202
/// new default implementation gets introduced.)
201203
pub trait Visitor<'v>: Sized {
202-
// This type should not be overridden, it exists for convenient usage as `Self::Map`.
203-
type Map: Map<'v> = <Self::NestedFilter as NestedFilter<'v>>::Map;
204+
// This type should not be overridden, it exists for convenient usage as `Self::MaybeTyCtxt`.
205+
type MaybeTyCtxt: HirTyCtxt<'v> = <Self::NestedFilter as NestedFilter<'v>>::MaybeTyCtxt;
204206

205207
///////////////////////////////////////////////////////////////////////////
206208
// Nested items.
207209

208210
/// Override this type to control which nested HIR are visited; see
209211
/// [`NestedFilter`] for details. If you override this type, you
210-
/// must also override [`nested_visit_map`](Self::nested_visit_map).
212+
/// must also override [`maybe_tcx`](Self::maybe_tcx).
211213
///
212214
/// **If for some reason you want the nested behavior, but don't
213-
/// have a `Map` at your disposal:** then override the
215+
/// have a `tcx` at your disposal:** then override the
214216
/// `visit_nested_XXX` methods. If a new `visit_nested_XXX` variant is
215217
/// added in the future, it will cause a panic which can be detected
216218
/// and fixed appropriately.
@@ -222,9 +224,9 @@ pub trait Visitor<'v>: Sized {
222224

223225
/// If `type NestedFilter` is set to visit nested items, this method
224226
/// must also be overridden to provide a map to retrieve nested items.
225-
fn nested_visit_map(&mut self) -> Self::Map {
227+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
226228
panic!(
227-
"nested_visit_map must be implemented or consider using \
229+
"maybe_tcx must be implemented or consider using \
228230
`type NestedFilter = nested_filter::None` (the default)"
229231
);
230232
}
@@ -236,10 +238,10 @@ pub trait Visitor<'v>: Sized {
236238
/// "deep" visit patterns described at
237239
/// [`rustc_hir::intravisit`]. The only reason to override
238240
/// this method is if you want a nested pattern but cannot supply a
239-
/// [`Map`]; see `nested_visit_map` for advice.
241+
/// [`TyCtxt`]; see `maybe_tcx` for advice.
240242
fn visit_nested_item(&mut self, id: ItemId) -> Self::Result {
241243
if Self::NestedFilter::INTER {
242-
let item = self.nested_visit_map().item(id);
244+
let item = self.maybe_tcx().hir_item(id);
243245
try_visit!(self.visit_item(item));
244246
}
245247
Self::Result::output()
@@ -250,7 +252,7 @@ pub trait Visitor<'v>: Sized {
250252
/// method.
251253
fn visit_nested_trait_item(&mut self, id: TraitItemId) -> Self::Result {
252254
if Self::NestedFilter::INTER {
253-
let item = self.nested_visit_map().trait_item(id);
255+
let item = self.maybe_tcx().hir_trait_item(id);
254256
try_visit!(self.visit_trait_item(item));
255257
}
256258
Self::Result::output()
@@ -261,7 +263,7 @@ pub trait Visitor<'v>: Sized {
261263
/// method.
262264
fn visit_nested_impl_item(&mut self, id: ImplItemId) -> Self::Result {
263265
if Self::NestedFilter::INTER {
264-
let item = self.nested_visit_map().impl_item(id);
266+
let item = self.maybe_tcx().hir_impl_item(id);
265267
try_visit!(self.visit_impl_item(item));
266268
}
267269
Self::Result::output()
@@ -272,7 +274,7 @@ pub trait Visitor<'v>: Sized {
272274
/// method.
273275
fn visit_nested_foreign_item(&mut self, id: ForeignItemId) -> Self::Result {
274276
if Self::NestedFilter::INTER {
275-
let item = self.nested_visit_map().foreign_item(id);
277+
let item = self.maybe_tcx().hir_foreign_item(id);
276278
try_visit!(self.visit_foreign_item(item));
277279
}
278280
Self::Result::output()
@@ -283,7 +285,7 @@ pub trait Visitor<'v>: Sized {
283285
/// `Self::NestedFilter`.
284286
fn visit_nested_body(&mut self, id: BodyId) -> Self::Result {
285287
if Self::NestedFilter::INTRA {
286-
let body = self.nested_visit_map().body(id);
288+
let body = self.maybe_tcx().hir_body(id);
287289
try_visit!(self.visit_body(body));
288290
}
289291
Self::Result::output()

Diff for: compiler/rustc_hir_analysis/src/check/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,8 @@ fn best_definition_site_of_opaque<'tcx>(
468468
impl<'tcx> intravisit::Visitor<'tcx> for TaitConstraintLocator<'tcx> {
469469
type NestedFilter = nested_filter::All;
470470
type Result = ControlFlow<(Span, LocalDefId)>;
471-
fn nested_visit_map(&mut self) -> Self::Map {
472-
self.tcx.hir()
471+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
472+
self.tcx
473473
}
474474
fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) -> Self::Result {
475475
if let hir::ExprKind::Closure(closure) = ex.kind {

Diff for: compiler/rustc_hir_analysis/src/collect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ fn reject_placeholder_type_signatures_in_item<'tcx>(
277277
impl<'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
278278
type NestedFilter = nested_filter::OnlyBodies;
279279

280-
fn nested_visit_map(&mut self) -> Self::Map {
281-
self.tcx.hir()
280+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
281+
self.tcx
282282
}
283283

284284
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {

Diff for: compiler/rustc_hir_analysis/src/collect/dump.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) {
5454
impl<'tcx> intravisit::Visitor<'tcx> for AnonConstFinder<'tcx> {
5555
type NestedFilter = nested_filter::All;
5656

57-
fn nested_visit_map(&mut self) -> Self::Map {
58-
self.tcx.hir()
57+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
58+
self.tcx
5959
}
6060

6161
fn visit_anon_const(&mut self, c: &'tcx rustc_hir::AnonConst) {

Diff for: compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ enum NonLifetimeBinderAllowed {
422422
impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
423423
type NestedFilter = nested_filter::OnlyBodies;
424424

425-
fn nested_visit_map(&mut self) -> Self::Map {
426-
self.tcx.hir()
425+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
426+
self.tcx
427427
}
428428

429429
fn visit_nested_body(&mut self, body: hir::BodyId) {

Diff for: compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ impl TaitConstraintLocator<'_> {
298298
impl<'tcx> intravisit::Visitor<'tcx> for TaitConstraintLocator<'tcx> {
299299
type NestedFilter = nested_filter::All;
300300

301-
fn nested_visit_map(&mut self) -> Self::Map {
302-
self.tcx.hir()
301+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
302+
self.tcx
303303
}
304304
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
305305
if let hir::ExprKind::Closure(closure) = ex.kind {
@@ -441,8 +441,8 @@ impl RpitConstraintChecker<'_> {
441441
impl<'tcx> intravisit::Visitor<'tcx> for RpitConstraintChecker<'tcx> {
442442
type NestedFilter = nested_filter::OnlyBodies;
443443

444-
fn nested_visit_map(&mut self) -> Self::Map {
445-
self.tcx.hir()
444+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
445+
self.tcx
446446
}
447447
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
448448
if let hir::ExprKind::Closure(closure) = ex.kind {

Diff for: compiler/rustc_hir_pretty/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use rustc_span::source_map::SourceMap;
2424
use rustc_span::{FileName, Ident, Span, Symbol, kw};
2525
use {rustc_ast as ast, rustc_hir as hir};
2626

27-
pub fn id_to_string(map: &dyn rustc_hir::intravisit::Map<'_>, hir_id: HirId) -> String {
28-
to_string(&map, |s| s.print_node(map.hir_node(hir_id)))
27+
pub fn id_to_string(cx: &dyn rustc_hir::intravisit::HirTyCtxt<'_>, hir_id: HirId) -> String {
28+
to_string(&cx, |s| s.print_node(cx.hir_node(hir_id)))
2929
}
3030

3131
pub enum AnnNode<'a> {
@@ -54,15 +54,15 @@ pub trait PpAnn {
5454
fn post(&self, _state: &mut State<'_>, _node: AnnNode<'_>) {}
5555
}
5656

57-
impl PpAnn for &dyn rustc_hir::intravisit::Map<'_> {
57+
impl PpAnn for &dyn rustc_hir::intravisit::HirTyCtxt<'_> {
5858
fn nested(&self, state: &mut State<'_>, nested: Nested) {
5959
match nested {
60-
Nested::Item(id) => state.print_item(self.item(id)),
61-
Nested::TraitItem(id) => state.print_trait_item(self.trait_item(id)),
62-
Nested::ImplItem(id) => state.print_impl_item(self.impl_item(id)),
63-
Nested::ForeignItem(id) => state.print_foreign_item(self.foreign_item(id)),
64-
Nested::Body(id) => state.print_expr(self.body(id).value),
65-
Nested::BodyParamPat(id, i) => state.print_pat(self.body(id).params[i].pat),
60+
Nested::Item(id) => state.print_item(self.hir_item(id)),
61+
Nested::TraitItem(id) => state.print_trait_item(self.hir_trait_item(id)),
62+
Nested::ImplItem(id) => state.print_impl_item(self.hir_impl_item(id)),
63+
Nested::ForeignItem(id) => state.print_foreign_item(self.hir_foreign_item(id)),
64+
Nested::Body(id) => state.print_expr(self.hir_body(id).value),
65+
Nested::BodyParamPat(id, i) => state.print_pat(self.hir_body(id).params[i].pat),
6666
}
6767
}
6868
}

Diff for: compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2735,8 +2735,8 @@ struct FindClosureArg<'tcx> {
27352735
impl<'tcx> Visitor<'tcx> for FindClosureArg<'tcx> {
27362736
type NestedFilter = rustc_middle::hir::nested_filter::All;
27372737

2738-
fn nested_visit_map(&mut self) -> Self::Map {
2739-
self.tcx.hir()
2738+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
2739+
self.tcx
27402740
}
27412741

27422742
fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {

0 commit comments

Comments
 (0)