pub static DEREF_INTO_DYN_SUPERTRAIT: &LintExpand 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.
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 implicit dyn upcasting coercion take priority over those Deref impls.