diff options
Diffstat (limited to 'tests/ui/impl-trait/closure-in-impl-trait.rs')
-rw-r--r-- | tests/ui/impl-trait/closure-in-impl-trait.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/closure-in-impl-trait.rs b/tests/ui/impl-trait/closure-in-impl-trait.rs new file mode 100644 index 000000000..3593a1d5c --- /dev/null +++ b/tests/ui/impl-trait/closure-in-impl-trait.rs @@ -0,0 +1,14 @@ +// run-pass +#![allow(unused_must_use)] +fn bug<T>() -> impl Iterator<Item = [(); { |x: u32| { x }; 4 }]> { + std::iter::empty() +} + +fn ok<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { + Box::new(std::iter::empty()) +} + +fn main() { + for _item in ok::<u32>() {} + for _item in bug::<u32>() {} +} |