about summary refs log tree commit diff
diff options
context:
space:
mode:
authorwhtahy <whtahy@users.noreply.github.com>2023-04-22 13:37:13 -0400
committerwhtahy <whtahy@users.noreply.github.com>2023-04-22 13:37:13 -0400
commitcff6c0e0c8d33efe4b64b08751008ac353c9b232 (patch)
tree30f7e1dd05afa48aa931589e50c373b82d2946c5
parent314126257d3d20e3e788325f3b88b7e635bd6bb8 (diff)
downloadrust-cff6c0e0c8d33efe4b64b08751008ac353c9b232.tar.gz
rust-cff6c0e0c8d33efe4b64b08751008ac353c9b232.zip
add known-bug test for unsound issue 100041
-rw-r--r--tests/ui/wf/wf-normalization-sized.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/wf/wf-normalization-sized.rs b/tests/ui/wf/wf-normalization-sized.rs
new file mode 100644
index 00000000000..473fc79a8a3
--- /dev/null
+++ b/tests/ui/wf/wf-normalization-sized.rs
@@ -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() {}