about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_mir/transform/validate.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/librustc_mir/transform/validate.rs b/src/librustc_mir/transform/validate.rs
index 046889193da..7a1393468ce 100644
--- a/src/librustc_mir/transform/validate.rs
+++ b/src/librustc_mir/transform/validate.rs
@@ -54,12 +54,10 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
         // `Operand::Copy` is only supposed to be used with `Copy` types.
         if let Operand::Copy(place) = operand {
             let ty = place.ty(&self.body.local_decls, self.tcx).ty;
+            let span = self.body.source_info(location).span;
 
-            if !ty.is_copy_modulo_regions(self.tcx, self.param_env, DUMMY_SP) {
-                self.fail(
-                    DUMMY_SP,
-                    format!("`Operand::Copy` with non-`Copy` type {} at {:?}", ty, location),
-                );
+            if !ty.is_copy_modulo_regions(self.tcx, self.param_env, span) {
+                self.fail(span, format!("`Operand::Copy` with non-`Copy` type {}", ty));
             }
         }