Skip to content

Commit 97688e3

Browse files
committed
Exclude AsRef<Path> for no-std builds
And test no-std in CI.
1 parent f3732a0 commit 97688e3

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.github/workflows/ci.yml

+21
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@ jobs:
5454
if: matrix.bench != ''
5555
run: cargo test -v --benches
5656

57+
nostd:
58+
runs-on: ubuntu-latest
59+
continue-on-error: false
60+
strategy:
61+
matrix:
62+
include:
63+
- rust: stable
64+
target: thumbv6m-none-eabi
65+
66+
name: nostd/${{ matrix.target }}/${{ matrix.rust }}
67+
steps:
68+
- uses: actions/checkout@v4
69+
- uses: dtolnay/rust-toolchain@stable
70+
with:
71+
toolchain: ${{ matrix.rust }}
72+
targets: ${{ matrix.target }}
73+
- name: Tests
74+
run: |
75+
cargo rustc "--target=${{ matrix.target }}" --no-default-features
76+
77+
5778
miri:
5879
runs-on: ubuntu-latest
5980
steps:

src/array_string.rs

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::fmt;
55
use std::hash::{Hash, Hasher};
66
use std::mem::MaybeUninit;
77
use std::ops::{Deref, DerefMut};
8+
#[cfg(feature="std")]
89
use std::path::Path;
910
use std::ptr;
1011
use std::slice;
@@ -502,6 +503,7 @@ impl<const CAP: usize> fmt::Debug for ArrayString<CAP>
502503
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) }
503504
}
504505

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

0 commit comments

Comments
 (0)