From 38922ca442fcaba6838dca4466406d699cc649a1 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Wed, 4 Mar 2026 20:28:59 +0000 Subject: [PATCH 01/13] test(replace): Mark a test as non-deterministic (#16700) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What does this PR try to resolve? Blocks a compiler change, see [#t-cargo > `replace::use_a_spec_to_select` test failure @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/.60replace.3A.3Ause_a_spec_to_select.60.20test.20failure/near/577341461) ### How to test and review this PR? --- tests/testsuite/replace.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/testsuite/replace.rs b/tests/testsuite/replace.rs index c075947c147..d1c93680d61 100644 --- a/tests/testsuite/replace.rs +++ b/tests/testsuite/replace.rs @@ -469,7 +469,8 @@ fn use_a_spec_to_select() { .build(); p.cargo("check") - .with_stderr_data(str![[r#" + .with_stderr_data( + str![[r#" [UPDATING] `dummy-registry` index [UPDATING] git repository `[ROOTURL]/override` [LOCKING] 4 packages to latest compatible versions @@ -483,7 +484,9 @@ fn use_a_spec_to_select() { [CHECKING] foo v0.0.1 ([ROOT]/foo) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s -"#]]) +"#]] + .unordered(), + ) .run(); } From e7b27c7f9224eb59c5ac35eb568517732397ece0 Mon Sep 17 00:00:00 2001 From: Scott Schafer Date: Thu, 5 Mar 2026 15:11:25 +0000 Subject: [PATCH 02/13] test(git): Mark a test as non-deterministic (#16706) ### What does this PR try to resolve? Fixes #16704 ### How to test and review this PR? --- tests/testsuite/git.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index a32ffacdff1..3c202addcb0 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -3509,7 +3509,8 @@ fn two_dep_forms() { // the two local deps. project .cargo("check") - .with_stderr_data(str![[r#" + .with_stderr_data( + str![[r#" [UPDATING] git repository `[ROOTURL]/dep1` [UPDATING] git repository `[ROOTURL]/dep1` [LOCKING] 3 packages to latest compatible versions @@ -3519,7 +3520,9 @@ fn two_dep_forms() { [CHECKING] foo v0.5.0 ([ROOT]/foo) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s -"#]]) +"#]] + .unordered(), + ) .run(); } From d428eaa44004c617a4d4258dd7b43958b88ad0f5 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 6 Mar 2026 12:33:45 +0000 Subject: [PATCH 03/13] fix(script): surpress `unused_features` lint for embedded (#16714) ### What does this PR try to resolve? https://github.com/rust-lang/rust/pull/152164 added a warn-by-default `unused_features` lint. Cargo injects `#![feature(frontmatter)]` for all embedded scripts, but scripts without frontmatter syntax never trigger feature gate check, and causes causing the lint warning. Given the stabilization FCP of frontmatter [is complete](https://github.com/rust-lang/rust/pull/148051#issuecomment-3868109254) already, we could expect it will soon be stabilized (?). It should be fine we suppress this new unstable lint. ### How to test and review this PR? Test suite passes. See for more. --- src/cargo/core/compiler/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index abdb469847b..5210792e60d 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -802,6 +802,7 @@ fn prepare_rustc(build_runner: &BuildRunner<'_, '_>, unit: &Unit) -> CargoResult ); } base.arg("-Z").arg("crate-attr=feature(frontmatter)"); + base.arg("-Z").arg("crate-attr=allow(unused_features)"); } base.inherit_jobserver(&build_runner.jobserver); @@ -857,6 +858,7 @@ fn prepare_rustdoc(build_runner: &BuildRunner<'_, '_>, unit: &Unit) -> CargoResu ); } rustdoc.arg("-Z").arg("crate-attr=feature(frontmatter)"); + rustdoc.arg("-Z").arg("crate-attr=allow(unused_features)"); } rustdoc.inherit_jobserver(&build_runner.jobserver); let crate_name = unit.target.crate_name(); From 634668d490bdc11b4c473058c6e56ae366bb5130 Mon Sep 17 00:00:00 2001 From: Scott Schafer Date: Wed, 21 Jan 2026 04:38:00 +0000 Subject: [PATCH 04/13] fix: `--remap-path-scope` stabilized in 1.95-nightly (#16536) See . --- src/cargo/core/compiler/mod.rs | 3 +- tests/testsuite/profile_trim_paths.rs | 106 +++++++++++++++----------- 2 files changed, 64 insertions(+), 45 deletions(-) diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index 5210792e60d..3dee17de7ab 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -1540,8 +1540,7 @@ fn trim_paths_args( } // feature gate was checked during manifest/config parsing. - cmd.arg("-Zunstable-options"); - cmd.arg(format!("-Zremap-path-scope={trim_paths}")); + cmd.arg(format!("--remap-path-scope={trim_paths}")); // Order of `--remap-path-prefix` flags is important for `-Zbuild-std`. // We want to show `/rustc//library/std` instead of `std-0.0.0`. diff --git a/tests/testsuite/profile_trim_paths.rs b/tests/testsuite/profile_trim_paths.rs index dfe1d98dc12..f89bdb32942 100644 --- a/tests/testsuite/profile_trim_paths.rs +++ b/tests/testsuite/profile_trim_paths.rs @@ -65,7 +65,7 @@ Caused by: .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn release_profile_default_to_object() { let p = project() .file( @@ -84,14 +84,14 @@ fn release_profile_default_to_object() { .masquerade_as_nightly_cargo(&["-Ztrim-paths"]) .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s "#]]) .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn one_option() { let build = |option| { let p = project() @@ -122,7 +122,7 @@ fn one_option() { "\ [COMPILING] foo v0.0.1 ([ROOT]/foo) [RUNNING] `rustc [..]\ - -Zremap-path-scope={option} \ + --remap-path-scope={option} \ --remap-path-prefix=[ROOT]/foo=. \ --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -132,12 +132,12 @@ fn one_option() { } build("none") .masquerade_as_nightly_cargo(&["-Ztrim-paths"]) - .with_stderr_does_not_contain("[..]-Zremap-path-scope=[..]") + .with_stderr_does_not_contain("[..]--remap-path-scope=[..]") .with_stderr_does_not_contain("[..]--remap-path-prefix=[..]") .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn multiple_options() { let p = project() .file( @@ -159,14 +159,14 @@ fn multiple_options() { .masquerade_as_nightly_cargo(&["-Ztrim-paths"]) .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=diagnostics,macro,object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=diagnostics,macro,object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s "#]]) .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn profile_merge_works() { let p = project() .file( @@ -192,14 +192,14 @@ fn profile_merge_works() { .masquerade_as_nightly_cargo(&["-Ztrim-paths"]) .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=diagnostics --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `custom` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s "#]]) .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn registry_dependency() { Package::new("bar", "0.0.1") .file("Cargo.toml", &basic_manifest("bar", "0.0.1")) @@ -236,9 +236,9 @@ fn registry_dependency() { [DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `dummy-registry`) [COMPILING] bar v0.0.1 -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] `target/debug/foo[EXE]` @@ -246,7 +246,7 @@ fn registry_dependency() { .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn registry_dependency_with_build_script_codegen() { Package::new("bar", "0.0.1") .file("Cargo.toml", &basic_manifest("bar", "0.0.1")) @@ -306,11 +306,11 @@ fn registry_dependency_with_build_script_codegen() { [DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.1 (registry `dummy-registry`) [COMPILING] bar v0.0.1 -[RUNNING] `rustc --crate-name build_script_build [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc --crate-name build_script_build [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [RUNNING] `[ROOT]/foo/target/debug/build/bar-[HASH]/build-script-build` -[RUNNING] `rustc --crate-name bar [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[ROOT]/foo/target=/cargo/build-dir --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..] +[RUNNING] `rustc --crate-name bar [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[ROOT]/foo/target=/cargo/build-dir --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..] [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc --crate-name foo [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc --crate-name foo [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] `target/debug/foo[EXE]` @@ -318,7 +318,7 @@ fn registry_dependency_with_build_script_codegen() { .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn git_dependency() { let git_project = git::new("bar", |project| { project @@ -358,9 +358,9 @@ bar-[..]/[..]/src/lib.rs [UPDATING] git repository `[ROOTURL]/bar` [LOCKING] 1 package to latest compatible version [COMPILING] bar v0.0.1 ([ROOTURL]/bar#[..]) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/git/checkouts= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/git/checkouts= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] `target/debug/foo[EXE]` @@ -368,7 +368,7 @@ bar-[..]/[..]/src/lib.rs .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn path_dependency() { let p = project() .file( @@ -403,9 +403,9 @@ cocktail-bar/src/lib.rs .with_stderr_data(str![[r#" [LOCKING] 1 package to latest compatible version [COMPILING] bar v0.0.1 ([ROOT]/foo/cocktail-bar) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] `target/debug/foo[EXE]` @@ -413,7 +413,7 @@ cocktail-bar/src/lib.rs .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn path_dependency_outside_workspace() { let _bar = project() .at("bar") @@ -449,9 +449,9 @@ bar-0.0.1/src/lib.rs .with_stderr_data(str![[r#" [LOCKING] 1 package to latest compatible version [COMPILING] bar v0.0.1 ([ROOT]/bar) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/bar=bar-0.0.1 --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/bar=bar-0.0.1 --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] `target/debug/foo[EXE]` @@ -459,7 +459,7 @@ bar-0.0.1/src/lib.rs .run(); } -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn diagnostics_works() { Package::new("bar", "0.0.1") .file("Cargo.toml", &basic_manifest("bar", "0.0.1")) @@ -495,10 +495,10 @@ fn diagnostics_works() { ) .with_stderr_data(str![[r#" ... -[RUNNING] `[..] rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `[..] rustc [..]--remap-path-scope=diagnostics --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [WARNING] unused variable: `unused` ... -[RUNNING] `[..] rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `[..] rustc [..]--remap-path-scope=diagnostics --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` ... "#]]) .run(); @@ -517,17 +517,29 @@ mod object_works { .stdout } - #[cargo_test(requires = "nm", nightly, reason = "-Zremap-path-scope is unstable")] + #[cargo_test( + requires = "nm", + nightly, + reason = "--remap-path-scope will be stabilized in 1.95" + )] fn with_split_debuginfo_off() { object_works_helper("off", inspect_debuginfo); } - #[cargo_test(requires = "nm", nightly, reason = "-Zremap-path-scope is unstable")] + #[cargo_test( + requires = "nm", + nightly, + reason = "--remap-path-scope will be stabilized in 1.95" + )] fn with_split_debuginfo_packed() { object_works_helper("packed", inspect_debuginfo); } - #[cargo_test(requires = "nm", nightly, reason = "-Zremap-path-scope is unstable")] + #[cargo_test( + requires = "nm", + nightly, + reason = "--remap-path-scope will be stabilized in 1.95" + )] fn with_split_debuginfo_unpacked() { object_works_helper("unpacked", inspect_debuginfo); } @@ -550,7 +562,7 @@ mod object_works { #[cargo_test( requires = "readelf", nightly, - reason = "-Zremap-path-scope is unstable" + reason = "--remap-path-scope will be stabilized in 1.95" )] fn with_split_debuginfo_off() { object_works_helper("off", inspect_debuginfo); @@ -559,7 +571,7 @@ mod object_works { #[cargo_test( requires = "readelf", nightly, - reason = "-Zremap-path-scope is unstable" + reason = "--remap-path-scope will be stabilized in 1.95" )] fn with_split_debuginfo_packed() { object_works_helper("packed", inspect_debuginfo); @@ -568,7 +580,7 @@ mod object_works { #[cargo_test( requires = "readelf", nightly, - reason = "-Zremap-path-scope is unstable" + reason = "--remap-path-scope will be stabilized in 1.95" )] fn with_split_debuginfo_unpacked() { object_works_helper("unpacked", inspect_debuginfo); @@ -591,7 +603,7 @@ mod object_works { #[cargo_test( requires = "strings", nightly, - reason = "-Zremap-path-scope is unstable" + reason = "--remap-path-scope will be stabilized in 1.95" )] fn with_split_debuginfo_packed() { object_works_helper("packed", inspect_debuginfo); @@ -661,12 +673,12 @@ fn object_works_helper(split_debuginfo: &str, run: impl Fn(&std::path::Path) -> "\ [COMPILING] bar v0.0.1 [RUNNING] `rustc [..]-C split-debuginfo={split_debuginfo} [..]\ - -Zremap-path-scope=object \ + --remap-path-scope=object \ --remap-path-prefix=[ROOT]/home/.cargo/registry/src= \ --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..] [COMPILING] foo v0.0.1 ([ROOT]/foo) [RUNNING] `rustc [..]-C split-debuginfo={split_debuginfo} [..]\ - -Zremap-path-scope=object \ + --remap-path-scope=object \ --remap-path-prefix=[ROOT]/foo=. \ --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..] [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -702,7 +714,7 @@ fn object_works_helper(split_debuginfo: &str, run: impl Fn(&std::path::Path) -> } // TODO: might want to move to test/testsuite/build_script.rs once stabilized. -#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test(nightly, reason = "--remap-path-scope will be stabilized in 1.95")] fn custom_build_env_var_trim_paths() { let p = project() .file( @@ -772,7 +784,11 @@ fn custom_build_env_var_trim_paths() { // This test is disabled, as it currently doesn't work due to issues with lldb. #[cfg(any())] #[cfg(unix)] -#[cargo_test(requires = "lldb", nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test( + requires = "lldb", + nightly, + reason = "--remap-path-scope will be stabilized in 1.95" +)] fn lldb_works_after_trimmed() { use cargo_test_support::compare::assert_e2e; use cargo_util::is_ci; @@ -823,7 +839,7 @@ fn lldb_works_after_trimmed() { .masquerade_as_nightly_cargo(&["-Ztrim-paths"]) .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s "#]]) @@ -850,7 +866,11 @@ Hello, Ferris! // This test is disabled, as it currently doesn't work. #[cfg(any())] #[cfg(target_env = "msvc")] -#[cargo_test(requires = "cdb", nightly, reason = "-Zremap-path-scope is unstable")] +#[cargo_test( + requires = "cdb", + nightly, + reason = "--remap-path-scope will be stabilized in 1.95" +)] fn cdb_works_after_trimmed() { use cargo_test_support::compare::assert_e2e; @@ -890,7 +910,7 @@ fn cdb_works_after_trimmed() { .masquerade_as_nightly_cargo(&["-Ztrim-paths"]) .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) -[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `rustc [..]--remap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s "#]]) @@ -989,7 +1009,7 @@ fn rustdoc_diagnostics_works() { .masquerade_as_nightly_cargo(&["-Ztrim-paths"]) .with_stderr_data(str![[r#" ... -[RUNNING] `[..]rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` +[RUNNING] `[..]rustc [..]--remap-path-scope=diagnostics --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]` ... [WARNING] unopened HTML tag `script` --> -[..]/bar-0.0.1/src/lib.rs:2:17 From a56abe18addb5e1a0fd4fb9e02fb874c1016231b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 15 Mar 2026 09:59:44 -0700 Subject: [PATCH 05/13] Disable custom target JSON spec test I do not want to backport the unstable JSON spec support to 1.94, and these tests do not pass CI on the latest nightly. --- tests/build-std/main.rs | 5 ++--- tests/testsuite/main.rs | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/build-std/main.rs b/tests/build-std/main.rs index 8fdf76a1480..5ec55ea0f8c 100644 --- a/tests/build-std/main.rs +++ b/tests/build-std/main.rs @@ -21,12 +21,9 @@ #![allow(clippy::disallowed_methods)] use cargo_test_support::Execs; -use cargo_test_support::basic_manifest; -use cargo_test_support::paths; use cargo_test_support::project; use cargo_test_support::rustc_host; use cargo_test_support::str; -use cargo_test_support::target_spec_json; use cargo_test_support::{Project, prelude::*}; use std::env; use std::path::{Path, PathBuf}; @@ -279,6 +276,7 @@ fn host_proc_macro() { } #[cargo_test(build_std_real)] +#[cfg(false)] // Disabling custom target tests, not backporting support to 1.94. fn cross_custom() { let p = project() .file( @@ -308,6 +306,7 @@ fn cross_custom() { } #[cargo_test(build_std_real)] +#[cfg(false)] // Disabling custom target tests, not backporting support to 1.94. fn custom_test_framework() { let p = project() .file( diff --git a/tests/testsuite/main.rs b/tests/testsuite/main.rs index ff63c642b5d..e5f8e83ca4a 100644 --- a/tests/testsuite/main.rs +++ b/tests/testsuite/main.rs @@ -83,6 +83,7 @@ mod corrupt_git; mod credential_process; mod cross_compile; mod cross_publish; +#[cfg(false)] // Disabling custom target tests, not backporting support to 1.94. mod custom_target; mod death; mod dep_info; From f7777c4f9e42789a58be6df6a55469c0ddb73e2b Mon Sep 17 00:00:00 2001 From: Jacob Finkelman Date: Fri, 20 Feb 2026 17:51:30 +0000 Subject: [PATCH 06/13] test(build-std): Update error message (#16658) ### What does this PR try to resolve? Unblocking CI. Maybe other work is needed for submodule sync but resolving that doesn't have to block fixing CI. ### How to test and review this PR? --- tests/testsuite/standard_lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testsuite/standard_lib.rs b/tests/testsuite/standard_lib.rs index dee8400f05a..acccdd4699d 100644 --- a/tests/testsuite/standard_lib.rs +++ b/tests/testsuite/standard_lib.rs @@ -698,7 +698,7 @@ fn no_implicit_alloc() { .target_host() .with_stderr_data(str![[r#" ... -error[E0433]: failed to resolve[..]`alloc` +error[E0433]: cannot find module or crate `alloc` in this scope ... "#]]) .with_status(101) From cb03b21f684b34c66453a941e23d780e462c8318 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 15 Mar 2026 10:14:29 -0700 Subject: [PATCH 07/13] Update cargo-semver-checks to 0.47.0 This updates cargo-semver-checks so that it can work correctly in CI because 0.45.0 doesn't seem to support Rust 1.94. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 861e63cecb8..9473a576ba1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -118,7 +118,7 @@ jobs: - name: Install cargo-semver-checks run: | mkdir installed-bins - curl -Lf https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.45.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz \ + curl -Lf https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.47.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz \ | tar -xz --directory=./installed-bins echo `pwd`/installed-bins >> $GITHUB_PATH - run: ci/validate-version-bump.sh From dfbe729f6a086443b488541fc10e518315747025 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Thu, 22 Jan 2026 16:16:56 +0000 Subject: [PATCH 08/13] chore: Updated compiler errors for Rust 1.93 (#16543) ### What does this PR try to resolve? Fixes the docs CI jobs that are currently failing since Rust 1.93 was released Example failed job: https://github.com/rust-lang/cargo/actions/runs/21252805301/job/61158769843?pr=16542 ### How to test and review this PR? See the CI jobs status r? @weihanglo --- src/doc/src/reference/semver.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/src/reference/semver.md b/src/doc/src/reference/semver.md index e5a54c33dcf..41434089590 100644 --- a/src/doc/src/reference/semver.md +++ b/src/doc/src/reference/semver.md @@ -471,7 +471,7 @@ pub struct Example { // Example usage that will break. fn main() { let f = updated_crate::Example { f1: 1, f2: 2 }; - let x = &f.f2; // Error: reference to packed field is unaligned + let x = &f.f2; // Error: error[E0793]: reference to field of packed struct is unaligned } ``` @@ -656,7 +656,7 @@ use updated_crate::Packed; fn main() { let p = Packed { a: 1, b: 2 }; - let x = &p.b; // Error: reference to packed field is unaligned + let x = &p.b; // Error: error[E0793]: reference to field of packed struct is unaligned } ``` From 95d93fb89ffb9d2fe6169b789c0c1b33eebd94db Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 23 Jan 2026 11:04:18 -0800 Subject: [PATCH 09/13] Don't check the specific build-std output This particular test was failing occasionally because the order of the output is not deterministic. Sometimes `test` would run first, and sometimes `rustc-std-workspace-std` would run first. This is because they start in parallel, and it is a race which one prints first. The exact output here isn't particularly interesting. I would prefer to not check the particular structure of the standard library, so this just elides all the output. --- tests/build-std/main.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/build-std/main.rs b/tests/build-std/main.rs index 5ec55ea0f8c..0e116308da0 100644 --- a/tests/build-std/main.rs +++ b/tests/build-std/main.rs @@ -162,9 +162,7 @@ fn basic() { .build_std_isolated() .target_host() .with_stderr_data(str![[r#" -[COMPILING] [..] ... -[COMPILING] test v0.0.0 ([..]) [COMPILING] foo v0.0.1 ([ROOT]/foo) [FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] unittests src/lib.rs (target/[HOST_TARGET]/debug/deps/foo-[HASH]) From d7a2a03073b46e4ca2c3bd36eb16e01669953a8b Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Thu, 22 Jan 2026 18:55:01 +0000 Subject: [PATCH 10/13] Increase cache_lock test timeout (#16545) We've been seeing occasional failures on CI with these tests timing out. I'm guessing that the runners are too overloaded and are unable to complete the test within 1 second. This bumps up the timeout to 10s to see if that will resolve the problem. --- tests/testsuite/cache_lock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testsuite/cache_lock.rs b/tests/testsuite/cache_lock.rs index a507677d7e1..e2c104138b0 100644 --- a/tests/testsuite/cache_lock.rs +++ b/tests/testsuite/cache_lock.rs @@ -12,7 +12,7 @@ use crate::config::GlobalContextBuilder; /// Helper to verify that it is OK to acquire the given lock (it shouldn't block). fn verify_lock_is_ok(mode: CacheLockMode) { let root = paths::root(); - threaded_timeout(10, move || { + threaded_timeout(100, move || { let gctx = GlobalContextBuilder::new().root(root).build(); let locker = CacheLocker::new(); // This would block if it is held. From 1ed92053d50ea3c3feef9776337ae983f6e77b92 Mon Sep 17 00:00:00 2001 From: Scott Schafer Date: Thu, 12 Feb 2026 22:43:05 +0000 Subject: [PATCH 11/13] test: Remove unused docker ip_address (#16636) The schema seems to have changed and this is no longer working. --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/cargo-test-support/Cargo.toml | 2 +- crates/cargo-test-support/src/containers.rs | 17 ----------------- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7727eca4d0..3fa6a16c576 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -476,7 +476,7 @@ version = "0.4.9" [[package]] name = "cargo-test-support" -version = "0.10.0" +version = "0.11.0" dependencies = [ "anstream", "anstyle", diff --git a/Cargo.toml b/Cargo.toml index 392758a17db..27f5f286958 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ cargo-credential-macos-keychain = { version = "0.4.20", path = "credential/cargo cargo-credential-wincred = { version = "0.4.20", path = "credential/cargo-credential-wincred" } cargo-platform = { path = "crates/cargo-platform", version = "0.3.0" } cargo-test-macro = { version = "0.4.9", path = "crates/cargo-test-macro" } -cargo-test-support = { version = "0.10.0", path = "crates/cargo-test-support" } +cargo-test-support = { version = "0.11.0", path = "crates/cargo-test-support" } cargo-util = { version = "0.2.27", path = "crates/cargo-util" } cargo-util-schemas = { version = "0.12.0", path = "crates/cargo-util-schemas" } cargo_metadata = "0.23.1" diff --git a/crates/cargo-test-support/Cargo.toml b/crates/cargo-test-support/Cargo.toml index e0441080a7c..19f04ddac4f 100644 --- a/crates/cargo-test-support/Cargo.toml +++ b/crates/cargo-test-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-test-support" -version = "0.10.0" +version = "0.11.0" edition.workspace = true rust-version = "1.92" # MSRV:1 license.workspace = true diff --git a/crates/cargo-test-support/src/containers.rs b/crates/cargo-test-support/src/containers.rs index 4ebbec93c5a..c1ea8385794 100644 --- a/crates/cargo-test-support/src/containers.rs +++ b/crates/cargo-test-support/src/containers.rs @@ -30,12 +30,6 @@ pub struct Container { pub struct ContainerHandle { /// The name of the container. name: String, - /// The IP address of the container. - /// - /// NOTE: This is currently unused, but may be useful so I left it in. - /// This can only be used on Linux. macOS and Windows docker doesn't allow - /// direct connection to the container. - pub ip_address: String, /// Port mappings of `container_port` to `host_port` for ports exposed via EXPOSE. pub port_mappings: HashMap, } @@ -69,22 +63,11 @@ impl Container { self.copy_files(&name); self.start_container(&name); let info = self.container_inspect(&name); - let ip_address = if cfg!(target_os = "linux") { - info[0]["NetworkSettings"]["IPAddress"] - .as_str() - .unwrap() - .to_string() - } else { - // macOS and Windows can't make direct connections to the - // container. It only works through exposed ports or mapped ports. - "127.0.0.1".to_string() - }; let port_mappings = self.port_mappings(&info); self.wait_till_ready(&port_mappings); ContainerHandle { name, - ip_address, port_mappings, } } From 5e256e377ed39df64bfa12a34b95ad58ec382677 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 15 Mar 2026 08:23:57 -0700 Subject: [PATCH 12/13] Add a test for a tar file with a symlink and directory of the same name This adds a test for a registry package where it has a symlink and a directory with the same name. The `tar` crate is incorrectly changing the permissions of the destination of the symlink (which can be anywhere on the filesystem). --- crates/cargo-test-support/src/registry.rs | 16 ++++ tests/testsuite/registry.rs | 98 +++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/crates/cargo-test-support/src/registry.rs b/crates/cargo-test-support/src/registry.rs index 9cf2aaaaad5..c1b7b0d86a4 100644 --- a/crates/cargo-test-support/src/registry.rs +++ b/crates/cargo-test-support/src/registry.rs @@ -607,6 +607,7 @@ pub struct Dependency { enum EntryData { Regular(String), Symlink(PathBuf), + Directory, } /// A file to be created in a package. @@ -1331,6 +1332,17 @@ impl Package { self } + /// Adds an empty directory at the given path. + pub fn directory(&mut self, path: &str) -> &mut Package { + self.files.push(PackageFile { + path: path.to_string(), + contents: EntryData::Directory, + mode: DEFAULT_MODE, + extra: false, + }); + self + } + /// Adds an "extra" file that is not rooted within the package. /// /// Normal files are automatically placed within a directory named @@ -1743,6 +1755,10 @@ impl Package { t!(header.set_link_name(src)); "" // Symlink has no contents. } + EntryData::Directory => { + header.set_entry_type(tar::EntryType::Directory); + "" + } }; header.set_size(contents.len() as u64); t!(header.set_path(path)); diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index 896bcc3432f..608188fc9f8 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -4695,3 +4695,101 @@ fn deterministic_mtime() { assert_deterministic_mtime(pkg_root.join("Cargo.toml")); assert_deterministic_mtime(pkg_root.join(".cargo_vcs_info.json")); } + +#[cargo_test] +#[cfg(unix)] +fn symlink_and_directory_on_unix() { + // Tests for symlink and directory entry in a tar file. The tar crate + // would incorrectly change the permissions of the symlink destination, + // which could be anywhere on the filesystem. + let victim = paths::root().join("victim"); + fs::create_dir(&victim).unwrap(); + use std::os::unix::fs::PermissionsExt; + let perm = fs::Permissions::from_mode(0o700); + fs::set_permissions(&victim, perm).unwrap(); + assert_eq!( + victim.metadata().unwrap().permissions().mode() & 0o777, + 0o700 + ); + + Package::new("bar", "1.0.0") + .file("src/lib.rs", "") + .symlink("smuggled", victim.to_str().unwrap()) + .directory("smuggled") + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + edition = "2015" + + [dependencies] + bar = "1.0" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("fetch").run(); + + // FIXME: This should not change permission. + assert_eq!( + victim.metadata().unwrap().permissions().mode() & 0o777, + 0o644 + ); +} + +#[cargo_test] +#[cfg(windows)] +fn symlink_and_directory_on_windows() { + // Equivalent of chmod_target_symlink for Windows, which does not allow + // trying to create a directory on top of a symlink. + let victim = paths::root().join("victim"); + Package::new("bar", "1.0.0") + .file("src/lib.rs", "") + .symlink("smuggled", victim.to_str().unwrap()) + .directory("smuggled") + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + edition = "2015" + + [dependencies] + bar = "1.0" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("fetch") + .with_status(101) + .with_stderr_data(str![[r#" +[UPDATING] `dummy-registry` index +[LOCKING] 1 package to latest compatible version +[DOWNLOADING] crates ... +[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`) +[ERROR] failed to download replaced source registry `crates-io` + +Caused by: + failed to unpack package `bar v1.0.0 (registry `dummy-registry`)` + +Caused by: + failed to unpack entry at `bar-1.0.0/smuggled` + +Caused by: + failed to unpack `[ROOT]/home/.cargo/registry/src/-[HASH]/bar-1.0.0/smuggled` + +Caused by: + [..](os error 183) when creating dir [ROOT]/home/.cargo/registry/src/-[HASH]/bar-1.0.0/smuggled + +"#]]) + .run(); +} From fec7f9297bd4b3614f3a621188c6ca31692eaf2a Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 19 Mar 2026 17:08:40 -0700 Subject: [PATCH 13/13] Update tar to 0.4.45 This updates tar to 0.4.45 to fix CVE-2026-33055 and CVE-2026-33056. --- Cargo.lock | 4 +-- Cargo.toml | 2 +- tests/testsuite/registry.rs | 68 ++++++++++++------------------------- 3 files changed, 25 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3fa6a16c576..d26644998aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4444,9 +4444,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.44" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" +checksum = "22692a6476a21fa75fdfc11d452fda482af402c008cdbaf3476414e122040973" dependencies = [ "filetime", "libc", diff --git a/Cargo.toml b/Cargo.toml index 27f5f286958..1232716917f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -103,7 +103,7 @@ similar = "2.7.0" supports-hyperlinks = "3.2.0" supports-unicode = "3.0.0" snapbox = { version = "0.6.23", features = ["diff", "dir", "term-svg", "regex", "json"] } -tar = { version = "0.4.44", default-features = false } +tar = { version = "0.4.45", default-features = false } tempfile = "3.24.0" thiserror = "2.0.17" time = { version = "0.3.44", features = ["parsing", "formatting", "serde"] } diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index 608188fc9f8..07a28864510 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -4697,57 +4697,23 @@ fn deterministic_mtime() { } #[cargo_test] -#[cfg(unix)] -fn symlink_and_directory_on_unix() { +fn symlink_and_directory() { // Tests for symlink and directory entry in a tar file. The tar crate // would incorrectly change the permissions of the symlink destination, // which could be anywhere on the filesystem. let victim = paths::root().join("victim"); fs::create_dir(&victim).unwrap(); - use std::os::unix::fs::PermissionsExt; - let perm = fs::Permissions::from_mode(0o700); - fs::set_permissions(&victim, perm).unwrap(); - assert_eq!( - victim.metadata().unwrap().permissions().mode() & 0o777, - 0o700 - ); - - Package::new("bar", "1.0.0") - .file("src/lib.rs", "") - .symlink("smuggled", victim.to_str().unwrap()) - .directory("smuggled") - .publish(); - - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - edition = "2015" - - [dependencies] - bar = "1.0" - "#, - ) - .file("src/lib.rs", "") - .build(); - - p.cargo("fetch").run(); - - // FIXME: This should not change permission. - assert_eq!( - victim.metadata().unwrap().permissions().mode() & 0o777, - 0o644 - ); -} + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + let perm = fs::Permissions::from_mode(0o700); + fs::set_permissions(&victim, perm).unwrap(); + assert_eq!( + victim.metadata().unwrap().permissions().mode() & 0o777, + 0o700 + ); + } -#[cargo_test] -#[cfg(windows)] -fn symlink_and_directory_on_windows() { - // Equivalent of chmod_target_symlink for Windows, which does not allow - // trying to create a directory on top of a symlink. - let victim = paths::root().join("victim"); Package::new("bar", "1.0.0") .file("src/lib.rs", "") .symlink("smuggled", victim.to_str().unwrap()) @@ -4788,8 +4754,18 @@ Caused by: failed to unpack `[ROOT]/home/.cargo/registry/src/-[HASH]/bar-1.0.0/smuggled` Caused by: - [..](os error 183) when creating dir [ROOT]/home/.cargo/registry/src/-[HASH]/bar-1.0.0/smuggled + [..] when creating dir [ROOT]/home/.cargo/registry/src/-[HASH]/bar-1.0.0/smuggled "#]]) .run(); + + #[cfg(unix)] + { + // Permissions should not change. + use std::os::unix::fs::PermissionsExt; + assert_eq!( + victim.metadata().unwrap().permissions().mode() & 0o777, + 0o700 + ); + } }