]> git.lizzy.rs Git - rust.git/blob - src/test/ui/function-pointer/function-pointer-comparison-issue-54685.rs
Make some diagnostics not depend on the source of what they reference being available
[rust.git] / src / test / ui / function-pointer / function-pointer-comparison-issue-54685.rs
1 // compile-flags: -C opt-level=3
2 // run-pass
3
4 fn foo(_i: i32) -> i32 {
5     1
6 }
7 fn bar(_i: i32) -> i32 {
8     1
9 }
10
11 fn main() {
12     let x: fn(i32) -> i32 = foo;
13     let y: fn(i32) -> i32 = bar;
14
15     let s1;
16     if x == y {
17         s1 = "same".to_string();
18     } else {
19         s1 = format!("{:?}, {:?}", x, y);
20     }
21
22     let s2;
23     if x == y {
24         s2 = "same".to_string();
25     } else {
26         s2 = format!("{:?}, {:?}", x, y);
27     }
28
29     assert_eq!(s1, s2);
30 }