diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-02-23 09:25:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-23 09:25:37 +0100 |
| commit | d038fb2a883ceedb7e72689d84a2ff961f3e1a8d (patch) | |
| tree | edc1b3305d100b012d59d6b92ecdd0194a366693 /src/librustc_mir/interpret | |
| parent | 2db0e489bc1af7518c51463d9b5fd4dd25bb73ce (diff) | |
| parent | d0c110f2c6a82f3c1cd6ebd004d211a43978b7d1 (diff) | |
| download | rust-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.rs | 6 |
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 \ |
