diff --git a/src/config/built_in.rs b/src/config/built_in.rs index fa07718..8d9a5a8 100644 --- a/src/config/built_in.rs +++ b/src/config/built_in.rs @@ -10,14 +10,17 @@ pub(crate) fn get_built_ins() -> BTreeMap { perm( &[ "std::fs", + // Darwin is not yet supported + //"std::os::darwin::fs", "std::os::linux::fs", "std::os::unix::fs", "std::os::unix::io", - "std::os::wasi::fs", - "std::os::wasi::io", - "std::os::windows::fs", - "std::os::windows::io", - "std::path", + // WASI is not yet supported + //"std::os::wasi::fs", + //"std::os::wasi::io", + // Windows is not yet supported + //"std::os::windows::fs", + //"std::os::windows::io", ], &[], ), @@ -26,7 +29,12 @@ pub(crate) fn get_built_ins() -> BTreeMap { result.insert( ApiName::from("net"), perm( - &["std::net", "std::os::wasi::net", "std::os::windows::net"], + &[ + "std::net", + "std::os::linux::net", + // Windows is not yet supported + //"std::os::windows::net", + ], &[], ), ); @@ -39,8 +47,10 @@ pub(crate) fn get_built_ins() -> BTreeMap { perm( &[ "std::process", + "std::os::linux::process", "std::unix::process", - "std::windows::process", + // Windows is not yet supported + //"std::windows::process", ], &["std::process::abort", "std::process::exit"], ), diff --git a/test_crates/cackle.toml b/test_crates/cackle.toml index ee9c435..7b4bd10 100644 --- a/test_crates/cackle.toml +++ b/test_crates/cackle.toml @@ -153,7 +153,6 @@ test.allow_apis = [ allow_unsafe = true build.allow_apis = [ "env", - "fs", "process", ] allow_build_instructions = [ diff --git a/test_crates/crab-4/src/lib.rs b/test_crates/crab-4/src/lib.rs index 42b86f7..89dc113 100644 --- a/test_crates/crab-4/src/lib.rs +++ b/test_crates/crab-4/src/lib.rs @@ -2,7 +2,7 @@ //! results from this crate in parallel to crab_1, since neither depends on the other. use std::ffi::OsString; -use std::path::Path; +use std::fs; pub fn access_file() { f1(); @@ -15,19 +15,19 @@ pub fn access_file() { } fn f1() { - let _ = Path::new("a.txt").exists(); + let _ = fs::exists("a.txt"); } fn f2() { - let _ = Path::new("a.txt").exists(); + let _ = fs::exists("a.txt"); } fn f3() { - let _ = Path::new("a.txt").exists(); + let _ = fs::exists("a.txt"); } fn f4() { - let _ = Path::new("a.txt").exists(); + let _ = fs::exists("a.txt"); } /// Make sure that we can't circumvent checks by accessing a function via a function pointer instead diff --git a/test_crates/crab-5/src/lib.rs b/test_crates/crab-5/src/lib.rs index 42b068f..0d86a18 100644 --- a/test_crates/crab-5/src/lib.rs +++ b/test_crates/crab-5/src/lib.rs @@ -2,7 +2,7 @@ //! problems encountered while checking this crate might show up twice, since the two build.rs files //! can be checked in parallel. -use std::path::Path; +use std::fs; use std::sync::atomic::AtomicU8; pub fn do_something() -> bool { @@ -10,7 +10,7 @@ pub fn do_something() -> bool { } fn helper() -> bool { - let c = || Path::new("/").exists(); + let c = || fs::exists("/").is_ok(); c() } diff --git a/test_crates/crab-7/src/lib.rs b/test_crates/crab-7/src/lib.rs index f824f28..97b7153 100644 --- a/test_crates/crab-7/src/lib.rs +++ b/test_crates/crab-7/src/lib.rs @@ -1,4 +1,4 @@ -use std::path::Path; +use std::fs; pub fn do_something() {} @@ -8,7 +8,7 @@ extern "C" fn before_main() { // pre-main activities and with recent versions doing so causes an assertion failure. We can // apparently still get away with the environment variable check. if std::env::var("FOO").is_ok() { - println!("Does / exist?: {:?}", Path::new("/").exists()); + println!("Does / exist?: {:?}", fs::exists("/").is_ok_and(|exists| exists)); } } diff --git a/test_crates/crab-8/src/lib.rs b/test_crates/crab-8/src/lib.rs index a7c9170..52126ae 100644 --- a/test_crates/crab-8/src/lib.rs +++ b/test_crates/crab-8/src/lib.rs @@ -1,5 +1,5 @@ pub fn print_defaults() { // Instantiate cra6::print_default with a PathBuf. This shouldn't count as crab_6 using the fs // API, but it should count as this crate using it. - crab_6::print_default::(); + crab_6::print_default::>(); }