0xMiden / 0xMiden/miden-formatting
Stack overflow in `Document::has_leading_newline` on large document
- Lenguaje dominante
- Rust
- Estrellas
- 0
- Forks
- 5
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
The stack overflow occurs in the recursion at https://github.com/0xPolygonMiden/miden-formatting/blob/edcd53720ec768775053488474c7ea3f8e7c8d13/formatting/src/prettier/document.rs#L52
during pretty printing.
To reproduce: print a `midenc_codegen_masm::Program` emitted with stdlib.
Workaround: increase the stack size via `RUST_MIN_STACK=104857600` env var.
Guía de contribución
Línea de trabajo
The issue points to a recursive function `Document::has_leading_newline` in formatting/src/prettier/document.rs at line 52. Start by examining that function and the `Document` type to understand the recursion. Reproduce the overflow by pretty-printing a `midenc_codegen_masm::Program` with stdlib, as described. Look for ways to convert the recursion to iteration or tail recursion. Check existing tests for the prettier module to understand the expected behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100