UNUSED_ASSOCIATED_TYPE_BOUNDS in rustc_lint_defs::builtin - Rust
Description: The `unused_associated_type_bounds` lint is emitted when an associated type bound is added to a trait object, but the associated type has a `where Self: Sized` bound, and is thus unavailable on the trait object anyway.

Skip to main content

## UNUSED_ASSOCIATED_TYPE_BOUNDS

# Static UNUSED_ASSOCIATED_TYPE_BOUNDS

Source

    pub static UNUSED_ASSOCIATED_TYPE_BOUNDS: &Lint

Expand description

The `unused_associated_type_bounds` lint is emitted when an associated type bound is added to a trait object, but the associated type has a `where Self: Sized` bound, and is thus unavailable on the trait object anyway.

#### §Example

    trait Foo {
        type Bar where Self: Sized;
    }
    type Mop = dyn Foo<Bar = ()>;

{{produces}}

#### §Explanation

Just like methods with `Self: Sized` bounds are unavailable on trait objects, associated types can be removed from the trait object.