-
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
Better diagnostics when where clauses need on associated type in impl #92033
Comments
I think this can be solved by just added the |
That being said, I feel like this should be fine, so there might be something more subtle going on. |
How to add |
This works (with the where clause on the impl): https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=cc1325c7ca369536e63c9e436d6eacf0 Were you trying to put the where clause on the impl at the end of the line? Like |
Yes... Should have thought of the correct place. It works in real code too. Closing the issue. Thanks a lot! |
I'm actually going to leave this open for two diagnostics improvements:
|
GATs issue triage: not blocking. At this point, this is just a diagnostics improvement. 1 from above is fixed; just want to do 2. |
Suggest copying trait associated type bounds on lifetime error Closes rust-lang#92033 Kind of the most simple suggestion to make - we don't try to be fancy. Turns out, it's still pretty useful (the couple existing tests that trigger this error end up fixed - for this error - upon applying the fix). r? `@estebank` cc `@nikomatsakis`
As suggested in #87479, I'm reporting a case where the required bound breaks code.
I was writing a 3D renderer and modeling the
surface
andswapchain
concepts using traits.A
Surface
is something you can render to, it should produce a iterator of references toTexture
s:A
Swapchain
produces a reference to aSurface
:Now a
Texture
itself can be used as a swapchain, producing reference to itself as theSurface
.Above code compiles under
rustc 1.58.0-nightly (0d1754e8b 2021-11-05)
.Now it doesn't with added
where Self: 'a
bound.This is a simplified example as
Surface
andSwapchain
have other required methods.Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: