The lint docs misrepresent trait Drop
#9227
Labels
A-documentation
Area: Adding or improving documentation
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
The reason why
Drop
is a trait is because adding adrop
method to a type is similar to implementing a trait on it.Other than that,
Drop
does not really behave like a trait. If a type doesn’t implementDrop
, then that doesn’t mean it lacks destructor code. For instance,String
andHashMap
currently don’t implement it.Instead,
core::mem::needs_drop::<T>()
is used to check if dropping aT
invokes a destructor.drop_non_drop
andforget_non_drop
should ideally not mention the traitDrop
in their name or documentation, it is misleading.The text was updated successfully, but these errors were encountered: