This commit is contained in:
Thalia Archibald 2025-04-13 13:28:09 +02:00 committed by GitHub
commit 9c71494fff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View File

@ -90,7 +90,7 @@ macro_rules! specialize_for_lengths {
$num => {
for s in iter {
copy_slice_and_advance!(target, sep_bytes);
let content_bytes = s.borrow().as_ref();
let content_bytes: &[_] = s.borrow().as_ref();
copy_slice_and_advance!(target, content_bytes);
}
},
@ -99,7 +99,7 @@ macro_rules! specialize_for_lengths {
// arbitrary non-zero size fallback
for s in iter {
copy_slice_and_advance!(target, sep_bytes);
let content_bytes = s.borrow().as_ref();
let content_bytes: &[_] = s.borrow().as_ref();
copy_slice_and_advance!(target, content_bytes);
}
}

View File

@ -201,7 +201,13 @@ impl AsRef<ByteStr> for ByteStr {
}
}
// `impl AsRef<ByteStr> for [u8]` omitted to avoid widespread inference failures
#[unstable(feature = "bstr", issue = "134915")]
impl AsRef<ByteStr> for [u8] {
#[inline]
fn as_ref(&self) -> &ByteStr {
ByteStr::new(self)
}
}
#[unstable(feature = "bstr", issue = "134915")]
impl AsRef<ByteStr> for str {

View File

@ -7,7 +7,7 @@ trait Trait {
fn as_ptr(&self);
}
impl<'a> Trait for &'a [u8] {
impl<'a> Trait for &'a [u32] {
fn as_ptr(&self) {
self.as_ref().as_ptr();
}