{"record":{"id":"84ee1b85078b35f1","repo":"tailwindlabs/tailwindcss","slug":"walkdir-same-file-system-option-not-supported-on","errorCode":null,"errorMessage":"walkdir: same_file_system option not supported on this platform","messagePattern":"walkdir: same_file_system option not supported on this platform","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/ignore/src/walk.rs","lineNumber":2030,"sourceCode":"\n#[cfg(unix)]\nfn device_num<P: AsRef<Path>>(path: P) -> io::Result<u64> {\n    use std::os::unix::fs::MetadataExt;\n\n    path.as_ref().metadata().map(|md| md.dev())\n}\n\n#[cfg(windows)]\nfn device_num<P: AsRef<Path>>(path: P) -> io::Result<u64> {\n    use winapi_util::{Handle, file};\n\n    let h = Handle::from_path_any(path)?;\n    file::information(h).map(|info| info.volume_serial_number())\n}\n\n#[cfg(not(any(unix, windows)))]\nfn device_num<P: AsRef<Path>>(_: P) -> io::Result<u64> {\n    Err(io::Error::new(\n        io::ErrorKind::Other,\n        \"walkdir: same_file_system option not supported on this platform\",\n    ))\n}\n\n#[cfg(test)]\nmod tests {\n    use std::ffi::OsStr;\n    use std::fs::{self, File};\n    use std::io::Write;\n    use std::path::Path;\n    use std::sync::{Arc, Mutex};\n\n    use super::{DirEntry, WalkBuilder, WalkState};\n    use crate::tests::TempDir;\n\n    fn wfile<P: AsRef<Path>>(path: P, contents: &str) {\n        let mut file = File::create(path).unwrap();","sourceCodeStart":2012,"sourceCodeEnd":2048,"githubUrl":"https://github.com/tailwindlabs/tailwindcss/blob/16e94cbf7f965c5ad697e90e940b5e178efad67c/crates/ignore/src/walk.rs#L2012-L2048","documentation":"Returned by device_num() when compiled for a target that is neither unix nor windows. device_num provides the volume/device number used by the same_file_system option (to detect filesystem boundaries during traversal). On unsupported platforms the option cannot work, so it errors instead of silently disabling.","triggerScenarios":"Enabling WalkBuilder::same_file_system(true) and building/running on a non-unix/non-windows target (e.g. wasm32). The fallback device_num always returns this error, so any traversal needing device numbers fails.","commonSituations":"WASM/embedded builds where a consumer enabled same_file_system. Porting desktop tooling that relies on same_file_system to a sandboxed runtime.","solutions":["Do not enable same_file_system(true) on non-unix/non-windows targets.","Target wasm32-wasi or a real unix/windows platform if you need filesystem-boundary detection.","Conditionally set the option: builder.same_file_system(cfg!(any(windows, unix)))."],"exampleFix":"// before — errors on wasm32\nbuilder.same_file_system(true);\n\n// after\nbuilder.same_file_system(cfg!(any(windows, unix)));","handlingStrategy":"validation","validationCode":"// Only enable same_file_system where device_num is real\nbuilder.same_file_system(cfg!(any(windows, unix)));","typeGuard":"const fn supports_device_num() -> bool {\n    cfg!(any(windows, unix))\n}","tryCatchPattern":null,"preventionTips":["Do not enable same_file_system on wasm32-unknown-unknown.","Conditionally set the option based on target cfg.","Use wasm32-wasi if filesystem-boundary detection is required."],"tags":["ignore","rust","platform","wasm","same-file-system"],"backgroundTag":null,"analyzedSha":"16e94cbf7f965c5ad697e90e940b5e178efad67c","analyzedAt":"2026-08-12T06:02:42.469Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}