-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
"Type annotations needed" with mixed lifetimes in trait bounds #34979
Comments
Doesn't repro anymore with the linked code. |
Error on latest stable:
|
Minimal repro: trait Foo {}
impl<'a, T> Foo for &'a T {}
// we need `'a _` and `'static _` in the same
// `where` bound afaict.
struct Ctx<'a>(&'a ()) where
&'a (): Foo,
&'static (): Foo; While this is a quite rare edge case, the error is very unhelpful rn 😅 |
Add some regression tests Closes rust-lang#29988 Closes rust-lang#34979 Pick up two snippets that have been fixed from rust-lang#67945 (shouldn't be closed yet!)
Add some regression tests Closes rust-lang#29988 Closes rust-lang#34979 Pick up two snippets that have been fixed from rust-lang#67945 (shouldn't be closed yet!)
This behavior is still a bug, this code snippet should compile afaict. Removing either the |
This only occurs if bounds have different lifetimes. Completely identical bounds work fine: trait Foo {}
impl<'a, T> Foo for &'a T {}
// we need `'a _` and `'static _` in the same
// `where` bound afaict.
struct Ctx<'a>(&'a ()) where
&'a (): Foo,
&'a (): Foo; |
@lcnr Ahh, I missed that! So, if someone fixes this issue, then please also tweak the test (I'll add a FIXME to it later if needed). |
Ran into this issue in #77052 |
I am retitling the issue to reflect the diagnostic from newer compilers.
|
I think the examples here will be solved by the Footnotes
|
This was encountered from a derive plugin that created where bounds for all member types. Occurs on stable, beta, and nightly.
playpen repro
The text was updated successfully, but these errors were encountered: