Skip to content

RA error: the trait Try is not implemented for _, where rustc compiles #13432

@safasofuoglu

Description

@safasofuoglu
pub fn read(bytes: &[u8]) -> Result<()> {
    let (input, _) = tag("tag")(bytes)?;
    Ok((input, ()))
}

pub type Result<'a, O = &'a [u8], I = [u8]> = nom::IResult<&'a I, O>;

pub trait Parser<'a, O = &'a [u8]>: (FnMut(&'a [u8]) -> Result<O>) {}

impl<'a, F, O> Parser<'a, O> for F where F: (FnMut(&'a [u8]) -> Result<O>) {}

pub fn tag<'a>(s: &'a str) -> impl Parser<'a,&'a [u8]> {
    nom::bytes::complete::tag(s)
}
[dependencies]
nom = "7.1.1"

RA produces error for the block tag("tag")(bytes) stating the trait 'Try' is not implemented for '_'.
cargo build runs fine.
Rolling back to RA 0.3.1238 makes the error disappear.

rust-analyzer version: rust-analyzer version: 0.3.1248-standalone (0531aab 2022-10-16)

rustc version: rustc 1.66.0-nightly (3f83906 2022-09-24)

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