about summary refs log tree commit diff
path: root/src/test/ui/consts
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-11-09 19:21:25 +0530
committerGitHub <noreply@github.com>2022-11-09 19:21:25 +0530
commit062f2fc50fa6c4d9acd652766123b7f766fab2ff (patch)
treefe420a97e9617ba5a05d793346d5ad96487679e7 /src/test/ui/consts
parent64e737c07c7dd10f8904265c82396a156a78ef12 (diff)
parentb6c05eb7d3f59b43b2e9ada520167f87bb4084aa (diff)
downloadrust-062f2fc50fa6c4d9acd652766123b7f766fab2ff.tar.gz
rust-062f2fc50fa6c4d9acd652766123b7f766fab2ff.zip
Rollup merge of #104125 - ink-feather-org:const_cmp_tuples, r=fee1-dead
Const Compare for Tuples

Makes the impls for Tuples of ~const `PartialEq` types also `PartialEq`, impls for Tuples of ~const `PartialOrd` types also `PartialOrd`, for Tuples of ~const `Ord` types also `Ord`.

behind the `#![feature(const_cmp)]` gate.

~~Do not merge before #104113 is merged because I want to use this feature to clean up the new test that I added there.~~

r? ``@fee1-dead``
Diffstat (limited to 'src/test/ui/consts')
-rw-r--r--src/test/ui/consts/fn_trait_refs.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/test/ui/consts/fn_trait_refs.rs b/src/test/ui/consts/fn_trait_refs.rs
index bc8766c74c6..b507492970a 100644
--- a/src/test/ui/consts/fn_trait_refs.rs
+++ b/src/test/ui/consts/fn_trait_refs.rs
@@ -1,4 +1,4 @@
-// build-pass
+// check-pass
 
 #![feature(const_fn_trait_ref_impls)]
 #![feature(fn_traits)]
@@ -60,21 +60,18 @@ const fn test(i: i32) -> i32 {
     i + 1
 }
 
-const fn main() {
+fn main() {
     const fn one() -> i32 {
         1
     };
     const fn two() -> i32 {
         2
     };
+    const _: () = {
+        let test_one = test_fn(one);
+        assert!(test_one == (1, 1, 1));
 
-    // FIXME(const_cmp_tuple)
-    let test_one = test_fn(one);
-    assert!(test_one.0 == 1);
-    assert!(test_one.1 == 1);
-    assert!(test_one.2 == 1);
-
-    let test_two = test_fn_mut(two);
-    assert!(test_two.0 == 1);
-    assert!(test_two.1 == 1);
+        let test_two = test_fn_mut(two);
+        assert!(test_two == (2, 2));
+    };
 }