Closed
Description
Summary
RFC: #3013
rustc tracking issue: rust-lang/rust#82450
Documentation:
- https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg
- https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#cargorustc-check-cfgcheck_cfg
This tracks the integration of rustc --check-cfg
flag (RFC #3013), which enables complete or partial checking of conditional compilation configuration at compile time.
Unresolved Issues
- Should these flags be enabled by default? What's the unintrusive interface to provide for users to opt-out the checking?
- If we feel the diagnostic on using a feature when no features are defined is insufficient, then do we feel it would not be incongruous with the design to fix this in the future? (see Fix
--check-cfg
invocations with zero features #13011).
Post-RFC decisions
- Support
cargo:rustc-check-cfg
despite::
being introduced in 1.77 and this being released after that. This was done to allow for wider MSRVs while using this feature
Future Extensions
No response
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Implementation history:
- Add -Z check-cfg-features to enable compile-time checking of features #10408
- Add -Z check-cfg-features support for rustdoc #10428
- Add support for rustc --check-cfg well known names and values #10486
- Improve support of condition compilation checking #10566
- Add unstable
rustc-check-cfg
build script output #10539 - Adjust
-Zcheck-cfg
for new rustc syntax and behavior #12845 - Remove outdated option to
-Zcheck-cfg
warnings #12884 - Fix
--check-cfg
invocations with zero features #13011 - Include declared list of features in fingerprint for
-Zcheck-cfg
#13012 - Go back to passing an empty
values()
when no features are declared #13316
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Unstable, baking
Status
FCP merge
Activity