Omit some more From impls to avoid inference failures

This commit is contained in:
Josh Triplett
2025-01-12 12:27:24 +02:00
parent 76780fa10e
commit 22a4ec39fb
2 changed files with 80 additions and 87 deletions

View File

@@ -246,21 +246,23 @@ impl<'a> Default for &'a mut ByteStr {
}
}
#[unstable(feature = "bstr", issue = "134915")]
impl<'a, const N: usize> From<&'a [u8; N]> for &'a ByteStr {
#[inline]
fn from(s: &'a [u8; N]) -> Self {
ByteStr::from_bytes(s)
}
}
#[unstable(feature = "bstr", issue = "134915")]
impl<'a> From<&'a [u8]> for &'a ByteStr {
#[inline]
fn from(s: &'a [u8]) -> Self {
ByteStr::from_bytes(s)
}
}
// Omitted due to inference failures
//
// #[unstable(feature = "bstr", issue = "134915")]
// impl<'a, const N: usize> From<&'a [u8; N]> for &'a ByteStr {
// #[inline]
// fn from(s: &'a [u8; N]) -> Self {
// ByteStr::from_bytes(s)
// }
// }
//
// #[unstable(feature = "bstr", issue = "134915")]
// impl<'a> From<&'a [u8]> for &'a ByteStr {
// #[inline]
// fn from(s: &'a [u8]) -> Self {
// ByteStr::from_bytes(s)
// }
// }
// Omitted due to slice-from-array-issue-113238:
//
@@ -280,13 +282,15 @@ impl<'a> From<&'a [u8]> for &'a ByteStr {
// }
// }
#[unstable(feature = "bstr", issue = "134915")]
impl<'a> From<&'a str> for &'a ByteStr {
#[inline]
fn from(s: &'a str) -> Self {
ByteStr::from_bytes(s.as_bytes())
}
}
// Omitted due to inference failures
//
// #[unstable(feature = "bstr", issue = "134915")]
// impl<'a> From<&'a str> for &'a ByteStr {
// #[inline]
// fn from(s: &'a str) -> Self {
// ByteStr::from_bytes(s.as_bytes())
// }
// }
#[unstable(feature = "bstr", issue = "134915")]
impl hash::Hash for ByteStr {