//@ known-bug: #74451 //@ compile-flags: -Copt-level=0 #![feature(specialization)] #![feature(unsize, coerce_unsized)] #![allow(incomplete_features)] #![crate_type = "lib"] use std::ops::CoerceUnsized; pub struct SmartassPtr(A::Data); pub trait Smartass { type Data; type Data2: CoerceUnsized<*const [u8]>; } pub trait MaybeObjectSafe {} impl MaybeObjectSafe for () {} impl Smartass for T { type Data = ::Data2; default type Data2 = *const [u8; 0]; } impl Smartass for () { type Data2 = *const [u8; 1]; } impl Smartass for dyn MaybeObjectSafe { type Data = *const [u8]; type Data2 = *const [u8; 0]; } impl CoerceUnsized> for SmartassPtr where ::Data: std::ops::CoerceUnsized<::Data> {} pub fn conv(s: SmartassPtr<()>) -> SmartassPtr { s // This shouldn't coerce }