Skip to content

Commit 135c241

Browse files
committed
Fix span for consts in mir builder
1 parent 455a55e commit 135c241

File tree

1 file changed

+13
-3
lines changed
  • compiler/rustc_mir_build/src/build

1 file changed

+13
-3
lines changed

compiler/rustc_mir_build/src/build/mod.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,18 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
250250
// of `mir_build`, so now we can steal it
251251
let thir = thir.steal();
252252

253-
build::construct_const(&thir, &infcx, expr, def, id, return_ty, return_ty_span)
253+
let span_with_body = span_with_body.to(tcx.hir().span(body_id.hir_id));
254+
255+
build::construct_const(
256+
&thir,
257+
&infcx,
258+
expr,
259+
def,
260+
id,
261+
return_ty,
262+
return_ty_span,
263+
span_with_body,
264+
)
254265
};
255266

256267
lints::check(tcx, &body);
@@ -705,9 +716,8 @@ fn construct_const<'a, 'tcx>(
705716
hir_id: hir::HirId,
706717
const_ty: Ty<'tcx>,
707718
const_ty_span: Span,
719+
span: Span,
708720
) -> Body<'tcx> {
709-
let tcx = infcx.tcx;
710-
let span = tcx.hir().span(hir_id);
711721
let mut builder = Builder::new(
712722
thir,
713723
infcx,

0 commit comments

Comments
 (0)