public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] ast: Fix ICE on generic args path
@ 2023-04-06 21:37 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-06 21:37 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7035cd6ba104fb1e600528ae6a91eda736029d4c

commit 7035cd6ba104fb1e600528ae6a91eda736029d4c
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Tue Apr 4 19:52:38 2023 +0200

    ast: Fix ICE on generic args path
    
    The path should be retrieved only when a generic arg has either type.
    
    gcc/rust/ChangeLog:
    
            * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix ICE.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/ast/rust-ast-tokenstream.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/rust/ast/rust-ast-tokenstream.cc b/gcc/rust/ast/rust-ast-tokenstream.cc
index 2fc7c2b3039..3e2fdfc9e7b 100644
--- a/gcc/rust/ast/rust-ast-tokenstream.cc
+++ b/gcc/rust/ast/rust-ast-tokenstream.cc
@@ -644,7 +644,6 @@ TokenStream::visit (GenericArg &arg)
 {
   // `GenericArg` implements `accept_vis` but it is not useful for this case as
   // it ignores unresolved cases (`Kind::Either`).
-  auto path = arg.get_path ();
   switch (arg.get_kind ())
     {
     case GenericArg::Kind::Const:
@@ -653,9 +652,11 @@ TokenStream::visit (GenericArg &arg)
     case GenericArg::Kind::Type:
       visit (arg.get_type ());
       break;
-    case GenericArg::Kind::Either:
-      tokens.push_back (
-	Rust::Token::make_identifier (Location (), std::move (path)));
+      case GenericArg::Kind::Either: {
+	auto path = arg.get_path ();
+	tokens.push_back (
+	  Rust::Token::make_identifier (Location (), std::move (path)));
+      }
       break;
     case GenericArg::Kind::Error:
       gcc_unreachable ();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-06 21:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-06 21:37 [gcc/devel/rust/master] ast: Fix ICE on generic args path Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).