Skip to content

Tracking issue for --env-set flag #118372

@GuillaumeGomez

Description

@GuillaumeGomez

Adds a new --env-set command line option on rustc. It allows to set environment variables value at compile-time to be used by env! and option_env! macros.

When retrieving and environment variable value, the one specified by --env-set will take precedence. For example if you want have PATH=a in your environment and pass --env-set PATH=env, then you will have:

assert_eq!(env!("PATH"), "env");

Steps

Unresolved questions

  • What is the desired behavior if the same --env variable is passed twice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC

    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