Skip to content

Conversation

@RalfJung
Copy link
Member

@RalfJung RalfJung commented Nov 14, 2025

This repeats the experiment from #122819. Back then, not even cargo built; since then, time-rs/time#704 has landed so maybe we get a bit further this time.

See #124328 for context.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 14, 2025
@RalfJung
Copy link
Member Author

@bors try

rust-bors bot added a commit that referenced this pull request Nov 14, 2025
crater experiment: do not promote function calls in const/static items
@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member Author

RalfJung commented Nov 14, 2025

Lol, this time we can't build clippy.^^ owo-colors fails.

This seems to have been fixed a year ago (owo-colors/owo-colors#131), but we depend on an ancient version of owo-colors via prettydiff. A newer prettydiff is available that would fix that, but the latest ui_test depends on an old prettydiff.

@rust-bors
Copy link

rust-bors bot commented Nov 14, 2025

☀️ Try build successful (CI)
Build commit: 943e220 (943e2200e35c3825486c4671b6cab0107a07f8c1, parent: 42f4793e5a514858221b07ac379029d90353913e)

@RalfJung
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-148952 created and queued.
🤖 Automatically detected try build 943e220
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 14, 2025
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_cranelift/build_system)
error[E0716]: temporary value dropped while borrowed
  --> compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs:14:52
   |
14 | static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe_target");
   |                                 -------------------^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------
   |                                 |                  |                                            |
   |                                 |                  |                                            temporary value is freed at the end of this statement
   |                                 |                  creates a temporary value which is freed while still in use
   |                                 argument requires that borrow lasts for `'static`

error[E0716]: temporary value dropped while borrowed
 --> compiler/rustc_codegen_cranelift/build_system/build_backend.rs:9:51
  |
9 | static CG_CLIF: CargoProject = CargoProject::new(&RelPath::source("."), "cg_clif");
  |                                -------------------^^^^^^^^^^^^^^^^^^^^------------
  |                                |                  |                              |
  |                                |                  |                              temporary value is freed at the end of this statement
  |                                |                  creates a temporary value which is freed while still in use
  |                                argument requires that borrow lasts for `'static`

error[E0716]: temporary value dropped while borrowed
   --> compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs:143:24
    |
143 |     CargoProject::new(&RelPath::build("stdlib/library/sysroot"), "stdlib_target");
    |     -------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------
    |     |                  |                                                        |
    |     |                  |                                                        temporary value is freed at the end of this statement
    |     |                  creates a temporary value which is freed while still in use
    |     argument requires that borrow lasts for `'static`

error[E0716]: temporary value dropped while borrowed
   --> compiler/rustc_codegen_cranelift/build_system/tests.rs:132:48
    |
132 | static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir(), "rand_target");
    |                             -------------------^^^^^^^^^^^^^^^^^^^^^^----------------
    |                             |                  |                                    |
    |                             |                  |                                    temporary value is freed at the end of this statement
    |                             |                  creates a temporary value which is freed while still in use
    |                             argument requires that borrow lasts for `'static`

error[E0716]: temporary value dropped while borrowed
   --> compiler/rustc_codegen_cranelift/build_system/tests.rs:142:49
    |
142 | static REGEX: CargoProject = CargoProject::new(&REGEX_REPO.source_dir(), "regex_target");
    |                              -------------------^^^^^^^^^^^^^^^^^^^^^^^-----------------
    |                              |                  |                                      |
    |                              |                  |                                      temporary value is freed at the end of this statement
    |                              |                  creates a temporary value which is freed while still in use
    |                              argument requires that borrow lasts for `'static`

For more information about this error, try `rustc --explain E0716`.
[RUSTC-TIMING] y test:false 0.449
error: could not compile `y` (bin "y") due to 5 previous errors
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Command `/checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo run --target aarch64-unknown-linux-gnu -Zbinary-dep-depinfo -j 4 -Zroot-dir=/checkout --locked --color always --release --manifest-path /checkout/compiler/rustc_codegen_cranelift/build_system/Cargo.toml -- test --download-dir /checkout/obj/build/cg_clif_download --out-dir /checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif --no-unstable-features --use-backend cranelift --sysroot llvm --skip-test testsuite.extended_sysroot [workdir=/checkout/compiler/rustc_codegen_cranelift]` failed with exit code 101
Created at: src/bootstrap/src/core/build_steps/test.rs:3717:25
Executed at: src/bootstrap/src/core/build_steps/test.rs:3762:26

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:20:58
  local time: Sun Nov 16 14:55:52 UTC 2025
  network time: Sun, 16 Nov 2025 14:55:57 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

@RalfJung
Copy link
Member Author

Fun, the cranelift backend has a whole bunch of cases of this. Cc @bjorn3

@craterbot
Copy link
Collaborator

🚧 Experiment pr-148952 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@bjorn3
Copy link
Member

bjorn3 commented Nov 17, 2025

