Skip to content

Commit c847071

Browse files
committed
add comment about not using builtin_deref
1 parent 56f1ef3 commit c847071

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/stacked_borrows.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,8 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for MiriEvalContext<'a, 'mir, 'tcx> {
624624
// a `MemPlace`, so we have a fast path for reference types that
625625
// avoids allocating.
626626
match place.layout.ty.sty {
627+
// Cannot use `builtin_deref` because that reports *immutable* for `Box`,
628+
// making it useless.
627629
ty::Ref(_, _, mutbl) => {
628630
// fast path
629631
let val = self.read_immediate(self.place_to_op(place)?)?;
@@ -657,6 +659,8 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for MiriEvalContext<'a, 'mir, 'tcx> {
657659
// Primitives of reference type, that is the one thing we are interested in.
658660
fn visit_primitive(&mut self, place: MPlaceTy<'tcx, Borrow>) -> EvalResult<'tcx>
659661
{
662+
// Cannot use `builtin_deref` because that reports *immutable* for `Box`,
663+
// making it useless.
660664
let mutbl = match place.layout.ty.sty {
661665
ty::Ref(_, _, mutbl) => mutbl,
662666
ty::Adt(..) if place.layout.ty.is_box() => MutMutable,

0 commit comments

Comments
 (0)