From 75897cfc992c03d757bda5a1cd3093183e40dd23 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 30 Dec 2023 17:54:47 -0800 Subject: [PATCH] Make CI verify that proc_macro_span works in latest nightly --- .github/workflows/ci.yml | 3 +++ src/lib.rs | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc6553b..caaef6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,6 +57,9 @@ jobs: components: rust-src - name: Enable type layout randomization run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV + - run: cargo check + env: + RUSTFLAGS: --cfg procmacro2_nightly_testing ${{env.RUSTFLAGS}} - run: cargo test - run: cargo test --no-default-features - run: cargo test --no-default-features --test features -- --ignored make_sure_no_proc_macro # run the ignored test to make sure the `proc-macro` feature is disabled diff --git a/src/lib.rs b/src/lib.rs index 6826226..230a398 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,6 +122,15 @@ compile_error! {"\ build script as well. "} +#[cfg(all( + procmacro2_nightly_testing, + feature = "proc-macro", + not(proc_macro_span) +))] +compile_error! {"\ + Build script probe failed to compile. +"} + extern crate alloc; #[cfg(feature = "proc-macro")]