From: Pierre-Emmanuel Patry Date: Wed, 25 Oct 2023 14:51:31 +0000 (+0200) Subject: gccrs: Small fix to the ast collector visitor X-Git-Tag: basepoints/gcc-15~2020 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=863174590a30970be903286ac34a7b3db1be179f;p=thirdparty%2Fgcc.git gccrs: Small fix to the ast collector visitor The parameter type was used instead of the default value. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Check for presence of a type and use the default value instead of the type. Signed-off-by: Pierre-Emmanuel Patry --- diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index dbc3ef2997cd..71cc09835c3a 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -534,11 +534,12 @@ TokenCollector::visit (ConstGenericParam ¶m) auto id = param.get_name ().as_string (); push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id))); push (Rust::Token::make (COLON, UNDEF_LOCATION)); - visit (param.get_type ()); + if (param.has_type ()) + visit (param.get_type ()); if (param.has_default_value ()) { push (Rust::Token::make (EQUAL, UNDEF_LOCATION)); - visit (param.get_type ()); + visit (param.get_default_value ()); } }