compiler: Lower fn call arg spans down to MIR
To enable improved accuracy of diagnostics in upcoming commits.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use rustc_index::{Idx, IndexVec};
|
||||
use rustc_middle::ty::util::IntTypeExt;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_target::abi::{Abi, FieldIdx, Primitive};
|
||||
|
||||
use crate::build::expr::as_place::PlaceBase;
|
||||
@@ -15,7 +16,7 @@ use rustc_middle::thir::*;
|
||||
use rustc_middle::ty::cast::{mir_cast_kind, CastTy};
|
||||
use rustc_middle::ty::layout::IntegerExt;
|
||||
use rustc_middle::ty::{self, Ty, UpvarArgs};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// Returns an rvalue suitable for use until the end of the current
|
||||
@@ -156,7 +157,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
synth_info,
|
||||
TerminatorKind::Call {
|
||||
func: exchange_malloc,
|
||||
args: vec![Operand::Move(size), Operand::Move(align)],
|
||||
args: vec![
|
||||
Spanned { node: Operand::Move(size), span: DUMMY_SP },
|
||||
Spanned { node: Operand::Move(align), span: DUMMY_SP },
|
||||
],
|
||||
destination: storage,
|
||||
target: Some(success),
|
||||
unwind: UnwindAction::Continue,
|
||||
@@ -733,7 +737,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
this.diverge_from(block);
|
||||
block = success;
|
||||
}
|
||||
this.record_operands_moved(&[value_operand]);
|
||||
this.record_operands_moved(&[Spanned { node: value_operand, span: DUMMY_SP }]);
|
||||
}
|
||||
block.and(Rvalue::Aggregate(Box::new(AggregateKind::Array(elem_ty)), IndexVec::new()))
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ use rustc_hir as hir;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::thir::*;
|
||||
use rustc_middle::ty::CanonicalUserTypeAnnotation;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use std::iter;
|
||||
|
||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
@@ -248,7 +249,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
let args: Vec<_> = args
|
||||
.into_iter()
|
||||
.copied()
|
||||
.map(|arg| unpack!(block = this.as_local_call_operand(block, arg)))
|
||||
.map(|arg| Spanned {
|
||||
node: unpack!(block = this.as_local_call_operand(block, arg)),
|
||||
span: this.thir.exprs[arg].span,
|
||||
})
|
||||
.collect();
|
||||
|
||||
let success = this.cfg.start_new_block();
|
||||
|
||||
Reference in New Issue
Block a user