From 0e1123b0ce814632d131da3b6e9849d71c7512b4 Mon Sep 17 00:00:00 2001 From: nori li <50680474+thenorili@users.noreply.github.com> Date: Sat, 18 Nov 2023 23:19:21 -0800 Subject: [PATCH] Support unstable-less nightly This change attempts to put unstable features behind an opt-in feature flag as requested by issue #120. Unstable lints and compile_test.rs are both gated by this feature which is added unconditionally to all CI that touches more than just stable. As expressed in issue #120, I have some concerns about *needing* to gate compile_test.rs behind feature = "unstable". I'm not certain that this unstable-less nightly eyre will work in production due to the reason that compile_test.rs fails: three of our dependencies, anyhow, thiserror, and proc-macro, all use a test for a nightly toolchain to gate unstable features. Maybe I'm wrong though and this change is sufficient! --- .github/workflows/ci.yml | 6 +++--- color-spantrace/Cargo.toml | 6 ++++++ color-spantrace/src/lib.rs | 2 +- eyre/Cargo.toml | 1 + eyre/src/lib.rs | 2 +- eyre/tests/compiletest.rs | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0d6919..cd8db8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,9 +44,9 @@ jobs: features: - # default - --no-default-features - - --features track-caller - - --features pyo3 - - --features auto-install + - --features unstable track-caller + - --features unstable pyo3 + - --features unstable auto-install - --all-features steps: - uses: actions/checkout@v1 diff --git a/color-spantrace/Cargo.toml b/color-spantrace/Cargo.toml index e1510d8..9d89d8c 100644 --- a/color-spantrace/Cargo.toml +++ b/color-spantrace/Cargo.toml @@ -11,6 +11,12 @@ repository = { workspace = true } readme = { workspace = true } rust-version = { workspace = true } +[features] +default = ["auto-install", "track-caller"] +auto-install = [] +track-caller = [] +unstable = [] + [dependencies] tracing-error = "0.2.0" tracing-core = "0.1.21" diff --git a/color-spantrace/src/lib.rs b/color-spantrace/src/lib.rs index 6b07a34..e7ace85 100644 --- a/color-spantrace/src/lib.rs +++ b/color-spantrace/src/lib.rs @@ -61,7 +61,7 @@ //! [`color-backtrace`]: https://github.com/athre0z/color-backtrace #![doc(html_root_url = "https://docs.rs/color-spantrace/0.2.0")] #![cfg_attr( - nightly, + all(nightly, feature = "unstable"), feature(rustdoc_missing_doc_code_examples), warn(rustdoc::missing_doc_code_examples) )] diff --git a/eyre/Cargo.toml b/eyre/Cargo.toml index 982d9b2..717eecc 100644 --- a/eyre/Cargo.toml +++ b/eyre/Cargo.toml @@ -16,6 +16,7 @@ rust-version = { workspace = true } default = ["auto-install", "track-caller"] auto-install = [] track-caller = [] +unstable = [] [dependencies] indenter = { workspace = true } diff --git a/eyre/src/lib.rs b/eyre/src/lib.rs index f56640a..0cf7df1 100644 --- a/eyre/src/lib.rs +++ b/eyre/src/lib.rs @@ -316,7 +316,7 @@ //! [`color-backtrace`]: https://github.com/athre0z/color-backtrace #![doc(html_root_url = "https://docs.rs/eyre/0.6.8")] #![cfg_attr( - nightly, + all(nightly, feature = "unstable"), feature(rustdoc_missing_doc_code_examples), warn(rustdoc::missing_doc_code_examples) )] diff --git a/eyre/tests/compiletest.rs b/eyre/tests/compiletest.rs index 7974a62..303e8d6 100644 --- a/eyre/tests/compiletest.rs +++ b/eyre/tests/compiletest.rs @@ -1,4 +1,4 @@ -#[rustversion::attr(not(nightly), ignore)] +#[cfg_attr(any(not(nightly), not(feature = "unstable")), ignore)] #[cfg_attr(miri, ignore)] #[test] fn ui() {