pub static SUSPICIOUS_AUTO_TRAIT_IMPLS: &Lint
Expand description

The suspicious_auto_trait_impls lint checks for potentially incorrect implementations of auto traits.

Example

struct Foo<T>(T);

unsafe impl<T> Send for Foo<*const T> {}

{{produces}}

Explanation

A type can implement auto traits, e.g. Send, Sync and Unpin, in two different ways: either by writing an explicit impl or if all fields of the type implement that auto trait.

The compiler disables the automatic implementation if an explicit one exists for given type constructor. The exact rules governing this are currently unsound, quite subtle, and will be modified in the future. This change will cause the automatic implementation to be disabled in more cases, potentially breaking some code.