diff options
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/mir/pretty.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/syntax.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/visit.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/util/find_self_call.rs | 9 |
4 files changed, 14 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 1a6b0f4031d..239929a2c0e 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -785,7 +785,7 @@ impl<'tcx> TerminatorKind<'tcx> { Call { func, args, destination, .. } => { write!(fmt, "{destination:?} = ")?; write!(fmt, "{func:?}(")?; - for (index, arg) in args.iter().enumerate() { + for (index, arg) in args.iter().map(|a| &a.node).enumerate() { if index > 0 { write!(fmt, ", ")?; } diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index 462076d750f..6ebe57e29da 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -16,6 +16,7 @@ use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_hir::def_id::DefId; use rustc_hir::{self, CoroutineKind}; use rustc_index::IndexVec; +use rustc_span::source_map::Spanned; use rustc_target::abi::{FieldIdx, VariantIdx}; use rustc_ast::Mutability; @@ -673,7 +674,9 @@ pub enum TerminatorKind<'tcx> { /// These are owned by the callee, which is free to modify them. /// This allows the memory occupied by "by-value" arguments to be /// reused across function calls without duplicating the contents. - args: Vec<Operand<'tcx>>, + /// The span for each arg is also included + /// (e.g. `a` and `b` in `x.foo(a, b)`). + args: Vec<Spanned<Operand<'tcx>>>, /// Where the returned value will be written destination: Place<'tcx>, /// Where to go after this call returns. If none, the call necessarily diverges. diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 2ccf5a9f6f7..4696f54c897 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -524,7 +524,7 @@ macro_rules! make_mir_visitor { } => { self.visit_operand(func, location); for arg in args { - self.visit_operand(arg, location); + self.visit_operand(&$($mutability)? arg.node, location); } self.visit_place( destination, diff --git a/compiler/rustc_middle/src/util/find_self_call.rs b/compiler/rustc_middle/src/util/find_self_call.rs index 9f1e4ac11c2..0ca4fce5da9 100644 --- a/compiler/rustc_middle/src/util/find_self_call.rs +++ b/compiler/rustc_middle/src/util/find_self_call.rs @@ -2,6 +2,7 @@ use crate::mir::*; use crate::ty::GenericArgsRef; use crate::ty::{self, TyCtxt}; use rustc_span::def_id::DefId; +use rustc_span::source_map::Spanned; /// Checks if the specified `local` is used as the `self` parameter of a method call /// in the provided `BasicBlock`. If it is, then the `DefId` of the called method is @@ -23,7 +24,13 @@ pub fn find_self_call<'tcx>( tcx.opt_associated_item(def_id) { debug!("find_self_call: args={:?}", fn_args); - if let [Operand::Move(self_place) | Operand::Copy(self_place), ..] = **args { + if let [ + Spanned { + node: Operand::Move(self_place) | Operand::Copy(self_place), .. + }, + .., + ] = **args + { if self_place.as_local() == Some(local) { return Some((def_id, fn_args)); } |
