]> git.lizzy.rs Git - rust.git/blob - tests/ui/dest-prop/skeptic-miscompile.rs
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs, r=Mark-Simulacrum
[rust.git] / tests / ui / dest-prop / skeptic-miscompile.rs
1 // run-pass
2
3 // compile-flags: -Zmir-opt-level=3
4
5 trait IterExt: Iterator {
6     fn fold_ex<B, F>(mut self, init: B, mut f: F) -> B
7     where
8         Self: Sized,
9         F: FnMut(B, Self::Item) -> B,
10     {
11         let mut accum = init;
12         while let Some(x) = self.next() {
13             accum = f(accum, x);
14         }
15         accum
16     }
17 }
18
19 impl<T: Iterator> IterExt for T {}
20
21 fn main() {
22     let test = &["\n"];
23     test.iter().fold_ex(String::new(), |_, b| b.to_string());
24 }