Skip to content

Panic 'index out of bounds: the len is 7 but the index is 7' #197

@alexcrichton

Description

@alexcrichton

This program:

extern crate url;

use url::Url;

fn main() {
    let mut url = Url::from_file_path("/").unwrap();
    url.path_segments_mut().unwrap().pop_if_empty();
}

will panic with:

thread '<main>' panicked at 'index out of bounds: the len is 7 but the index is 7', src/lib.rs:1095
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Oddly enough the "equivalent" program of Url::parse("file://") works just fine!

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