From 8d5edea9891dbc05af30048e7914b6947b073be8 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. --- .github/workflows/check-and-lint.yaml | 9 +++++++++ sample/src/lib.rs | 2 ++ sample_rlib/lib.rs | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-and-lint.yaml b/.github/workflows/check-and-lint.yaml index e692716..b9c403f 100644 --- a/.github/workflows/check-and-lint.yaml +++ b/.github/workflows/check-and-lint.yaml @@ -22,6 +22,15 @@ jobs: - name: Build all the things run: cargo build --tests + - name: xxx + run: rustc --version + + - name: xxx1 + run: cargo run -- --manifest-path sample/Cargo.toml --intel --everything + + - name: xxx2 + run: cargo run -- --manifest-path sample/Cargo.toml + - name: Run unit tests run: cargo test --all-features 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 } -