Skip to content

Commit 7fdc650

Browse files
authored
#326 fix: add missing alloc imports for no_std compatibility (#327)
Add missing imports from alloc crate when std feature is disabled: - String in builder.rs (lines 126, 416) - Box in introspection.rs (line 238) - ToString in display.rs (line 391) Also add CI check for no_std builds to prevent future regressions. Fixes #326
1 parent b6b9bb9 commit 7fdc650

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,28 @@ jobs:
2525
all-features: true
2626
secrets: inherit
2727

28+
no-std:
29+
name: no_std compatibility
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v5
33+
34+
- name: Install Rust (stable)
35+
uses: dtolnay/rust-toolchain@v1
36+
with:
37+
toolchain: stable
38+
39+
- name: Cache cargo
40+
uses: Swatinem/rust-cache@v2
41+
with:
42+
shared-key: no-std
43+
save-if: ${{ github.ref == 'refs/heads/main' }}
44+
45+
- name: Check no_std build
46+
run: cargo check --no-default-features
47+
2848
update-changelog:
29-
needs: ci
49+
needs: [ci, no-std]
3050
uses: ./.github/workflows/reusable-changelog.yml
3151
secrets:
3252
GH_TOKEN: ${{ secrets.GH_TOKEN }}

src/app_error/core/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// SPDX-License-Identifier: MIT
44

5-
use alloc::{borrow::Cow, sync::Arc};
5+
use alloc::{borrow::Cow, string::String, sync::Arc};
66
use core::error::Error as CoreError;
77
#[cfg(feature = "backtrace")]
88
use std::backtrace::Backtrace;

src/app_error/core/display.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//
33
// SPDX-License-Identifier: MIT
44

5+
use alloc::string::ToString;
56
use core::{
67
error::Error as CoreError,
78
fmt::{Formatter, Result as FmtResult},

src/app_error/core/introspection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// SPDX-License-Identifier: MIT
44

5-
use alloc::borrow::Cow;
5+
use alloc::{borrow::Cow, boxed::Box};
66
use core::error::Error as CoreError;
77

88
#[cfg(feature = "backtrace")]

0 commit comments

Comments
 (0)