RFC3239: Implement compact cfg(target(..))
This commit is contained in:
parent
ae38533ed7
commit
8345571cd0
4 changed files with 24 additions and 0 deletions
|
@ -630,6 +630,25 @@ pub fn eval_condition(
|
||||||
|
|
||||||
!eval_condition(mis[0].meta_item().unwrap(), sess, features, eval)
|
!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!(
|
struct_span_err!(
|
||||||
sess.span_diagnostic,
|
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`
|
//! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax`
|
||||||
//! to this crate.
|
//! to this crate.
|
||||||
|
|
||||||
|
#![feature(let_chains)]
|
||||||
#![feature(let_else)]
|
#![feature(let_else)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -319,6 +319,8 @@ declare_features! (
|
||||||
(active, cfg_sanitize, "1.41.0", Some(39699), None),
|
(active, cfg_sanitize, "1.41.0", Some(39699), None),
|
||||||
/// Allows `cfg(target_abi = "...")`.
|
/// Allows `cfg(target_abi = "...")`.
|
||||||
(active, cfg_target_abi, "1.55.0", Some(80970), None),
|
(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 = "...")`.
|
/// Allows `cfg(target_has_atomic_load_store = "...")`.
|
||||||
(active, cfg_target_has_atomic, "1.60.0", Some(94039), None),
|
(active, cfg_target_has_atomic, "1.60.0", Some(94039), None),
|
||||||
/// Allows `cfg(target_has_atomic_equal_alignment = "...")`.
|
/// Allows `cfg(target_has_atomic_equal_alignment = "...")`.
|
||||||
|
|
|
@ -427,6 +427,7 @@ symbols! {
|
||||||
cfg_panic,
|
cfg_panic,
|
||||||
cfg_sanitize,
|
cfg_sanitize,
|
||||||
cfg_target_abi,
|
cfg_target_abi,
|
||||||
|
cfg_target_compact,
|
||||||
cfg_target_feature,
|
cfg_target_feature,
|
||||||
cfg_target_has_atomic,
|
cfg_target_has_atomic,
|
||||||
cfg_target_has_atomic_equal_alignment,
|
cfg_target_has_atomic_equal_alignment,
|
||||||
|
@ -1375,6 +1376,7 @@ symbols! {
|
||||||
sym,
|
sym,
|
||||||
sync,
|
sync,
|
||||||
t32,
|
t32,
|
||||||
|
target,
|
||||||
target_abi,
|
target_abi,
|
||||||
target_arch,
|
target_arch,
|
||||||
target_endian,
|
target_endian,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue