From e7e31ac71fdc8d350226a39ac2be5a4a47c6bac0 Mon Sep 17 00:00:00 2001 From: Michael Baikov Date: Thu, 28 Dec 2023 18:31:58 -0500 Subject: [PATCH] fix CI in newer rust The culprit lied in rust-lang/rust#116505 In short, with default features turned off, main was trivial enough to be marked as inline function automatically which then made the symbol weak. Since nobody was referencing it, it got stripped away. Marking main in default-features=false config as #[inline(never)] or replacing 1 + 1 in it's body with a simple println!("foo") call (to make the main function sophisticated enough not to be subject to the new automatic marking as inline) makes the test pass again. --- sample/src/lib.rs | 2 ++ sample_rlib/lib.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sample/src/lib.rs b/sample/src/lib.rs index b27c062..17f79c5 100644 --- a/sample/src/lib.rs +++ b/sample/src/lib.rs @@ -25,6 +25,7 @@ impl SeedableRng for MyRngCore { } #[cfg(not(feature = "superbanana"))] +#[inline(never)] pub fn main() -> u32 { 1 + 1 } @@ -38,6 +39,7 @@ impl Bar { } #[cfg(feature = "superbanana")] +#[inline(never)] pub fn main() { let mut rng = BlockRng::::seed_from_u64(0); for ix in 0..10 { diff --git a/sample_rlib/lib.rs b/sample_rlib/lib.rs index f577d47..d9364a6 100644 --- a/sample_rlib/lib.rs +++ b/sample_rlib/lib.rs @@ -1,4 +1,4 @@ +#[inline(never)] pub fn add(a: usize, b: usize) -> usize { a + b } -