# Static rustc_lint::deref_into_dyn_supertrait::DEREF_INTO_DYN_SUPERTRAIT

source ·

    pub static DEREF_INTO_DYN_SUPERTRAIT: &Lint

Expand description

The `deref_into_dyn_supertrait` lint is output whenever there is a use of the `Deref` implementation with a `dyn SuperTrait` type as `Output`.

These implementations will become shadowed when the `trait_upcasting` feature is stabilized. The `deref` functions will no longer be called implicitly, so there might be behavior change.

#### §Example

ⓘ

    #![deny(deref_into_dyn_supertrait)]
    #![allow(dead_code)]

    use core::ops::Deref;

    trait A {}
    trait B: A {}
    impl<'a> Deref for dyn 'a + B {
        type Target = dyn A;
        fn deref(&self) -> &Self::Target {
            todo!()
        }
    }

    fn take_a(_: &dyn A) { }

    fn take_b(b: &dyn B) {
        take_a(b);
    }

{{produces}}

#### §Explanation

The dyn upcasting coercion feature adds new coercion rules, taking priority over certain other coercion rules, which will cause some behavior change.