Skip to content

Commit 113252e

Browse files
committed
Ensure BytesIter is an unsafe trait.
Closes #104. Part of fixes to addrss #100.
1 parent 24a1d6a commit 113252e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lexical-util/src/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub use crate::skip::{AsBytes, Bytes};
2020
/// A default implementation is provided for slice iterators.
2121
/// This trait **should never** return `null` from `as_ptr`, or be
2222
/// implemented for non-contiguous data.
23-
pub trait BytesIter<'a>: Iterator<Item = &'a u8> {
23+
pub unsafe trait BytesIter<'a>: Iterator<Item = &'a u8> {
2424
/// Determine if each yielded value is adjacent in memory.
2525
const IS_CONTIGUOUS: bool;
2626

lexical-util/src/noskip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ pub struct BytesIterator<'a: 'b, 'b, const __: u128> {
232232
byte: &'b mut Bytes<'a, __>,
233233
}
234234

235-
impl<'a: 'b, 'b, const __: u128> BytesIter<'a> for BytesIterator<'a, 'b, __> {
235+
unsafe impl<'a: 'b, 'b, const __: u128> BytesIter<'a> for BytesIterator<'a, 'b, __> {
236236
const IS_CONTIGUOUS: bool = Bytes::<'a, __>::IS_CONTIGUOUS;
237237

238238
#[inline(always)]

0 commit comments

Comments
 (0)