Skip to content

RUSTFLAGS is easy to misspell as RUST_FLAGS #6406

@huonw

Description

@huonw

Problem

I can never remember if it's RUSTFLAGS or RUST_FLAGS, and writing the latter silently does nothing. This is made worse because essentially every other environment variable cargo understands or declares uses _s: https://doc.rust-lang.org/cargo/reference/environment-variables.html

(This also applies to RUSTDOCFLAGS vs. the incorrect RUSTDOC_FLAGS.)

Steps

  1. Be forgetful and write RUST_FLAGS instead of RUSTFLAGS
  2. Run RUST_FLAGS=some-arg cargo build
  3. Don't notice (and/or be surprised) that some-arg didn't take effect (for that specific example, the build "should" fail but doesn't).

Possible Solution(s)

Cargo could check for a RUST_FLAGS environment variable and emit a warning (or note) that RUSTFLAGS was meant.

Notes

Output of cargo version: cargo 1.31.0 (339d9f9 2018-11-16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`E-easyExperience: Easy

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions