Skip to content

Commit 1b5b88a

Browse files
committed
handle cfg bootstrap on compiler and miri
Signed-off-by: onur-ozkan <[email protected]>
1 parent bc3ce09 commit 1b5b88a

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/concurrency/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,19 @@ pub mod thread;
88
mod vector_clock;
99
pub mod weak_memory;
1010

11+
// cfg(bootstrap)
12+
macro_rules! cfg_select_dispatch {
13+
($($tokens:tt)*) => {
14+
#[cfg(bootstrap)]
15+
cfg_match! { $($tokens)* }
16+
17+
#[cfg(not(bootstrap))]
18+
cfg_select! { $($tokens)* }
19+
};
20+
}
21+
1122
// Import either the real genmc adapter or a dummy module.
12-
cfg_select! {
23+
cfg_select_dispatch! {
1324
feature = "genmc" => {
1425
mod genmc;
1526
pub use self::genmc::{GenmcCtx, GenmcConfig};

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#![cfg_attr(bootstrap, feature(cfg_match))]
2+
#![cfg_attr(not(bootstrap), feature(cfg_select))]
13
#![feature(rustc_private)]
2-
#![feature(cfg_select)]
34
#![feature(float_gamma)]
45
#![feature(float_erf)]
56
#![feature(map_try_insert)]

src/shims/unix/fs.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,19 @@ impl UnixFileDescription for FileHandle {
8989
communicate_allowed: bool,
9090
op: FlockOp,
9191
) -> InterpResult<'tcx, io::Result<()>> {
92+
// cfg(bootstrap)
93+
macro_rules! cfg_select_dispatch {
94+
($($tokens:tt)*) => {
95+
#[cfg(bootstrap)]
96+
cfg_match! { $($tokens)* }
97+
98+
#[cfg(not(bootstrap))]
99+
cfg_select! { $($tokens)* }
100+
};
101+
}
102+
92103
assert!(communicate_allowed, "isolation should have prevented even opening a file");
93-
cfg_select! {
104+
cfg_select_dispatch! {
94105
all(target_family = "unix", not(target_os = "solaris")) => {
95106
use std::os::fd::AsRawFd;
96107

0 commit comments

Comments
 (0)