-
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
illegal moves permitted in statics and constants #38520
Comments
triage: P-medium |
This is likely a problem of how borrowck kind of special-cases the handling of statics a bit. Should be relatively easy to fix. Could be fixed "en passante" by MIR borrowck; I'll also try to add some mentoring tips. |
Hello @nikomatsakis. I'd like to take a shot at this if I'm allowed. |
My first observation is that this isn't related to I'm reading the RFC now and doesn't seem to require EDIT: I somehow missed the |
Hello again @nikomatsakis I'm working on this right now. |
@cengizio ok -- how are you making out? Sorry I didn't get around to leaving any notes on how to proceed. Let me know if you still want me to go digging around -- or privmsg me on IRC ( |
@cengizio so looking at the code a bit, it seems clear that the problem is that the borrowck code has this kind of custom and woefully insufficient bit of code dedicated to statics and constants. It really ought to be using the same pathways as the rest of the code. (In particular, the I feel like this bug fix is "just" a refactoring, but the refactoring itself may not be all that simple. Doing the borrowck on the MIR we generate for constants would fix it, but it's not clear when MIR borrowck will land. |
@nikomatsakis as we talked in IRC, I think this should be discussed widely before we start implementing anything. |
…k-2, r=eddyb transition borrowck to visit all **bodies** and not item-likes This is a better structure for incremental compilation and also more compatible with the eventual borrowck mir. It also fixes rust-lang#38520 as a drive-by fix. r? @eddyb
This code compiles on nightly today but it should not, because
Foo
is notCopy
:Note that the
get(*&X)
in a function body properly results in an error.The text was updated successfully, but these errors were encountered: