about summary refs log tree commit diff
path: root/src/librustc_mir/interpret
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-02-23 09:25:37 +0100
committerGitHub <noreply@github.com>2019-02-23 09:25:37 +0100
commitd038fb2a883ceedb7e72689d84a2ff961f3e1a8d (patch)
treeedc1b3305d100b012d59d6b92ecdd0194a366693 /src/librustc_mir/interpret
parent2db0e489bc1af7518c51463d9b5fd4dd25bb73ce (diff)
parentd0c110f2c6a82f3c1cd6ebd004d211a43978b7d1 (diff)
downloadrust-d038fb2a883ceedb7e72689d84a2ff961f3e1a8d.tar.gz
rust-d038fb2a883ceedb7e72689d84a2ff961f3e1a8d.zip
Rollup merge of #58658 - pmccarter:align_msg, r=matthewjasper
Add expected/provided byte alignments to validation error message

Fixes #58617
Diffstat (limited to 'src/librustc_mir/interpret')
-rw-r--r--src/librustc_mir/interpret/validity.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs
index 8b97d9ded74..6b932b17524 100644
--- a/src/librustc_mir/interpret/validity.rs
+++ b/src/librustc_mir/interpret/validity.rs
@@ -357,8 +357,10 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>
                         match err.kind {
                             EvalErrorKind::InvalidNullPointerUsage =>
                                 return validation_failure!("NULL reference", self.path),
-                            EvalErrorKind::AlignmentCheckFailed { .. } =>
-                                return validation_failure!("unaligned reference", self.path),
+                            EvalErrorKind::AlignmentCheckFailed { required, has } =>
+                                return validation_failure!(format!("unaligned reference \
+                                    (required {} byte alignment but found {})",
+                                    required.bytes(), has.bytes()), self.path),
                             _ =>
                                 return validation_failure!(
                                     "dangling (out-of-bounds) reference (might be NULL at \