aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/rust/ast/rust-ast-tokenstream.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/rust/ast/rust-ast-tokenstream.cc b/gcc/rust/ast/rust-ast-tokenstream.cc
index 2fc7c2b..3e2fdfc 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 ();