False "missing_const_in_fn" for a function that consumes self
#8874
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
L-nursery
Lint: Currently in the nursery group
Summary
Hi,
First of all, thanks a lot for working on Rust and the related tools and crates!
Clippy seems to report a "missing_const_in_fn" for a function that replaces a field in a struct. If I add "const" to the function, rustc says "constant functions cannot evaluate destructors". It is quite possible that, just like e.g. #4041, this is actually a bug in rustc's parser, AST builder, code analyzer, etc; apologies if it has been reported already.
Since the source file is a bit on the large side, I have put the mini-"crate" up in a Git repository at https://gitlab.com/ppentchev/rust-bug-missing-const
Lint Name
clippy::missing_const_for_fn
Reproducer
I tried this code (it uses expect-exit 0.4.2):
I saw this happen:
I expected to see no warnings at all.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: