From e071728eed83e0ee732afdc39005311b598ec25e Mon Sep 17 00:00:00 2001 From: Paul Murphy Date: Tue, 3 Feb 2026 15:26:29 -0600 Subject: [PATCH] Update rust-profiler sanity test Desugar the for-loop to minimize ambiguity when testing the profiler. The original regression is tracked upstream as rust#151554. For: RUST-52 --- tests/Sanity/rust-profiler/coverage.exp | 19 ++++++++++--------- tests/Sanity/rust-profiler/main.rs | 7 ++++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/Sanity/rust-profiler/coverage.exp b/tests/Sanity/rust-profiler/coverage.exp index eafa341..b24c031 100644 --- a/tests/Sanity/rust-profiler/coverage.exp +++ b/tests/Sanity/rust-profiler/coverage.exp @@ -1,10 +1,11 @@ - 1| 1|fn main(){ + 1| 1|fn main() { 2| 1| let mut sum: u32 = 0; - 3| 10| for i in 1..10 { - 4| 9| sum += i; - 5| 9| } - 6| 1| if false{ - 7| 0| println!("This code can't be reached"); - 8| 1| } - 9| 1| println!("Sum: {}", sum); - 10| 1|} + 3| 1| let mut iter = 1..10; + 4| 10| while let Some(i) = iter.next() { + 5| 9| sum += i; + 6| 9| } + 7| 1| if false { + 8| 0| println!("This code can't be reached"); + 9| 1| } + 10| 1| println!("Sum: {}", sum); + 11| 1|} diff --git a/tests/Sanity/rust-profiler/main.rs b/tests/Sanity/rust-profiler/main.rs index 8550df0..8db0150 100644 --- a/tests/Sanity/rust-profiler/main.rs +++ b/tests/Sanity/rust-profiler/main.rs @@ -1,9 +1,10 @@ -fn main(){ +fn main() { let mut sum: u32 = 0; - for i in 1..10 { + let mut iter = 1..10; + while let Some(i) = iter.next() { sum += i; } - if false{ + if false { println!("This code can't be reached"); } println!("Sum: {}", sum);