diff options
| author | Ralf Jung <post@ralfj.de> | 2023-01-13 11:46:54 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-01-13 11:46:54 +0100 |
| commit | 9475277c235d2297dc446155325b0b3fcfdbf722 (patch) | |
| tree | bf243b402462c46038a1692d4ab52a7148b75d52 /tests/ui/function-pointer/function-pointer-comparison-issue-54685.rs | |
| parent | 9742679ebed966c62bf457df8353b9a5c6c22d29 (diff) | |
| parent | 7d59c0ccaa3aeb528a66ae3d2fec6a5ebbe44bc2 (diff) | |
| download | rust-9475277c235d2297dc446155325b0b3fcfdbf722.tar.gz rust-9475277c235d2297dc446155325b0b3fcfdbf722.zip | |
Merge from rustc
Diffstat (limited to 'tests/ui/function-pointer/function-pointer-comparison-issue-54685.rs')
| -rw-r--r-- | tests/ui/function-pointer/function-pointer-comparison-issue-54685.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/function-pointer/function-pointer-comparison-issue-54685.rs b/tests/ui/function-pointer/function-pointer-comparison-issue-54685.rs new file mode 100644 index 00000000000..855749c14b9 --- /dev/null +++ b/tests/ui/function-pointer/function-pointer-comparison-issue-54685.rs @@ -0,0 +1,30 @@ +// compile-flags: -C opt-level=3 +// run-pass + +fn foo(_i: i32) -> i32 { + 1 +} +fn bar(_i: i32) -> i32 { + 1 +} + +fn main() { + let x: fn(i32) -> i32 = foo; + let y: fn(i32) -> i32 = bar; + + let s1; + if x == y { + s1 = "same".to_string(); + } else { + s1 = format!("{:?}, {:?}", x, y); + } + + let s2; + if x == y { + s2 = "same".to_string(); + } else { + s2 = format!("{:?}, {:?}", x, y); + } + + assert_eq!(s1, s2); +} |
