]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-34349.rs
Rollup merge of #60492 - acrrd:issues/54054_chain, r=SimonSapin
[rust.git] / src / test / ui / issues / issue-34349.rs
1 // This is a regression test for a problem encountered around upvar
2 // inference and trait caching: in particular, we were entering a
3 // temporary closure kind during inference, and then caching results
4 // based on that temporary kind, which led to no error being reported
5 // in this particular test.
6
7 fn main() {
8     let inc = || {};
9     inc();
10
11     fn apply<F>(f: F) where F: Fn() {
12         f()
13     }
14
15     let mut farewell = "goodbye".to_owned();
16     let diary = || { //~ ERROR E0525
17         farewell.push_str("!!!");
18         println!("Then I screamed {}.", farewell);
19     };
20
21     apply(diary);
22 }