// compile-flags: --crate-type=lib // check-pass pub trait Widget { fn boxed<'w>(self) -> Box + 'w> where Self: Sized + 'w; } pub trait WidgetDyn {} impl WidgetDyn for T where T: Widget {} impl Widget for dyn WidgetDyn + '_ { fn boxed<'w>(self) -> Box + 'w> where Self: Sized + 'w, { // Even though this is illegal to const evaluate, this should never // trigger an ICE because it can never be called from actual code // (due to the trivially false where-clause predicate). Box::new(self) } }