Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit be73ea8

Browse files
authoredFeb 19, 2025
Rollup merge of #137277 - m4rch3n1ng:stabilize-inherent-str-constructors, r=tgross35
stabilize `inherent_str_constructors` fcp done in #131114 (comment). tracking issue: #131114 closes: #131114
2 parents 704a024 + b24f775 commit be73ea8

File tree

3 files changed

+47
-59
lines changed

3 files changed

+47
-59
lines changed
 

‎library/core/src/str/mod.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ impl str {
198198
/// Basic usage:
199199
///
200200
/// ```
201-
/// #![feature(inherent_str_constructors)]
202-
///
203201
/// // some bytes, in a vector
204202
/// let sparkle_heart = vec![240, 159, 146, 150];
205203
///
@@ -213,8 +211,6 @@ impl str {
213211
/// Incorrect bytes:
214212
///
215213
/// ```
216-
/// #![feature(inherent_str_constructors)]
217-
///
218214
/// // some invalid bytes, in a vector
219215
/// let sparkle_heart = vec![0, 159, 146, 150];
220216
///
@@ -227,8 +223,6 @@ impl str {
227223
/// A "stack allocated string":
228224
///
229225
/// ```
230-
/// #![feature(inherent_str_constructors)]
231-
///
232226
/// // some bytes, in a stack-allocated array
233227
/// let sparkle_heart = [240, 159, 146, 150];
234228
///
@@ -237,7 +231,8 @@ impl str {
237231
///
238232
/// assert_eq!("💖", sparkle_heart);
239233
/// ```
240-
#[unstable(feature = "inherent_str_constructors", issue = "131114")]
234+
#[stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
235+
#[rustc_const_stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
241236
#[rustc_diagnostic_item = "str_inherent_from_utf8"]
242237
pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
243238
converts::from_utf8(v)
@@ -250,8 +245,6 @@ impl str {
250245
/// Basic usage:
251246
///
252247
/// ```
253-
/// #![feature(inherent_str_constructors)]
254-
///
255248
/// // "Hello, Rust!" as a mutable vector
256249
/// let mut hellorust = vec![72, 101, 108, 108, 111, 44, 32, 82, 117, 115, 116, 33];
257250
///
@@ -264,16 +257,14 @@ impl str {
264257
/// Incorrect bytes:
265258
///
266259
/// ```
267-
/// #![feature(inherent_str_constructors)]
268-
///
269260
/// // Some invalid bytes in a mutable vector
270261
/// let mut invalid = vec![128, 223];
271262
///
272263
/// assert!(str::from_utf8_mut(&mut invalid).is_err());
273264
/// ```
274265
/// See the docs for [`Utf8Error`] for more details on the kinds of
275266
/// errors that can be returned.
276-
#[unstable(feature = "inherent_str_constructors", issue = "131114")]
267+
#[stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
277268
#[rustc_const_unstable(feature = "const_str_from_utf8", issue = "91006")]
278269
#[rustc_diagnostic_item = "str_inherent_from_utf8_mut"]
279270
pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
@@ -294,8 +285,6 @@ impl str {
294285
/// Basic usage:
295286
///
296287
/// ```
297-
/// #![feature(inherent_str_constructors)]
298-
///
299288
/// // some bytes, in a vector
300289
/// let sparkle_heart = vec![240, 159, 146, 150];
301290
///
@@ -307,7 +296,8 @@ impl str {
307296
/// ```
308297
#[inline]
309298
#[must_use]
310-
#[unstable(feature = "inherent_str_constructors", issue = "131114")]
299+
#[stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
300+
#[rustc_const_stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
311301
#[rustc_diagnostic_item = "str_inherent_from_utf8_unchecked"]
312302
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
313303
// SAFETY: converts::from_utf8_unchecked has the same safety requirements as this function.
@@ -324,16 +314,15 @@ impl str {
324314
/// Basic usage:
325315
///
326316
/// ```
327-
/// #![feature(inherent_str_constructors)]
328-
///
329317
/// let mut heart = vec![240, 159, 146, 150];
330318
/// let heart = unsafe { str::from_utf8_unchecked_mut(&mut heart) };
331319
///
332320
/// assert_eq!("💖", heart);
333321
/// ```
334322
#[inline]
335323
#[must_use]
336-
#[unstable(feature = "inherent_str_constructors", issue = "131114")]
324+
#[stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
325+
#[rustc_const_stable(feature = "inherent_str_constructors", since = "CURRENT_RUSTC_VERSION")]
337326
#[rustc_diagnostic_item = "str_inherent_from_utf8_unchecked_mut"]
338327
pub const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
339328
// SAFETY: converts::from_utf8_unchecked_mut has the same safety requirements as this function.

‎tests/ui/lint/invalid_from_utf8.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ check-pass
22

33
#![feature(concat_bytes)]
4-
#![feature(inherent_str_constructors)]
54
#![warn(invalid_from_utf8_unchecked)]
65
#![warn(invalid_from_utf8)]
76

‎tests/ui/lint/invalid_from_utf8.stderr

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,217 +1,217 @@
11
warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
2-
--> $DIR/invalid_from_utf8.rs:22:9
2+
--> $DIR/invalid_from_utf8.rs:21:9
33
|
44
LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
66
| |
77
| the literal was valid UTF-8 up to the 2 bytes
88
|
99
note: the lint level is defined here
10-
--> $DIR/invalid_from_utf8.rs:5:9
10+
--> $DIR/invalid_from_utf8.rs:4:9
1111
|
1212
LL | #![warn(invalid_from_utf8_unchecked)]
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414

1515
warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
16-
--> $DIR/invalid_from_utf8.rs:24:9
16+
--> $DIR/invalid_from_utf8.rs:23:9
1717
|
1818
LL | str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
2020
| |
2121
| the literal was valid UTF-8 up to the 2 bytes
2222

2323
warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
24-
--> $DIR/invalid_from_utf8.rs:26:9
24+
--> $DIR/invalid_from_utf8.rs:25:9
2525
|
2626
LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
2727
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
2828
| |
2929
| the literal was valid UTF-8 up to the 2 bytes
3030

3131
warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
32-
--> $DIR/invalid_from_utf8.rs:28:9
32+
--> $DIR/invalid_from_utf8.rs:27:9
3333
|
3434
LL | str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
3636
| |
3737
| the literal was valid UTF-8 up to the 2 bytes
3838

3939
warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
40-
--> $DIR/invalid_from_utf8.rs:50:9
40+
--> $DIR/invalid_from_utf8.rs:49:9
4141
|
4242
LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
4444
| |
4545
| the literal was valid UTF-8 up to the 2 bytes
4646

4747
warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
48-
--> $DIR/invalid_from_utf8.rs:52:9
48+
--> $DIR/invalid_from_utf8.rs:51:9
4949
|
5050
LL | str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
5151
| ^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
5252
| |
5353
| the literal was valid UTF-8 up to the 2 bytes
5454

5555
warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
56-
--> $DIR/invalid_from_utf8.rs:54:9
56+
--> $DIR/invalid_from_utf8.rs:53:9
5757
|
5858
LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
6060
| |
6161
| the literal was valid UTF-8 up to the 2 bytes
6262

6363
warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
64-
--> $DIR/invalid_from_utf8.rs:56:9
64+
--> $DIR/invalid_from_utf8.rs:55:9
6565
|
6666
LL | str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
6767
| ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
6868
| |
6969
| the literal was valid UTF-8 up to the 2 bytes
7070

7171
warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
72-
--> $DIR/invalid_from_utf8.rs:58:9
72+
--> $DIR/invalid_from_utf8.rs:57:9
7373
|
7474
LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
7575
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
7676
| |
7777
| the literal was valid UTF-8 up to the 2 bytes
7878

7979
warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
80-
--> $DIR/invalid_from_utf8.rs:60:9
80+
--> $DIR/invalid_from_utf8.rs:59:9
8181
|
8282
LL | str::from_utf8_unchecked(b"cl\x82ippy");
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
8484
| |
8585
| the literal was valid UTF-8 up to the 2 bytes
8686

8787
warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
88-
--> $DIR/invalid_from_utf8.rs:62:9
88+
--> $DIR/invalid_from_utf8.rs:61:9
8989
|
9090
LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
9191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
9292
| |
9393
| the literal was valid UTF-8 up to the 2 bytes
9494

9595
warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
96-
--> $DIR/invalid_from_utf8.rs:64:9
96+
--> $DIR/invalid_from_utf8.rs:63:9
9797
|
9898
LL | str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
9999
| ^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
100100
| |
101101
| the literal was valid UTF-8 up to the 2 bytes
102102

103103
warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
104-
--> $DIR/invalid_from_utf8.rs:84:9
104+
--> $DIR/invalid_from_utf8.rs:83:9
105105
|
106106
LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
107107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
108108
| |
109109
| the literal was valid UTF-8 up to the 2 bytes
110110
|
111111
note: the lint level is defined here
112-
--> $DIR/invalid_from_utf8.rs:6:9
112+
--> $DIR/invalid_from_utf8.rs:5:9
113113
|
114114
LL | #![warn(invalid_from_utf8)]
115115
| ^^^^^^^^^^^^^^^^^
116116

117117
warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
118-
--> $DIR/invalid_from_utf8.rs:86:9
118+
--> $DIR/invalid_from_utf8.rs:85:9
119119
|
120120
LL | str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
121121
| ^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
122122
| |
123123
| the literal was valid UTF-8 up to the 2 bytes
124124

125125
warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
126-
--> $DIR/invalid_from_utf8.rs:88:9
126+
--> $DIR/invalid_from_utf8.rs:87:9
127127
|
128128
LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
129129
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
130130
| |
131131
| the literal was valid UTF-8 up to the 2 bytes
132132

133133
warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
134-
--> $DIR/invalid_from_utf8.rs:90:9
134+
--> $DIR/invalid_from_utf8.rs:89:9
135135
|
136136
LL | str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
137137
| ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
138138
| |
139139
| the literal was valid UTF-8 up to the 2 bytes
140140

141141
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
142-
--> $DIR/invalid_from_utf8.rs:112:9
142+
--> $DIR/invalid_from_utf8.rs:111:9
143143
|
144144
LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
145145
| ^^^^^^^^^^^^^^^^^^^^^----------------------------------^
146146
| |
147147
| the literal was valid UTF-8 up to the 2 bytes
148148

149149
warning: calls to `str::from_utf8` with an invalid literal always return an error
150-
--> $DIR/invalid_from_utf8.rs:114:9
150+
--> $DIR/invalid_from_utf8.rs:113:9
151151
|
152152
LL | str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
153153
| ^^^^^^^^^^^^^^^^----------------------------------^
154154
| |
155155
| the literal was valid UTF-8 up to the 2 bytes
156156

157157
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
158-
--> $DIR/invalid_from_utf8.rs:116:9
158+
--> $DIR/invalid_from_utf8.rs:115:9
159159
|
160160
LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
161161
| ^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
162162
| |
163163
| the literal was valid UTF-8 up to the 2 bytes
164164

165165
warning: calls to `str::from_utf8` with an invalid literal always return an error
166-
--> $DIR/invalid_from_utf8.rs:118:9
166+
--> $DIR/invalid_from_utf8.rs:117:9
167167
|
168168
LL | str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
169169
| ^^^^^^^^^^^^^^^^---------------------------------------------^
170170
| |
171171
| the literal was valid UTF-8 up to the 2 bytes
172172

173173
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
174-
--> $DIR/invalid_from_utf8.rs:120:9
174+
--> $DIR/invalid_from_utf8.rs:119:9
175175
|
176176
LL | std::str::from_utf8(b"cl\x82ippy");
177177
| ^^^^^^^^^^^^^^^^^^^^-------------^
178178
| |
179179
| the literal was valid UTF-8 up to the 2 bytes
180180

181181
warning: calls to `str::from_utf8` with an invalid literal always return an error
182-
--> $DIR/invalid_from_utf8.rs:122:9
182+
--> $DIR/invalid_from_utf8.rs:121:9
183183
|
184184
LL | str::from_utf8(b"cl\x82ippy");
185185
| ^^^^^^^^^^^^^^^-------------^
186186
| |
187187
| the literal was valid UTF-8 up to the 2 bytes
188188

189189
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
190-
--> $DIR/invalid_from_utf8.rs:124:9
190+
--> $DIR/invalid_from_utf8.rs:123:9
191191
|
192192
LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
193193
| ^^^^^^^^^^^^^^^^^^^^---------------------------------^
194194
| |
195195
| the literal was valid UTF-8 up to the 2 bytes
196196

197197
warning: calls to `str::from_utf8` with an invalid literal always return an error
198-
--> $DIR/invalid_from_utf8.rs:126:9
198+
--> $DIR/invalid_from_utf8.rs:125:9
199199
|
200200
LL | str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
201201
| ^^^^^^^^^^^^^^^---------------------------------^
202202
| |
203203
| the literal was valid UTF-8 up to the 2 bytes
204204

205205
warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
206-
--> $DIR/invalid_from_utf8.rs:133:5
206+
--> $DIR/invalid_from_utf8.rs:132:5
207207
|
208208
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
209209
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
210210
LL | std::str::from_utf8_mut(&mut a);
211211
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
212212

213213
warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
214-
--> $DIR/invalid_from_utf8.rs:135:5
214+
--> $DIR/invalid_from_utf8.rs:134:5
215215
|
216216
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
217217
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -220,7 +220,7 @@ LL | str::from_utf8_mut(&mut a);
220220
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
221221

222222
warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
223-
--> $DIR/invalid_from_utf8.rs:139:5
223+
--> $DIR/invalid_from_utf8.rs:138:5
224224
|
225225
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
226226
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -229,7 +229,7 @@ LL | std::str::from_utf8_mut(c);
229229
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
230230

231231
warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
232-
--> $DIR/invalid_from_utf8.rs:141:5
232+
--> $DIR/invalid_from_utf8.rs:140:5
233233
|
234234
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
235235
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -238,15 +238,15 @@ LL | str::from_utf8_mut(c);
238238
| ^^^^^^^^^^^^^^^^^^^^^
239239

240240
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
241-
--> $DIR/invalid_from_utf8.rs:144:5
241+
--> $DIR/invalid_from_utf8.rs:143:5
242242
|
243243
LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
244244
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
245245
LL | std::str::from_utf8(c);
246246
| ^^^^^^^^^^^^^^^^^^^^^^
247247

248248
warning: calls to `str::from_utf8` with an invalid literal always return an error
249-
--> $DIR/invalid_from_utf8.rs:146:5
249+
--> $DIR/invalid_from_utf8.rs:145:5
250250
|
251251
LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
252252
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -255,15 +255,15 @@ LL | str::from_utf8(c);
255255
| ^^^^^^^^^^^^^^^^^
256256

257257
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
258-
--> $DIR/invalid_from_utf8.rs:149:5
258+
--> $DIR/invalid_from_utf8.rs:148:5
259259
|
260260
LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
261261
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
262262
LL | std::str::from_utf8(&INVALID_1);
263263
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
264264

265265
warning: calls to `str::from_utf8` with an invalid literal always return an error
266-
--> $DIR/invalid_from_utf8.rs:151:5
266+
--> $DIR/invalid_from_utf8.rs:150:5
267267
|
268268
LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
269269
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -272,15 +272,15 @@ LL | str::from_utf8(&INVALID_1);
272272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
273273

274274
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
275-
--> $DIR/invalid_from_utf8.rs:154:5
275+
--> $DIR/invalid_from_utf8.rs:153:5
276276
|
277277
LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
278278
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
279279
LL | std::str::from_utf8(&INVALID_2);
280280
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
281281

282282
warning: calls to `str::from_utf8` with an invalid literal always return an error
283-
--> $DIR/invalid_from_utf8.rs:156:5
283+
--> $DIR/invalid_from_utf8.rs:155:5
284284
|
285285
LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
286286
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -289,15 +289,15 @@ LL | str::from_utf8(&INVALID_2);
289289
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
290290

291291
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
292-
--> $DIR/invalid_from_utf8.rs:159:5
292+
--> $DIR/invalid_from_utf8.rs:158:5
293293
|
294294
LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
295295
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
296296
LL | std::str::from_utf8(INVALID_3);
297297
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
298298

299299
warning: calls to `str::from_utf8` with an invalid literal always return an error
300-
--> $DIR/invalid_from_utf8.rs:161:5
300+
--> $DIR/invalid_from_utf8.rs:160:5
301301
|
302302
LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
303303
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -306,15 +306,15 @@ LL | str::from_utf8(INVALID_3);
306306
| ^^^^^^^^^^^^^^^^^^^^^^^^^
307307

308308
warning: calls to `std::str::from_utf8` with an invalid literal always return an error
309-
--> $DIR/invalid_from_utf8.rs:164:5
309+
--> $DIR/invalid_from_utf8.rs:163:5
310310
|
311311
LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
312312
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
313313
LL | std::str::from_utf8(INVALID_4);
314314
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
315315

316316
warning: calls to `str::from_utf8` with an invalid literal always return an error
317-
--> $DIR/invalid_from_utf8.rs:166:5
317+
--> $DIR/invalid_from_utf8.rs:165:5
318318
|
319319
LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
320320
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes

0 commit comments

Comments
 (0)
Please sign in to comment.