Skip to content

Tracking Issue for env_host_tuple #146295

@kornelski

Description

@kornelski

Feature gate: #![feature(env_host_tuple)]

This adds the current host tuple (AKA target triple) to std::env.

The goal is to remove the need for using build scripts to save Cargo's TARGET env var (example). Tools invoking cargo often need to know the platform's default target in order to add a matching --target <tuple> arg.

It uses the term "tuple" instead of "triple", because the "host tuple" terminology has been decided in: #125579 (comment)

It uses the term "host", because:

  • after std has been built, its compilation target becomes the host for programs using it.
  • during cross-compilation, Cargo's build.rs scripts will get the same tuple in the HOST env var, but a different TARGET.
  • the term "target" is overloaded in Rust/Cargo.

Public API

std::env::consts::HOST_TUPLE: &str

Steps / History

Unresolved Questions

  • None yet.

@rustbot label -S-tracking-unimplemented

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions