]> git.lizzy.rs Git - rust.git/commitdiff
fix ptr comparison test
authorRalf Jung <post@ralfj.de>
Wed, 13 Feb 2019 09:07:31 +0000 (10:07 +0100)
committerRalf Jung <post@ralfj.de>
Wed, 13 Feb 2019 09:07:31 +0000 (10:07 +0100)
tests/run-pass/function_pointers.rs

index cc888630d3eea8e3565370c2ba02216aadb87c88..26a2d5a6c2a9e1a1f677ae7b749e326880e57761 100644 (file)
@@ -1,5 +1,16 @@
-fn f() -> i32 {
-    42
+trait Answer {
+    fn answer() -> Self;
+}
+
+impl Answer for i32 {
+    fn answer() -> i32 {
+        42
+    }
+}
+
+// A generic function, to make its address unstable
+fn f<T: Answer>() -> T {
+    Answer::answer()
 }
 
 fn g(i: i32) -> i32 {