diff options
| author | Ralf Jung <post@ralfj.de> | 2018-10-10 09:11:38 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-10-13 09:09:03 +0200 |
| commit | 3272c9845cb6fcd8c15bcd0cb4c229de42f583c7 (patch) | |
| tree | 54e3274198bd68ec375c6f0aca63b117d26afd33 | |
| parent | d0c585c52582d79dc83ac180521ccf1d8c249b57 (diff) | |
| download | rust-3272c9845cb6fcd8c15bcd0cb4c229de42f583c7.tar.gz rust-3272c9845cb6fcd8c15bcd0cb4c229de42f583c7.zip | |
foreign types: use size and align from layout
| -rw-r--r-- | src/librustc_mir/interpret/validity.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index e2fa4b15f81..59df61f2a6f 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -210,8 +210,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // Make sure this is non-NULL and aligned let (size, align) = self.size_and_align_of(place.meta, place.layout)? // for the purpose of validity, consider foreign types to have - // alignment 1 and size 0. - .unwrap_or_else(|| (Size::ZERO, Align::from_bytes(1, 1).unwrap())); + // alignment and size determined by the layout (size will be 0, + // alignment should take attributes into account). + .unwrap_or_else(|| place.layout.size_and_align()); match self.memory.check_align(place.ptr, align) { Ok(_) => {}, Err(err) => match err.kind { |
