From bca15dde38f4969ac3a2ff7a89600fd229927d2e Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 6 Nov 2024 17:02:36 +0800 Subject: [PATCH 1/8] ci: Remove outdated -Zprofile options Signed-off-by: Xuanwo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5b5bee59..dd9ad7eab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -239,7 +239,7 @@ jobs: env: CARGO_INCREMENTAL: "0" RUSTC_WRAPPER: "" - RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off" + RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off" - name: Generate coverage data (via `grcov`) id: coverage From d56b39a50deea53e55e48c1d9b36822b80e81bb0 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 6 Nov 2024 17:04:03 +0800 Subject: [PATCH 2/8] Remove more Signed-off-by: Xuanwo --- .github/workflows/integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b71adc13f..d57794f12 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,5 +1,5 @@ name: integration-tests -on: [push, pull_request] +on: [ push, pull_request ] env: RUST_BACKTRACE: full @@ -812,7 +812,7 @@ jobs: env: RUSTC_WRAPPER: /home/runner/.cargo/bin/sccache CARGO_INCREMENTAL: "0" - RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" + RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" RUSTDOCFLAGS: "-Cpanic=abort" steps: From 4e1fa8f802e92090fc0fef0e9bb856e032c6236c Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 6 Nov 2024 17:11:13 +0800 Subject: [PATCH 3/8] Fix tests Signed-off-by: Xuanwo --- src/compiler/rust.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/compiler/rust.rs b/src/compiler/rust.rs index c72fdc51b..169c2ada1 100644 --- a/src/compiler/rust.rs +++ b/src/compiler/rust.rs @@ -3561,7 +3561,6 @@ proc_macro false "--emit=dep-info,link", "--out-dir", "/out", - "-Zprofile" ); assert_eq!(h.gcno, Some("foo.gcno".into())); @@ -3577,7 +3576,6 @@ proc_macro false "extra-filename=-a1b6419f8321841f", "--out-dir", "/out", - "-Zprofile" ); assert_eq!(h.gcno, Some("foo-a1b6419f8321841f.gcno".into())); From 1c40e27f7de6622719a869b6db1ea66cb1496008 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 6 Nov 2024 17:16:47 +0800 Subject: [PATCH 4/8] Fix clippy Signed-off-by: Xuanwo --- src/compiler/args.rs | 2 +- src/compiler/c.rs | 2 +- src/compiler/rust.rs | 4 ++-- src/server.rs | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/compiler/args.rs b/src/compiler/args.rs index 64d7eb98a..2233ebbb3 100644 --- a/src/compiler/args.rs +++ b/src/compiler/args.rs @@ -671,7 +671,7 @@ macro_rules! take_arg { ArgInfo::TakeArg( $s, |arg: OsString| $vtype::process(arg).map($variant), - ArgDisposition::$d(Some($x as u8)), + ArgDisposition::$d(Some(b'=')), ) }; } diff --git a/src/compiler/c.rs b/src/compiler/c.rs index be335d9a6..e316c1065 100644 --- a/src/compiler/c.rs +++ b/src/compiler/c.rs @@ -1263,7 +1263,7 @@ impl pkg::ToolchainPackager for CToolchainPackager { // files by path. let named_file = |kind: &str, name: &str| -> Option { let mut output = process::Command::new(&self.executable) - .arg(&format!("-print-{}-name={}", kind, name)) + .arg(format!("-print-{}-name={}", kind, name)) .output() .ok()?; debug!( diff --git a/src/compiler/rust.rs b/src/compiler/rust.rs index 169c2ada1..32cc4d8bd 100644 --- a/src/compiler/rust.rs +++ b/src/compiler/rust.rs @@ -3560,7 +3560,7 @@ proc_macro false "./src/lib.rs", "--emit=dep-info,link", "--out-dir", - "/out", + "/out" ); assert_eq!(h.gcno, Some("foo.gcno".into())); @@ -3575,7 +3575,7 @@ proc_macro false "-C", "extra-filename=-a1b6419f8321841f", "--out-dir", - "/out", + "/out" ); assert_eq!(h.gcno, Some("foo-a1b6419f8321841f.gcno".into())); diff --git a/src/server.rs b/src/server.rs index 03c2b6a63..769109479 100644 --- a/src/server.rs +++ b/src/server.rs @@ -56,7 +56,6 @@ use std::task::{Context, Poll, Waker}; use std::time::Duration; #[cfg(feature = "dist-client")] use std::time::Instant; -use std::u64; use tokio::sync::Mutex; use tokio::sync::RwLock; use tokio::{ From 06ad9e926f338b661155177bc3ce3c31462876c1 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 6 Nov 2024 17:32:40 +0800 Subject: [PATCH 5/8] Try fix tests Signed-off-by: Xuanwo --- src/compiler/rust.rs | 50 +++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/compiler/rust.rs b/src/compiler/rust.rs index 32cc4d8bd..a00158fcd 100644 --- a/src/compiler/rust.rs +++ b/src/compiler/rust.rs @@ -159,8 +159,8 @@ pub struct ParsedArguments { crate_types: CrateTypes, /// If dependency info is being emitted, the name of the dep info file. dep_info: Option, - /// If gcno info is being emitted, the name of the gcno file. - gcno: Option, + /// If profile info is being emitted, the name of the profile file. + profile: Option, /// rustc says that emits .rlib for --emit=metadata /// https://github.com/rust-lang/rust/issues/54852 emit: HashSet, @@ -994,7 +994,6 @@ ArgData! { CodeGen(ArgCodegen), PassThrough(OsString), Target(ArgTarget), - Unstable(ArgUnstable), } use self::ArgData::*; @@ -1036,7 +1035,6 @@ counted_array!(static ARGS: [ArgInfo; _] = [ take_arg!("-L", ArgLinkPath, CanBeSeparated, LinkPath), flag!("-V", NotCompilationFlag), take_arg!("-W", OsString, CanBeSeparated, PassThrough), - take_arg!("-Z", ArgUnstable, CanBeSeparated, Unstable), take_arg!("-l", ArgLinkLibrary, CanBeSeparated, LinkLibrary), take_arg!("-o", PathBuf, CanBeSeparated, TooHardPath), ]); @@ -1114,6 +1112,7 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments extra_filename = Some(value.to_owned()), ("extra-filename", None) => cannot_cache!("extra-filename"), + ("profile-generate", Some(_)) => profile = true, // Incremental compilation makes a mess of sccache's entire world // view. It produces additional compiler outputs that we don't cache, // and just letting rustc do its work in incremental mode is likely @@ -1126,12 +1125,6 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments (), } } - Some(Unstable(ArgUnstable { opt, value })) => match value.as_deref() { - Some("y") | Some("yes") | Some("on") | None if opt == "profile" => { - profile = true; - } - _ => (), - }, Some(Color(value)) => { // We'll just assume the last specified value wins. color_mode = match value.as_ref() { @@ -1220,14 +1213,15 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments CompilerArguments Date: Wed, 6 Nov 2024 17:38:21 +0800 Subject: [PATCH 6/8] Don't know why clippy fix this Signed-off-by: Xuanwo --- src/compiler/args.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/args.rs b/src/compiler/args.rs index 2233ebbb3..64d7eb98a 100644 --- a/src/compiler/args.rs +++ b/src/compiler/args.rs @@ -671,7 +671,7 @@ macro_rules! take_arg { ArgInfo::TakeArg( $s, |arg: OsString| $vtype::process(arg).map($variant), - ArgDisposition::$d(Some(b'=')), + ArgDisposition::$d(Some($x as u8)), ) }; } From 58fcbf8aa408cda33b3a7e1c73a67c605c56d14e Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 6 Nov 2024 17:45:12 +0800 Subject: [PATCH 7/8] Fix test Signed-off-by: Xuanwo --- tests/sccache_cargo.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/sccache_cargo.rs b/tests/sccache_cargo.rs index 126f1e515..ec040be8f 100644 --- a/tests/sccache_cargo.rs +++ b/tests/sccache_cargo.rs @@ -98,7 +98,10 @@ fn test_rust_cargo_check_nightly() -> Result<()> { test_rust_cargo_cmd( "check", - SccacheTest::new(Some(&[("RUSTFLAGS", OsString::from("-Zprofile"))]))?, + SccacheTest::new(Some(&[( + "RUSTFLAGS", + OsString::from("-Cprofile-generate=."), + )]))?, ) } @@ -110,7 +113,10 @@ fn test_rust_cargo_check_nightly_readonly() -> Result<()> { test_rust_cargo_cmd_readonly( "check", - SccacheTest::new(Some(&[("RUSTFLAGS", OsString::from("-Zprofile"))]))?, + SccacheTest::new(Some(&[( + "RUSTFLAGS", + OsString::from("-Cprofile-generate=."), + )]))?, ) } @@ -122,7 +128,10 @@ fn test_rust_cargo_build_nightly() -> Result<()> { test_rust_cargo_cmd( "build", - SccacheTest::new(Some(&[("RUSTFLAGS", OsString::from("-Zprofile"))]))?, + SccacheTest::new(Some(&[( + "RUSTFLAGS", + OsString::from("-Cprofile-generate=."), + )]))?, ) } @@ -134,7 +143,10 @@ fn test_rust_cargo_build_nightly_readonly() -> Result<()> { test_rust_cargo_cmd_readonly( "build", - SccacheTest::new(Some(&[("RUSTFLAGS", OsString::from("-Zprofile"))]))?, + SccacheTest::new(Some(&[( + "RUSTFLAGS", + OsString::from("-Cprofile-generate=."), + )]))?, ) } From dec56d792a3bd850d57fd2f567c619b1711a159a Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 6 Nov 2024 18:15:06 +0800 Subject: [PATCH 8/8] Fix profile gen Signed-off-by: Xuanwo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd9ad7eab..c1481933d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -239,7 +239,7 @@ jobs: env: CARGO_INCREMENTAL: "0" RUSTC_WRAPPER: "" - RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off" + RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Cprofile-generate=target/debug" - name: Generate coverage data (via `grcov`) id: coverage