diff options
| author | Ralf Jung <post@ralfj.de> | 2022-05-25 14:29:46 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-05-25 15:08:07 +0200 |
| commit | d7a2d9ae0e7e4b3c5811bdfd4809cfc772062140 (patch) | |
| tree | 4446478ef690dcda3c8810822f3f7eb1a1b19ae0 /compiler/rustc_const_eval/src/interpret | |
| parent | 4a99c5f504ab65a0fd9d60f515811e1d9cff8c0a (diff) | |
| download | rust-d7a2d9ae0e7e4b3c5811bdfd4809cfc772062140.tar.gz rust-d7a2d9ae0e7e4b3c5811bdfd4809cfc772062140.zip | |
Miri call ABI check: ensure type size+align stay the same
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/terminator.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index a5c7d4c8e20..10da2f803af 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -185,7 +185,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // No question return true; } - // Compare layout + if caller_abi.layout.size != callee_abi.layout.size + || caller_abi.layout.align.abi != callee_abi.layout.align.abi + { + // This cannot go well... + // FIXME: What about unsized types? + return false; + } + // The rest *should* be okay, but we are extra conservative. match (caller_abi.layout.abi, callee_abi.layout.abi) { // Different valid ranges are okay (once we enforce validity, // that will take care to make it UB to leave the range, just |
