From 22bce7cbfa02a53f5505971211374cf336e07aa1 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Mon, 31 Jul 2023 15:10:41 +0200 Subject: [PATCH] gccrs: Parse unparsed derive tokenstreams 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 --- gcc/rust/ast/rust-ast.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc index 13499461b1c9..cb0281ec9569 100644 --- a/gcc/rust/ast/rust-ast.cc +++ b/gcc/rust/ast/rust-ast.cc @@ -95,6 +95,9 @@ Attribute::is_derive () const std::vector> Attribute::get_traits_to_derive () { + rust_assert (this->is_derive ()); + + this->parse_attr_to_meta_item (); std::vector> result; auto &input = get_attr_input (); switch (input.get_attr_input_type ()) -- 2.47.2