]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: derive(Ord): Fix condition for matching on Option::Some instead
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 23 Apr 2025 10:37:57 +0000 (12:37 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:48 +0000 (16:36 +0200)
gcc/rust/ChangeLog:

* expand/rust-derive-ord.cc (DeriveOrd::make_cmp_arms): Fix condition.

gcc/rust/expand/rust-derive-ord.cc

index 68a9c53ab1c9b77f276ca00bf8cc6ec8832ef08c..ffe269c3c0a49654ec6fd9de20a94126956cbd04 100644 (file)
@@ -117,8 +117,9 @@ DeriveOrd::make_cmp_arms ()
   std::unique_ptr<Pattern> equal = ptrify (
     builder.path_in_expression ({"core", "cmp", "Ordering", "Equal"}, true));
 
-  // We need to wrap the pattern in Option::Some if we are doing total ordering
-  if (ordering == Ordering::Total)
+  // We need to wrap the pattern in Option::Some if we are doing partial
+  // ordering
+  if (ordering == Ordering::Partial)
     {
       auto pattern_items = std::unique_ptr<TupleStructItems> (
        new TupleStructItemsNoRange (vec (std::move (equal))));