]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Retrieve token stream before vector move
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Fri, 1 Aug 2025 14:43:18 +0000 (16:43 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:37:02 +0000 (16:37 +0200)
gcc/rust/ChangeLog:

* expand/rust-macro-builtins-helpers.cc: Remove use after move.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/expand/rust-macro-builtins-helpers.cc

index 864379a3ffa4b5502e726573391d93dc1e6003a5..19af5df4a68cb4fa8e126603f8a1b4077509171c 100644 (file)
@@ -68,6 +68,7 @@ make_eager_builtin_invocation (
 {
   auto path_str = make_macro_path_str (kind);
 
+  auto token_stream = arguments.to_token_stream ();
   std::unique_ptr<AST::Expr> node = AST::MacroInvocation::Builtin (
     kind,
     AST::MacroInvocData (AST::SimplePath (
@@ -76,7 +77,7 @@ make_eager_builtin_invocation (
     {}, locus, std::move (pending_invocations));
 
   return AST::Fragment ({AST::SingleASTNode (std::move (node))},
-                       arguments.to_token_stream ());
+                       std::move (token_stream));
 }
 
 /* Match the end token of a macro given the start delimiter of the macro */