about summary refs log tree commit diff
path: root/tests/ui/sized-hierarchy/alias-bounds.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/sized-hierarchy/alias-bounds.rs')
-rw-r--r--tests/ui/sized-hierarchy/alias-bounds.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/sized-hierarchy/alias-bounds.rs b/tests/ui/sized-hierarchy/alias-bounds.rs
new file mode 100644
index 00000000000..87b4bab11b7
--- /dev/null
+++ b/tests/ui/sized-hierarchy/alias-bounds.rs
@@ -0,0 +1,28 @@
+//@ check-pass
+//@ compile-flags: --crate-type=lib
+//@ revisions: old next
+//@[next] compile-flags: -Znext-solver
+#![feature(sized_hierarchy)]
+
+use std::marker::{PointeeSized, MetaSized};
+
+trait Id: PointeeSized {
+    type This: PointeeSized;
+}
+
+impl<T: PointeeSized> Id for T {
+    type This = T;
+}
+
+fn requires_metasized<T: MetaSized>() {}
+
+fn foo<T>()
+where
+    T: PointeeSized,
+    <T as Id>::This: Sized
+{
+    // `T: Sized` from where bounds (`T: PointeeSized` removes any default bounds and
+    // `<T as Id>::This: Sized` normalizes to `T: Sized`). This should trivially satisfy
+    // `T: MetaSized`.
+    requires_metasized::<T>();
+}