-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Proposal
rustc has the ability to use a custom target spec via JSON (--target ./uwu.json
). The properties for this target are undocumented and unstable (even though it can be used on stable, lol). The way people use this in practice is by dumping the JSON for the target closest to their desired target and then modifying the JSON. This is hard because of the lack of documentation.
With a JSON schema, it would be significantly easier to write such a target spec JSON. It would give autocomplete in the editor, suggesting fields and their types. It can even contain some documentation generated from doc comments in rustc (of which a few exist already, and more could be written (or not)).
I want to add the flag --print target-spec-json-schema
(unstable, with no interest in stabilizing it) which prints the JSON schema file, and then also add the schema as a file into the sysroot (./etc/target-spec-json-schema.json
). None of this would be guaranteed stable, it would just exist (and be documented in the rustc book as existing and unstable). People can then configure their editors to point to this schema file in the sysroot.
draft implementation: rust-lang/rust#144498
resulting schema: https://gist.github.com/Noratrieb/e6f51b13d59b097d647f637314de37c5#file-schema-json
Mentors or Reviewers
anyone lol
Process
The main points of the Major Change Process are as follows:
- File an issue describing the proposal.
- A compiler team member who is knowledgeable in the area can second by writing
@rustbot second
or kickoff a team FCP with@rfcbot fcp $RESOLUTION
.- Refer to Proposals, Approvals and Stabilization docs for when a second is sufficient, or when a full team FCP is required.
- Once an MCP is seconded, the Final Comment Period begins.
- Final Comment Period lasts for 10 days after all outstanding concerns are solved.
- Outstanding concerns will block the Final Comment Period from finishing. Once all concerns are resolved, the 10 day countdown is restarted.
- If no concerns are raised after 10 days since the resolution of the last outstanding concern, the MCP is considered approved.
You can read more about Major Change Proposals on forge.