Skip to content

tonic_prost_build: emit_rerun_if_changed no longer does anything #2511

@cmtm

Description

@cmtm

Bug Report

The Builder::emit_rerun_if_changed method in tonic-prost-build does nothing. The field is stored but never used, and the documented behavior ("Passed directly to prost_build::Config.emit_rerun_if_changed") is incorrect because prost_build::Config has no such method.

Version

0.14.4

Platform

All

Crates

tonic_prost_build

Description

The emit_rerun_if_changed field is defined in the Builder struct (lib.rs:405):

emit_rerun_if_changed: bool,

It has a setter method (lib.rs:639-642):

/// Passed directly to `prost_build::Config.emit_rerun_if_changed`. pub fn emit_rerun_if_changed(mut self, enable: bool) -> Self { self.emit_rerun_if_changed = enable; self }

However, searching compile_with_config (the method that actually uses the Builder fields to configure prost), the emit_rerun_if_changed field is never read or used. Every other field is passed to the prost_build::Config, but this one is simply ignored.

Furthermore, prost_build::Config does not have an emit_rerun_if_changed method. The prost-build source contains only a TODO comment about potentially adding this functionality (prost-build config.rs:1037-1041):

// TODO: This should probably emit 'rerun-if-changed=PATH' directives for cargo, however // according to [1] if any are output then those paths replace the default crate root, // which is undesirable. Figure out how to do it in an additive way; perhaps gcc-rs has // this figured out. // [1]: https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions