-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Proposal
Some rustc codegen flags are target specific (or specific to families of targets) and have no effect when used on unsupported targets. For example:
-C control-flow-guard- Only supported on Windows targets-C dlltool- Only used on*-windows-gnutargets-C dwarf-version- Has no effect on*-windows-msvctargets-C relro-level- Has no effect on*-windows-msvctargets
The question of "what should a codegen flag do on unsupported targets" has previously come up during stabilization of some codegen flags.
I propose that we add a lint which fires when a codegen flag is passed to the compiler which is ignored for the active target:
$ rustc -C dlltool=something.exe -C control-flow-guard=on --target x86_64-unknown-linux-gnu hello_world.rs
warning: `-C dlltool` has no effect on the target platform
warning: `-C control-flow-guard` has no effect on the target platform
The lint should default to the warn level but users can choose to deny or allow it via -D or -A flags respectively. Ideally the lint would only flag attempts to activate unsupported options as to avoid unnecessary diagnostic noise (eg rustc -C control-flow-guard=off --target x86_64-unknown-linux-gnu ... would not trigger the lint).
Mentors or Reviewers
I'm willing to mentor or implement the proposal.
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 secondor 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.