diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae3c2fdfa..a3cf4c374 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -117,16 +117,19 @@ jobs: # # for lots of more discussion. runs-on: ubuntu-latest - name: ubuntu / stable / coverage + name: ubuntu / nightly / coverage steps: - uses: actions/checkout@v4 with: submodules: true - name: Install rust + # We run in nightly to make use of the `#[coverage(off)]` attribute (see _contracts/src/lib.rs_) + # We'll return to stable release after the tracking issue is merged (and the feature is stable) + # See: https://github.com/rust-lang/rust/issues/84605 uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: stable + toolchain: nightly components: llvm-tools-preview rustflags: "" diff --git a/Cargo.toml b/Cargo.toml index 61534133e..0da983309 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,6 +65,7 @@ version = "0.2.0-alpha.1" missing_docs = "warn" unreachable_pub = "warn" rust_2021_compatibility = { level = "warn", priority = -1 } +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } [workspace.lints.clippy] pedantic = "warn" diff --git a/contracts/src/lib.rs b/contracts/src/lib.rs index aa0055308..a20819af7 100644 --- a/contracts/src/lib.rs +++ b/contracts/src/lib.rs @@ -46,6 +46,7 @@ impl MyContract { } )] #![cfg_attr(not(feature = "std"), no_std, no_main)] #![deny(rustdoc::broken_intra_doc_links)] +#![cfg_attr(coverage_nightly, feature(coverage_attribute))] extern crate alloc; pub mod access;