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 diff --git a/Cargo.lock b/Cargo.lock index f7727eca4d0..d26644998aa 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", @@ -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 392758a17db..1232716917f 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" @@ -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/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, } } 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/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index abdb469847b..3dee17de7ab 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(); @@ -1538,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/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 } ``` diff --git a/tests/build-std/main.rs b/tests/build-std/main.rs index 8fdf76a1480..0e116308da0 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}; @@ -165,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]) @@ -279,6 +274,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 +304,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/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. 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(); } 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; 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 diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index 896bcc3432f..07a28864510 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -4695,3 +4695,77 @@ fn deterministic_mtime() { assert_deterministic_mtime(pkg_root.join("Cargo.toml")); assert_deterministic_mtime(pkg_root.join(".cargo_vcs_info.json")); } + +#[cargo_test] +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(); + #[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 + ); + } + + 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: + [..] 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 + ); + } +} 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(); } 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)