Skip to content

Calling .tail() on a empty slice panics #24141

Closed
@elinorbgr

Description

@elinorbgr

Calling .tail() on a slice does no check at all (see https://github.com/rust-lang/rust/blob/master/src/libcore/slice.rs#L210 ), and will panic if called on a empty slice.

Nothing suggests it in the documentation, I personally expected that calling .tail() on an empty slice would return an empty slice, as .first() returns an Option.

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