Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4af44ae51f402ccb59f770a3ff706b46d461e5e3
Choose a base ref
..
head repository: rust-lang/rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 50c29364c7edddea3b7b4e24c0ea4c7363bca8fd
Choose a head ref
Showing with 20 additions and 18 deletions.
  1. +17 −15 library/core/src/bstr.rs
  2. +3 −3 tests/ui/suggestions/issue-71394-no-from-impl.stderr
32 changes: 17 additions & 15 deletions library/core/src/bstr.rs
Original file line number Diff line number Diff line change
@@ -259,21 +259,23 @@ impl<'a> From<&'a [u8]> for &'a ByteStr {
}
}

#[unstable(feature = "bstr", issue = "134915")]
impl<'a> From<&'a ByteStr> for &'a [u8] {
#[inline]
fn from(s: &'a ByteStr) -> Self {
&s.0
}
}

#[unstable(feature = "bstr", issue = "134915")]
impl<'a> From<&'a mut ByteStr> for &'a mut [u8] {
#[inline]
fn from(s: &'a mut ByteStr) -> Self {
&mut s.0
}
}
// Omitted due to slice-from-array-issue-113238:
//
// #[unstable(feature = "bstr", issue = "134915")]
// impl<'a> From<&'a ByteStr> for &'a [u8] {
// #[inline]
// fn from(s: &'a ByteStr) -> Self {
// &s.0
// }
// }
//
// #[unstable(feature = "bstr", issue = "134915")]
// impl<'a> From<&'a mut ByteStr> for &'a mut [u8] {
// #[inline]
// fn from(s: &'a mut ByteStr) -> Self {
// &mut s.0
// }
// }

#[unstable(feature = "bstr", issue = "134915")]
impl<'a> From<&'a str> for &'a ByteStr {
6 changes: 3 additions & 3 deletions tests/ui/suggestions/issue-71394-no-from-impl.stderr
Original file line number Diff line number Diff line change
@@ -5,15 +5,15 @@ LL | let _: &[i8] = data.into();
| ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`
|
= help: the following other types implement trait `From<T>`:
`&[u8]` implements `From<&ByteStr>`
`&mut [u8]` implements `From<&mut ByteStr>`
`[T; 10]` implements `From<(T, T, T, T, T, T, T, T, T, T)>`
`[T; 11]` implements `From<(T, T, T, T, T, T, T, T, T, T, T)>`
`[T; 12]` implements `From<(T, T, T, T, T, T, T, T, T, T, T, T)>`
`[T; 1]` implements `From<(T,)>`
`[T; 2]` implements `From<(T, T)>`
`[T; 3]` implements `From<(T, T, T)>`
and 8 others
`[T; 4]` implements `From<(T, T, T, T)>`
`[T; 5]` implements `From<(T, T, T, T, T)>`
and 6 others
= note: required for `&[u8]` to implement `Into<&[i8]>`

error: aborting due to 1 previous error