]>
git.ipfire.org Git - thirdparty/gcc.git/log
Martin Jambor [Fri, 24 Nov 2023 16:32:35 +0000 (17:32 +0100)]
sra: SRA of non-escaped aggregates passed by reference to calls
PR109849 shows that a loop that heavily pushes and pops from a stack
implemented by a C++ std::vec results in slow code, mainly because the
vector structure is not split by SRA and so we end up in many loads
and stores into it. This is because it is passed by reference
to (re)allocation methods and so needs to live in memory, even though
it does not escape from them and so we could SRA it if we
re-constructed it before the call and then separated it to distinct
replacements afterwards.
This patch does exactly that, first relaxing the selection of
candidates to also include those which are addressable but do not
escape and then adding code to deal with the calls. The
micro-benchmark that is also the (scan-dump) testcase in this patch
runs twice as fast with it than with current trunk. Honza measured
its effect on the libjxl benchmark and it almost closes the
performance gap between Clang and GCC while not requiring excessive
inlining and thus code growth.
The patch disallows creation of replacements for such aggregates which
are also accessed with a precision smaller than their size because I
have observed that this led to excessive zero-extending of data
leading to slow-downs of perlbench (on some CPUs). Apart from this
case I have not noticed any regressions, at least not so far.
Gimple call argument flags can tell if an argument is unused (and then
we do not need to generate any statements for it) or if it is not
written to and then we do not need to generate statements loading
replacements from the original aggregate after the call statement.
Unfortunately, we cannot symmetrically use flags that an aggregate is
not read because to avoid re-constructing the aggregate before the
call because flags don't tell which what parts of aggregates were not
written to, so we load all replacements, and so all need to have the
correct value before the call.
This version of the patch also takes care to avoid attempts to modify
abnormal edges, something which was missing in the previosu version.
gcc/ChangeLog:
2023-11-23 Martin Jambor <mjambor@suse.cz>
PR middle-end/109849
* tree-sra.cc (passed_by_ref_in_call): New.
(sra_initialize): Allocate passed_by_ref_in_call.
(sra_deinitialize): Free passed_by_ref_in_call.
(create_access): Add decl pool candidates only if they are not
already candidates.
(build_access_from_expr_1): Bail out on ADDR_EXPRs.
(build_access_from_call_arg): New function.
(asm_visit_addr): Rename to scan_visit_addr, change the
disqualification dump message.
(scan_function): Check taken addresses for all non-call statements,
including phi nodes. Process all call arguments, including the static
chain, build_access_from_call_arg.
(maybe_add_sra_candidate): Relax need_to_live_in_memory check to allow
non-escaped local variables.
(sort_and_splice_var_accesses): Disallow smaller-than-precision
replacements for aggregates passed by reference to functions.
(sra_modify_expr): Use a separate stmt iterator for adding satements
before the processed statement and after it.
(enum out_edge_check): New type.
(abnormal_edge_after_stmt_p): New function.
(sra_modify_call_arg): New function.
(sra_modify_assign): Adjust calls to sra_modify_expr.
(sra_modify_function_body): Likewise, use sra_modify_call_arg to
process call arguments, including the static chain.
gcc/testsuite/ChangeLog:
2023-11-23 Martin Jambor <mjambor@suse.cz>
PR middle-end/109849
* g++.dg/tree-ssa/pr109849.C: New test.
* g++.dg/tree-ssa/sra-eh-1.C: Likewise.
* gcc.dg/tree-ssa/pr109849.c: Likewise.
* gcc.dg/tree-ssa/sra-longjmp-1.c: Likewise.
* gfortran.dg/pr43984.f90: Added -fno-tree-sra to dg-options.
(cherry picked from commit
aae723d360ca26cd9fd0b039fb0a616bd0eae363 )
Pierre-Emmanuel Patry [Thu, 22 Feb 2024 17:55:53 +0000 (18:55 +0100)]
Replace unique_ptr references with references
This kind of double indirection is pointless and prone to error. This
commit change the api of all getters from the AST to use references
directly instead of references to unique pointers.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Remove reference
to unique pointer and replace it with a direct reference to the wrapped
data.
* ast/rust-ast.cc (VariadicParam::as_string): Likewise.
(BlockExpr::normalize_tail_expr): Likewise.
* ast/rust-expr.h: Likewise and add pointer getter in order to allow
pointer reseat.
* ast/rust-item.h: Likewise and add pointer getter for reseat.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-stmt.h: Likewise.
* ast/rust-type.h: Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_struct_fields):
Remove references to unique pointers and replace it with direct
references to the wrapped object.
(CfgStrip::maybe_strip_tuple_fields): Likewise.
(CfgStrip::maybe_strip_generic_args): Likewise.
(CfgStrip::maybe_strip_qualified_path_type): Likewise.
(CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::maybe_expand_expr):
Likewise.
(ExpandVisitor::maybe_expand_type): Likewise.
(ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_binding):
Likewise.
(ASTLoweringBase::lower_generic_args): Likewise.
(ASTLoweringBase::lower_self): Likewise.
(ASTLoweringBase::lower_type_no_bounds): Likewise.
(ASTLoweringBase::lower_bound): Likewise.
(ASTLoweringBase::lower_range_pattern_bound): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-block.h: Likewise.
* hir/rust-ast-lower-enumitem.h: Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::translate): Likewise.
(ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-expr.h: Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::translate):
Likewise.
(ASTLowerImplItem::visit): Likewise.
(ASTLowerTraitItem::translate): Likewise.
(ASTLowerTraitItem::visit): Likewise.
* hir/rust-ast-lower-implitem.h: Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::translate): Likewise.
(ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-item.h: Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate):
Likewise.
(ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-pattern.h: Likewise.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Likewise.
* hir/rust-ast-lower-struct-field-expr.h: Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Likewise.
(ASTLowerQualifiedPathInType::visit): Likewise.
(ASTLoweringType::translate): Likewise.
(ASTLoweringType::visit): Likewise.
(ASTLowerGenericParam::translate): Likewise.
(ASTLowerGenericParam::visit): Likewise.
(ASTLoweringTypeBounds::translate): Likewise.
(ASTLoweringTypeBounds::visit): Likewise.
(ASTLowerWhereClauseItem::visit): Likewise.
* hir/rust-ast-lower-type.h: Likewise.
* hir/rust-ast-lower.cc (ASTLowering::go): Likewise.
(ASTLoweringBlock::visit): Likewise.
(ASTLoweringIfBlock::visit): Likewise.
(ASTLoweringIfLetBlock::visit): Likewise.
(ASTLowerStructExprField::visit): Likewise.
(ASTLoweringExprWithBlock::visit): Likewise.
(ASTLoweringBase::lower_qual_path_type): Likewise.
(ASTLoweringBase::lower_closure_param): Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::resolve_visibility):
Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::go): Likewise.
(ResolveExpr::visit): Likewise.
(ResolveExpr::resolve_closure_param): Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::go): Likewise.
(ResolveItem::visit): Likewise.
(ResolveItem::resolve_impl_item): Likewise.
(ResolveItem::resolve_extern_item): Likewise.
(ResolveImplItems::go): Likewise.
(ResolveExternItem::go): Likewise.
(ResolveExternItem::visit): Likewise.
* resolve/rust-ast-resolve-item.h: Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::go): Likewise.
(ResolvePath::resolve_path): Likewise.
* resolve/rust-ast-resolve-path.h: Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go):
Likewise.
(PatternDeclaration::visit): Likewise.
(resolve_range_pattern_bound): Likewise.
* resolve/rust-ast-resolve-pattern.h: Likewise.
* resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-struct-expr-field.cc (ResolveStructExprField::go):
Likewise.
(ResolveStructExprField::visit): Likewise.
* resolve/rust-ast-resolve-struct-expr-field.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveType::visit): Likewise.
(ResolveRelativeTypePath::go): Likewise.
(ResolveRelativeQualTypePath::resolve_qual_seg): Likewise.
(ResolveTypeToCanonicalPath::go): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
(ResolveGenericArgs::resolve_disambiguated_generic): Likewise.
(ResolveGenericArgs::go): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-ast-resolve.cc (NameResolution::go): Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::resolve_qualified_path_type):
Likewise.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
* checks/errors/rust-ast-validation.cc: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Pierre-Emmanuel Patry [Wed, 21 Feb 2024 15:45:18 +0000 (16:45 +0100)]
Replace reference to unique pointer with reference
Reference to unique pointers are a known anti pattern, only the element
shall be taken by reference instead of the whole wrapper.
gcc/rust/ChangeLog:
* ast/rust-item.h: Change getter function prototype to return a
reference directly instead of a reference to the wrapper type.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Fix
the code to accept references instead.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): Change
function implementation to return a reference.
* hir/rust-ast-lower-base.h: Accept a reference instead of a unique
pointer reference.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adapt the code
to a reference instead of a unique pointer.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Thomas Schwinge [Tue, 12 Mar 2024 08:41:55 +0000 (09:41 +0100)]
Thomas Schwinge [Tue, 12 Mar 2024 08:36:43 +0000 (09:36 +0100)]
Placate clang-format re 'gcc/rust/backend/rust-tree.cc'
Reformat the upstream GCC commit
f4a2ae2338962208b8039f154f5912402e94c378
"Change MODE_BITSIZE to MODE_PRECISION for MODE_VECTOR_BOOL" change to
'gcc/rust/backend/rust-tree.cc' to clang-format's liking.
gcc/rust/
* backend/rust-tree.cc (c_common_type_for_mode): Placate clang-format.
Thomas Schwinge [Mon, 11 Mar 2024 22:44:18 +0000 (23:44 +0100)]
Adjust '.github/bors_log_expected_warnings'
Jakub Jelinek [Wed, 18 Oct 2023 15:01:26 +0000 (17:01 +0200)]
cse: Workaround GCC < 5 bug in cse_insn [PR111852]
Before the r5-3834 commit for PR63362, GCC 4.8-4.9 refuses to compile
cse.cc which contains a variable with rtx_def type, because rtx_def
contains a union with poly_uint16 element. poly_int template has
defaulted default constructor and a variadic template constructor which
could have empty parameter pack. GCC < 5 treated it as non-trivially
constructible class and deleted rtunion and rtx_def default constructors.
For the cse_insn purposes, all we need is a variable with size and alignment
of rtx_def, not necessarily rtx_def itself, which we then memset to 0 and
fill in like rtx is normally allocated from heap, so this patch for
GCC_VERSION < 5000 uses an unsigned char array of the right size/alignment.
2023-10-18 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/111852
* cse.cc (cse_insn): Add workaround for GCC 4.8-4.9, instead of
using rtx_def type for memory_extend_buf, use unsigned char
arrayy with size of rtx_def and its alignment.
(cherry picked from commit
bc4bd69faf986326f6b0fd0400cdd6871577afd1 )
Thomas Schwinge [Mon, 11 Mar 2024 21:51:28 +0000 (22:51 +0100)]
Thomas Schwinge [Mon, 11 Mar 2024 21:43:19 +0000 (22:43 +0100)]
Thomas Schwinge [Mon, 11 Mar 2024 21:38:33 +0000 (22:38 +0100)]
Thomas Schwinge [Mon, 11 Mar 2024 00:05:15 +0000 (01:05 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:59:26 +0000 (00:59 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:58:39 +0000 (00:58 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:57:51 +0000 (00:57 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:56:06 +0000 (00:56 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:47:49 +0000 (00:47 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:45:13 +0000 (00:45 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:34:47 +0000 (00:34 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:34:22 +0000 (00:34 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:33:08 +0000 (00:33 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:26:50 +0000 (00:26 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:25:25 +0000 (00:25 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:25:10 +0000 (00:25 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:24:32 +0000 (00:24 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:24:01 +0000 (00:24 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:21:19 +0000 (00:21 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:20:06 +0000 (00:20 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:18:11 +0000 (00:18 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:17:15 +0000 (00:17 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 23:15:40 +0000 (00:15 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:58:16 +0000 (23:58 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:54:17 +0000 (23:54 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:42:52 +0000 (23:42 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:42:46 +0000 (23:42 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:38:46 +0000 (23:38 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:38:38 +0000 (23:38 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:34:31 +0000 (23:34 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:34:09 +0000 (23:34 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:24:35 +0000 (23:24 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:22:34 +0000 (23:22 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:19:06 +0000 (23:19 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:18:49 +0000 (23:18 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:16:21 +0000 (23:16 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 22:15:52 +0000 (23:15 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 21:57:58 +0000 (22:57 +0100)]
Thomas Schwinge [Sun, 10 Mar 2024 21:56:03 +0000 (22:56 +0100)]
0xn4utilus [Wed, 28 Feb 2024 14:05:30 +0000 (19:35 +0530)]
Remove dead code associated with `AST::ExternalFunctionItem`
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit):
Remove dead code.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-full-decls.h (class ExternalFunctionItem):
Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit):
Likewise.
* ast/rust-ast-visitor.h: Likewise.
* ast/rust-ast.cc (ExternalFunctionItem::as_string): Likewise.
(ExternalFunctionItem::accept_vis): Likewise.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Likewise.
* checks/errors/rust-ast-validation.h: Likewise.
* checks/errors/rust-feature-gate.h: Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::visit):
Likewise.
* expand/rust-cfg-strip.h: Likewise.
* expand/rust-derive.h: Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit):
Likewise.
* expand/rust-expand-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit):
Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* metadata/rust-export-metadata.cc (ExportContext::emit_function):
Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Likewise.
* resolve/rust-default-resolver.h: Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
* util/rust-attributes.h: Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/extern_func_with_body.rs: New test.
Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
0xn4utilus [Sun, 25 Feb 2024 23:09:43 +0000 (04:39 +0530)]
Update resolver to use `AST::Function` instead of `AST::ExternalFunctionItem`
gcc/rust/ChangeLog:
* checks/errors/rust-feature-gate.cc (FeatureGate::visit):
Check if function is_external or not.
* hir/rust-ast-lower-extern.h: Use AST::Function
instead of AST::ExternalFunctionItem.
* parse/rust-parse-impl.h (Parser::parse_external_item):
Likewise.
(Parser::parse_pattern): Fix clang format.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveExternItem::visit):
Likewise.
* resolve/rust-ast-resolve-item.h: Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Check if param has_pattern before using get_pattern.
Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
0xn4utilus [Sun, 25 Feb 2024 13:33:55 +0000 (19:03 +0530)]
Unify ASTValidation::visit for ExternalFunctionItem and Function
gcc/rust/ChangeLog:
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Add external function validation support. Add ErrorCode::E0130.
* parse/rust-parse-impl.h (Parser::parse_function): Parse
external functions from `parse_function`.
(Parser::parse_external_item): Clang format.
(Parser::parse_pattern): Clang format.
* parse/rust-parse.h: Add default parameter
`is_external` in `parse_function`.
Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
0xn4utilus [Sun, 25 Feb 2024 00:50:51 +0000 (06:20 +0530)]
Add get_pattern_kind to Pattern
gcc/rust/ChangeLog:
* ast/rust-ast.h: Add Kind Enum to
Pattern.
* ast/rust-macro.h: Add get_pattern_kind().
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
0xn4utilus [Sun, 25 Feb 2024 00:02:26 +0000 (05:32 +0530)]
Add support for external functions
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Function::Function): Add `is_external_function` field.
(Function::operator=): Likewise.
* ast/rust-ast.h: New constructor for ExternalItem.
* ast/rust-item.h (class Function): Add `is_external_function`
field. Update `get_node_id`.
* ast/rust-macro.h: Update copy constructor.
Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
Sourabh Jaiswal [Fri, 1 Mar 2024 11:46:23 +0000 (19:46 +0800)]
Clean BiMap to use tl::optional for lookups
gcc/rust/Changelog:
* expand/rust-expand-visitor.cc
(ExpandVisitor::expand_inner_items): Adjust to use has_value ()
(ExpandVisitor::expand_inner_stmts): Likewise
* expand/rust-macro-builtins.cc (builtin_macro_from_string): Likewise
(make_macro_path_str): Likewise
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise
* util/rust-lang-item.cc (LangItem::Parse): Adjust to return tl::optional
(LangItem::toString) Likewise
* util/rust-token-converter.cc (handle_suffix): Adjust to use value.or ()
(from_literal) Likewise
* util/bi-map.h (BiMap::lookup): Adjust to use tl::optional for
lookups
Signed-off-by: Sourabh Jaiswal <sourabhrj31@gmail.com>
Owen Avery [Tue, 27 Feb 2024 21:34:23 +0000 (16:34 -0500)]
Ensure TupleStructPattern and TuplePattern have items
Note that instances of both classes which have been
moved from will have (items == nullptr).
gcc/rust/ChangeLog:
* ast/rust-pattern.h
(class TupleStructPattern): Assert that items != nullptr.
(class TuplePattern): Likewise.
(TupleStructPattern::has_items): Remove.
(TuplePattern::has_tuple_pattern_items): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_ident_leading_pattern):
Prevent construction of TupleStructPattern with
(items == nullptr).
(Parser::parse_pattern_no_alt): Likewise.
* ast/rust-ast-collector.cc
(TokenCollector::visit): Remove usage of
TupleStructPattern::has_items.
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Likewise.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/pattern-struct.rs: Fix test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
jjasmine [Fri, 1 Mar 2024 21:40:17 +0000 (16:40 -0500)]
Add curly brackets, formatted clang
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
jjasmine [Fri, 1 Mar 2024 10:31:15 +0000 (05:31 -0500)]
Add error emitting when we can't resolve id expr
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
Arthur Cohen [Fri, 1 Mar 2024 14:37:45 +0000 (15:37 +0100)]
format-args: Add documentation for future expansion of function
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Add
documentation regarding future tasks.
Arthur Cohen [Thu, 22 Feb 2024 13:59:17 +0000 (14:59 +0100)]
lower: Add base for lowering FormatArgs nodes
gcc/rust/ChangeLog:
* Make-lang.in: Compile the new source file.
* ast/rust-ast-collector.cc (TokenCollector::visit): Error out when
visiting FormatArgs nodes.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* ast/rust-ast.cc (FormatArgs::get_locus): New.
* ast/rust-builtin-ast-nodes.h: Improve FormatArgs API.
* ast/rust-fmt.cc (Pieces::~Pieces): Cleanup.
(Pieces::Pieces): Likewise.
* ast/rust-fmt.h (struct Pieces): Add pieces_vector member.
* hir/rust-ast-lower-format-args.cc: New file.
* hir/rust-ast-lower-format-args.h: New file.
Arthur Cohen [Fri, 16 Feb 2024 17:27:22 +0000 (18:27 +0100)]
format-args: Fix Rust interface and add input parsing.
gcc/rust/ChangeLog:
* Make-lang.in: Do not build Rust library in release mode.
* ast/rust-ast.cc: Make FormatArgs inherit from AST::Expr
* ast/rust-builtin-ast-nodes.h: Improve FormatArg* nodes and helpers.
* ast/rust-fmt.cc (Pieces::collect): Fix interface to match FFI function.
* ast/rust-fmt.h (collect_pieces): Likewise.
(struct Pieces): Add append_newline parameter.
* expand/rust-macro-builtins.cc: Add proper parsing of format_args
input.
* hir/rust-ast-lower-base.cc: Include diagnostics header.
libgrust/ChangeLog:
* libformat_parser/src/lib.rs: Switch interface to use more parser
parameters.
* libformat_parser/src/bin.rs: Use new interface.
Arthur Cohen [Mon, 19 Feb 2024 19:41:50 +0000 (20:41 +0100)]
parser: Add peek(n) method to parser
gcc/rust/ChangeLog:
* parse/rust-parse.h: New method.
Arthur Cohen [Fri, 16 Feb 2024 15:19:27 +0000 (16:19 +0100)]
macro-builtins: Add newline generic format_args!() handler
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc (format_args_maker): New function.
(try_expand_many_expr): Add comment about reworking function.
(MacroBuiltin::format_args_handler): Add newline parameter.
* expand/rust-macro-builtins.h: Likewise.
Arthur Cohen [Thu, 15 Feb 2024 19:58:48 +0000 (20:58 +0100)]
ast: Add base nodes for FormatArgs
This commit adds a base for creating AST FormatArgs nodes after expanding
invocations of `format_args!()`. These nodes will then be expanded to
the proper runtime function calls (to core::fmt::rt) during the AST
lowering.
gcc/rust/ChangeLog:
* ast/rust-builtin-ast-nodes.h: New file.
* ast/rust-ast-full-decls.h (class FormatArgs): Declare new class.
* ast/rust-ast-collector.cc: Handle FormatArgs nodes properly.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-full.h: Likewise.
* ast/rust-ast-visitor.cc: Likewise.
* ast/rust-ast-visitor.h: Likewise.
* ast/rust-ast.cc: Likewise.
* ast/rust-ast.h: Likewise.
* expand/rust-derive.h: Likewise.
* hir/rust-ast-lower-base.cc: Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-expr.cc: Likewise.
* hir/rust-ast-lower-expr.h: Likewise.
* resolve/rust-ast-resolve-base.cc: Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
Owen Avery [Wed, 28 Feb 2024 22:42:49 +0000 (17:42 -0500)]
Make DefaultResolver visit more of the AST
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Visit inner AST nodes of ClosureExprInner,
ClosureExprInnerTyped, IfExpr, IfExprConseqElse, MatchExpr,
PathInExpression, EnumItemTuple, EnumItemStruct, and
EnumItemDiscriminant.
* ast/rust-item.h
(EnumItemDiscriminant::has_expr): New function.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Arthur Cohen [Tue, 20 Feb 2024 15:22:20 +0000 (16:22 +0100)]
extern-types: Lower to HIR::ExternalTypeItem properly
gcc/rust/ChangeLog:
* hir/rust-ast-lower-extern.h: Lower to HIR::ExternalTypeItem nodes.
* hir/tree/rust-hir-item.h (class ExternalTypeItem): Create private
visibility by default as extern types have no visibility - add a comment
about the correctness of this.
Arthur Cohen [Tue, 20 Feb 2024 14:45:35 +0000 (15:45 +0100)]
hir: Add ExternalTypeItem node
gcc/rust/ChangeLog:
* hir/tree/rust-hir-item.h (class ExternalTypeItem): New class.
* hir/tree/rust-hir.cc (ExternalTypeItem::as_string): Likewise.
* backend/rust-compile-extern.h: Add base for handling HIR::ExternalTypeItem
node.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-full-decls.h (class ExternalTypeItem): Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
(ExternalTypeItem::accept_vis): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.h: Likewise.
Arthur Cohen [Tue, 20 Feb 2024 13:53:32 +0000 (14:53 +0100)]
extern-types: Declare external types in name resolver.
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-implitem.h: Declare external types as new
types.
Arthur Cohen [Tue, 27 Feb 2024 13:39:22 +0000 (14:39 +0100)]
lang-items: Make lang items enum stronger, rename class, cleanup ns.
gcc/rust/ChangeLog:
* util/rust-lang-item.h (class RustLangItem): Renamed to...
(class LangItem): ...this. Rename ItemType enum to Kind
* util/rust-lang-item.cc: Rename methods to use new class name.
* backend/rust-compile-expr.cc (CompileExpr::visit): Use new lang-item API.
(CompileExpr::resolve_operator_overload): Likewise.
* backend/rust-compile-expr.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Likewise.
* typecheck/rust-autoderef.cc (Adjuster::try_deref_type): Likewise.
(AutoderefCycle::cycle): Likewise.
* typecheck/rust-autoderef.h: Likewise.
* typecheck/rust-hir-type-bounds.h: Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): Likewise.
(TypeBoundsProbe::assemble_builtin_candidate): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::get_lang_item): Likewise.
(Mappings::lookup_trait_item_lang_item): Likewise.
* util/rust-hir-map.h: Likewise.
Arthur Cohen [Tue, 27 Feb 2024 12:35:50 +0000 (13:35 +0100)]
lang-items: Cleanup parsing and lookups of lang items.
gcc/rust/ChangeLog:
* Make-lang.in: Compile new rust-lang-item.o.
* util/rust-lang-item.h: Split into header and source.
* util/rust-lang-item.cc: Cleanup parsing of lang items by using a hashmap
and returning optional values, cleanup handling of exhaustive lang item
lookups.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Use
new optional API.
Thomas Schwinge [Thu, 29 Feb 2024 13:04:29 +0000 (14:04 +0100)]
jjasmine [Fri, 23 Feb 2024 21:06:14 +0000 (13:06 -0800)]
Fix small FixMe task in rust macro builtins
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc: Change BuiltinMacro in
builtin_macro_from_string to tl::optional<>
* expand/rust-macro-builtins.h (enum class): Change BuiltinMacro
in builtin_macro_from_string to tl::optional<>
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Resolved wrong type dependency of builtin_macro_from_string
Signed-off-by: jjasmine <tanghocle456@gmail.com>
Owen Avery [Fri, 23 Feb 2024 15:20:55 +0000 (10:20 -0500)]
Adjust error checks to match name resolution 2.0
gcc/testsuite/ChangeLog:
* rust/compile/bad_stmt_enums.rs: Adjust redefinition error.
* rust/compile/bad_toplevel_enums.rs: Likewise.
* rust/compile/redef_error1.rs: Likewise.
* rust/compile/redef_error3.rs: Likewise.
* rust/compile/redef_error4.rs: Likewise.
* rust/compile/redef_error6.rs: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Arthur Cohen [Mon, 26 Feb 2024 10:57:54 +0000 (11:57 +0100)]
ci: Install cargo on ubuntu 18.04 container.
ChangeLog:
* .github/workflows/ccpp.yml: Install cargo for GCC 4.8 job.
Arthur Cohen [Mon, 26 Feb 2024 10:55:47 +0000 (11:55 +0100)]
format-parser: Add `is_some_and` method for Option<T>
Workaround for Ubuntu 18.04, since we still use it for the GCC 4.8 CI.
The default Rust package is 1.65 (and unlikely to change I assume?),
but the generic format parser library uses `is_some_and` which was
introduced in 1.70. So this is a simple reimplementation, directly taken
from the standard library sources.
libgrust/ChangeLog:
* libformat_parser/generic_format_parser/src/lib.rs: Add IsSomeAnd<T>
trait, impl it for Option<T>.
Arthur Cohen [Thu, 15 Feb 2024 12:11:26 +0000 (13:11 +0100)]
libformat_parser: Fix Rust warnings.
libgrust/ChangeLog:
* libformat_parser/generic_format_parser/src/lib.rs: Remove
unused deprecated attribute and unused import.
* libformat_parser/src/lib.rs: Remove unused import.
Arthur Cohen [Tue, 13 Feb 2024 15:31:25 +0000 (16:31 +0100)]
rust-fmt: Store parsed string in Pieces struct
gcc/rust/ChangeLog:
* ast/rust-fmt.cc (Pieces::collect): Fix signature to take ownership
of the given string.
* ast/rust-fmt.h (struct Pieces): Store parsed string in the struct.
libgrust/ChangeLog:
* libformat_parser/src/lib.rs: Add debug prompt.
Arthur Cohen [Wed, 7 Feb 2024 11:46:16 +0000 (12:46 +0100)]
format_args: Parse entire token invocation
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
Transform entire invocation token stream into string for the parser.
Arthur Cohen [Tue, 30 Jan 2024 15:16:36 +0000 (16:16 +0100)]
format_args: Parse format string properly
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
Construct string to parser properly.
Arthur Cohen [Tue, 30 Jan 2024 00:48:13 +0000 (01:48 +0100)]
libformat_parser: Send boxed values across FFI properly
gcc/rust/ChangeLog:
* ast/rust-fmt.cc (Pieces::~Pieces): Call libformat_parser's release
function in destructor.
* ast/rust-fmt.h (struct PieceSlice): Add capacity.
(destroy_pieces): New.
(struct Pieces): Add destructor.
libgrust/ChangeLog:
* libformat_parser/src/lib.rs: Leak Boxes properly for C++ to
see them, add memory release function.
Arthur Cohen [Mon, 29 Jan 2024 21:06:39 +0000 (22:06 +0100)]
libformat_parser: Update header and remove old interface
gcc/rust/ChangeLog:
* ast/rust-fmt.cc (Pieces::collect): Use new Pieces API.
* ast/rust-fmt.h: Update interface with new FFI bindings.
libgrust/ChangeLog:
* libformat_parser/src/lib.rs: Add IntoFFI trait.
* libformat_parser/libformat-parser.h: Removed.
Arthur Cohen [Mon, 29 Jan 2024 15:17:00 +0000 (16:17 +0100)]
git: Ignore libgrust build folders
ChangeLog:
* .gitignore: Add libgrust target folders to the ignore list.
Arthur Cohen [Mon, 29 Jan 2024 15:14:13 +0000 (16:14 +0100)]
libformat_parser: Start experimenting with cbindgen
libgrust/ChangeLog:
* libformat_parser/cbindgen.toml: New file.
* libformat_parser/libformat-parser.h: New file.
gcc/rust/ChangeLog:
* ast/rust-fmt.h: Add remaining FFI types.
Arthur Cohen [Mon, 29 Jan 2024 15:13:24 +0000 (16:13 +0100)]
libformat_parser: Add FFI safe interface
libgrust/ChangeLog:
* libformat_parser/generic_format_parser/src/lib.rs: Add generic
library.
* libformat_parser/src/lib.rs: Add base for FFI interface.
Arthur Cohen [Thu, 30 Nov 2023 13:11:41 +0000 (14:11 +0100)]
libgrust: Add format_parser library
Compile libformat_parser and link to it.
gcc/rust/ChangeLog:
* Make-lang.in: Compile libformat_parser.
* ast/rust-fmt.cc: New FFI definitions.
* ast/rust-fmt.h: Likewise.
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Call
into libformat_parser.
* expand/rust-macro-builtins.h: Define format_args!() handler proper.
libgrust/ChangeLog:
* libformat_parser/Cargo.lock: New file.
* libformat_parser/Cargo.toml: New file.
* libformat_parser/generic_format_parser/Cargo.toml: New file.
* libformat_parser/generic_format_parser/src/lib.rs: New file.
* libformat_parser/src/bin.rs: New file.
* libformat_parser/src/lib.rs: New file.
Arthur Cohen [Thu, 9 Nov 2023 17:32:52 +0000 (18:32 +0100)]
fmt: Start working on format_args!() parser
This commit adds a base class for parsing the various constructs of a
Rust format string, according to the grammar in the reference:
https://doc.rust-lang.org/std/fmt/index.html#syntax
gcc/rust/ChangeLog:
* Make-lang.in: Compile rust-fmt object
* ast/rust-fmt.cc: New file.
* ast/rust-fmt.h: New file.
Marc Poulhiès [Mon, 19 Feb 2024 21:52:29 +0000 (22:52 +0100)]
gccrs: minor cleanup in langhook.type_for_mode
gcc/rust/ChangeLog:
* rust-lang.cc (grs_langhook_type_for_mode): simplify code for
xImode. Add missing long_double_type_node.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Owen Avery [Sun, 18 Feb 2024 05:19:25 +0000 (00:19 -0500)]
Fix false positive for top-level AltPattern
gcc/rust/ChangeLog:
* hir/rust-ast-lower-pattern.cc
(ASTLoweringPattern::visit):
Reset is_let_top_level while visiting GroupedPattern.
gcc/testsuite/ChangeLog:
* rust/compile/let_alt.rs: Check for false positive.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Marc Poulhiès [Mon, 19 Feb 2024 21:36:39 +0000 (22:36 +0100)]
gccrs: fix powif64 intrinsic
The signature was incorrectly using an i64 for the integer power,
instead of an i32.
gcc/testsuite/ChangeLog:
* rust/compile/torture/intrinsics-math.rs: Adjust powif64
intrinsic signature.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Pierre-Emmanuel Patry [Tue, 28 Nov 2023 12:40:55 +0000 (13:40 +0100)]
libgrust: Add entry for maintainers
ChangeLog:
* MAINTAINERS: Add maintainers for libgrust.
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Add libgrust.
(cherry picked from commit
e4f0eb725d836ef0eec780cbb9e7be0d31c6fe8b )
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Pierre-Emmanuel Patry [Tue, 28 Nov 2023 12:39:35 +0000 (13:39 +0100)]
libgrust: Add ChangeLog file
libgrust/ChangeLog:
* ChangeLog: New file.
(cherry picked from commit
a857ec6aada08d8c334c389c7b682198d749b6c9 )
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Jakub Jelinek [Thu, 15 Feb 2024 12:55:49 +0000 (13:55 +0100)]
gccrs: Avoid *.bak suffixed tests - use dg-skip-if instead
On Fri, Feb 09, 2024 at 11:03:38AM +0100, Jakub Jelinek wrote:
> On Wed, Feb 07, 2024 at 12:43:59PM +0100, arthur.cohen@embecosm.com wrote:
> > This patch introduces one regression because generics are getting better
> > understood over time. The code here used to apply generics with the same
> > symbol from previous segments which was a bit of a hack with out limited
> > inference variable support. The regression looks like it will be related
> > to another issue which needs to default integer inference variables much
> > more aggresivly to default integer.
> >
> > Fixes #2723
> > * rust/compile/issue-1773.rs: Moved to...
> > * rust/compile/issue-1773.rs.bak: ...here.
>
> Please don't use such suffixes in the testsuite.
> Either delete the testcase, or xfail it somehow until the bug is fixed.
To be precise, I have scripts to look for backup files in the tree (*~,
*.bak, *.orig, *.rej etc.) and this stands in the way several times a day.
Here is a fix for that in patch form, tested on x86_64-linux with
make check-rust RUNTESTFLAGS='compile.exp=issue-1773.rs'
2024-02-15 Jakub Jelinek <jakub@redhat.com>
* rust/compile/issue-1773.rs.bak: Rename to ...
* rust/compile/issue-1773.rs: ... this. Add dg-skip-if directive.
Sahil Yeole [Thu, 15 Feb 2024 20:48:44 +0000 (02:18 +0530)]
Update copyright years.
Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
Sahil Yeole [Thu, 15 Feb 2024 20:45:17 +0000 (02:15 +0530)]
contrib: Add libgrust to update-copyright.py script
contrib/ChangeLog:
* update-copyright.py: Add libgrust folder.
Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
0xn4utilus [Wed, 14 Feb 2024 16:49:15 +0000 (22:19 +0530)]
Add variadic check on function params
gcc/rust/ChangeLog:
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Add variadic check on all parameters.
gcc/testsuite/ChangeLog:
* rust/compile/issue-2850.rs: New test.
Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
Owen Avery [Mon, 12 Feb 2024 23:20:19 +0000 (18:20 -0500)]
Fix lookup of TuplePattern sub-pattern types
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit):
Lookup type of sub-pattern, not tuple pattern itself.
gcc/testsuite/ChangeLog:
* rust/compile/issue-2847-b.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Marc Poulhiès [Sun, 22 Oct 2023 16:52:22 +0000 (18:52 +0200)]
gccrs: add powi intrinsics
gcc/rust/ChangeLog:
* backend/rust-builtins.cc
(BuiltinsContext::register_rust_mappings): Add powi and reformat.
* backend/rust-builtins.h: Add missing copyright header.
gcc/testsuite/ChangeLog:
* rust/compile/torture/intrinsics-math.rs: Adjust pow test, add
test for powi.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Arthur Cohen [Wed, 7 Feb 2024 08:27:11 +0000 (09:27 +0100)]
gccrs: Add testcase for #[rustc_const_stable]
To ensure we don't introduce regressions back to issue #2314
gcc/testsuite/ChangeLog:
* rust/compile/rustc_const_stable.rs: New test.
Arthur Cohen [Tue, 6 Feb 2024 16:26:23 +0000 (17:26 +0100)]
expand: Fix formatting for "macro not found" error
gcc/rust/ChangeLog:
* expand/rust-macro-expand.h (struct MacroExpander): Nitpick: fix
formatting of emitted error.
Owen Avery [Wed, 21 Jun 2023 14:26:30 +0000 (10:26 -0400)]
Fix rebinding imports
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-item.cc
(flatten_glob): Use Import class.
(flatten_rebind): Likewise.
(flatten_list): Likewise.
(flatten): Likewise.
(flatten_use_dec_to_paths): Likewise.
(flatten_use_dec_to_imports): Likewise.
(ResolveItem::visit): Likewise.
(Import::add_prefix): New.
(rust_flatten_nested_glob): Adjust test.
(rust_flatten_glob): Likewise.
(rust_flatten_rebind_none): Likewise.
(rust_flatten_rebind): Likewise.
(rust_flatten_rebind_nested): Likewise.
(rust_flatten_list): Likewise.
* resolve/rust-ast-resolve-item.h
(class Import): New.
gcc/testsuite/ChangeLog:
* rust/compile/use_2.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Arthur Cohen [Tue, 6 Feb 2024 16:01:46 +0000 (17:01 +0100)]
gccrs: Add testcase for matches!() macro
This adds a testcase for issue #2129.
gcc/testsuite/ChangeLog:
* rust/execute/torture/matches_macro.rs: New test.
Arthur Cohen [Wed, 7 Feb 2024 14:42:18 +0000 (15:42 +0100)]
gccrs: Fix typo in RegionConstraints instance
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-implitem.h: Fix typo in field
(region_costraints -> region_constraints).
Kushal Pal [Fri, 26 Jan 2024 13:05:59 +0000 (18:35 +0530)]
Fix macro parsing for trait items.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_trait_item):
Handle macros in trait items similar to how its handled for trait
implementation items.
Signed-off-by: Kushal Pal <kushalpal109@gmail.com>