Skip to content

Environment variable RUSTFLAGS not set inside build.rs script since Rust 1.55.0 #10111

Closed
@Tirka

Description

@Tirka

Problem

Environment variable RUSTFLAGS not set inside build.rs script since Rust 1.55.0

Steps

Install Rust Stable 1.54 and 1.55

rustup install 1.54.0
rustup install 1.55.0

Clone Minimal Reproducible Example

git clone https://github.com/Tirka/rustflags-buildrs.git
cd ./rustflags-buildrs

Build with Cargo and Rust Stable 1.54.0

RUSTFLAGS="-C target-cpu=skylake" FOO="bar" cargo +1.54.0 build -vv

Output:

[rustflags-buildrs 0.1.0] RUSTFLAGS=Some("-C target-cpu=skylake")
[rustflags-buildrs 0.1.0] FOO=Some("bar")

Cargo clean

cargo clean

Build with Cargo and Rust Stable 1.55.0

RUSTFLAGS="-C target-cpu=skylake" FOO="bar" cargo +1.55.0 build -vv

Output:

[rustflags-buildrs 0.1.0] RUSTFLAGS=None
[rustflags-buildrs 0.1.0] FOO=Some("bar")

It looks like RUSTFLAGS environment variable is not available within build.rs script since 1.55.0 and I can't find any info related to this new behavior in the changelog.

Possible Solution(s)

No response

Notes

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions