feat: Add moved-out-of-ref diagnostic#14789
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.
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.
Instead of adding that clause we should just ignore the diagnostics for types containing errors I think
There was a problem hiding this comment.
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.
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.
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.