op_ref
false positive(?) when comparing Box<dyn Tr>
where dyn Tr: PartialEq
#12113
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
op_ref
triggers when equating values of type{Box,Rc,Arc}<dyn Tr>
(wheredyn Tr: PartialEq
) with extra&
s (as in&lhs == &rhs
). The extra&
s are necessary to avoid a borrowck error, though this is a bug on the rustc side (rust-lang/rust#31740).Lint Name
op_ref
Reproducer
I tried this code (Playground, minimized from an in-the-wild usage of
arrow::array::ArrayRef
):I saw this happen:
I expected to see this happen:
No warnings, because removing
&
as per suggestion would cause a compile error:Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: