Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Element segment expressions are evaluated interleaved with table writes during instantiation

Abierto
#15,036 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
24/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust, wasm
Área
compilers

Línea de trabajo

Reproduce both snippets with cargo run -- wast foo.wast, then follow the module-instantiation path in the wasmtime crate to where element segment expressions are evaluated and active segments run table.init. The spec order (all expressions evaluated first, then table writes) has to be reflected there, and the change must keep the fast path for the common case. Done when both scripts trap as expected and imported tables are untouched after the trap; run the existing wast spec tests for element segments and tables.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

This test:

(module $M
  (type $t (func (result i32)))
  (table (export "t") 2 funcref)
  (table (export "a") 2 anyref)
  (func (export "call") (param i32) (result i32)
    (call_indirect (type $t) (local.get 0)))
  (func (export "get-a") (param i32) (result i32)
    (i31.get_s (ref.cast (ref i31) (table.get 1 (local.get 0))))))
(register "M" $M)

(assert_trap
  (module
    (type $a (array (mut i64)))
    (import "M" "t" (table 2 funcref))
    (table $t2 1 anyref)
    (func $f (result i32) (i32.const 7))
    (elem (table 0) (i32.const 0) func $f)
    (elem (table $t2) (i32.const 0) anyref
      (array.new_default $a (i32.const 0x7fffffff))))
  "allocation size too large")
(assert_trap (invoke $M "call" (i32.const 0)) "uninitialized element")

fails with:

$ cargo run -- wast foo.wast
Error: failed to run script file 'foo.wast'

Caused by:
    0: failed directive on foo.wast:21
    1: expected trap, got Core([I32(7)])

and the same with the trap in a later element of the same segment:

(assert_trap
  (module
    (type $a (array (mut i64)))
    (import "M" "a" (table 2 anyref))
    (elem (table 0) (i32.const 0) anyref
      (ref.i31 (i32.const 5))
      (array.new_default $a (i32.const 0x7fffffff))))
  "allocation size too large")
(assert_trap (invoke $M "get-a" (i32.const 0)) "null reference")
$ cargo run -- wast foo.wast
Error: failed to run script file 'foo.wast'

Caused by:
    0: failed directive on foo.wast:19
    1: expected trap, got Core([I32(5)])

The spec's instantiation evaluates the element expressions of every segment before running any active segment's table.init, so a trapping expression should leave imported tables untouched.

Fixing this in my opinion is going to need to be balanced with implementation complexity. This is a vanishingly niche use case which in theory shouldn't come along with a large implementation burden. Nevertheless I figured it's worth opening here.

Lenguaje dominante
Rust
Estrellas
18.8k
Forks
1.9k
Merge medio
23 h 31 min
PR fusionados (30 d)
410

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bytecodealliance/wasmtime

Todos los issues de bytecodealliance/wasmtime

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.