-
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
Can't cast self
to trait object in default methods
#7320
Comments
Related to (or duplicate of?) #7183 |
@Blei might be related, but I would not call it a duplicate; the type (as in, the use-cases for the two are so different, I'd want to ensure they are addressed, independently if necessary. Though maybe we will be lucky and they will end up having the same root cause.) |
Regardless of whether this is a dupe of 7183, it is definitely part of #2794. |
The code I think is not correct. It doesn't actually do a cast. |
I feel like the code should be
This fails with
Hm. |
Yes, I tried multiple variants, both with and without cast. I meant to paste the one with a cast, but alas. |
Sully's error is legit, in the sense that the type system is operating as expected. The type
which would say that the trait If we added the rule that |
@nikomatsakis FYI, when I attempted this morning to replicate the issues I was having with syntax::visit |
The following example works:
Since |
Does |
Yes, it works! |
Closing based on the above comments |
Reopening since the above example requires |
To be more specific. The same thing that happens here can be reproduced w/
|
We no longer have the default bounds on Flagging as needstest. |
…g#7320 When inverting an expression, the output is now like ```foo != 0``` instead of ```!(foo == 0)```, the comparison operator is now replaced.
update: ```Sugg::not()``` replacing the comparison operator. rust-lang#7320 fixes rust-lang#7320 changelog: ```needless_bool```: Changed to make a smart suggestion.
The following code doesn't work (even though I suspect it's correct):
The following error is returned:
The text was updated successfully, but these errors were encountered: