Skip to content

Panic in char index #136

Closed
Closed
@GuillaumeGomez

Description

@GuillaumeGomez

While working on rust-lang/rust-clippy#11421, I encountered this error:

thread 'main' panicked at /home/imperio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/annotate-snippets-0.11.4/src/renderer/display_list.rs:1103:29:
byte index 18 is not a char boundary; it is inside '脑' (bytes 16..19) of `    let _ = "电脑\0".as_ptr();`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

with this code:

fn main() {
    let _ = "电脑\0".as_ptr();
    //~^ clippy::manual_c_str_literals
}

I would have loved to send a fix but I couldn't figure out how to add a test. ^^'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions