Skip to content

Commit 037e189

Browse files
committed
Remove box_alloc from Machine trait.
1 parent 1b7f5a3 commit 037e189

File tree

4 files changed

+1
-21
lines changed

4 files changed

+1
-21
lines changed

compiler/rustc_const_eval/src/const_eval/machine.rs

-7
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,6 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
406406
Err(ConstEvalErrKind::NeedsRfc("pointer arithmetic or comparison".to_string()).into())
407407
}
408408

409-
fn box_alloc(
410-
_ecx: &mut InterpCx<'mir, 'tcx, Self>,
411-
_dest: &PlaceTy<'tcx>,
412-
) -> InterpResult<'tcx> {
413-
Err(ConstEvalErrKind::NeedsRfc("heap allocations via `box` keyword".to_string()).into())
414-
}
415-
416409
fn before_terminator(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
417410
// The step limit has already been hit in a previous call to `before_terminator`.
418411
if ecx.machine.steps_remaining == 0 {

compiler/rustc_const_eval/src/interpret/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub enum StackPopCleanup {
152152
/// `ret` stores the block we jump to on a normal return, while `unwind`
153153
/// stores the block used for cleanup during unwinding.
154154
Goto { ret: Option<mir::BasicBlock>, unwind: StackPopUnwind },
155-
/// Just do nothing: Used by Main and for the `box_alloc` hook in miri.
155+
/// Just do nothing: Used by Main and for TLS hooks in miri.
156156
/// `cleanup` says whether locals are deallocated. Static computation
157157
/// wants them leaked to intern what they need (and just throw away
158158
/// the entire `ecx` when it is done).

compiler/rustc_const_eval/src/interpret/machine.rs

-6
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,6 @@ pub trait Machine<'mir, 'tcx>: Sized {
208208
right: &ImmTy<'tcx, Self::PointerTag>,
209209
) -> InterpResult<'tcx, (Scalar<Self::PointerTag>, bool, Ty<'tcx>)>;
210210

211-
/// Heap allocations via the `box` keyword.
212-
fn box_alloc(
213-
ecx: &mut InterpCx<'mir, 'tcx, Self>,
214-
dest: &PlaceTy<'tcx, Self::PointerTag>,
215-
) -> InterpResult<'tcx>;
216-
217211
/// Called to read the specified `local` from the `frame`.
218212
/// Since reading a ZST is not actually accessing memory or locals, this is never invoked
219213
/// for ZST reads.

compiler/rustc_mir_transform/src/const_prop.rs

-7
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,6 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine<'mir, 'tcx>
233233
throw_machine_stop_str!("pointer arithmetic or comparisons aren't supported in ConstProp")
234234
}
235235

236-
fn box_alloc(
237-
_ecx: &mut InterpCx<'mir, 'tcx, Self>,
238-
_dest: &PlaceTy<'tcx>,
239-
) -> InterpResult<'tcx> {
240-
throw_machine_stop_str!("can't const prop heap allocations")
241-
}
242-
243236
fn access_local(
244237
_ecx: &InterpCx<'mir, 'tcx, Self>,
245238
frame: &Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>,

0 commit comments

Comments
 (0)