`T: ?Sized` bound in where cuase got compile time error: unexpect `?`

// error version: unexpected `?`
fn get_tydesc_var<T>(var: &T) -> std::intrinsics::TyDesc where T: ?Sized {
    unsafe { *std::intrinsics::get_tydesc::<T>() }
}

// no error
fn get_tydesc_var<T: ?Sized>(var: &T) -> std::intrinsics::TyDesc {
     unsafe { *std::intrinsics::get_tydesc::<T>() }
}

?Sized as type bound like other types should avilable in where cause, is this a bug?

https://github.com/rust-lang/rust/issues/20503

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.