summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs')
-rw-r--r--tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
new file mode 100644
index 000000000..eb2fb6e84
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
@@ -0,0 +1,15 @@
+// Check that we validate associated type bounds for trait objects when they
+// have bound lifetimes
+
+trait X<'a> {
+ type F: FnOnce(&i32) -> &'a i32;
+}
+
+fn f<T: for<'r> X<'r> + ?Sized>() {
+ None::<T::F>.map(|f| f(&0));
+}
+
+fn main() {
+ f::<dyn for<'x> X<'x, F = i32>>();
+ //~^ expected a `FnOnce<(&i32,)>` closure, found `i32`
+}