manual_non_exhaustive
is overzealous for items not visible outside the crate
#10301
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
Summary
manual_non_exhaustive
lint and a suggestion to use#[non_exhaustive]
is emitted for items that are not visible outside the crate, whereas thenon_exhaustive
attribute controls cross-crate behaviour.Lint Name
manual_non_exhaustive
Reproducer
I tried this code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=dc927a61851e2fd8e25e4d3570a4eb57
I saw this happen:
I expected to see this happen:
pub(crate)
,pub(super)
etc. itemsThe example also contains code showing that clippy's suggestion is not equivalent - adding
non_exhaustive
attribute does not prevent the construction of theNonExhausive
structVersion
Additional Labels
No response
The text was updated successfully, but these errors were encountered: