Skip to content

Missing impls when using nom 8 with bits #1826

Open
@jgeibel-burns

Description

@jgeibel-burns

In #1747 the InputLength trait was removed and all bounds were transitioned over to Input. However, Input is only implemented for &[u8] and &str whereas InputLength was also implemented for (&[u8], usize), [u8; N], &[u8; N], and &[T] (for any T, not just u8).

In particular, the loss of the (&[u8], usize) implementation seems to have broken many combinators when used with items under nom::bits. In my attempt to port to nom 8, I'm running into issues with combinator::eof and multi::many_till though I expect users would run into issues using any of the functions with modified bounds under those 2 modules. (I'm not currently using anything under bytes or character so the impacts there, and due to the other dropped impls, is less clear to me.)

Here is a reduced test case that compiles for me with nom 7 but not nom 8:

use nom::bits::bits;
use nom::combinator::eof;
use nom::error::Error;
use nom::{IResult, Parser as _};

fn main() {
    let _ = test(b"");
}

fn test(bytes: &[u8]) -> IResult<&[u8], ()> {
    bits::<_, _, Error<(&[u8], usize)>, _, _>(eof)
        .map(|_| ())
        .parse(bytes)
}

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