Rust codegen: Gating emit_rust on emit_release breaks Rust native_deps and valdi_test under code_coverage and output_flavor=debug

Abierto
#235 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
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cpp, rust

Línea de trabajo

Start in bzl/valdi/valdi_compiled.bzl and trace how emit_release controls emit_rust and outputs for debug and code_coverage builds. Then read bzl/valdi/extract_rust_outputs.bzl and bzl/valdi/valdi_test.bzl to follow the generated Rust sources into native_deps. Done means Rust bindings are generated and native_deps and valdi_test compile with both configurations.

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

Descripción

Found while reviewing https://github.com/Snapchat/Valdi/pull/211 (native Rust code generation). Not blocking that PR.

Gating emit_rust on emit_release breaks Rust native_deps and valdi_test under code_coverage and output_flavor=debug

File: bzl/valdi/valdi_compiled.bzl

When building a native_language = "rust" module (or running its valdi_test target) with @valdi//bzl/valdi:code_coverage_enabled=true or @valdi//bzl/valdi:output_flavor=debug, Rust compilation of native_deps fails because the generated _rust crate is empty. In valdi_compiled.bzl, emit_rust is gated on emit_release, which is False under code_coverage or output_flavor == "debug".

When emit_rust is False, ValdiModuleInfo.rust_srcs is None, so bzl/valdi/extract_rust_outputs.bzl writes an empty .rs file for <name>_rust_srcs. Any rust_library in native_deps then fails to compile due to missing generated traits, models, and registration macros — including during valdi_test, because bzl/valdi/valdi_test.bzl now builds a test_binary linked against <target>_native -> <target>_cpp -> native_deps.

Either keep generating the shared Rust bindings regardless of output_flavor / code_coverage (the compiler only suppresses release platform outputs when --output-target debug is passed), or avoid gating emit_rust / outputs on emit_release when native targets depend on them.

Lenguaje dominante
C++
Estrellas
16.4k
Forks
539
Métricas de merge de PR
Sin PR fusionados en 30 d

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 Snapchat/Valdi

Todos los issues de Snapchat/Valdi

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.