Skip to main content

INPLACE_LIST_MUTATORS

Constant INPLACE_LIST_MUTATORS 

Source
pub const INPLACE_LIST_MUTATORS: &[&str];
Expand description

The DQ30 in-place List mutators, lowered natively per target via desugared_list_inplace_mutator. All are mut self (E5004-enforced like DQ18’s push/append); the per-method contracts:

  • pop() -> Optional[T] — removes/returns the last element; None on empty (emptiness is a normal state, never an abort);
  • remove_at(index) -> T — removes/returns the element at index; out-of-bounds (including negative) aborts (§10.5 Panic);
  • insert(index, value) -> Void — inserts before index; valid range 0..=len (len is the append position); out-of-bounds aborts — explicitly NOT Python’s native clamp;
  • reverse() -> Void — reverses in place;
  • set(index, value) -> Void — overwrites the element at index; out-of-bounds aborts (JS’s native silent array extension and Python’s negative indexing are both excluded by explicit bounds checks).

The synthesized abort checks (js/ts/python/go) throw/raise/panic with the normalized message List.<op>: index <i> out of bounds (len <n>); the Rust backend keeps Vec’s native panics (which carry the index and length), per the DQ23 native-abort convention.