compiler: Lower fn call arg spans down to MIR
To enable improved accuracy of diagnostics in upcoming commits.
This commit is contained in:
@@ -45,9 +45,9 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
kind: StatementKind::Intrinsic(Box::new(
|
||||
NonDivergingIntrinsic::CopyNonOverlapping(
|
||||
rustc_middle::mir::CopyNonOverlapping {
|
||||
src: args.next().unwrap(),
|
||||
dst: args.next().unwrap(),
|
||||
count: args.next().unwrap(),
|
||||
src: args.next().unwrap().node,
|
||||
dst: args.next().unwrap().node,
|
||||
count: args.next().unwrap().node,
|
||||
},
|
||||
),
|
||||
)),
|
||||
@@ -66,7 +66,7 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
block.statements.push(Statement {
|
||||
source_info: terminator.source_info,
|
||||
kind: StatementKind::Intrinsic(Box::new(
|
||||
NonDivergingIntrinsic::Assume(args.next().unwrap()),
|
||||
NonDivergingIntrinsic::Assume(args.next().unwrap().node),
|
||||
)),
|
||||
});
|
||||
assert_eq!(
|
||||
@@ -112,7 +112,7 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
source_info: terminator.source_info,
|
||||
kind: StatementKind::Assign(Box::new((
|
||||
*destination,
|
||||
Rvalue::BinaryOp(bin_op, Box::new((lhs, rhs))),
|
||||
Rvalue::BinaryOp(bin_op, Box::new((lhs.node, rhs.node))),
|
||||
))),
|
||||
});
|
||||
terminator.kind = TerminatorKind::Goto { target };
|
||||
@@ -136,7 +136,7 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
source_info: terminator.source_info,
|
||||
kind: StatementKind::Assign(Box::new((
|
||||
*destination,
|
||||
Rvalue::CheckedBinaryOp(bin_op, Box::new((lhs, rhs))),
|
||||
Rvalue::CheckedBinaryOp(bin_op, Box::new((lhs.node, rhs.node))),
|
||||
))),
|
||||
});
|
||||
terminator.kind = TerminatorKind::Goto { target };
|
||||
@@ -164,7 +164,7 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
let [arg] = args.as_slice() else {
|
||||
span_bug!(terminator.source_info.span, "Wrong number of arguments");
|
||||
};
|
||||
let derefed_place = if let Some(place) = arg.place()
|
||||
let derefed_place = if let Some(place) = arg.node.place()
|
||||
&& let Some(local) = place.as_local()
|
||||
{
|
||||
tcx.mk_place_deref(local.into())
|
||||
@@ -200,7 +200,7 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
"Wrong number of arguments for write_via_move intrinsic",
|
||||
);
|
||||
};
|
||||
let derefed_place = if let Some(place) = ptr.place()
|
||||
let derefed_place = if let Some(place) = ptr.node.place()
|
||||
&& let Some(local) = place.as_local()
|
||||
{
|
||||
tcx.mk_place_deref(local.into())
|
||||
@@ -214,13 +214,13 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
source_info: terminator.source_info,
|
||||
kind: StatementKind::Assign(Box::new((
|
||||
derefed_place,
|
||||
Rvalue::Use(val),
|
||||
Rvalue::Use(val.node),
|
||||
))),
|
||||
});
|
||||
terminator.kind = TerminatorKind::Goto { target };
|
||||
}
|
||||
sym::discriminant_value => {
|
||||
if let (Some(target), Some(arg)) = (*target, args[0].place()) {
|
||||
if let (Some(target), Some(arg)) = (*target, args[0].node.place()) {
|
||||
let arg = tcx.mk_place_deref(arg);
|
||||
block.statements.push(Statement {
|
||||
source_info: terminator.source_info,
|
||||
@@ -244,7 +244,7 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
source_info: terminator.source_info,
|
||||
kind: StatementKind::Assign(Box::new((
|
||||
*destination,
|
||||
Rvalue::BinaryOp(BinOp::Offset, Box::new((ptr, delta))),
|
||||
Rvalue::BinaryOp(BinOp::Offset, Box::new((ptr.node, delta.node))),
|
||||
))),
|
||||
});
|
||||
terminator.kind = TerminatorKind::Goto { target };
|
||||
@@ -265,7 +265,7 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
|
||||
source_info: terminator.source_info,
|
||||
kind: StatementKind::Assign(Box::new((
|
||||
*destination,
|
||||
Rvalue::Cast(CastKind::Transmute, arg, dst_ty),
|
||||
Rvalue::Cast(CastKind::Transmute, arg.node, dst_ty),
|
||||
))),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user