-
Notifications
You must be signed in to change notification settings - Fork 74
Disallow incoherent cfgs #610
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
Disallow combinations of flags that don't make sense. Here is a non-exhaustive list:
--cfg debug_assertions -C debug-assertions=off--cfg unix --target x86_64-pc-windows-msvc(and similar for--cfg windows,--cfg target_arch=...,target_os, etc)--cfg testwithout--test--cfg proc_macro --crate-type lib--cfg panic=abort -C panic=unwindI don't see any other cfgs in https://doc.rust-lang.org/reference/conditional-compilation.html, but I'm unsure if that's because there are no others or the reference just isn't up to date. The implementation PR should verify that this is an exhaustive list (once all the
target_*cfgs are included).Note that this is technically a breaking change, but in practice any code that is using these combinations of flags is already hopelessly broken. I am of course happy to do a crater run to verify that's true.
Alternatives
Disallow
--cfg debug_assertionsetc. even if-C debug-assertions=onis set. This seems unnecessary, since the meaning is clear, and would be a larger breaking change.Mentors or Reviewers
I am not sure who should mentor this work, but the code itself should be fairly simple.
Process
The main points of the Major Change Process are as follows:
@rustbot second.-C flag, then full team check-off is required.@rfcbot fcp mergeon either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.