Skip to content

rustc has incomplete version information when compiling from source #86587

Closed
@Zapeth

Description

@Zapeth

When building from released sources (https://static.rust-lang.org/dist/rustc-<version>-src.tar.xz), the resulting rustc binary is missing detailed version information like commit hash and commit date.

Looking at the source it seems to only rely on git commands/paths to assemble this information (https://github.com/rust-lang/rust/blob/5a7834050f3a0ebcd117b4ddf0bc1e8459594309/src/bootstrap/channel.rs#L26-L36), but it could also be obtained/parsed from rustc-<version>-src/version when compiling from the released source files (and rustc-<version>-src/git-commit-hash if the entire commit hash is required too).

As far as I know this affects all rust releases that are not obtained via rustup (i.e. packaged by distributions or built from scratch).

Sample output of rustc -vV:

rustc 1.51.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-pc-windows-gnu
release: 1.51.0
LLVM version: 11.0.0

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