Description
In a recent Zulip discussion, it was noted that we currently consider JSON target specifications unstable, in the sense that options are relatively freely added and removed.
Currently, the compiler will load target specifications from three places.
If a triple is passed without trailing ".json":
- a built-in list, specified as Rust structs
$RUST_TARGET_PATH
, split like PATH on the system we're running on, or, if not set, the current directory.- we then attempt to load
$triple.json
from the directories listed
- we then attempt to load
If a triple is passed with .json, then we directly attempt to load that file path (relative or absolute).
This is the history as best as I can tell:
- Original
--target
support, including RUST_TARGET_PATH, was implemented in Implement flexible target specification #16156. - Trailing .json leading to a file lookup was added by @phil-opp in Introduce a TargetTriple enum to support absolute target paths #49019.
I cannot currently find any explicit discussion around stability, but presumably that discussion did happen at some time, happy to receive links to it. I would like to propose that we de-stabilize the RUST_TARGET_PATH and file-path loading, making only built-in targets usable. To my knowledge, this essentially is already the status quo: you need to build core/std to actually use a target, and that's not possible on beta/stable without intentional stability holes like RUSTC_BOOTSTRAP.