add known-bug test for unsound issue 100041

This commit is contained in:
whtahy 2023-04-22 13:37:13 -04:00
parent 314126257d
commit cff6c0e0c8
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// check-pass
// known-bug: #100041
// Should fail. Normalization can bypass well-formedness checking.
// `[[[[[[u8]]]]]]` is not a well-formed type since size of type `[u8]` cannot
// be known at compile time (since `Sized` is not implemented for `[u8]`).
trait WellUnformed {
type RequestNormalize;
}
impl<T: ?Sized> WellUnformed for T {
type RequestNormalize = ();
}
const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = ();
const _: <Vec<str> as WellUnformed>::RequestNormalize = ();
fn main() {}