Fixes for from_over_into
and clone_on_copy
conflict and lead to compiler error
#13549
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
The fix for
from_over_into
fails if theInto
implementation includes aself.<expr>.clone()
if the cloned type implementsCopy
. The fix forclone_on_copy
keepsself
, but the fix forfrom_over_into
meansself
is no longer valid. Using#[allow(...)]
to apply the suggestions serially (in either order) works fine.Reproducer
Here's a simple example that triggers the error:
I expected to see the code transformed into this:
Instead, it produces invalid code that results in the following compiler error:
Version
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.81.0
LLVM version: 18.1.7
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: