Rust codegen: Gating emit_rust on emit_release breaks Rust native_deps and valdi_test under code_coverage and output_flavor=debug
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend, build-system
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- C++
- Stars
- 16.4k
- Forks
- 539
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Snapchat/Valdi
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Rust codegen: RustMethodResolver fails to unwrap .nullable on optional interface/module methodsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepseek-ai/DeepGEMM-Ascend#49 ·
Maintainers usually reply within 1 day
-
bug needs testing platform:windows topic:buildsystem topic:platforms
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
godotengine/godot#126110 · 1 comment ·
Maintainers usually reply within 1 day
-
comp-s3queue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ClickHouse/ClickHouse#137649 ·
Maintainers usually reply within 1 day
-
area/docdb kind/enhancement mvu-pg15-pg19 priority/low
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
yugabyte/yugabyte-db#40355 ·
Maintainers usually reply within 1 day
-
Clear params.inputs in dials.indexPossibly taken @phyy-nx claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dials/dials#3361 · 1 comment ·
Maintainers usually reply within 1 day