-
Notifications
You must be signed in to change notification settings - Fork 13.4k
GAT: lifetime mismatch when requiring lifetime bounds despite type not using the lifetimes at all #87748
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
So, I think this is mostly just "intended"; the That said, I would expect |
Err, no |
Hmm, by "stricter" do you mean "more specific"? As in: because
Edit 2: Thinking about it for even longer, it does seem fine for it to compile, since the trait MyTrait {
type Assoc;
fn do_sth(arg: Self::Assoc);
}
struct Foo;
impl MyTrait for Foo {
type Assoc = u32;
fn do_sth(_: u32) {}
} I guess there isn't any precedent yet for "slightly more specific", since without GAT, you either pass the assoc type or the concrete one, nothing in between. |
Okay, so I've convinced myself that example 3 should work based on implied bounds. This is just a bug. Example 1 is a little weird. When we check the trait fn, we can use implied bounds to prove that Example 2 ( |
Okay I have a fix and the |
That's great to hear! Thanks for your effort with this! :-) |
Treat types in unnormalized function signatures as well-formed Fixes rust-lang#87748 r? `@nikomatsakis`
Treat types in unnormalized function signatures as well-formed Fixes rust-lang#87748 r? ``@nikomatsakis``
Treat types in unnormalized function signatures as well-formed Fixes rust-lang#87748 r? ```@nikomatsakis```
GATs issue triage: not blocking. The implied bounds story here is not great. But the simple attempt to fix thing opened up soundness holes. It's also not backwards-incompatible to fix. |
Uh oh!
There was an error while loading. Please reload this page.
Compiling this code:
I'd expect all of these three versions to compile. The associated type has two lifetimes as well as a lifetime bound
'b: 'a
, butu32
doesn't use the lifetime. However, I'm getting a compiler error:Without the
where 'b: 'a
, all three compile fine.Playground Link
The text was updated successfully, but these errors were encountered: