Skip to content

Commit 273465e

Browse files
committed
Auto merge of #137163 - matthiaskrgr:rollup-ovgfkns, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #136466 (Start removing `rustc_middle::hir::map::Map`) - #136671 (Overhaul `rustc_middle::limits`) - #136817 (Pattern Migration 2024: clean up and comment) - #136844 (Use `const_error!` when possible) - #137080 (bootstrap: add more tracing to compiler/std/llvm flows) - #137101 (`invalid_from_utf8[_unchecked]`: also lint inherent methods) - #137140 (Fix const items not being allowed to be called `r#move` or `r#static`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d5eb31c + f071099 commit 273465e

File tree

295 files changed

+1845
-1098
lines changed

Some content is hidden

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

295 files changed

+1845
-1098
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

+17-19
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_errors::codes::*;
1414
use rustc_errors::{Applicability, Diag, MultiSpan, struct_span_code_err};
1515
use rustc_hir as hir;
1616
use rustc_hir::def::{DefKind, Res};
17-
use rustc_hir::intravisit::{Map, Visitor, walk_block, walk_expr};
17+
use rustc_hir::intravisit::{Visitor, walk_block, walk_expr};
1818
use rustc_hir::{CoroutineDesugaring, CoroutineKind, CoroutineSource, LangItem, PatField};
1919
use rustc_middle::bug;
2020
use rustc_middle::hir::nested_filter::OnlyBodies;
@@ -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
@@ -1082,7 +1082,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10821082
] {
10831083
for (destination, sp) in elements {
10841084
if let Ok(hir_id) = destination.target_id
1085-
&& let hir::Node::Expr(expr) = tcx.hir().hir_node(hir_id)
1085+
&& let hir::Node::Expr(expr) = tcx.hir_node(hir_id)
10861086
&& !matches!(
10871087
sp.desugaring_kind(),
10881088
Some(DesugaringKind::ForLoop | DesugaringKind::WhileLoop)
@@ -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,10 +2452,10 @@ 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> {
2460-
hir: rustc_middle::hir::map::Map<'hir>,
2458+
tcx: TyCtxt<'hir>,
24612459
borrow_span: Span,
24622460
res: Option<(&'hir hir::Expr<'hir>, &'hir hir::Closure<'hir>)>,
24632461
/// The path expression with the `borrow_span` span
@@ -2466,8 +2464,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
24662464
impl<'hir> Visitor<'hir> for ClosureFinder<'hir> {
24672465
type NestedFilter = OnlyBodies;
24682466

2469-
fn nested_visit_map(&mut self) -> Self::Map {
2470-
self.hir
2467+
fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
2468+
self.tcx
24712469
}
24722470

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

24942492
// Find the closure that most tightly wraps `capture_kind_span`
24952493
let mut finder =
2496-
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 };
24972495
finder.visit_expr(body_expr);
24982496
let Some((closure_expr, closure)) = finder.res else { return };
24992497

@@ -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

+6-6
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 {
@@ -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)
@@ -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

+7-7
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;
@@ -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
@@ -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,

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
@@ -219,7 +219,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
219219
lower_bound: RegionVid,
220220
) {
221221
let mut suggestions = vec![];
222-
let hir = self.infcx.tcx.hir();
222+
let tcx = self.infcx.tcx;
223223

224224
// find generic associated types in the given region 'lower_bound'
225225
let gat_id_and_generics = self
@@ -228,12 +228,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
228228
.map(|placeholder| {
229229
if let Some(id) = placeholder.bound.kind.get_id()
230230
&& let Some(placeholder_id) = id.as_local()
231-
&& let gat_hir_id = self.infcx.tcx.local_def_id_to_hir_id(placeholder_id)
232-
&& let Some(generics_impl) = self
233-
.infcx
234-
.tcx
235-
.parent_hir_node(self.infcx.tcx.parent_hir_id(gat_hir_id))
236-
.generics()
231+
&& let gat_hir_id = tcx.local_def_id_to_hir_id(placeholder_id)
232+
&& let Some(generics_impl) =
233+
tcx.parent_hir_node(tcx.parent_hir_id(gat_hir_id)).generics()
237234
{
238235
Some((gat_hir_id, generics_impl))
239236
} else {
@@ -254,7 +251,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
254251
};
255252
if bound_generic_params
256253
.iter()
257-
.rfind(|bgp| self.infcx.tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id)
254+
.rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id)
258255
.is_some()
259256
{
260257
for bound in *bounds {
@@ -270,7 +267,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
270267
return;
271268
};
272269
diag.span_note(*trait_span, fluent::borrowck_limitations_implies_static);
273-
let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local())
270+
let Some(generics_fn) = tcx.hir_get_generics(self.body.source.def_id().expect_local())
274271
else {
275272
return;
276273
};
@@ -1162,7 +1159,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11621159

11631160
if ocx.select_all_or_error().is_empty() && count > 0 {
11641161
diag.span_suggestion_verbose(
1165-
tcx.hir().body(*body).value.peel_blocks().span.shrink_to_lo(),
1162+
tcx.hir_body(*body).value.peel_blocks().span.shrink_to_lo(),
11661163
fluent::borrowck_dereference_suggestion,
11671164
"*".repeat(count),
11681165
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);

0 commit comments

Comments
 (0)