Skip to content

Commit f86f7ad

Browse files
committed
Move some Map methods onto TyCtxt.
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
1 parent cd1d84c commit f86f7ad

File tree

197 files changed

+465
-476
lines changed

Some content is hidden

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

197 files changed

+465
-476
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ fn compute_hir_hash(
407407
.iter_enumerated()
408408
.filter_map(|(def_id, info)| {
409409
let info = info.as_owner()?;
410-
let def_path_hash = tcx.hir().def_path_hash(def_id);
410+
let def_path_hash = tcx.hir_def_path_hash(def_id);
411411
Some((def_path_hash, info))
412412
})
413413
.collect();
@@ -497,7 +497,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
497497
"adding a def'n for node-id {:?} and def kind {:?} but a previous def'n exists: {:?}",
498498
node_id,
499499
def_kind,
500-
self.tcx.hir().def_key(self.local_def_id(node_id)),
500+
self.tcx.hir_def_key(self.local_def_id(node_id)),
501501
);
502502

503503
let def_id = self.tcx.at(span).create_def(parent, name, def_kind).def_id();

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
14371437
let Some(hir_generics) = tcx
14381438
.typeck_root_def_id(self.mir_def_id().to_def_id())
14391439
.as_local()
1440-
.and_then(|def_id| tcx.hir().get_generics(def_id))
1440+
.and_then(|def_id| tcx.hir_get_generics(def_id))
14411441
else {
14421442
return;
14431443
};
@@ -1889,7 +1889,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
18891889

18901890
fn suggest_copy_for_type_in_cloned_ref(&self, err: &mut Diag<'infcx>, place: Place<'tcx>) {
18911891
let tcx = self.infcx.tcx;
1892-
let hir = tcx.hir();
18931892
let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return };
18941893

18951894
struct FindUselessClone<'tcx> {
@@ -1917,7 +1916,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
19171916

19181917
let mut expr_finder = FindUselessClone::new(tcx, self.mir_def_id());
19191918

1920-
let body = hir.body(body_id).value;
1919+
let body = tcx.hir_body(body_id).value;
19211920
expr_finder.visit_expr(body);
19221921

19231922
struct Holds<'tcx> {
@@ -2106,7 +2105,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
21062105
let tcx = self.infcx.tcx;
21072106
let body_id = tcx.hir_node(self.mir_hir_id()).body_id()?;
21082107
let mut expr_finder = FindExprBySpan::new(span, tcx);
2109-
expr_finder.visit_expr(tcx.hir().body(body_id).value);
2108+
expr_finder.visit_expr(tcx.hir_body(body_id).value);
21102109
expr_finder.result
21112110
}
21122111

@@ -2258,7 +2257,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
22582257
) {
22592258
let issue_span = issued_spans.args_or_use();
22602259
let tcx = self.infcx.tcx;
2261-
let hir = tcx.hir();
22622260

22632261
let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return };
22642262
let typeck_results = tcx.typeck(self.mir_def_id());
@@ -2346,7 +2344,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
23462344
pat_span: None,
23472345
head: None,
23482346
};
2349-
finder.visit_expr(hir.body(body_id).value);
2347+
finder.visit_expr(tcx.hir_body(body_id).value);
23502348

23512349
if let Some(body_expr) = finder.body_expr
23522350
&& let Some(loop_span) = finder.loop_span
@@ -2454,7 +2452,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
24542452
// Get the body the error happens in
24552453
let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return };
24562454

2457-
let body_expr = hir.body(body_id).value;
2455+
let body_expr = tcx.hir_body(body_id).value;
24582456

24592457
struct ClosureFinder<'hir> {
24602458
hir: rustc_middle::hir::map::Map<'hir>,
@@ -2558,7 +2556,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
25582556
}
25592557

25602558
let mut finder = VariableUseFinder { local_id, spans: Vec::new() };
2561-
finder.visit_expr(hir.body(closure.body).value);
2559+
finder.visit_expr(tcx.hir_body(closure.body).value);
25622560

