Skip to content

Commit fdb1daa

Browse files
authored
Rollup merge of #86398 - yerke:add-test-for-issue-54685, r=Mark-Simulacrum
Add regression test for issue #54685 Closes #54685 Took the test from #54685 and modified it a bit to use assertion. Made sure that the updated test catches the original issue on 1.50 by running on Compiler Explorer (https://godbolt.org/z/E64onYeT5).
2 parents d285235 + 22029a2 commit fdb1daa

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// min-llvm-version: 12.0
2+
// compile-flags: -C opt-level=3
3+
// run-pass
4+
5+
fn foo(_i: i32) -> i32 {
6+
1
7+
}
8+
fn bar(_i: i32) -> i32 {
9+
1
10+
}
11+
12+
fn main() {
13+
let x: fn(i32) -> i32 = foo;
14+
let y: fn(i32) -> i32 = bar;
15+
16+
let s1;
17+
if x == y {
18+
s1 = "same".to_string();
19+
} else {
20+
s1 = format!("{:?}, {:?}", x, y);
21+
}
22+
23+
let s2;
24+
if x == y {
25+
s2 = "same".to_string();
26+
} else {
27+
s2 = format!("{:?}, {:?}", x, y);
28+
}
29+
30+
assert_eq!(s1, s2);
31+
}

0 commit comments

Comments
 (0)