Fun, the cranelift backend has a whole bunch of cases of this.

Would this work?

diff --git a/build_system/abi_cafe.rs b/build_system/abi_cafe.rs
index 5a393a21..762b2be8 100644
--- a/build_system/abi_cafe.rs
+++ b/build_system/abi_cafe.rs
@@ -11,7 +11,7 @@
     "abi-cafe",
 );
 
-static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe_target");
+static ABI_CAFE: CargoProject = CargoProject::new(ABI_CAFE_REPO.source_dir(), "abi_cafe_target");
 
 pub(crate) fn run(
     sysroot_kind: SysrootKind,
diff --git a/build_system/build_backend.rs b/build_system/build_backend.rs
index b9fa0ff2..ad6743a6 100644
--- a/build_system/build_backend.rs
+++ b/build_system/build_backend.rs
@@ -6,7 +6,7 @@
 use crate::shared_utils::{rustflags_from_env, rustflags_to_cmd_env};
 use crate::utils::{CargoProject, Compiler, LogGroup};
 
-static CG_CLIF: CargoProject = CargoProject::new(&RelPath::source("."), "cg_clif");
+static CG_CLIF: CargoProject = CargoProject::new(RelPath::source("."), "cg_clif");
 
 pub(crate) fn build_backend(
     dirs: &Dirs,
diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs
index 70504ee8..804d50e2 100644
--- a/build_system/build_sysroot.rs
+++ b/build_system/build_sysroot.rs
@@ -140,7 +140,7 @@ fn install_into_sysroot(&self, sysroot: &Path) {
 
 static STDLIB_SRC: RelPath = RelPath::build("stdlib");
 static STANDARD_LIBRARY: CargoProject =
-    CargoProject::new(&RelPath::build("stdlib/library/sysroot"), "stdlib_target");
+    CargoProject::new(RelPath::build("stdlib/library/sysroot"), "stdlib_target");
 
 fn build_sysroot_for_triple(
     dirs: &Dirs,
diff --git a/build_system/tests.rs b/build_system/tests.rs
index dd8cf929..3b6a2e7a 100644
--- a/build_system/tests.rs
+++ b/build_system/tests.rs
@@ -129,7 +129,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
     "rand",
 );
 
-static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir(), "rand_target");
+static RAND: CargoProject = CargoProject::new(RAND_REPO.source_dir(), "rand_target");
 
 pub(crate) static REGEX_REPO: GitRepo = GitRepo::github(
     "rust-lang",
@@ -139,15 +139,15 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
     "regex",
 );
 
-static REGEX: CargoProject = CargoProject::new(&REGEX_REPO.source_dir(), "regex_target");
+static REGEX: CargoProject = CargoProject::new(REGEX_REPO.source_dir(), "regex_target");
 
 static PORTABLE_SIMD_SRC: RelPath = RelPath::build("portable-simd");
 
-static PORTABLE_SIMD: CargoProject = CargoProject::new(&PORTABLE_SIMD_SRC, "portable-simd_target");
+static PORTABLE_SIMD: CargoProject = CargoProject::new(PORTABLE_SIMD_SRC, "portable-simd_target");
 
 static SYSROOT_TESTS_SRC: RelPath = RelPath::build("sysroot_tests");
 
-static SYSROOT_TESTS: CargoProject = CargoProject::new(&SYSROOT_TESTS_SRC, "sysroot_tests_target");
+static SYSROOT_TESTS: CargoProject = CargoProject::new(SYSROOT_TESTS_SRC, "sysroot_tests_target");
 
 const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
     TestCase::custom("test.rust-random/rand", &|runner| {
diff --git a/build_system/utils.rs b/build_system/utils.rs
index 3266aa0c..5c7cefa1 100644
--- a/build_system/utils.rs
+++ b/build_system/utils.rs
@@ -75,12 +75,12 @@ pub(crate) fn run_with_runner(&self, program: impl AsRef<OsStr>) -> Command {
 }
 
 pub(crate) struct CargoProject {
-    source: &'static RelPath,
+    source: RelPath,
     target: &'static str,
 }
 
 impl CargoProject {
-    pub(crate) const fn new(path: &'static RelPath, target: &'static str) -> CargoProject {
+    pub(crate) const fn new(path: RelPath, target: &'static str) -> CargoProject {
         CargoProject { source: path, target }
     }
 

Edit: Committed as rust-lang/rustc_codegen_cranelift@2017344

@RalfJung
Copy link
Member Author

That should help, yeah. Alternatively, replacing &RelPath::source(".") by const { &RelPath::source(".") } would also work.

@craterbot
Copy link
Collaborator

🎉 Experiment pr-148952 is completed!
📊 6478 regressed and 5 fixed (737227 total)
📊 1826 spurious results on the retry-regessed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-148952/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Nov 19, 2025
@RalfJung
Copy link
Member Author

We got the data, nothing left to do here.

@RalfJung RalfJung closed this Nov 19, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants