needs_drop in core::intrinsics - Rust
Description: Returns `true` if the actual type given as `T` requires drop glue; returns `false` if the actual type provided for `T` implements `Copy`.

## needs_drop

# Function needs_drop

Source

    pub const fn needs_drop<T: ?Sized>() -> bool

🔬This is a nightly-only experimental API. (`core_intrinsics`)
Expand description

Returns `true` if the actual type given as `T` requires drop glue; returns `false` if the actual type provided for `T` implements `Copy`.

If the actual type neither requires drop glue nor implements `Copy`, then the return value of this function is unspecified.

Note that, unlike most intrinsics, this can only be called at compile-time as backends do not have an implementation for it. The only caller (its stable counterpart) wraps this intrinsic call in a `const` block so that backends only see an evaluated constant.

The stabilized version of this intrinsic is `mem::needs_drop`.