summaryrefslogtreecommitdiffstats
path: root/src/test/ui/mir/important-higher-ranked-regions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/mir/important-higher-ranked-regions.rs')
-rw-r--r--src/test/ui/mir/important-higher-ranked-regions.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/mir/important-higher-ranked-regions.rs b/src/test/ui/mir/important-higher-ranked-regions.rs
new file mode 100644
index 000000000..cadfb3b66
--- /dev/null
+++ b/src/test/ui/mir/important-higher-ranked-regions.rs
@@ -0,0 +1,26 @@
+// check-pass
+// compile-flags: -Zvalidate-mir
+
+// This test checks that bivariant parameters are handled correctly
+// in the mir.
+#![allow(coherence_leak_check)]
+trait Trait {
+ type Assoc;
+}
+
+struct Foo<T, U>(T)
+where
+ T: Trait<Assoc = U>;
+
+impl Trait for for<'a> fn(&'a ()) {
+ type Assoc = u32;
+}
+impl Trait for fn(&'static ()) {
+ type Assoc = String;
+}
+
+fn foo(x: Foo<for<'a> fn(&'a ()), u32>) -> Foo<fn(&'static ()), String> {
+ x
+}
+
+fn main() {}