about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-03-05 12:53:17 -0500
committerGitHub <noreply@github.com>2022-03-05 12:53:17 -0500
commit00fd87e68ae02bb2a8b04fc00d6e9dd471470485 (patch)
treeaac6a444eb8cb82859e70f8e49d7ed92e78da579
parent49d20c4500114284921af61bf33a27c3c72a4ea0 (diff)
parent51b4ea2ba1f4ee5dde7091858ac7807c72ffcb85 (diff)
downloadrust-00fd87e68ae02bb2a8b04fc00d6e9dd471470485.tar.gz
rust-00fd87e68ae02bb2a8b04fc00d6e9dd471470485.zip
Rollup merge of #94645 - RalfJung:available-parallelism-miri, r=the8472
do not attempt to open cgroup files under Miri

Since https://github.com/rust-lang/rust/pull/92697, `cargo miri test` always fails under default flags, and one would have to use `MIRIFLAGS=-Zmiri-disable-isolation cargo miri test` instead. This PR fixes that problem.

Cc `@the8472` `@joshtriplett`
-rw-r--r--library/std/src/sys/unix/thread.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs
index ff01ce27333..2d5d306ed62 100644
--- a/library/std/src/sys/unix/thread.rs
+++ b/library/std/src/sys/unix/thread.rs
@@ -384,6 +384,11 @@ fn cgroup2_quota() -> usize {
     use crate::path::PathBuf;
 
     let mut quota = usize::MAX;
+    if cfg!(miri) {
+        // Attempting to open a file fails under default flags due to isolation.
+        // And Miri does not have parallelism anyway.
+        return quota;
+    }
 
     let _: Option<()> = try {
         let mut buf = Vec::with_capacity(128);