Static rustc_lint::builtin::WHERE_CLAUSES_OBJECT_SAFETY

source ·
pub static WHERE_CLAUSES_OBJECT_SAFETY: &'static Lint
Expand description

The where_clauses_object_safety lint detects for object safety of where clauses.


trait Trait {}

trait X { fn foo(&self) where Self: Trait; }

impl X for () { fn foo(&self) {} }

impl Trait for dyn X {}

// Segfault at opt-level 0, SIGILL otherwise.
pub fn main() { <dyn X as X>::foo(&()); }



The compiler previously allowed these object-unsafe bounds, which was incorrect. This is a future-incompatible lint to transition this to a hard error in the future. See issue #51443 for more details.