diff options
Diffstat (limited to '')
-rw-r--r-- | tests/mir-opt/slice_filter.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/mir-opt/slice_filter.rs b/tests/mir-opt/slice_filter.rs new file mode 100644 index 000000000..97c18af31 --- /dev/null +++ b/tests/mir-opt/slice_filter.rs @@ -0,0 +1,18 @@ +fn main() { + let input = vec![]; + let _variant_a_result = variant_a(&input); + let _variant_b_result = variant_b(&input); +} + +pub fn variant_a(input: &[(usize, usize, usize, usize)]) -> usize { + input.iter().filter(|(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count() +} + +pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize { + input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count() +} + +// EMIT_MIR slice_filter.variant_a-{closure#0}.CopyProp.diff +// EMIT_MIR slice_filter.variant_a-{closure#0}.DestinationPropagation.diff +// EMIT_MIR slice_filter.variant_b-{closure#0}.CopyProp.diff +// EMIT_MIR slice_filter.variant_b-{closure#0}.DestinationPropagation.diff |