Rollup merge of #137277 - m4rch3n1ng:stabilize-inherent-str-constructors, r=tgross35

stabilize `inherent_str_constructors`

fcp done in https://github.com/rust-lang/rust/issues/131114#issuecomment-2668859969.

tracking issue: #131114
closes: #131114
This commit is contained in:
Matthias Krüger 2025-02-20 00:55:16 +01:00 committed by GitHub
commit be73ea82ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 47 additions and 59 deletions

View File

@ -198,8 +198,6 @@ impl str {
/// Basic usage:
///
/// ```
/// #![feature(inherent_str_constructors)]
///
/// // some bytes, in a vector
/// let sparkle_heart = vec![240, 159, 146, 150];
///
@ -213,8 +211,6 @@ impl str {
/// Incorrect bytes:
///
/// ```
/// #![feature(inherent_str_constructors)]
///
/// // some invalid bytes, in a vector
/// let sparkle_heart = vec![0, 159, 146, 150];
///
@ -227,8 +223,6 @@ impl str {
/// A "stack allocated string":
///
/// ```
/// #![feature(inherent_str_constructors)]
///
/// // some bytes, in a stack-allocated array
/// let sparkle_heart = [240, 159, 146, 150];
///
@ -237,7 +231,8 @@ impl str {
///
/// assert_eq!("💖", sparkle_heart);
/// ```
#[unstable(feature = "inherent_str_constructors", issue = "131114")]
#[stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
#[rustc_diagnostic_item = "str_inherent_from_utf8"]
pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
converts::from_utf8(v)
@ -250,8 +245,6 @@ impl str {
/// Basic usage:
///
/// ```
/// #![feature(inherent_str_constructors)]
///
/// // "Hello, Rust!" as a mutable vector
/// let mut hellorust = vec![72, 101, 108, 108, 111, 44, 32, 82, 117, 115, 116, 33];
///
@ -264,8 +257,6 @@ impl str {
/// Incorrect bytes:
///
/// ```
/// #![feature(inherent_str_constructors)]
///
/// // Some invalid bytes in a mutable vector
/// let mut invalid = vec![128, 223];
///
@ -273,7 +264,7 @@ impl str {
/// ```
/// See the docs for [`Utf8Error`] for more details on the kinds of
/// errors that can be returned.
#[unstable(feature = "inherent_str_constructors", issue = "131114")]
#[stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_str_from_utf8", issue = "91006")]
#[rustc_diagnostic_item = "str_inherent_from_utf8_mut"]
pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
@ -294,8 +285,6 @@ impl str {
/// Basic usage:
///
/// ```
/// #![feature(inherent_str_constructors)]
///
/// // some bytes, in a vector
/// let sparkle_heart = vec![240, 159, 146, 150];
///
@ -307,7 +296,8 @@ impl str {
/// ```
#[inline]
#[must_use]
#[unstable(feature = "inherent_str_constructors", issue = "131114")]
#[stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
#[rustc_diagnostic_item = "str_inherent_from_utf8_unchecked"]
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
// SAFETY: converts::from_utf8_unchecked has the same safety requirements as this function.
@ -324,8 +314,6 @@ impl str {
/// Basic usage:
///
/// ```
/// #![feature(inherent_str_constructors)]
///
/// let mut heart = vec![240, 159, 146, 150];
/// let heart = unsafe { str::from_utf8_unchecked_mut(&mut heart) };
///
@ -333,7 +321,8 @@ impl str {
/// ```
#[inline]
#[must_use]
#[unstable(feature = "inherent_str_constructors", issue = "131114")]
#[stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
#[rustc_diagnostic_item = "str_inherent_from_utf8_unchecked_mut"]
pub const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
// SAFETY: converts::from_utf8_unchecked_mut has the same safety requirements as this function.

View File

@ -1,7 +1,6 @@
//@ check-pass
#![feature(concat_bytes)]
#![feature(inherent_str_constructors)]
#![warn(invalid_from_utf8_unchecked)]
#![warn(invalid_from_utf8)]

View File

@ -1,5 +1,5 @@
warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:22:9
--> $DIR/invalid_from_utf8.rs:21:9
|
LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -7,13 +7,13 @@ LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112
| the literal was valid UTF-8 up to the 2 bytes
|
note: the lint level is defined here
--> $DIR/invalid_from_utf8.rs:5:9
--> $DIR/invalid_from_utf8.rs:4:9
|
LL | #![warn(invalid_from_utf8_unchecked)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:24:9
--> $DIR/invalid_from_utf8.rs:23:9
|
LL | str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -21,7 +21,7 @@ LL | str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:26:9
--> $DIR/invalid_from_utf8.rs:25:9
|
LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -29,7 +29,7 @@ LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i',
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:28:9
--> $DIR/invalid_from_utf8.rs:27:9
|
LL | str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -37,7 +37,7 @@ LL | str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p',
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:50:9
--> $DIR/invalid_from_utf8.rs:49:9
|
LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -45,7 +45,7 @@ LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:52:9
--> $DIR/invalid_from_utf8.rs:51:9
|
LL | str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -53,7 +53,7 @@ LL | str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:54:9
--> $DIR/invalid_from_utf8.rs:53:9
|
LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -61,7 +61,7 @@ LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:56:9
--> $DIR/invalid_from_utf8.rs:55:9
|
LL | str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -69,7 +69,7 @@ LL | str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:58:9
--> $DIR/invalid_from_utf8.rs:57:9
|
LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
@ -77,7 +77,7 @@ LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:60:9
--> $DIR/invalid_from_utf8.rs:59:9
|
LL | str::from_utf8_unchecked(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
@ -85,7 +85,7 @@ LL | str::from_utf8_unchecked(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:62:9
--> $DIR/invalid_from_utf8.rs:61:9
|
LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
@ -93,7 +93,7 @@ LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:64:9
--> $DIR/invalid_from_utf8.rs:63:9
|
LL | str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
@ -101,7 +101,7 @@ LL | str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:84:9
--> $DIR/invalid_from_utf8.rs:83:9
|
LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -109,13 +109,13 @@ LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
|
note: the lint level is defined here
--> $DIR/invalid_from_utf8.rs:6:9
--> $DIR/invalid_from_utf8.rs:5:9
|
LL | #![warn(invalid_from_utf8)]
| ^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:86:9
--> $DIR/invalid_from_utf8.rs:85:9
|
LL | str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -123,7 +123,7 @@ LL | str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:88:9
--> $DIR/invalid_from_utf8.rs:87:9
|
LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -131,7 +131,7 @@ LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p'
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:90:9
--> $DIR/invalid_from_utf8.rs:89:9
|
LL | str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -139,7 +139,7 @@ LL | str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:112:9
--> $DIR/invalid_from_utf8.rs:111:9
|
LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -147,7 +147,7 @@ LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:114:9
--> $DIR/invalid_from_utf8.rs:113:9
|
LL | str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^----------------------------------^
@ -155,7 +155,7 @@ LL | str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:116:9
--> $DIR/invalid_from_utf8.rs:115:9
|
LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -163,7 +163,7 @@ LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y'])
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:118:9
--> $DIR/invalid_from_utf8.rs:117:9
|
LL | str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^---------------------------------------------^
@ -171,7 +171,7 @@ LL | str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:120:9
--> $DIR/invalid_from_utf8.rs:119:9
|
LL | std::str::from_utf8(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^-------------^
@ -179,7 +179,7 @@ LL | std::str::from_utf8(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:122:9
--> $DIR/invalid_from_utf8.rs:121:9
|
LL | str::from_utf8(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^-------------^
@ -187,7 +187,7 @@ LL | str::from_utf8(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:124:9
--> $DIR/invalid_from_utf8.rs:123:9
|
LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^---------------------------------^
@ -195,7 +195,7 @@ LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:126:9
--> $DIR/invalid_from_utf8.rs:125:9
|
LL | str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^---------------------------------^
@ -203,7 +203,7 @@ LL | str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:133:5
--> $DIR/invalid_from_utf8.rs:132:5
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -211,7 +211,7 @@ LL | std::str::from_utf8_mut(&mut a);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:135:5
--> $DIR/invalid_from_utf8.rs:134:5
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -220,7 +220,7 @@ LL | str::from_utf8_mut(&mut a);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:139:5
--> $DIR/invalid_from_utf8.rs:138:5
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -229,7 +229,7 @@ LL | std::str::from_utf8_mut(c);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:141:5
--> $DIR/invalid_from_utf8.rs:140:5
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -238,7 +238,7 @@ LL | str::from_utf8_mut(c);
| ^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:144:5
--> $DIR/invalid_from_utf8.rs:143:5
|
LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -246,7 +246,7 @@ LL | std::str::from_utf8(c);
| ^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:146:5
--> $DIR/invalid_from_utf8.rs:145:5
|
LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -255,7 +255,7 @@ LL | str::from_utf8(c);
| ^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:149:5
--> $DIR/invalid_from_utf8.rs:148:5
|
LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -263,7 +263,7 @@ LL | std::str::from_utf8(&INVALID_1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:151:5
--> $DIR/invalid_from_utf8.rs:150:5
|
LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -272,7 +272,7 @@ LL | str::from_utf8(&INVALID_1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:154:5
--> $DIR/invalid_from_utf8.rs:153:5
|
LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -280,7 +280,7 @@ LL | std::str::from_utf8(&INVALID_2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:156:5
--> $DIR/invalid_from_utf8.rs:155:5
|
LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -289,7 +289,7 @@ LL | str::from_utf8(&INVALID_2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:159:5
--> $DIR/invalid_from_utf8.rs:158:5
|
LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -297,7 +297,7 @@ LL | std::str::from_utf8(INVALID_3);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:161:5
--> $DIR/invalid_from_utf8.rs:160:5
|
LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -306,7 +306,7 @@ LL | str::from_utf8(INVALID_3);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:164:5
--> $DIR/invalid_from_utf8.rs:163:5
|
LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -314,7 +314,7 @@ LL | std::str::from_utf8(INVALID_4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `str::from_utf8` with an invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:166:5
--> $DIR/invalid_from_utf8.rs:165:5
|
LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes