about summary refs log tree commit diff
path: root/src/test/ui/function-pointer
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-06-22 01:14:31 +0000
committerbors <bors@rust-lang.org>2021-06-22 01:14:31 +0000
commit2c04f0bb171bb7dc573d0da4b59960106823c2cd (patch)
tree17cd6d646a69fe85d3b46de682002aa7e0cfbba0 /src/test/ui/function-pointer
parent4573a4a879a8e1f773944a8859e4dcd136138af8 (diff)
parent4495ce75d975136173dbd4c139f00d1f508a6994 (diff)
downloadrust-2c04f0bb171bb7dc573d0da4b59960106823c2cd.tar.gz
rust-2c04f0bb171bb7dc573d0da4b59960106823c2cd.zip
Auto merge of #86527 - JohnTitor:rollup-cbu78g4, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #85054 (Revert SGX inline asm syntax)
 - #85182 (Move `available_concurrency` implementation to `sys`)
 - #86037 (Add `io::Cursor::{remaining, remaining_slice, is_empty}`)
 - #86114 (Reopen #79692 (Format symbols under shared frames))
 - #86297 (Allow to pass arguments to rustdoc-gui tool)
 - #86334 (Resolve type aliases to the type they point to in intra-doc links)
 - #86367 (Fix comment about rustc_inherit_overflow_checks in abs().)
 - #86381 (Add regression test for issue #39161)
 - #86387 (Remove `#[allow(unused_lifetimes)]` which is now unnecessary)
 - #86398 (Add regression test for issue #54685)
 - #86493 (Say "this enum variant takes"/"this struct takes" instead of "this function takes")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui/function-pointer')
-rw-r--r--src/test/ui/function-pointer/function-pointer-comparison-issue-54685.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/function-pointer/function-pointer-comparison-issue-54685.rs b/src/test/ui/function-pointer/function-pointer-comparison-issue-54685.rs
new file mode 100644
index 00000000000..a036d10e639
--- /dev/null
+++ b/src/test/ui/function-pointer/function-pointer-comparison-issue-54685.rs
@@ -0,0 +1,31 @@
+// min-llvm-version: 12.0
+// 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);
+}