]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Parse unparsed derive tokenstreams
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 31 Jul 2023 13:10:41 +0000 (15:10 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:04:32 +0000 (19:04 +0100)
Derive attributes should be parsed before attempting to retrieve any
traits. This will convert the tokenstream to a list of path if this
hasn't been done previously.

gcc/rust/ChangeLog:

* ast/rust-ast.cc (Attribute::get_traits_to_derive): Convert
tokenstream to path list.

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

index 13499461b1c90ec142bb693b8c190b843941861e..cb0281ec95699150de58dccaeb40150a233c55c2 100644 (file)
@@ -95,6 +95,9 @@ Attribute::is_derive () const
 std::vector<std::reference_wrapper<AST::SimplePath>>
 Attribute::get_traits_to_derive ()
 {
+  rust_assert (this->is_derive ());
+
+  this->parse_attr_to_meta_item ();
   std::vector<std::reference_wrapper<AST::SimplePath>> result;
   auto &input = get_attr_input ();
   switch (input.get_attr_input_type ())