diff --git a/src/doc/book b/src/doc/book index 5228bfac8267a..45c1a6d69edfd 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 5228bfac8267ad24659a81b92ec5417976b5edbc +Subproject commit 45c1a6d69edfd1fc91fb7504cb73958dbd09441e diff --git a/src/doc/edition-guide b/src/doc/edition-guide index bbaabbe088e21..cb58c430b4e80 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit bbaabbe088e21a81a0d9ae6757705020d5d7b416 +Subproject commit cb58c430b4e8054c2cb81d2d4434092c482a93d8 diff --git a/src/doc/reference b/src/doc/reference index 6019b76f5b289..0b805c6580401 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 6019b76f5b28938565b251bbba0bf5cc5c43d863 +Subproject commit 0b805c65804019b0ac8f2fe3117afad82a6069b8 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 4840dca06cadf..b1d97bd6113ab 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 4840dca06cadf48b305d3ce0aeafde7f80933f80 +Subproject commit b1d97bd6113aba732b2091ce093c76f2d05bb8a0 diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide index 6a7374bd87cba..aec82168dd312 160000 --- a/src/doc/rustc-dev-guide +++ b/src/doc/rustc-dev-guide @@ -1 +1 @@ -Subproject commit 6a7374bd87cbac0f8be4fd4877d8186d9c313985 +Subproject commit aec82168dd3121289a194b381f56076fc789a4d2 diff --git a/src/tools/cargo b/src/tools/cargo index 4dcbca118ab7f..4ed7bee47f7dd 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 4dcbca118ab7f9ffac4728004c983754bc6a04ff +Subproject commit 4ed7bee47f7dd4416b36fada1909e9a62c546246 diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index e0d145c625be4..6e010e9525e95 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -22,7 +22,6 @@ use std::panic; use std::path::{Path, PathBuf}; pub use gimli; -pub use glob; pub use object; pub use regex; pub use wasmparser; @@ -223,40 +222,33 @@ pub fn bin_name(name: &str) -> String { if is_windows() { format!("{name}.exe") } else { name.to_string() } } -/// Remove all dynamic libraries possessing a name starting with `paths`. +/// Browse the directory `path` non-recursively and return all files which respect the parameters +/// outlined by `closure`. #[track_caller] -pub fn remove_dylibs(paths: &str) { - let paths = format!(r"{paths}*"); - remove_glob(dynamic_lib_name(&paths).as_str()); -} - -/// Remove all rust libraries possessing a name starting with `paths`. -#[track_caller] -pub fn remove_rlibs(paths: &str) { - let paths = format!(r"{paths}*"); - remove_glob(rust_lib_name(&paths).as_str()); -} - -#[track_caller] -fn remove_glob(paths: &str) { - let paths = glob::glob(paths).expect(format!("Glob expression {paths} is not valid.").as_str()); - paths - .filter_map(|entry| entry.ok()) - .filter(|entry| entry.as_path().is_file()) - .for_each(|file| fs_wrapper::remove_file(&file)); +pub fn shallow_find_files, F: Fn(&PathBuf) -> bool>( + path: P, + closure: F, +) -> Vec { + let mut matching_files = Vec::new(); + for entry in fs_wrapper::read_dir(path) { + let entry = entry.expect("failed to read directory entry."); + let path = entry.path(); + + if path.is_file() && closure(&path) { + matching_files.push(path); + } + } + matching_files } -#[track_caller] -fn count_glob(paths: &str) -> usize { - let paths = glob::glob(paths).expect(format!("Glob expression {paths} is not valid.").as_str()); - paths.filter_map(|entry| entry.ok()).filter(|entry| entry.as_path().is_file()).count() +/// Returns true if the filename at `path` starts with `prefix`. +pub fn has_prefix>(path: P, prefix: &str) -> bool { + path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().starts_with(prefix)) } -/// Count the number of rust libraries possessing a name starting with `paths`. -#[track_caller] -pub fn count_rlibs(paths: &str) -> usize { - let paths = format!(r"{paths}*"); - count_glob(rust_lib_name(&paths).as_str()) +/// Returns true if the filename at `path` has the extension `extension`. +pub fn has_extension>(path: P, extension: &str) -> bool { + path.as_ref().extension().is_some_and(|ext| ext == extension) } /// Return the current working directory. diff --git a/tests/run-make/lib-trait-for-trait-no-ice/rmake.rs b/tests/run-make/lib-trait-for-trait-no-ice/rmake.rs index 5f8c998874b65..bec316f186281 100644 --- a/tests/run-make/lib-trait-for-trait-no-ice/rmake.rs +++ b/tests/run-make/lib-trait-for-trait-no-ice/rmake.rs @@ -5,9 +5,9 @@ // the lib crate-type flag was actually followed. // See https://github.com/rust-lang/rust/issues/18943 -use run_make_support::{count_rlibs, rustc}; +use run_make_support::{fs_wrapper, rust_lib_name, rustc}; fn main() { rustc().input("foo.rs").crate_type("lib").run(); - assert_eq!(count_rlibs("foo"), 1); + fs_wrapper::remove_file(rust_lib_name("foo")); } diff --git a/tests/run-make/mixing-libs/rmake.rs b/tests/run-make/mixing-libs/rmake.rs index d46a2403c25b3..06ef6ab00f5f8 100644 --- a/tests/run-make/mixing-libs/rmake.rs +++ b/tests/run-make/mixing-libs/rmake.rs @@ -6,7 +6,7 @@ //@ ignore-cross-compile -use run_make_support::{remove_dylibs, rustc}; +use run_make_support::{dynamic_lib_name, fs_wrapper, rustc}; fn main() { rustc().input("rlib.rs").crate_type("rlib").crate_type("dylib").run(); @@ -16,6 +16,6 @@ fn main() { // librlib's dynamic version needs to be removed here to prevent prog.rs from fetching // the wrong one. - remove_dylibs("rlib"); + fs_wrapper::remove_file(dynamic_lib_name("rlib")); rustc().input("prog.rs").run_fail(); } diff --git a/tests/run-make/obey-crate-type-flag/rmake.rs b/tests/run-make/obey-crate-type-flag/rmake.rs index 4ae4b6e4eec0a..37d322a7e93dd 100644 --- a/tests/run-make/obey-crate-type-flag/rmake.rs +++ b/tests/run-make/obey-crate-type-flag/rmake.rs @@ -5,12 +5,14 @@ //@ ignore-cross-compile -use run_make_support::{count_rlibs, remove_dylibs, remove_rlibs, rustc}; +use run_make_support::{ + cwd, dynamic_lib_name, fs_wrapper, has_extension, rust_lib_name, rustc, shallow_find_files, +}; fn main() { rustc().input("test.rs").run(); - remove_rlibs("test"); - remove_dylibs("test"); + fs_wrapper::remove_file(dynamic_lib_name("test")); + fs_wrapper::remove_file(rust_lib_name("test")); rustc().crate_type("dylib").input("test.rs").run(); - assert_eq!(count_rlibs("test"), 0); + assert!(shallow_find_files(cwd(), |path| { has_extension(path, "rlib") }).is_empty()); }