11warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
2- --> $DIR/invalid_from_utf8.rs:18 :9
2+ --> $DIR/invalid_from_utf8.rs:19 :9
33 |
44LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------^
@@ -13,44 +13,98 @@ LL | #![warn(invalid_from_utf8_unchecked)]
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414
1515warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
16- --> $DIR/invalid_from_utf8.rs:20 :9
16+ --> $DIR/invalid_from_utf8.rs:21 :9
1717 |
1818LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
1919 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------------------^
2020 | |
2121 | the literal was valid UTF-8 up to the 2 bytes
2222
2323warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
24- --> $DIR/invalid_from_utf8.rs:38 :9
24+ --> $DIR/invalid_from_utf8.rs:39 :9
2525 |
2626LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
2727 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^
2828 | |
2929 | the literal was valid UTF-8 up to the 2 bytes
3030
3131warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
32- --> $DIR/invalid_from_utf8.rs:40 :9
32+ --> $DIR/invalid_from_utf8.rs:41 :9
3333 |
3434LL | std::str::from_utf8_unchecked(&[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
3939warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
40- --> $DIR/invalid_from_utf8.rs:42 :9
40+ --> $DIR/invalid_from_utf8.rs:43 :9
4141 |
4242LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
4343 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
4444 | |
4545 | the literal was valid UTF-8 up to the 2 bytes
4646
4747warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
48- --> $DIR/invalid_from_utf8.rs:44 :9
48+ --> $DIR/invalid_from_utf8.rs:45 :9
4949 |
5050LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
5151 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
5252 | |
5353 | the literal was valid UTF-8 up to the 2 bytes
5454
55- warning: 6 warnings emitted
55+ warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
56+ --> $DIR/invalid_from_utf8.rs:62:9
57+ |
58+ LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
59+ | ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------^
60+ | |
61+ | the literal was valid UTF-8 up to the 2 bytes
62+ |
63+ note: the lint level is defined here
64+ --> $DIR/invalid_from_utf8.rs:5:9
65+ |
66+ LL | #![warn(invalid_from_utf8)]
67+ | ^^^^^^^^^^^^^^^^^
68+
69+ warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
70+ --> $DIR/invalid_from_utf8.rs:64:9
71+ |
72+ LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
73+ | ^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------------------^
74+ | |
75+ | the literal was valid UTF-8 up to the 2 bytes
76+
77+ warning: calls to `std::str::from_utf8` with a invalid literal always return an error
78+ --> $DIR/invalid_from_utf8.rs:82:9
79+ |
80+ LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
81+ | ^^^^^^^^^^^^^^^^^^^^-----------------------------------^
82+ | |
83+ | the literal was valid UTF-8 up to the 2 bytes
84+
85+ warning: calls to `std::str::from_utf8` with a invalid literal always return an error
86+ --> $DIR/invalid_from_utf8.rs:84:9
87+ |
88+ LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
89+ | ^^^^^^^^^^^^^^^^^^^^----------------------------------------------^
90+ | |
91+ | the literal was valid UTF-8 up to the 2 bytes
92+
93+ warning: calls to `std::str::from_utf8` with a invalid literal always return an error
94+ --> $DIR/invalid_from_utf8.rs:86:9
95+ |
96+ LL | std::str::from_utf8(b"cl\x82ippy");
97+ | ^^^^^^^^^^^^^^^^^^^^-------------^
98+ | |
99+ | the literal was valid UTF-8 up to the 2 bytes
100+
101+ warning: calls to `std::str::from_utf8` with a invalid literal always return an error
102+ --> $DIR/invalid_from_utf8.rs:88:9
103+ |
104+ LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
105+ | ^^^^^^^^^^^^^^^^^^^^---------------------------------^
106+ | |
107+ | the literal was valid UTF-8 up to the 2 bytes
108+
109+ warning: 12 warnings emitted
56110
0 commit comments