Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/alloctests/tests/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2348,6 +2348,7 @@ fn utf8_char_counts() {
.flat_map(|n| n - spread..=n + spread)
.collect::<Vec<usize>>();
if cfg!(not(miri)) {
// Miri is too slow
reps.extend([1024, 1 << 16].iter().copied().flat_map(|n| n - spread..=n + spread));
}
let counts = if cfg!(miri) { 0..1 } else { 0..8 };
Expand Down
2 changes: 0 additions & 2 deletions library/alloctests/tests/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,6 @@ fn test_weak_count_locked() {
while !a2.load(SeqCst) {
let n = Arc::weak_count(&a2);
assert!(n < 2, "bad weak count: {}", n);
#[cfg(miri)] // Miri's scheduler does not guarantee liveness, and thus needs this hint.
std::hint::spin_loop();
}
t.join().unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/fs/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ impl DirEntry {
target_os = "illumos",
target_vendor = "apple",
)),
miri
miri // no dirfd on Miri
))]
pub fn metadata(&self) -> io::Result<FileAttr> {
run_path_with_cstr(&self.path(), &lstat)
Expand Down
4 changes: 1 addition & 3 deletions library/std/src/sys/pal/unix/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ pub fn page_size() -> usize {
///
/// [posix_confstr]:
/// https://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html
//
// FIXME: Support `confstr` in Miri.
#[cfg(all(target_vendor = "apple", not(miri)))]
Copy link
Copy Markdown
Member Author

@RalfJung RalfJung May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't actually ever hit this code path in what we currently test... and if we do, I'll add a little stub shim in Miri. That's almost always better than cfg.

View changes since the review

#[cfg(target_vendor = "apple")]
pub fn confstr(
key: crate::ffi::c_int,
size_hint: Option<usize>,
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/unix/conf/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn test_parse_glibc_version() {
// Smoke check `confstr`, do it for several hint values, to ensure our resizing
// logic is correct.
#[test]
#[cfg(all(target_vendor = "apple", not(miri)))]
#[cfg(target_vendor = "apple")]
fn test_confstr() {
for key in [libc::_CS_DARWIN_USER_TEMP_DIR, libc::_CS_PATH] {
let value_nohint = super::confstr(key, None).unwrap_or_else(|e| {
Expand Down
4 changes: 1 addition & 3 deletions library/std/src/sys/pal/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {

// fast path with a single syscall for systems with poll()
#[cfg(not(any(
miri,
miri, // no `poll`
target_os = "emscripten",
target_os = "fuchsia",
target_os = "vxworks",
Expand Down Expand Up @@ -125,8 +125,6 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {

// fallback in case poll isn't available or limited by RLIMIT_NOFILE
#[cfg(not(any(
// The standard fds are always available in Miri.
miri,
target_os = "emscripten",
target_os = "fuchsia",
target_os = "vxworks",
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/paths/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
if !path.is_absolute() { getcwd().map(|cwd| cwd.join(path)) } else { Ok(path) }
}

#[cfg(all(target_vendor = "apple", not(miri)))]
#[cfg(target_vendor = "apple")]
fn darwin_temp_dir() -> PathBuf {
crate::sys::pal::conf::confstr(libc::_CS_DARWIN_USER_TEMP_DIR, Some(64))
.map(PathBuf::from)
Expand All @@ -407,7 +407,7 @@ fn darwin_temp_dir() -> PathBuf {
pub fn temp_dir() -> PathBuf {
crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| {
cfg_select! {
all(target_vendor = "apple", not(miri)) => darwin_temp_dir(),
target_vendor = "apple" => darwin_temp_dir(),
target_os = "android" => PathBuf::from("/data/local/tmp"),
_ => PathBuf::from("/tmp"),
}
Expand Down
1 change: 1 addition & 0 deletions library/std/tests/pipe_subprocess.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
fn main() {
// No `Command` on Miri and emscripten
#[cfg(all(not(miri), any(unix, windows), not(target_os = "emscripten")))]
{
use std::io::{Read, pipe};
Expand Down
2 changes: 1 addition & 1 deletion library/std/tests/windows_unix_socket.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg(windows)]
#![cfg(not(miri))] // no socket support in Miri
#![cfg(not(miri))] // no Windows socket support in Miri
#![feature(windows_unix_domain_sockets)]
// Now only test windows_unix_domain_sockets feature
// in the future, will test both unix and windows uds
Expand Down
Loading