mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
RFC3239: Implement compact cfg(target(..))
This commit is contained in:
parent
ae38533ed7
commit
8345571cd0
@ -630,6 +630,25 @@ pub fn eval_condition(
|
||||
|
||||
!eval_condition(mis[0].meta_item().unwrap(), sess, features, eval)
|
||||
}
|
||||
sym::target => {
|
||||
if let Some(features) = features && !features.cfg_target_compact {
|
||||
feature_err(
|
||||
sess,
|
||||
sym::cfg_target_compact,
|
||||
cfg.span,
|
||||
&"compact `cfg(target(..))` is experimental and subject to change"
|
||||
).emit();
|
||||
}
|
||||
|
||||
mis.iter().fold(true, |res, mi| {
|
||||
let mut mi = mi.meta_item().unwrap().clone();
|
||||
if let [seg, ..] = &mut mi.path.segments[..] {
|
||||
seg.ident.name = Symbol::intern(&format!("target_{}", seg.ident.name));
|
||||
}
|
||||
|
||||
res & eval_condition(&mi, sess, features, eval)
|
||||
})
|
||||
}
|
||||
_ => {
|
||||
struct_span_err!(
|
||||
sess.span_diagnostic,
|
||||
|
@ -4,6 +4,7 @@
|
||||
//! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax`
|
||||
//! to this crate.
|
||||
|
||||
#![feature(let_chains)]
|
||||
#![feature(let_else)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -319,6 +319,8 @@ declare_features! (
|
||||
(active, cfg_sanitize, "1.41.0", Some(39699), None),
|
||||
/// Allows `cfg(target_abi = "...")`.
|
||||
(active, cfg_target_abi, "1.55.0", Some(80970), None),
|
||||
/// Allows `cfg(target(abi = "..."))`.
|
||||
(active, cfg_target_compact, "1.63.0", Some(96901), None),
|
||||
/// Allows `cfg(target_has_atomic_load_store = "...")`.
|
||||
(active, cfg_target_has_atomic, "1.60.0", Some(94039), None),
|
||||
/// Allows `cfg(target_has_atomic_equal_alignment = "...")`.
|
||||
|
@ -427,6 +427,7 @@ symbols! {
|
||||
cfg_panic,
|
||||
cfg_sanitize,
|
||||
cfg_target_abi,
|
||||
cfg_target_compact,
|
||||
cfg_target_feature,
|
||||
cfg_target_has_atomic,
|
||||
cfg_target_has_atomic_equal_alignment,
|
||||
@ -1375,6 +1376,7 @@ symbols! {
|
||||
sym,
|
||||
sync,
|
||||
t32,
|
||||
target,
|
||||
target_abi,
|
||||
target_arch,
|
||||
target_endian,
|
||||
|
Loading…
Reference in New Issue
Block a user