-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: Add moved-out-of-ref
diagnostic
#14789
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
Conversation
// FIXME: we should not show error for this. | ||
*x | ||
//^^ error: cannot move `X<{unknown}>` out of reference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a {unknown}: Copy
clause in trait env for chalk, but it only works for the trivial case. Any idea why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding that clause we should just ignore the diagnostics for types containing errors I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is also an option, I tried to avoid false negative in cases like Vec<{unknown}>
which is definitely not copy regardless of the inner type, but if it doesn't work we should probably do that.
@lowr do you know why adding a {unknown}: Copy
is not enough for chalk to proof that X<{unknown}>
is copy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like X<{unknown}>: Copy
produces two subgoals, {unknown}: Copy
and {unknown}: Sized
, and chalk fails to prove the latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, so it also will have problems with other bounds on X
, I guess we should replace the error types with some variable and solve exists<T> X<T>: Copy
right? I think we can start with ignoring types containing errors for now. Thanks for investigating.
Can we merge this, since it is an experimental diagnostic? Or should we wait until monday release? |
Let's wait til monday, even if its experimental. That way people on stable r-a don't have to fiddle with the setting if we manage to make it trigger less in a week. |
☔ The latest upstream changes (presumably #14787) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r+ |
☀️ Test successful - checks-actions |
moved-out-of-ref
diagnosticmoved-out-of-ref
diagnostic
This is the rustc diagnostic. Ours is very ugly :) But why it is not showing here? Are experimental diagnostics enabled? |
Oops, sorry, updated. They were disabled. |
This is marked as experimental, since spans are terrible, there are some false positives due #14754, and it doesn't play well with unknown types. But I hope we can soon lift it.