Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6b3a9f4
thir.md: update example output
simono Oct 1, 2026
d8eeadd
thir.md: update date-check, add tail call checking
simono Oct 1, 2026
6ae045a
thir.md: thir_body is a query
simono Oct 1, 2026
f855fc6
Merge pull request #3041 from simono/thir-date-check
jyn514 Oct 2, 2026
1f6dc4d
Prepare for merging from rust-lang/rust
invalid-email-address Oct 5, 2026
b611f26
Merge ref '260f1acad9d7' from rust-lang/rust
invalid-email-address Oct 5, 2026
cc119c0
Merge pull request #3043 from rust-lang/rustc-pull
tshepang Oct 5, 2026
a8b032f
add type system invariant
lcnr Oct 5, 2026
f589bb0
Merge pull request #3044 from lcnr/main
lcnr Oct 5, 2026
75b0be8
remove redundant unsafe
yilin0518 Oct 7, 2026
7243c36
Prepare for merging from rust-lang/rust
invalid-email-address Oct 10, 2026
d9ed88e
Merge ref '5ec56e390265' from rust-lang/rust
invalid-email-address Oct 10, 2026
266158b
Merge pull request #3048 from rust-lang/rustc-pull
tshepang Oct 10, 2026
ee3e2e7
reflow src/compiler-debugging.md
tshepang Oct 10, 2026
5c1fb39
Remove indirection for `Expr` in `Body`
JonathanBrouwer Oct 9, 2026
319d431
Fix clippy
JonathanBrouwer Oct 10, 2026
ac1b3f8
sembr src/rustc-driver/intro.md
tshepang Oct 10, 2026
885e562
sembr src/solve/invariants.md
tshepang Oct 10, 2026
4fa1e59
improve solve/invariants.md
tshepang Oct 10, 2026
e85e06f
reflow src/solve/invariants.md
tshepang Oct 10, 2026
78ae36c
reflow src/tests/directives.md
tshepang Oct 10, 2026
9d0b35c
improve tests/directives.md
tshepang Oct 10, 2026
d84ad96
reflow src/thir.md
tshepang Oct 10, 2026
e4e2eae
sembr src/hir-typeck/coercions.md
tshepang Oct 10, 2026
311a2a5
sembr: reduce indentation
tshepang Oct 10, 2026
cf021fd
overlong sentence should be split if it has a comma
tshepang Oct 11, 2026
a385ff2
sembr src/hir-typeck/method-lookup.md
tshepang Oct 11, 2026
863b937
sembr src/queries/incremental-compilation.md
tshepang Oct 11, 2026
b6f2bc9
sembr src/tests/ui.md
tshepang Oct 11, 2026
15a0b4f
improve tests/ui.md
tshepang Oct 11, 2026
2430188
sembr src/tests/misc.md
tshepang Oct 11, 2026
fb8e41b
reflow src/tests/ui.md
tshepang Oct 11, 2026
b0c6de4
sembr src/tests/compiletest.md
tshepang Oct 11, 2026
1b71fad
improve tests/compiletest.md
tshepang Oct 11, 2026
1817647
reflow src/tests/compiletest.md
tshepang Oct 11, 2026
33031a7
sembr src/serialization.md
tshepang Oct 11, 2026
24bcd25
improve serialization.md
tshepang Oct 11, 2026
f916ff5
reflow src/serialization.md
tshepang Oct 11, 2026
25f1242
sembr src/cli.md
tshepang Oct 11, 2026
77b666a
reflow src/cli.md
tshepang Oct 11, 2026
15afb78
Merge pull request #3050 from rust-lang/tshepang/misc
tshepang Oct 11, 2026
f3983ba
Rollup merge of #163918 - yilin0518:fix_arm_hint, r=JohnTitor
JonathanBrouwer Oct 11, 2026
8499655
Rollup merge of #164047 - JonathanBrouwer:expr-body, r=Kivooeo
JonathanBrouwer Oct 11, 2026
debc07b
Rollup merge of #164154 - tshepang:rdg-sync, r=tshepang
JonathanBrouwer Oct 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
params: &'hir [hir::Param<'hir>],
value: hir::Expr<'hir>,
) -> hir::BodyId {
let body = hir::Body { params, value: self.arena.alloc(value) };
let body = hir::Body { params, value };
let id = body.id();
assert_eq!(id.hir_id.owner, self.curr_owner.owner_id());
self.curr_owner.bodies.push((id.hir_id.local_id, self.arena.alloc(body)));
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
}
let tcx = self.infcx.tcx;
if let Some(body) = tcx.hir_maybe_body_owned_by(self.mir_def_id()) {
let expr = body.value;
let expr = &body.value;
let place = &self.move_data.move_paths[mpi].place;
let span = place.as_local().map(|local| self.body.local_decls[local].source_info.span);
let mut finder = ExpressionFinder {
Expand Down Expand Up @@ -2134,7 +2134,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {

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

let body = tcx.hir_body(body_id).value;
let body = &tcx.hir_body(body_id).value;
expr_finder.visit_expr(body);

struct Holds<'tcx> {
Expand Down Expand Up @@ -2323,7 +2323,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
let tcx = self.infcx.tcx;
let body_id = tcx.hir_node(self.mir_hir_id()).body_id()?;
let mut expr_finder = FindExprBySpan::new(span, tcx);
expr_finder.visit_expr(tcx.hir_body(body_id).value);
expr_finder.visit_expr(&tcx.hir_body(body_id).value);
expr_finder.result
}

Expand Down Expand Up @@ -2554,7 +2554,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
}
}
let mut finder = ExprFinder { tcx, expr_span: span, issue_span, .. };
finder.visit_expr(tcx.hir_body(body_id).value);
finder.visit_expr(&tcx.hir_body(body_id).value);

if let Some(body_expr) = finder.body_expr
&& let Some(loop_span) = finder.loop_span
Expand Down Expand Up @@ -2705,7 +2705,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
// Get the body the error happens in
let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return };

let body_expr = tcx.hir_body(body_id).value;
let body_expr = &tcx.hir_body(body_id).value;

struct ClosureFinder<'hir> {
tcx: TyCtxt<'hir>,
Expand Down Expand Up @@ -2809,7 +2809,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
}

let mut finder = VariableUseFinder { local_id, spans: Vec::new() };
finder.visit_expr(tcx.hir_body(closure.body).value);
finder.visit_expr(&tcx.hir_body(closure.body).value);

spans = finder.spans;
} else {
Expand Down Expand Up @@ -4747,7 +4747,7 @@ fn find_for_loop_span<'hir>(
}
}
let mut finder = ExprFinder { tcx, issue_span, result: None };
finder.visit_expr(tcx.hir_body(body_id).value);
finder.visit_expr(&tcx.hir_body(body_id).value);
finder.result
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
{
let body = tcx.hir_body(body_id);
let mut expr_finder = FindExprBySpan::new(span, tcx);
expr_finder.visit_expr(body.value);
expr_finder.visit_expr(&body.value);
if let Some(mut expr) = expr_finder.result {
while let hir::ExprKind::AddrOf(_, _, inner)
| hir::ExprKind::Unary(hir::UnOp::Deref, inner)
Expand Down Expand Up @@ -308,7 +308,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
&& let hir_body = tcx.hir_body(body_id)
&& let mut expr_finder = (FindLetExpr { span: old, result: None, tcx })
&& let Some((let_expr_span, let_expr_pat, let_expr_init)) = {
expr_finder.visit_expr(hir_body.value);
expr_finder.visit_expr(&hir_body.value);
expr_finder.result
}
&& !let_expr_span.contains(new)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
// Find the closure that captured the binding.
let mut expr_finder = FindExprBySpan::new(args_span, tcx);
expr_finder.include_closures = true;
expr_finder.visit_expr(tcx.hir_body(body_id).value);
expr_finder.visit_expr(&tcx.hir_body(body_id).value);
let Some(closure_expr) = expr_finder.result else { return };
let ExprKind::Closure(closure) = closure_expr.kind else { return };
// We'll only suggest cloning the binding if it's a `move` closure.
Expand All @@ -349,7 +349,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
let use_span = use_spans.var_or_use();
let mut expr_finder = FindExprBySpan::new(use_span, tcx);
expr_finder.include_closures = true;
expr_finder.visit_expr(tcx.hir_body(body_id).value);
expr_finder.visit_expr(&tcx.hir_body(body_id).value);
let Some(use_expr) = expr_finder.result else { return };
let parent = tcx.parent_hir_node(use_expr.hir_id);
if let Node::Expr(expr) = parent
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ pub struct BodyId {
#[derive(Debug, Clone, Copy, StableHash)]
pub struct Body<'hir> {
pub params: &'hir [Param<'hir>],
pub value: &'hir Expr<'hir>,
pub value: Expr<'hir>,
}

impl<'hir> Body<'hir> {
Expand Down Expand Up @@ -5275,7 +5275,7 @@ mod size_asserts {
use super::*;
// tidy-alphabetical-start
static_assert_size!(Block<'_>, 48);
static_assert_size!(Body<'_>, 24);
static_assert_size!(Body<'_>, 80);
static_assert_size!(Expr<'_>, 64);
static_assert_size!(ExprKind<'_>, 48);
static_assert_size!(FnDecl<'_>, 40);
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_hir/src/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ pub trait Visitor<'v>: Sized {
walk_item(self, i)
}

fn visit_body(&mut self, b: &Body<'v>) -> Self::Result {
fn visit_body(&mut self, b: &'v Body<'v>) -> Self::Result {
walk_body(self, b)
}

Expand Down Expand Up @@ -662,10 +662,10 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
V::Result::output()
}

pub fn walk_body<'v, V: Visitor<'v>>(visitor: &mut V, body: &Body<'v>) -> V::Result {
pub fn walk_body<'v, V: Visitor<'v>>(visitor: &mut V, body: &'v Body<'v>) -> V::Result {
let Body { params, value } = body;
walk_list!(visitor, visit_param, *params);
visitor.visit_expr(*value)
visitor.visit_expr(value)
}

pub fn walk_ident<'v, V: Visitor<'v>>(visitor: &mut V, ident: Ident) -> V::Result {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_hir_analysis/src/check/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ impl<'tcx> Visitor<'tcx> for ScopeResolutionVisitor<'tcx> {
resolve_block(self, b, false);
}

fn visit_body(&mut self, body: &hir::Body<'tcx>) {
fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {
let body_id = body.id();
let owner_id = self.tcx.hir_body_owner_def_id(body_id);

Expand All @@ -783,7 +783,7 @@ impl<'tcx> Visitor<'tcx> for ScopeResolutionVisitor<'tcx> {
}

// The body of the every fn is a root scope.
resolve_expr(this, body.value, true);
resolve_expr(this, &body.value, true);
} else {
// All bodies have an outer temporary drop scope, but temporaries
// and `super let` bindings in constant initializers may be extended
Expand All @@ -808,7 +808,7 @@ impl<'tcx> Visitor<'tcx> for ScopeResolutionVisitor<'tcx> {
local_id: body.value.hir_id.local_id,
data: ScopeData::Destruction,
});
resolve_local(this, None, Some(body.value), LetKind::Regular);
resolve_local(this, None, Some(&body.value), LetKind::Regular);
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ fn coroutine_for_closure(tcx: TyCtxt<'_>, def_id: LocalDefId) -> DefId {
bug!()
};

let &hir::Expr {
let hir::Expr {
kind:
hir::ExprKind::Closure(&rustc_hir::Closure {
def_id,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl PpAnn for &dyn rustc_hir::intravisit::HirTyCtxt<'_> {
Nested::TraitItem(id) => state.print_trait_item(self.hir_trait_item(id)),
Nested::ImplItem(id) => state.print_impl_item(self.hir_impl_item(id)),
Nested::ForeignItem(id) => state.print_foreign_item(self.hir_foreign_item(id)),
Nested::Body(id) => state.print_expr(self.hir_body(id).value),
Nested::Body(id) => state.print_expr(&self.hir_body(id).value),
Nested::BodyParamPat(id, i) => state.print_pat(self.hir_body(id).params[i].pat),
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub(super) fn check_fn<'a, 'tcx>(
}

fcx.is_whole_body.set(true);
fcx.check_return_or_body_tail(body.value, false);
fcx.check_return_or_body_tail(&body.value, false);

// Finalize the return check by taking the LUB of the return types
// we saw and assigning it to the expected return type. This isn't
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

let mut expr_finder = FindExprs { hir_id: local_hir_id, uses: init.into_iter().collect() };
let body = self.tcx.hir_body_owned_by(self.body_def_id);
expr_finder.visit_expr(body.value);
expr_finder.visit_expr(&body.value);

// Replaces all of the variables in the given type with a fresh inference variable.
let mut fudger = BottomUpFolder {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let def_id = block.def_id;
let fcx = FnCtxt::new(self, self.param_env, def_id);

let ty = fcx.check_expr_with_expectation(body.value, expected);
let ty = fcx.check_expr_with_expectation(&body.value, expected);
fcx.require_type_is_sized(ty, body.value.span, ObligationCauseCode::SizedConstOrStatic);
fcx.write_ty(block.hir_id, ty);
ty
Expand Down Expand Up @@ -3730,7 +3730,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let body = self.tcx.hir_body(anon_const.body);

let fcx = FnCtxt::new(self, self.param_env, anon_const.def_id);
let ty = fcx.check_expr(body.value);
let ty = fcx.check_expr(&body.value);
let target_ty = match self.structurally_resolve_type(body.value.span, ty).kind()
{
ty::FnDef(..) => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/expr_use_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
self.walk_pat(&param_place, param.pat, false)?;
}

self.consume_expr(body.value)?;
self.consume_expr(&body.value)?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
let reachable_vids =
graph::depth_first_search_as_undirected(coercions, vid).collect();
AnnotateUnitFallbackVisitor { reachable_vids, fcx: self }
.visit_expr(body.value)
.visit_expr(&body.value)
.break_value()
})
.collect();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/inline_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
}
}
hir::InlineAsmOperand::Const { anon_const } => {
let ty = self.expr_ty(self.tcx().hir_body(anon_const.body).value);
let ty = self.expr_ty(&self.tcx().hir_body(anon_const.body).value);
match ty.kind() {
ty::Error(_) => {}
_ if ty.is_integral() => {}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_typeck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn typeck_with_inspect<'tcx>(
if let hir::Node::Item(hir::Item { kind: hir::ItemKind::GlobalAsm { .. }, .. }) = node {
// Check the fake body of a global ASM. There's not much to do here except
// for visit the asm expr of the body.
let ty = fcx.check_expr(body.value);
let ty = fcx.check_expr(&body.value);
fcx.write_ty(id, ty);
} else if let Some(hir::FnSig { header, decl, span: _ }) = node.fn_sig() {
let fn_sig = if decl.output.is_suggestable_infer_ty().is_some() {
Expand Down Expand Up @@ -204,7 +204,7 @@ fn typeck_with_inspect<'tcx>(
);
}

fcx.check_expr_coercible_to_type_or_error(body.value, expected_type, None, |err, _| {
fcx.check_expr_coercible_to_type_or_error(&body.value, expected_type, None, |err, _| {
extend_err_with_const_context(err, tcx, node, expected_type);
});

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// for the inner coroutine may actually be more restrictive.
if infer_kind {
let ty::Coroutine(_, coroutine_args) =
*self.typeck_results.borrow().expr_ty(body.value).kind()
*self.typeck_results.borrow().expr_ty(&body.value).kind()
else {
bug!();
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/async_closures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for AsyncClosureUsage {
return;
};

let mut body = cx.tcx.hir_body(body).value;
let mut body = &cx.tcx.hir_body(body).value;

// Only peel blocks that have no expressions.
while let hir::ExprKind::Block(&hir::Block { stmts: [], expr: Some(tail), .. }, None) =
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ impl<'tcx> LateContext<'tcx> {
hir::Node::Item(item) => match item.kind {
// FIXME(mgca): figure out how to handle ConstArgKind::Path (or don't but add warning in docs here)
hir::ItemKind::Const(.., hir::ConstItemRhs::Body(body_id))
| hir::ItemKind::Static(.., body_id) => Some(self.tcx.hir_body(body_id).value),
| hir::ItemKind::Static(.., body_id) => Some(&self.tcx.hir_body(body_id).value),
_ => None,
},
_ => None,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/for_loops_over_fallibles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn suggest_question_mark<'tcx>(
// Check that the function/closure/constant we are in has a `Result` type.
// Otherwise suggesting using `?` may not be a good idea.
{
let ty = cx.typeck_results().expr_ty(cx.tcx.hir_body(body_id).value);
let ty = cx.typeck_results().expr_ty(&cx.tcx.hir_body(body_id).value);
let ty::Adt(ret_adt, ..) = ty.kind() else { return false };
if !cx.tcx.is_diagnostic_item(sym::Result, ret_adt.did()) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
});
}

fn visit_body(&mut self, body: &hir::Body<'tcx>) {
fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {
lint_callback!(self, check_body, body);
hir_visit::walk_body(self, body);
lint_callback!(self, check_body_post, body);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lint/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ macro_rules! late_lint_methods {
($macro:path, $args:tt) => (
// `_post` methods are called *after* recursing into the node.
$macro!($args, [
fn check_body(a: &rustc_hir::Body<'tcx>);
fn check_body_post(a: &rustc_hir::Body<'tcx>);
fn check_body(a: &'tcx rustc_hir::Body<'tcx>);
fn check_body_post(a: &'tcx rustc_hir::Body<'tcx>);
fn check_crate();
fn check_crate_post();
fn check_mod(a: &'tcx rustc_hir::Mod<'tcx>, b: rustc_span::def_id::LocalModId);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2839,7 +2839,7 @@ pub(crate) fn provide(providers: &mut Providers) {
/// use a different method for pretty-printing. Ideally this function
/// should only ever be used as a fallback.
pub fn rendered_const<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body<'_>, def_id: LocalDefId) -> String {
let value = body.value;
let value = &body.value;

#[derive(PartialEq, Eq)]
enum Classification {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/thir/cx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub(crate) fn thir_body<'tcx>(
}
}

let expr = cx.mirror_expr(body.value);
let expr = cx.mirror_expr(&body.value);
Ok((tcx.alloc_steal_thir(cx.thir), expr))
}

Expand Down
7 changes: 5 additions & 2 deletions compiler/rustc_mir_transform/src/coverage/hir_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ fn hash_mir_source<'tcx>(tcx: TyCtxt<'tcx>, hir_body: &'tcx hir::Body<'tcx>) ->
.as_u64()
}

fn extract_hole_spans_from_hir<'tcx>(tcx: TyCtxt<'tcx>, hir_body: &hir::Body<'tcx>) -> Vec<Span> {
fn extract_hole_spans_from_hir<'tcx>(
tcx: TyCtxt<'tcx>,
hir_body: &'tcx hir::Body<'tcx>,
) -> Vec<Span> {
struct HolesVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
hole_spans: Vec<Span>,
Expand Down Expand Up @@ -156,7 +159,7 @@ fn extract_hole_spans_from_hir<'tcx>(tcx: TyCtxt<'tcx>, hir_body: &hir::Body<'tc
fn find_nodes_to_ignore<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
hir_body: &hir::Body<'tcx>,
hir_body: &'tcx hir::Body<'tcx>,
) -> FxHashSet<HirId> {
/// Top-level visitor used by [`find_nodes_to_ignore`].
struct FindNodesToIgnoreVisitor<'tcx> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/input_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
hir_visit::walk_item(self, i)
}

fn visit_body(&mut self, b: &hir::Body<'v>) {
fn visit_body(&mut self, b: &'v hir::Body<'v>) {
self.record("Body", None, b);
hir_visit::walk_body(self, b);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
if let Some(body) =
self.tcx.hir_maybe_body_owned_by(self.tcx.typeck_root_def_id_local(body_def_id))
{
let expr = body.value;
let expr = &body.value;
local_visitor.visit_expr(expr);
body_from_expansion = body.value.span.from_expansion();
}
Expand Down Expand Up @@ -1380,7 +1380,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> {

/// For closures, we first visit the parameters and then the content,
/// as we prefer those.
fn visit_body(&mut self, body: &Body<'tcx>) {
fn visit_body(&mut self, body: &'tcx Body<'tcx>) {
for param in body.params {
debug!(
"param: span {:?}, ty_span {:?}, pat.span {:?}",
Expand Down
Loading
Loading