Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
safasofuoglu opened this issue Oct 18, 2022 · 1 comment
Closed

Comments

@safasofuoglu
Copy link

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 (3f83906b3 2022-09-24)

@lnicola
Copy link
Member

lnicola commented Oct 18, 2022

Dupe of #13355, #13354. Nice repro, though, thank you.

@lnicola lnicola closed this as completed Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants