1.64 treats as
casts from non-Copy enums as not moving the LHS
#104262
Labels
C-bug
Category: This is a bug.
as
casts from non-Copy enums as not moving the LHS
#104262
This code is (rightfully) rejected by at least 1.57 - 1.63, accepted by 1.64, and rejected again by 1.65.
In compiler versions other than 1.64, the second
a as u8
assignment is rejected, sincea
is notCopy
and was previously moved into theas u8
operation that createdb
. On 1.64 it's silently tolerated.This does not, as far as I can tell, affect
as
conversions other non-Copy
types, though I could only come up with one example (&mut
can beas
-converted without beingCopy
). It also appears to be specific toas
conversions -- attempting to move the value twice without casting triggers the compiler warning you'd expect.It's possible this is already covered by an existing bug report, since it appears to be fixed in 1.65, but I couldn't find one, and wanted to make sure there was a paper trail in case this surprises anyone else. We've got a repo pinned to 1.64 that contains some incorrect code being admitted by this bug. (The closest thing we could find is #91161.)
Thanks to @jgallagher for help tracking this down.
The text was updated successfully, but these errors were encountered: