]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs
Auto merge of #101969 - reez12g:issue-101306, r=reez12g
[rust.git] / src / test / ui / borrowck / issue-95079-missing-move-in-nested-closure.rs
1 fn foo1(s: &str) -> impl Iterator<Item = String> + '_ {
2     None.into_iter()
3         .flat_map(move |()| s.chars().map(|c| format!("{}{}", c, s)))
4         //~^ ERROR captured variable cannot escape `FnMut` closure body
5         //~| HELP consider adding 'move' keyword before the nested closure
6 }
7
8 fn foo2(s: &str) -> impl Sized + '_ {
9     move |()| s.chars().map(|c| format!("{}{}", c, s))
10     //~^ ERROR lifetime may not live long enough
11     //~| HELP consider adding 'move' keyword before the nested closure
12 }
13
14 fn main() {}