From eecd247cdf7dfa1cee9898dd29d56b0021b5f4d0 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 10 Jan 2025 09:55:44 -0800 Subject: [PATCH 1/3] Add CI step to test with "std" disabled --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e492af..554873e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: - run: cargo test --workspace --exclude thiserror_no_std_test - run: cargo test --manifest-path tests/no-std/Cargo.toml if: matrix.rust != '1.70.0' + - run: cargo test --no-default-features - uses: actions/upload-artifact@v4 if: matrix.rust == 'nightly' && always() with: From 8b5f2d78f0576d8a64a96bd0b73c2b4eef45e6c9 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 10 Jan 2025 09:56:33 -0800 Subject: [PATCH 2/3] Fix unused import in test when built without std warning: unused import: `std::path::PathBuf` --> tests/test_expr.rs:4:5 | 4 | use std::path::PathBuf; | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default --- tests/test_expr.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_expr.rs b/tests/test_expr.rs index 5678e84..1872fb5 100644 --- a/tests/test_expr.rs +++ b/tests/test_expr.rs @@ -1,6 +1,7 @@ #![allow(clippy::iter_cloned_collect, clippy::uninlined_format_args)] use core::fmt::Display; +#[cfg(feature = "std")] use std::path::PathBuf; use thiserror::Error; From 1a226ae42c20114f71bd3ed339f9e0351351abce Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 10 Jan 2025 10:00:21 -0800 Subject: [PATCH 3/3] Disable two more integration tests in no-std mode --- tests/test_backtrace.rs | 1 + tests/test_option.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/test_backtrace.rs b/tests/test_backtrace.rs index 2a4cffa..cc25676 100644 --- a/tests/test_backtrace.rs +++ b/tests/test_backtrace.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "std")] #![cfg_attr(thiserror_nightly_testing, feature(error_generic_member_access))] use thiserror::Error; diff --git a/tests/test_option.rs b/tests/test_option.rs index fbdbec0..21cd5e1 100644 --- a/tests/test_option.rs +++ b/tests/test_option.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "std")] #![cfg_attr(thiserror_nightly_testing, feature(error_generic_member_access))] #[cfg(thiserror_nightly_testing)]