Skip to content

Commit aa3232a

Browse files
committed
Cover native interop in no-alloc smoke
1 parent e112841 commit aa3232a

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@
124124
- Added zero-dependency `TryFrom<&[u8; N]>` interop for `EncodedBuffer`,
125125
`DecodedBuffer`, and `SecretBuffer` so byte-string literals use the same
126126
explicit strict standard policy as byte slices.
127+
- Expanded no-alloc smoke coverage and release metadata validation for the
128+
native byte-array and `FromStr` buffer interop surfaces.
127129

128130
## 0.8.0 - 2026-05-16
129131

portability/no_alloc_smoke/src/lib.rs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,42 @@ pub fn fmt_surfaces() -> bool {
430430
output.as_bytes() == b"aGVsbG8="
431431
}
432432

433+
pub fn native_interop_surfaces() -> bool {
434+
let encoded = match EncodedBuffer::<8>::try_from(b"hello") {
435+
Ok(encoded) => encoded,
436+
Err(_) => return false,
437+
};
438+
if encoded.as_bytes() != b"aGVsbG8=" {
439+
return false;
440+
}
441+
442+
let decoded = match DecodedBuffer::<5>::try_from(b"aGVsbG8=") {
443+
Ok(decoded) => decoded,
444+
Err(_) => return false,
445+
};
446+
if decoded.as_bytes() != b"hello" {
447+
return false;
448+
}
449+
450+
let parsed = match "aGVsbG8=".parse::<DecodedBuffer<5>>() {
451+
Ok(decoded) => decoded,
452+
Err(_) => return false,
453+
};
454+
if parsed.as_bytes() != b"hello" {
455+
return false;
456+
}
457+
458+
DecodedBuffer::<5>::try_from(b"aGVsbG8").is_err()
459+
&& "aGVsbG8".parse::<DecodedBuffer<5>>().is_err()
460+
}
461+
433462
#[cfg(test)]
434463
mod tests {
435464
use super::{
436465
CONST_HELLO, clear_tail_surfaces, ct_stack_decode, custom_profile_surfaces, fmt_surfaces,
437-
in_place_surfaces, legacy_stack_decode, length_and_stack_state_surfaces, stack_round_trip,
438-
named_profile_surfaces, url_safe_round_trip, validate_only_surfaces, wrapped_round_trip,
466+
in_place_surfaces, legacy_stack_decode, length_and_stack_state_surfaces,
467+
named_profile_surfaces, native_interop_surfaces, stack_round_trip, url_safe_round_trip,
468+
validate_only_surfaces, wrapped_round_trip,
439469
};
440470

441471
#[test]
@@ -461,5 +491,6 @@ mod tests {
461491
assert!(ct_stack_decode());
462492
assert!(length_and_stack_state_surfaces());
463493
assert!(fmt_surfaces());
494+
assert!(native_interop_surfaces());
464495
}
465496
}

scripts/validate-release-metadata.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ for required_no_alloc_symbol in \
210210
"custom_profile_surfaces" \
211211
"validate_only_surfaces" \
212212
"in_place_surfaces" \
213+
"native_interop_surfaces" \
213214
"BCRYPT" \
214215
"CRYPT" \
215216
"MIME" \

0 commit comments

Comments
 (0)