INVALID_FROM_UTF8 in rustc_lint::invalid_from_utf8 - Rust
Description: The `invalid_from_utf8` lint checks for calls to `std::str::from_utf8` and `std::str::from_utf8_mut` with a known invalid UTF-8 value.

Skip to main content

## INVALID_FROM_UTF8

# Static INVALID_FROM_UTF8

Source

    pub static INVALID_FROM_UTF8: &Lint

Expand description

The `invalid_from_utf8` lint checks for calls to `std::str::from_utf8` and `std::str::from_utf8_mut` with a known invalid UTF-8 value.

#### §Example

    std::str::from_utf8(b"Ru\x82st");

{{produces}}

#### §Explanation

Trying to create such a `str` would always return an error as per documentation for `std::str::from_utf8` and `std::str::from_utf8_mut`.