about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/util/find_self_call.rs
diff options
context:
space:
mode:
authorMartin Nordholts <martin.nordholts@codetale.se>2024-01-12 08:21:42 +0100
committerMartin Nordholts <martin.nordholts@codetale.se>2024-01-15 19:07:11 +0100
commit16ba56c24238b2f44e0a97da760c83d8795abd80 (patch)
tree7b6b595de31dc60239c669591f3231a6648b7840 /compiler/rustc_middle/src/util/find_self_call.rs
parent924ea05103da3bd25e6021535615ca7f8b9ec76d (diff)
downloadrust-16ba56c24238b2f44e0a97da760c83d8795abd80.tar.gz
rust-16ba56c24238b2f44e0a97da760c83d8795abd80.zip
compiler: Lower fn call arg spans down to MIR
To enable improved accuracy of diagnostics in upcoming commits.
Diffstat (limited to 'compiler/rustc_middle/src/util/find_self_call.rs')
-rw-r--r--compiler/rustc_middle/src/util/find_self_call.rs9
1 files changed, 8 insertions, 1 deletions
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));
                         }