Skip to content

BitSlice::shift_start and BitSlice::shift_end argument bounds incorrectly documented #250

@albertsgarde

Description

@albertsgarde

The bounds on the by argument for the methods BitSlice::shift_start and BitSlice::shift_end are incorrectly documented.
The documentation states that "This panics if by is not less than self.len()." when in fact it should be "less than or equal", as stated correctly just above.
The assert message has the same error.

The following program shows clearly what the actual behaviour is

use bitvec::array::BitArray;

fn main() {
    let mut array = BitArray::<u8>::new(52);
    print!("{:?}", array);
    let len = array.len();
    array.shift_left(len);
    println!("{:?}", array);
}

I've created PR #251 to fix this

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