25632561
spans = finder.spans;
25642562
} else {
@@ -3211,7 +3209,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
32113209
if let Some(scope) = self.body.source_scopes.get(source_info.scope)
32123210
&& let ClearCrossCrate::Set(scope_data) = &scope.local_data
32133211
&& let Some(id) = self.infcx.tcx.hir_node(scope_data.lint_root).body_id()
3214-
&& let hir::ExprKind::Block(block, _) = self.infcx.tcx.hir().body(id).value.kind
3212+
&& let hir::ExprKind::Block(block, _) = self.infcx.tcx.hir_body(id).value.kind
32153213
{
32163214
for stmt in block.stmts {
32173215
let mut visitor = NestedStatementVisitor {

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ impl<'tcx> BorrowExplanation<'tcx> {
7575

7676
if let Some(span) = borrow_span {
7777
let def_id = body.source.def_id();
78-
if let Some(node) = tcx.hir().get_if_local(def_id)
78+
if let Some(node) = tcx.hir_get_if_local(def_id)
7979
&& let Some(body_id) = node.body_id()
8080
{
81-
let body = tcx.hir().body(body_id);
81+
let body = tcx.hir_body(body_id);
8282
let mut expr_finder = FindExprBySpan::new(span, tcx);
8383
expr_finder.visit_expr(body.value);
8484
if let Some(mut expr) = expr_finder.result {
@@ -308,9 +308,9 @@ impl<'tcx> BorrowExplanation<'tcx> {
308308
suggest_rewrite_if_let(tcx, expr, &pat, init, conseq, alt, err);
309309
} else if let Some((old, new)) = multiple_borrow_span
310310
&& let def_id = body.source.def_id()
311-
&& let Some(node) = tcx.hir().get_if_local(def_id)
311+
&& let Some(node) = tcx.hir_get_if_local(def_id)
312312
&& let Some(body_id) = node.body_id()
313-
&& let hir_body = tcx.hir().body(body_id)
313+
&& let hir_body = tcx.hir_body(body_id)
314314
&& let mut expr_finder = (FindLetExpr { span: old, result: None, tcx })
315315
&& let Some((let_expr_span, let_expr_pat, let_expr_init)) = {
316316
expr_finder.visit_expr(hir_body.value);

compiler/rustc_borrowck/src/diagnostics/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
12201220
.tcx
12211221
.typeck_root_def_id(self.mir_def_id().to_def_id())
12221222
.as_local()
1223-
.and_then(|def_id| self.infcx.tcx.hir().get_generics(def_id))
1223+
.and_then(|def_id| self.infcx.tcx.hir_get_generics(def_id))
12241224
&& let spans = hir_generics
12251225
.predicates
12261226
.iter()

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
347347
// Find the closure that captured the binding.
348348
let mut expr_finder = FindExprBySpan::new(args_span, tcx);
349349
expr_finder.include_closures = true;
350-
expr_finder.visit_expr(tcx.hir().body(body_id).value);
350+
expr_finder.visit_expr(tcx.hir_body(body_id).value);
351351
let Some(closure_expr) = expr_finder.result else { return };
352352
let ExprKind::Closure(closure) = closure_expr.kind else { return };
353353
// We'll only suggest cloning the binding if it's a `move` closure.
@@ -357,7 +357,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
357357
let use_span = use_spans.var_or_use();
358358
let mut expr_finder = FindExprBySpan::new(use_span, tcx);
359359
expr_finder.include_closures = true;
360-
expr_finder.visit_expr(tcx.hir().body(body_id).value);
360+
expr_finder.visit_expr(tcx.hir_body(body_id).value);
361361
let Some(use_expr) = expr_finder.result else { return };
362362
let parent = tcx.parent_hir_node(use_expr.hir_id);
363363
if let Node::Expr(expr) = parent

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
936936
fn expected_fn_found_fn_mut_call(&self, err: &mut Diag<'_>, sp: Span, act: &str) {
937937
err.span_label(sp, format!("cannot {act}"));
938938

939-
let hir = self.infcx.tcx.hir();
939+
let tcx = self.infcx.tcx;
940+
let hir = tcx.hir();
940941
let closure_id = self.mir_hir_id();
941-
let closure_span = self.infcx.tcx.def_span(self.mir_def_id());
942-
let fn_call_id = self.infcx.tcx.parent_hir_id(closure_id);
943-
let node = self.infcx.tcx.hir_node(fn_call_id);
942+
let closure_span = tcx.def_span(self.mir_def_id());
943+
let fn_call_id = tcx.parent_hir_id(closure_id);
944+
let node = tcx.hir_node(fn_call_id);
944945
let def_id = hir.enclosing_body_owner(fn_call_id);
945946
let mut look_at_return = true;
946947

@@ -951,7 +952,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
951952
return None;
952953
};
953954

954-
let typeck_results = self.infcx.tcx.typeck(def_id);
955+
let typeck_results = tcx.typeck(def_id);
955956

956957
match kind {
957958
hir::ExprKind::Call(expr, args) => {
@@ -980,7 +981,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
980981
.map(|(pos, _)| pos)
981982
.next();
982983

983-
let arg = match hir.get_if_local(callee_def_id) {
984+
let arg = match tcx.hir_get_if_local(callee_def_id) {
984985
Some(
985986
hir::Node::Item(hir::Item {
986987
ident, kind: hir::ItemKind::Fn { sig, .. }, ..
@@ -1022,7 +1023,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10221023
if look_at_return && hir.get_fn_id_for_return_block(closure_id).is_some() {
10231024
// ...otherwise we are probably in the tail expression of the function, point at the
10241025
// return type.
1025-
match self.infcx.tcx.hir_node_by_def_id(hir.get_parent_item(fn_call_id).def_id) {
1026+
match tcx.hir_node_by_def_id(hir.get_parent_item(fn_call_id).def_id) {
10261027
hir::Node::Item(hir::Item {
10271028
ident, kind: hir::ItemKind::Fn { sig, .. }, ..
10281029
})
@@ -1050,9 +1051,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10501051

10511052
fn suggest_using_iter_mut(&self, err: &mut Diag<'_>) {
10521053
let source = self.body.source;
1053-
let hir = self.infcx.tcx.hir();
10541054
if let InstanceKind::Item(def_id) = source.instance
1055-
&& let Some(Node::Expr(hir::Expr { hir_id, kind, .. })) = hir.get_if_local(def_id)
1055+
&& let Some(Node::Expr(hir::Expr { hir_id, kind, .. })) =
1056+
self.infcx.tcx.hir_get_if_local(def_id)
10561057
&& let ExprKind::Closure(hir::Closure { kind: hir::ClosureKind::Closure, .. }) = kind
10571058
&& let Node::Expr(expr) = self.infcx.tcx.parent_hir_node(*hir_id)
10581059
{

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
205205
lower_bound: RegionVid,
206206
) {
207207
let mut suggestions = vec![];
208-
let hir = self.infcx.tcx.hir();
208+
let tcx = self.infcx.tcx;
209209

210210
// find generic associated types in the given region 'lower_bound'
211211
let gat_id_and_generics = self
@@ -214,12 +214,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
214214
.map(|placeholder| {
215215
if let Some(id) = placeholder.bound.kind.get_id()
216216
&& let Some(placeholder_id) = id.as_local()
217-
&& let gat_hir_id = self.infcx.tcx.local_def_id_to_hir_id(placeholder_id)
218-
&& let Some(generics_impl) = self
219-
.infcx
220-
.tcx
221-
.parent_hir_node(self.infcx.tcx.parent_hir_id(gat_hir_id))
222-
.generics()
217+
&& let gat_hir_id = tcx.local_def_id_to_hir_id(placeholder_id)
218+
&& let Some(generics_impl) =
219+
tcx.parent_hir_node(tcx.parent_hir_id(gat_hir_id)).generics()
223220
{
224221
Some((gat_hir_id, generics_impl))
225222
} else {
@@ -240,7 +237,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
240237
};
241238
if bound_generic_params
242239
.iter()
243-
.rfind(|bgp| self.infcx.tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id)
240+
.rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id)
244241
.is_some()
245242
{
246243
for bound in *bounds {
@@ -256,7 +253,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
256253
return;
257254
};
258255
diag.span_note(*trait_span, fluent::borrowck_limitations_implies_static);
259-
let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local())
256+
let Some(generics_fn) = tcx.hir_get_generics(self.body.source.def_id().expect_local())
260257
else {
261258
return;
262259
};
@@ -1144,7 +1141,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11441141

11451142
if ocx.select_all_or_error().is_empty() && count > 0 {
11461143
diag.span_suggestion_verbose(
1147-
tcx.hir().body(*body).value.peel_blocks().span.shrink_to_lo(),
1144+
tcx.hir_body(*body).value.peel_blocks().span.shrink_to_lo(),
11481145
fluent::borrowck_dereference_suggestion,
11491146
"*".repeat(count),
11501147
Applicability::MachineApplicable,

compiler/rustc_codegen_cranelift/src/driver/jit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, codegen_mode: CodegenMode, jit_args: Vec<
124124
crate::constant::codegen_static(tcx, &mut jit_module, def_id);
125125
}
126126
MonoItem::GlobalAsm(item_id) => {
127-
let item = tcx.hir().item(item_id);
127+
let item = tcx.hir_item(item_id);
128128
tcx.dcx().span_fatal(item.span, "Global asm is not supported in JIT mode");
129129
}
130130
}

compiler/rustc_codegen_cranelift/src/global_asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_target::asm::InlineAsmArch;
1515
use crate::prelude::*;
1616

1717
pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String, item_id: ItemId) {
18-
let item = tcx.hir().item(item_id);
18+
let item = tcx.hir_item(item_id);
1919
if let rustc_hir::ItemKind::GlobalAsm(asm) = item.kind {
2020
let is_x86 =
2121
matches!(tcx.sess.asm_arch.unwrap(), InlineAsmArch::X86 | InlineAsmArch::X86_64);

compiler/rustc_codegen_ssa/src/mono_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
3535
cx.codegen_static(def_id);
3636
}
3737
MonoItem::GlobalAsm(item_id) => {
38-
let item = cx.tcx().hir().item(item_id);
38+
let item = cx.tcx().hir_item(item_id);
3939
if let hir::ItemKind::GlobalAsm(asm) = item.kind {
4040
let operands: Vec<_> = asm
4141
.operands

compiler/rustc_driver_impl/src/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
273273
let attrs = |id| hir_map.attrs(id);
274274
pprust_hir::print_crate(
275275
sm,
276-
hir_map.root_module(),
276+
tcx.hir_root_module(),
277277
src_name,
278278
src,
279279
&attrs,
@@ -294,7 +294,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
294294
}
295295
HirTree => {
296296
debug!("pretty printing HIR tree");
297-
format!("{:#?}", ex.tcx().hir().krate())
297+
format!("{:#?}", ex.tcx().hir_krate())
298298
}
299299
Mir => {
300300
let mut out = Vec::new();

compiler/rustc_hir_analysis/src/check/check.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
124124

125125
for field in &def.non_enum_variant().fields {
126126
if !allowed_union_or_unsafe_field(tcx, field.ty(tcx, args), typing_env, span) {
127-
let (field_span, ty_span) = match tcx.hir().get_if_local(field.did) {
127+
let (field_span, ty_span) = match tcx.hir_get_if_local(field.did) {
128128
// We are currently checking the type this field came from, so it must be local.
129129
Some(Node::Field(field)) => (field.span, field.ty.span),
130130
_ => unreachable!("mir field has to correspond to hir field"),
@@ -880,7 +880,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
880880
.emit();
881881
}
882882

883-
let item = tcx.hir().foreign_item(item.id);
883+
let item = tcx.hir_foreign_item(item.id);
884884
match &item.kind {
885885
hir::ForeignItemKind::Fn(sig, _, _) => {
886886
require_c_abi_if_c_variadic(tcx, sig.decl, abi, item.span);
@@ -1494,7 +1494,7 @@ fn detect_discriminant_duplicate<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
14941494
// In the case the discriminant is both a duplicate and overflowed, let the user know
14951495
if let hir::Node::AnonConst(expr) =
14961496
tcx.hir_node_by_def_id(discr_def_id.expect_local())
1497-
&& let hir::ExprKind::Lit(lit) = &tcx.hir().body(expr.body).value.kind
1497+
&& let hir::ExprKind::Lit(lit) = &tcx.hir_body(expr.body).value.kind
14981498
&& let rustc_ast::LitKind::Int(lit_value, _int_kind) = &lit.node
14991499
&& *lit_value != dis.val
15001500
{

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,10 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
658658
"method `{}` has an incompatible return type for trait",
659659
trait_m.name
660660
);
661-
let hir = tcx.hir();
662661
infcx.err_ctxt().note_type_err(
663662
&mut diag,
664663
&cause,
665-
hir.get_if_local(impl_m.def_id)
664+
tcx.hir_get_if_local(impl_m.def_id)
666665
.and_then(|node| node.fn_decl())
667666
.map(|decl| (decl.output.span(), Cow::from("return type in trait"), false)),
668667
Some(param_env.and(infer::ValuePairs::Terms(ExpectedFound {
@@ -1123,15 +1122,14 @@ fn check_region_bounds_on_impl_item<'tcx>(
11231122
// the moment, give a kind of vague error message.
11241123
if trait_params != impl_params {
11251124
let span = tcx
1126-
.hir()
1127-
.get_generics(impl_m.def_id.expect_local())
1125+
.hir_get_generics(impl_m.def_id.expect_local())
11281126
.expect("expected impl item to have generics or else we can't compare them")
11291127
.span;
11301128

11311129
let mut generics_span = None;
11321130
let mut bounds_span = vec![];
11331131
let mut where_span = None;
1134-
if let Some(trait_node) = tcx.hir().get_if_local(trait_m.def_id)
1132+
if let Some(trait_node) = tcx.hir_get_if_local(trait_m.def_id)
11351133
&& let Some(trait_generics) = trait_node.generics()
11361134
{
11371135
generics_span = Some(trait_generics.span);
@@ -1146,7 +1144,7 @@ fn check_region_bounds_on_impl_item<'tcx>(
11461144
}
11471145
}
11481146
}
1149-
if let Some(impl_node) = tcx.hir().get_if_local(impl_m.def_id)
1147+
if let Some(impl_node) = tcx.hir_get_if_local(impl_m.def_id)
11501148
&& let Some(impl_generics) = impl_node.generics()
11511149
{
11521150
let mut impl_bounds = 0;

compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub(crate) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
9696

9797
// This opaque also needs to be from the impl method -- otherwise,
9898
// it's a refinement to a TAIT.
99-
if !tcx.hir().get_if_local(impl_opaque.def_id).is_some_and(|node| {
99+
if !tcx.hir_get_if_local(impl_opaque.def_id).is_some_and(|node| {
100100
matches!(
101101
node.expect_opaque_ty().origin,
102102
hir::OpaqueTyOrigin::AsyncFn { parent, .. } | hir::OpaqueTyOrigin::FnReturn { parent, .. }
@@ -327,7 +327,7 @@ fn report_mismatched_rpitit_signature<'tcx>(
327327
hir::FnRetTy::Return(ty) => (ty.span, ty.span, "", ""),
328328
};
329329
let trait_return_span =
330-
tcx.hir().get_if_local(trait_m_def_id).map(|node| match node.fn_decl().unwrap().output {
330+
tcx.hir_get_if_local(trait_m_def_id).map(|node| match node.fn_decl().unwrap().output {
331331
hir::FnRetTy::DefaultReturn(_) => tcx.def_span(trait_m_def_id),
332332
hir::FnRetTy::Return(ty) => ty.span,
333333
});

0 commit comments

Comments
 (0)