From f3a80ff29bd8990c235d906435bc01e6b2161441 Mon Sep 17 00:00:00 2001 From: Aaron Gowatch Date: Thu, 1 Feb 2024 16:55:23 -0700 Subject: [PATCH] Add support for Rust stable --- .github/workflows/ci.yaml | 6 ++++++ macros/build.rs | 15 +++++++++++++++ macros/src/lib.rs | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 macros/build.rs diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c0b370c..c32f82a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,6 +16,12 @@ on: jobs: ci: runs-on: ubuntu-20.04 + strategy: + matrix: + rust: + - stable + - nightly-2023-11-01 + steps: - uses: actions/checkout@v3 diff --git a/macros/build.rs b/macros/build.rs new file mode 100644 index 0000000..eff403c --- /dev/null +++ b/macros/build.rs @@ -0,0 +1,15 @@ +use std::{env, ffi::OsString, process::Command}; + +fn main() { + let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); + + let output = Command::new(rustc) + .arg("--version") + .output() + .expect("failed to run `rustc --version`"); + + if String::from_utf8_lossy(&output.stdout).contains("nightly") { + println!("cargo:rustc-cfg=nightly"); + } + println!("cargo:rerun-if-changed=build.rs"); +} diff --git a/macros/src/lib.rs b/macros/src/lib.rs index ad5217c..43d5128 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -1,5 +1,5 @@ #![allow(incomplete_features)] -#![feature(proc_macro_diagnostic)] +#![cfg_attr(nightly, feature(proc_macro_diagnostic))] extern crate proc_macro; mod actor;