Skip to content

Stop using 0.0.0 as a fallback version for rustc compilation. #3674

@dzbarsky

Description

@dzbarsky

If the version attribute is omitted, we set rustc env vars corresponding to an assumed version of 0.0.0 (such as CARGO_PKG_VERSION_MAJOR=0, etc.). We only set these for rustc compilation, but we omit them for running the cargo build script itself, which is inconsistent with the behavior when version is provided (in which case, the env vars are set both for compilation and build script execution). In addition, these env vars can conflict with the .env files that are provided to the rustc_env_files and build_script_env_files attributes, in which case their values are overridden by the values in the files.

To resolve the inconsistencies and make it easier to reason about the behavior, if the version attribute is omitted, we will stop injecting the "0.0.0" version and skip setting the extra env vars, as long as the incompatible_do_not_inject_degenerate_version_to_rustc_env flag is enabled.

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