mirror of https://github.com/rust-lang/rust.git
327 lines
15 KiB
Plaintext
327 lines
15 KiB
Plaintext
warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
|
|
--> $DIR/invalid_from_utf8.rs:21:9
|
|
|
|
|
LL | std::str::from_utf8_unchecked_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: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:23:9
|
|
|
|
|
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:25:9
|
|
|
|
|
LL | std::str::from_utf8_unchecked_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 `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
|
|
--> $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']);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
|
|
| |
|
|
| 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:49:9
|
|
|
|
|
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:51:9
|
|
|
|
|
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:53:9
|
|
|
|
|
LL | std::str::from_utf8_unchecked(&[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_unchecked` with an invalid literal are undefined behavior
|
|
--> $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']);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
|
|
| |
|
|
| 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:57:9
|
|
|
|
|
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:59:9
|
|
|
|
|
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:61:9
|
|
|
|
|
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:63:9
|
|
|
|
|
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:83:9
|
|
|
|
|
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: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:85:9
|
|
|
|
|
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:87:9
|
|
|
|
|
LL | std::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 `str::from_utf8_mut` with an invalid literal always return an error
|
|
--> $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']);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
|
|
| |
|
|
| 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:111:9
|
|
|
|
|
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:113:9
|
|
|
|
|
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:115:9
|
|
|
|
|
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:117:9
|
|
|
|
|
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:119:9
|
|
|
|
|
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:121:9
|
|
|
|
|
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:123:9
|
|
|
|
|
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:125:9
|
|
|
|
|
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:132:5
|
|
|
|
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
|
|
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
|
|
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:134:5
|
|
|
|
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
|
|
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
|
|
...
|
|
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:138:5
|
|
|
|
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
|
|
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
|
|
...
|
|
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:140:5
|
|
|
|
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
|
|
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
|
|
...
|
|
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:143:5
|
|
|
|
|
LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
|
|
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
|
|
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:145:5
|
|
|
|
|
LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
|
|
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
|
|
...
|
|
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: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
|
|
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: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
|
|
...
|
|
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: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
|
|
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: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
|
|
...
|
|
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: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
|
|
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: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
|
|
...
|
|
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: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
|
|
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: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
|
|
...
|
|
LL | str::from_utf8(INVALID_4);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
warning: 38 warnings emitted
|
|
|