-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Enable conditional compilation checking on the Rust codebase #94298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,6 +186,34 @@ const LLVM_TOOLS: &[&str] = &[ | |
|
||
pub const VERSION: usize = 2; | ||
|
||
/// Extra --check-cfg to add when building | ||
/// (Mode restriction, config name, config values (if any)) | ||
const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)] = &[ | ||
(None, "bootstrap", None), | ||
(Some(Mode::Rustc), "parallel_compiler", None), | ||
(Some(Mode::ToolRustc), "parallel_compiler", None), | ||
(Some(Mode::Std), "miri", None), | ||
(Some(Mode::Std), "stdarch_intel_sde", None), | ||
(Some(Mode::Std), "no_fp_fmt_parse", None), | ||
(Some(Mode::Std), "no_global_oom_handling", None), | ||
(Some(Mode::Std), "freebsd12", None), | ||
(Some(Mode::Std), "backtrace_in_libstd", None), | ||
// FIXME: Used by rustfmt is their test but is invalid (neither cargo nor bootstrap ever set | ||
// this config) should probably by removed or use a allow attribute. | ||
(Some(Mode::ToolRustc), "release", None), | ||
// FIXME: Used by stdarch in their test, should use a allow attribute instead. | ||
(Some(Mode::Std), "dont_compile_me", None), | ||
// FIXME: Used by serde_json, but we should not be triggering on external dependencies. | ||
(Some(Mode::Rustc), "no_btreemap_remove_entry", None), | ||
(Some(Mode::ToolRustc), "no_btreemap_remove_entry", None), | ||
// FIXME: Used by crossbeam-utils, but we should not be triggering on external dependencies. | ||
(Some(Mode::Rustc), "crossbeam_loom", None), | ||
(Some(Mode::ToolRustc), "crossbeam_loom", None), | ||
// FIXME: Used by proc-macro2, but we should not be triggering on external dependencies. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be a good idea to document this in the tracking issue for this feature, and consider if there's some kind of crate-level opt-in that can be added -- I suspect in many cases folks will want to have this sort of crate-private cfg without end users needing to opt-in to it. It's also the case that the proc-macro2 library for example I think intends for this to be used by users, but doesn't expose it as a Cargo feature to avoid accidental use (e.g., by a library that enables that feature), forcing the 'last' user to actually pass the relevant cfg. I think this is fine for this PR but we should consider this as part of the feature development process, especially if and when stabilization is considered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes absolutely, it should be mentioned. I don't have the permissions to edit it but fell free to do so. I would also mention that were are getting those because we are using |
||
(Some(Mode::Rustc), "span_locations", None), | ||
(Some(Mode::ToolRustc), "span_locations", None), | ||
]; | ||
|
||
/// A structure representing a Rust compiler. | ||
/// | ||
/// Each compiler has a `stage` that it is associated with and a `host` that | ||
|
Uh oh!
There was an error while loading. Please reload this page.