diff options
Diffstat (limited to 'tests/ui/higher-ranked/subtype/placeholder-pattern.rs')
-rw-r--r-- | tests/ui/higher-ranked/subtype/placeholder-pattern.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/higher-ranked/subtype/placeholder-pattern.rs b/tests/ui/higher-ranked/subtype/placeholder-pattern.rs new file mode 100644 index 000000000..061e66e54 --- /dev/null +++ b/tests/ui/higher-ranked/subtype/placeholder-pattern.rs @@ -0,0 +1,18 @@ +// check-pass +// Check that higher ranked subtyping correctly works when using +// placeholder patterns. +fn hr_subtype<'c>(f: for<'a, 'b> fn(&'a (), &'b ())) { + let _: for<'a> fn(&'a (), &'a ()) = f; + let _: for<'a, 'b> fn(&'a (), &'b ()) = f; + let _: for<'a> fn(&'a (), &'c ()) = f; + let _: fn(&'c (), &'c ()) = f; +} + +fn simple<'c>(x: (&'static i32,)) { + let _: (&'c i32,) = x; +} + +fn main() { + hr_subtype(|_, _| {}); + simple((&3,)); +} |