Skip to content

Commit

Permalink
Exclude AsRef<Path> for no-std builds
Browse files Browse the repository at this point in the history
And test no-std in CI.
  • Loading branch information
bluss committed Aug 17, 2024
1 parent f3732a0 commit 909c766
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,41 @@ jobs:
run: |
cargo update -p serde_test --precise 1.0.163
cargo update -p serde --precise 1.0.69
- name: Tests
- name: Build
run: |
cargo build -v --no-default-features
cargo build --verbose --features "${{ matrix.features }}"
- name: Tests
run: |
cargo doc --verbose --features "${{ matrix.features }}" --no-deps
cargo test --verbose --features "${{ matrix.features }}"
cargo test --release --verbose --features "${{ matrix.features }}"
- name: Test run benchmarks
if: matrix.bench != ''
run: cargo test -v --benches

nostd:
runs-on: ubuntu-latest
continue-on-error: false
strategy:
matrix:
include:
- rust: stable
target: thumbv6m-none-eabi
features: zeroize

name: nostd/${{ matrix.target }}/${{ matrix.rust }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- name: Tests
run: |
cargo rustc "--target=${{ matrix.target }}" --no-default-features --features "${{ matrix.features }}"
miri:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions src/array_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::fmt;
use std::hash::{Hash, Hasher};
use std::mem::MaybeUninit;
use std::ops::{Deref, DerefMut};
#[cfg(feature="std")]
use std::path::Path;
use std::ptr;
use std::slice;
Expand Down Expand Up @@ -502,6 +503,7 @@ impl<const CAP: usize> fmt::Debug for ArrayString<CAP>
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) }
}

#[cfg(feature="std")]
impl<const CAP: usize> AsRef<Path> for ArrayString<CAP> {
fn as_ref(&self) -> &Path {
self.as_str().as_ref()
Expand Down

0 comments on commit 909c766

Please sign in to comment.