diff --git a/rust/ares/src/interpreter.rs b/rust/ares/src/interpreter.rs index 5427b75..1b172f1 100644 --- a/rust/ares/src/interpreter.rs +++ b/rust/ares/src/interpreter.rs @@ -83,6 +83,17 @@ pub fn interpret( *(stack.local_noun_pointer(0)) = work_to_noun(Done); } push_formula(stack, formula); + // DO NOT REMOVE THIS ASSERTION + // + // If you need to allocate for debugging, wrap the debugging code in + // + // ``` + // permit_alloc(|| { + // your.code.goes.here() + // }) + // ``` + // + // (See https://docs.rs/assert_no_alloc/latest/assert_no_alloc/#advanced-use) assert_no_alloc(|| unsafe { loop { match noun_to_work(*(stack.local_noun_pointer(0))) { diff --git a/rust/ares/src/lib.rs b/rust/ares/src/lib.rs index 61f94e8..512daa8 100644 --- a/rust/ares/src/lib.rs +++ b/rust/ares/src/lib.rs @@ -36,6 +36,18 @@ macro_rules! gdb { }; } +// Use the allocator from assert_no_alloc. +// +// DO NOT COMMENT THIS OUT +// +// if you need to allow allocations somewhere for debugging, wrap your debug code in +// ``` +// permit_alloc( || { +// your.code.goes.here() +// }) +// ``` +// +// (see https://docs.rs/assert_no_alloc/latest/assert_no_alloc/#advanced-use) #[cfg(debug_assertions)] #[global_allocator] static A: assert_no_alloc::AllocDisabler = assert_no_alloc::AllocDisabler;