-
Notifications
You must be signed in to change notification settings - Fork 74
Add JSON schema for target spec JSON #905
Copy link
Copy link
Closed
Labels
T-compilerAdd this label so rfcbot knows to poll the compiler teamAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustcA proposal to make a major change to rustcmajor-change-acceptedA major change proposal that was acceptedA major change proposal that was accepted
Metadata
Metadata
Assignees
Labels
T-compilerAdd this label so rfcbot knows to poll the compiler teamAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustcA proposal to make a major change to rustcmajor-change-acceptedA major change proposal that was acceptedA major change proposal that was accepted
Type
Fields
Give feedbackNo fields configured for issues without a type.
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:
@rustbot secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.You can read more about Major Change Proposals on forge.