Skip to content

Commit

Permalink
Rollup merge of rust-lang#102393 - Rageking8:add-regression-test-for-…
Browse files Browse the repository at this point in the history
…issue-94923, r=JohnTitor

Add regression test for issue 94923

Fixes rust-lang#94923
  • Loading branch information
Dylan-DPC authored Sep 28, 2022
2 parents 9c4b247 + 356a52c commit d72a105
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/test/ui/generics/issue-94923.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// run-pass
// regression test for issue #94923
// min-llvm-version: 15.0.0
// compile-flags: -C opt-level=3

fn f0<T>(mut x: usize) -> usize {
for _ in 0..1000 {
x *= 123;
x %= 99
}
x + 321 // function composition is not just longer iteration
}

fn f1<T>(x: usize) -> usize {
f0::<(i8, T)>(f0::<(u8, T)>(x))
}

fn f2<T>(x: usize) -> usize {
f1::<(i8, T)>(f1::<(u8, T)>(x))
}

fn f3<T>(x: usize) -> usize {
f2::<(i8, T)>(f2::<(u8, T)>(x))
}

fn f4<T>(x: usize) -> usize {
f3::<(i8, T)>(f3::<(u8, T)>(x))
}

fn f5<T>(x: usize) -> usize {
f4::<(i8, T)>(f4::<(u8, T)>(x))
}

fn f6<T>(x: usize) -> usize {
f5::<(i8, T)>(f5::<(u8, T)>(x))
}

fn f7<T>(x: usize) -> usize {
f6::<(i8, T)>(f6::<(u8, T)>(x))
}

fn f8<T>(x: usize) -> usize {
f7::<(i8, T)>(f7::<(u8, T)>(x))
}

fn main() {
let y = f8::<()>(1);
assert_eq!(y, 348);
}

0 comments on commit d72a105

Please sign in to comment.