Skip to content

Commit d60ac69

Browse files
committed
Add CI job for no-std build verification and fix Infallible StdError implementation
- Add dedicated no-std CI job that builds for wasm32-unknown-unknown target - Fix Infallible StdError implementation for no-std environments The CI job validates: 1. Core no-std functionality (no default features) 2. fancy-no-syscall feature set compatible with no-std environments
1 parent 16f4521 commit d60ac69

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ jobs:
6868
- name: Check wasm target
6969
run: cargo check --target wasm32-unknown-unknown --features fancy-no-syscall
7070

71+
no-std:
72+
name: Check no-std build
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v4
76+
- name: Install Rust
77+
uses: dtolnay/rust-toolchain@master
78+
with:
79+
toolchain: stable
80+
targets: wasm32-unknown-unknown
81+
- name: Check no-std core build
82+
run: cargo check --target wasm32-unknown-unknown --no-default-features
83+
- name: Check no-std with fancy-no-syscall
84+
run: cargo check --target wasm32-unknown-unknown --no-default-features --features fancy-no-syscall
85+
7186
miri:
7287
name: Miri
7388
runs-on: ubuntu-latest

src/diagnostic_impls.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ use core::{convert::Infallible, fmt::Display};
88

99
use crate::{Diagnostic, LabeledSpan, Severity, SourceCode};
1010

11+
#[cfg(not(feature = "std"))]
12+
impl crate::StdError for Infallible {}
13+
1114
impl Diagnostic for Infallible {
1215
fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>> {
1316
match *self {}

src/eyreish/wrapper.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,16 @@ impl<C> StdError for WithSourceCode<Report, C> {
209209
}
210210
}
211211

212-
#[cfg(test)]
212+
#[cfg(all(test, feature = "std"))]
213213
mod tests {
214-
214+
#[cfg(feature = "fancy")]
215+
use std::format;
215216
use std::{
216217
boxed::Box,
217218
string::{String, ToString},
218219
};
220+
#[cfg(feature = "fancy")]
221+
use std::{vec, vec::Vec};
219222
use thiserror::Error;
220223

221224
use crate::{Diagnostic, LabeledSpan, Report, SourceCode, SourceSpan};

0 commit comments

Comments
 (0)