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

Consider adding a where bound (that's already present) #53908

Closed
CAD97 opened this issue Sep 2, 2018 · 2 comments
Closed

Consider adding a where bound (that's already present) #53908

CAD97 opened this issue Sep 2, 2018 · 2 comments

Comments

@CAD97
Copy link
Contributor

CAD97 commented Sep 2, 2018

playground, r/rust thread (includes larger examples)

use std::marker::PhantomData;

pub trait FromPest<'a>: Sized {
    type Rule;
    const RULE: Self::Rule;
}

impl<'a, T> FromPest<'a> for PhantomData<T>
where
    T: FromPest<'a>,
{
    type Rule = T::Rule;
    const RULE: T::Rule = T::RULE;
}
error[E0277]: the trait bound `T: FromPest<'a>` is not satisfied
  --> src/lib.rs:13:5
   |
13 |     const RULE: T::Rule = T::RULE;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromPest<'a>` is not implemented for `T`
   |
   = help: consider adding a `where T: FromPest<'a>` bound

I'm unsure as to whether this is a compiler bug or something I've missed, but at the very least, this error is less than helpful at exposing the actual issue.

@kennytm
Copy link
Member

kennytm commented Sep 2, 2018

Duplicate of #46969.

@CAD97
Copy link
Contributor Author

CAD97 commented Sep 2, 2018

Well that shows how much I looked, I guess.

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