Skip to content

Commit 0a35464

Browse files
committed
Implement built-in attribute macro #[cfg_eval]
1 parent 4332fba commit 0a35464

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

core/src/macros/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,18 @@ pub(crate) mod builtin {
14521452
/* compiler built-in */
14531453
}
14541454

1455+
/// Expands all `#[cfg]` and `#[cfg_attr]` attributes in the code fragment it's applied to.
1456+
#[cfg(not(bootstrap))]
1457+
#[unstable(
1458+
feature = "cfg_eval",
1459+
issue = "82679",
1460+
reason = "`cfg_eval` is a recently implemented feature"
1461+
)]
1462+
#[rustc_builtin_macro]
1463+
pub macro cfg_eval($($tt:tt)*) {
1464+
/* compiler built-in */
1465+
}
1466+
14551467
/// Unstable implementation detail of the `rustc` compiler, do not use.
14561468
#[rustc_builtin_macro]
14571469
#[stable(feature = "rust1", since = "1.0.0")]

core/src/prelude/v1.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,12 @@ pub use crate::macros::builtin::derive;
8181
)]
8282
#[doc(no_inline)]
8383
pub use crate::macros::builtin::cfg_accessible;
84+
85+
#[cfg(not(bootstrap))]
86+
#[unstable(
87+
feature = "cfg_eval",
88+
issue = "82679",
89+
reason = "`cfg_eval` is a recently implemented feature"
90+
)]
91+
#[doc(no_inline)]
92+
pub use crate::macros::builtin::cfg_eval;

std/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
#![feature(box_syntax)]
235235
#![feature(c_variadic)]
236236
#![feature(cfg_accessible)]
237+
#![cfg_attr(not(bootstrap), feature(cfg_eval))]
237238
#![feature(cfg_target_has_atomic)]
238239
#![feature(cfg_target_thread_local)]
239240
#![feature(char_error_internals)]

std/src/prelude/v1.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ pub use core::prelude::v1::derive;
6767
#[doc(hidden)]
6868
pub use core::prelude::v1::cfg_accessible;
6969

70+
#[cfg(not(bootstrap))]
71+
#[unstable(
72+
feature = "cfg_eval",
73+
issue = "82679",
74+
reason = "`cfg_eval` is a recently implemented feature"
75+
)]
76+
#[doc(hidden)]
77+
pub use core::prelude::v1::cfg_eval;
78+
7079
// The file so far is equivalent to src/libcore/prelude/v1.rs,
7180
// and below to src/liballoc/prelude.rs.
7281
// Those files are duplicated rather than using glob imports

0 commit comments

Comments
 (0)