]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Remove rvalue reference binding
authorOwen Avery <powerboat9.gamer@gmail.com>
Tue, 13 May 2025 22:01:33 +0000 (18:01 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:43 +0000 (16:36 +0200)
This should be unnecessary, since even C++11 has implicit move.

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::parse_expr_stmt): Avoid
reference binding and remove std::move in return statements.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/parse/rust-parse-impl.h

index b661040a7159b05a95869c4c492859495ab2c214..7a4d47658f12e61bfdcfaa62d26303437addfb46 100644 (file)
@@ -7103,10 +7103,7 @@ Parser<ManagedTokenSource>::parse_expr_stmt (AST::AttrVec outer_attrs,
 
        if (lexer.peek_token ()->get_id () == EXCLAM)
          {
-           // Bind a reference to avoid -Wredundant-move on post-P1825R0
-           // compilers. Change to non-reference type and remove the moves
-           // below once C++20 is required to build gcc.
-           std::unique_ptr<AST::MacroInvocation> &&invoc
+           std::unique_ptr<AST::MacroInvocation> invoc
              = parse_macro_invocation_partial (std::move (path),
                                                std::move (outer_attrs));
 
@@ -7114,7 +7111,7 @@ Parser<ManagedTokenSource>::parse_expr_stmt (AST::AttrVec outer_attrs,
              {
                invoc->add_semicolon ();
                // Macro invocation with semicolon.
-               return std::move (invoc);
+               return invoc;
              }
 
            TokenId after_macro = lexer.peek_token ()->get_id ();
@@ -7122,14 +7119,14 @@ Parser<ManagedTokenSource>::parse_expr_stmt (AST::AttrVec outer_attrs,
            if (restrictions.allow_close_after_expr_stmt
                && (after_macro == RIGHT_PAREN || after_macro == RIGHT_CURLY
                    || after_macro == RIGHT_SQUARE))
-             return std::move (invoc);
+             return invoc;
 
            if (invoc->get_invoc_data ().get_delim_tok_tree ().get_delim_type ()
                  == AST::CURLY
                && after_macro != DOT && after_macro != QUESTION_MARK)
              {
                rust_debug ("braced macro statement");
-               return std::move (invoc);
+               return invoc;
              }
 
            null_denotation = std::move (invoc);