diff options
Diffstat (limited to 'src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2-ok.rs')
-rw-r--r-- | src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2-ok.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2-ok.rs b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2-ok.rs new file mode 100644 index 000000000..1422dda27 --- /dev/null +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2-ok.rs @@ -0,0 +1,15 @@ +// Make sure that we're handling bound lifetimes correctly when validating trait +// bounds. +// run-pass + +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 = fn(&i32) -> &'x i32>>(); +} |