Skip to content

Tracking Issue for env_host_tuple #146295

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions