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

オープン
#235 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp, rust

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C++
スター
16.4k
フォーク
539
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Snapchat/Valdi のほかの issue

Snapchat/Valdi の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。