-
Notifications
You must be signed in to change notification settings - Fork 13k
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
GATs in Generics not working properly (not Generic) #117296
Comments
Repo where I encountered the issue: https://github.com/Aras14HD/monads/ |
This works as intended. The You are looking for |
While it's unfortunate that you currently can't express what you have in mind, the specific code you submitted works as intended. The incomplete feature Closing as works-as-intended. |
When used in generics (T: Trait<A = B>) GATs are not properly recognized, no scope for U is generated. All workarounds are hacky and limiting.
I tried this code:
I expected to see this happen: The code should have compiled, as the output of y.run(...) which is of type Self::Wrapper<T> which is the same as Y::Wrapper<T> so also the same as X::Wrapper<T>.
Instead, this happened: While the compiler correctly recognizes that Self::Wrapper<T> == Y::Wrapper<T> it complains about the GAT assignment at Y: Run<B, Wrapper<T> = X::Wrapper<T>>, that T is not in scope. While I am able to circumvent this issue, the solution is hacky and likely not usable everywhere.
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: