about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-11 15:08:41 +0000
committerbors <bors@rust-lang.org>2022-06-11 15:08:41 +0000
commit85a26a9a96d3d0b1846cee97abbe6714dcbc6483 (patch)
treeaeaae2a25c2e278eaa5177e0486ac4d37aa86891 /compiler/rustc_const_eval/src
parentfa68e73e9947be8ffc5b3b46d899e4953a44e7e9 (diff)
parentb3c9a2fde4a28bfdced15a1cc8583b155d1d281a (diff)
downloadrust-85a26a9a96d3d0b1846cee97abbe6714dcbc6483.tar.gz
rust-85a26a9a96d3d0b1846cee97abbe6714dcbc6483.zip
Auto merge of #97989 - Dylan-DPC:rollup-wol1a1y, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #97761 (validating the vtable can lead to Stacked Borrows errors)
 - #97789 (Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no`)
 - #97913 (Wrap `HirId`s of locals into `LocalVarId`s for THIR nodes)
 - #97979 (Fix typos in Provider API docs)
 - #97987 (remove an unnecessary `String`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/interpret/validity.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs
index b39a33aff09..630281bb092 100644
--- a/compiler/rustc_const_eval/src/interpret/validity.rs
+++ b/compiler/rustc_const_eval/src/interpret/validity.rs
@@ -338,6 +338,10 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
                         { "invalid drop function pointer in vtable (not pointing to a function)" },
                     err_ub!(InvalidVtableDropFn(..)) =>
                         { "invalid drop function pointer in vtable (function has incompatible signature)" },
+                    // Stacked Borrows errors can happen here, see https://github.com/rust-lang/miri/issues/2123.
+                    // (We assume there are no other MachineStop errors possible here.)
+                    InterpError::MachineStop(_) =>
+                        { "vtable pointer does not have permission to read drop function pointer" },
                 );
                 try_validation!(
                     self.ecx.read_size_and_align_from_vtable(vtable),
@@ -347,6 +351,10 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
                     err_ub!(InvalidVtableAlignment(msg)) =>
                         { "invalid vtable: alignment {}", msg },
                     err_unsup!(ReadPointerAsBytes) => { "invalid size or align in vtable" },
+                    // Stacked Borrows errors can happen here, see https://github.com/rust-lang/miri/issues/2123.
+                    // (We assume there are no other MachineStop errors possible here.)
+                    InterpError::MachineStop(_) =>
+                        { "vtable pointer does not have permission to read size and alignment" },
                 );
                 // FIXME: More checks for the vtable.
             }