-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Possible regression with type_alias_impl_trait
#97651
Comments
I don't have any experience with rustc development but PR #95474 seems relevant? |
@rustbot label: +F-type_alias_impl_trait |
signs on to apply a label they missed While I'm thanking you for being helpful, it was nice to have the date of the nightly where this worked. It makes bisecting (running the script that figures out when the change was introduced) a lot faster. |
This seems potentially related to #97515 as well. |
@101arrowz: I think that's not super likely. #95519, which introduced this, was specifically related to validation for type-alias impl traits. My impression is that it shouldn't have affected GATs. |
This is #95922. The problem is that type-alias-impl-trait doesn't make use of implied bounds from the impl header. As a workaround for now, you can specify explicit bounds instead: impl<'a, 'b> Foo for &'b mut Quix<'a>
where
'a: 'b,
{
type Ty = impl Printy;
fn bar(self) -> Self::Ty {
self
}
} Unrelated to this issue, but you should expect this impl to break once #96996 is fixed. The correct way would then be: impl<'a, 'b> Foo for &'b mut Quix<'a> {
type Ty = impl Printy + Captures<'a> + Captures<'b>;
fn bar(self) -> Self::Ty {
self
}
}
|
Thanks @aliemjay. Closing as a duplicate. |
Code
I tried this code:
I expected to see this happen: Successful compile
Instead, this happened:
Version it worked on
It most recently worked on: nightly-2021-10-21
It's very possible there are more recent nightlies where this compiles, but I don't know how to easily find this.
Version with regression
rustc --version --verbose
:Additional observations
Works with:
but also if the implementations are on an immutable reference to
Quix
The text was updated successfully, but these errors were encountered: