rustc_lint::multiple_supertrait_upcastable

Static MULTIPLE_SUPERTRAIT_UPCASTABLE

source
pub static MULTIPLE_SUPERTRAIT_UPCASTABLE: &Lint
Expand description

The multiple_supertrait_upcastable lint detects when a dyn-compatible trait has multiple supertraits.

§Example

#![feature(multiple_supertrait_upcastable)]
trait A {}
trait B {}

#[warn(multiple_supertrait_upcastable)]
trait C: A + B {}

{{produces}}

§Explanation

To support upcasting with multiple supertraits, we need to store multiple vtables and this can result in extra space overhead, even if no code actually uses upcasting. This lint allows users to identify when such scenarios occur and to decide whether the additional overhead is justified.