rust/tests/ui/impl-trait/closure-in-impl-trait.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
318 B
Rust
Raw Normal View History

2020-10-04 22:25:51 +00:00
//@ 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>() {}
}