-
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
associated_type_bounds
: errors with ambiguous associated type
#61752
Comments
associated_type_bounds
Seems like a bug indeed! |
Same error with: fn breaks2<F>() where F: Foo<Bar: Foo>, F::Bar: Copy {}
fn breaks3_no_atb<F>() where F: Foo, Foo::Bar: Foo, F::Bar: Copy {}
|
associated_type_bounds
associated_type_bounds
: errors with ambiguous associated type
Ignore this, I got myself confused.
Ok, maybe just the wrong error in the desugaring? I guess this never came up because people tend to group up the bounds.
So, they would do this instead fn breaks3_no_atb<F>() where F: Foo, Foo::Bar: Foo + Copy {} Which works fine fn breaks3_no_atb<F>() where F: Foo, F::Bar: Foo + Copy {} Which does work fine, but I copy pasted from Centril's comment earlier. |
@KrishnaSannasi Oops; I wrote So it is a bug after all... |
It's a very weird bug yes, confirmed. For now, just avoid splitting up your associated type bounds like this, but I'll try to get it fixed soon. |
@KrishnaSannasi Hopefully you can see above a fix PR has been submitted now. It seems to do the job, but will need review then merge... |
Fix for "ambiguous associated type" issue with ATBs Fixes #61752. r? @nikomatsakis CC @Centril
I think I found a bug with associated type bounds! #52662
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=28d566e7244a0b3ad21b73e31418894d
This is the exact same error you get when you do this
Because Rust can't tell which
Foo::<_>::Bar
you mean, but in the case ofassociated_type_bounds
, there is no ambiguity, which makes this error confusing.The text was updated successfully, but these errors were encountered: