aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-03-19libstdc++: Activate a __cpp_lib_ranges_to_container dependent testFrançois Dumont1-3/+1
Now that std::set has support for __cpp_lib_ranges_to_container we can activate a test using it in a fancy allocator pointer context. libstdc++-v3/ChangeLog * testsuite/23_containers/set/requirements/explicit_instantiation/alloc_ptr.cc: Activate the template member tests involving __cpp_lib_ranges_to_container support. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-03-19libstdc++: Make <stdbit.h> test use <climits> instead of <limits.h>Jonathan Wakely1-1/+1
Our <climits> ensures that LLONG_MIN, LLONG_MAX, and ULLONG_MAX are defined even if the C library's <limits.h> doesn't define them. Our <limits.h> then includes <climits>, which should mean that <limits.h> and <climits> always define the same macros. However, we only install our own version of <limits.h> for --enable-cheaders=c and not for the default --enable-cheaders=c_global setting that everybody uses. This means that if the C library's <limits.h> is not C++-aware, or if the C library doesn't provide it and GCC's own gcc/glimits.h is used instead, then <climits> defines the macros for long long types but <limits.h> does not. This causes the new 20_util/stdbit/1.cc test to fail for arm-non-eabi because it uses gcc/glimits.h which is not C++-aware, only checking __STDC_VERSION__ when deciding whether to declare the long long macros. If gcc/glimits.h also checked __cplusplus it would be OK, and we would not need our own <limits.h> to be installed. This commit just changes the new test to use <climits> instead of <limits.h>, but we should ensure that gcc/glimits.h is made to work (i.e. define the long long macros) for C++, and/or install our own <limits.h> for the --enable-cheaders=c_global configuration. libstdc++-v3/ChangeLog: * testsuite/20_util/stdbit/1.cc: Include <climits> instead of <limits.h>.
2025-03-19[PR119270][IRA]: Ignore equiv init insns for cost calculation for invariants ↵Vladimir N. Makarov1-6/+9
only My previous patch for PR114991 contains code ignoring equiv init insns for increasing cost of usage the equivalence. Although common sense says it is right thing to do, this results in more aggressive usage of memory equivalence and significant performance degradation of SPEC2017 cactuBSSM. Given patch restores previous cost calculation for all equivalences except for invariant ones. gcc/ChangeLog: PR target/119270 * ira-costs.cc (calculate_equiv_gains): Ignore equiv init insns only for invariants.
2025-03-19Update gcc fr.poJoseph Myers1-741/+537
* fr.po: Update.
2025-03-19diagnostics: fix crash in urlifier with -Wfatal-errors [PR119366]David Malcolm8-34/+74
diagnostic_context's dtor assumed that it owned the m_urlifier pointer and would delete it. As of r15-5988-g5a022062d22e0b this isn't always the case - auto_urlify_attributes is used in various places in the C/C++ frontends and in the middle-end to temporarily override the urlifier with an on-stack instance, which would lead to delete-of-on-stack-buffer crashes with -Wfatal-errors as the global_dc was cleaned up. Fix by explicitly tracking the stack of urlifiers within diagnostic_context, tracking for each node whether the pointer is owned or borrowed. gcc/ChangeLog: PR c/119366 * diagnostic-format-sarif.cc (test_message_with_embedded_link): Convert diagnostic_context from one urlifier to a stack of urlifiers, where each node in the stack tracks whether the urlifier is owned or borrowed. * diagnostic.cc (diagnostic_context::initialize): Likewise. (diagnostic_context::finish): Likewise. (diagnostic_context::set_urlifier): Delete. (diagnostic_context::push_owned_urlifier): New. (diagnostic_context::push_borrowed_urlifier): New. (diagnostic_context::pop_urlifier): New. (diagnostic_context::get_urlifier): Reimplement in terms of stack. (diagnostic_context::override_urlifier): Delete. * diagnostic.h (diagnostic_context::set_urlifier): Delete decl. (diagnostic_context::override_urlifier): Delete decl. (diagnostic_context::push_owned_urlifier): New decl. (diagnostic_context::push_borrowed_urlifier): New decl. (diagnostic_context::pop_urlifier): New decl. (diagnostic_context::get_urlifier): Make return value const; hide implementation. (diagnostic_context::m_urlifier): Replace with... (diagnostic_context::urlifier_stack_node): ... this and... (diagnostic_context::m_urlifier_stack): ...this. * gcc-urlifier.cc (auto_override_urlifier::auto_override_urlifier): Reimplement. (auto_override_urlifier::~auto_override_urlifier): Reimplement. * gcc-urlifier.h (class auto_override_urlifier): Reimplement. (auto_urlify_attributes::auto_urlify_attributes): Update for pass-by-reference. * gcc.cc (driver::global_initializations): Update for reimplementation of urlifiers in terms of a stack. * toplev.cc (general_init): Likewise. gcc/testsuite/ChangeLog: PR c/119366 * gcc.dg/Wfatal-bad-attr-pr119366.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-03-19c: pedwarn on flexible array member initialization with {} for C23+ [PR119350]Jakub Jelinek4-6/+53
Even in C23/C2Y any initialization of flexible array member is still invalid, so we should emit a pedwarn on it. But we no longer do for initialization with {}. The reason is that for C17 and earlier, we already emitted a pedwarn on the {} initializer and so emitting another pedwarn on the flexible array member initialization would be diagnosing the same thing multiple times. In C23 we no longer pedwarn on {}, it is standard. The following patch arranges a pedwarning for that for C23+, so that at least one pedwarning is emitted. So that we don't "regress" from C17 to C23 on nested flexible array member initialization with no -pedantic/-pedantic-errors/-Wpedantic, the patch emits even the initialization of flexible array member in a nested context diagnostic as pedwarn in the {} case, after all, it doesn't cause much trouble, we just ignore it like before, it wouldn't initialize anything. 2025-03-19 Jakub Jelinek <jakub@redhat.com> PR c/119350 * c-typeck.cc (pop_init_level): Don't ignore empty brackets for flag_isoc23, still set constructor_type to NULL in that case but emit a pedwarn_init in that case. * gcc.dg/pr119350-1.c: New test. * gcc.dg/pr119350-2.c: New test. * gcc.dg/pr119350-3.c: New test.
2025-03-19testsuite/113634 - fixup declarations of calloc/reallocRichard Biener1-3/+3
Then we can also remove the added -std=gnu17 PR testsuite/113634 * gcc.dg/Wfree-nonheap-object-7.c: Adjust calloc and realloc declarations, remove -std=gnu17.
2025-03-19Fix formatting of version message for gnat driverEric Botcazou1-3/+4
Like the main driver (as well as gccgo, gccrs, gcov, etc) the gnat driver prints the standard version message in response to the --version switch, but it is not properly formatted. gcc/ada * gnatvsn.adb (Gnat_Free_Software): Fix message formatting.
2025-03-19s390: testsuite: Fix autovec-double-signaling-eq-z13.cStefan Schulze Frielinghaus1-1/+1
Since r15-3992-g698e0ec89bc096 we optimize x<=y && x>=y to x==y. Honour signaling NaNs by using option -fsignaling-nans in order to prevent this. gcc/testsuite/ChangeLog: * gcc.target/s390/zvector/autovec-double-signaling-eq-z13.c: Honour sNaNs.
2025-03-19s390: testsuite: Fix vcond-shift.cStefan Schulze Frielinghaus1-6/+6
Previously we optimized expressions of the form a < 0 ? -1 : 0 to (signed)a >> 31 during vcond expanding. Since r15-1638-gaac00d09859cc5 this is done in match.pd. The implementation in the back end as well as in match.pd are basically the same but still distinct. For the tests in vcond-shift.c the back end emitted (xx - (xx >> 31)) >> 1 whereas now via match.pd ((int) ((unsigned int) xx >> 31) + xx) >> 1 which is basically the same. We just have to adapt the scan-assembler directives w.r.t. signed/unsigned shifts which is done by this patch. gcc/testsuite/ChangeLog: * gcc.target/s390/vector/vcond-shift.c: Adapt to new match.pd rule and change scan-assembler-times for shifts.
2025-03-19gccrs: Handle external static items in toplevel resolver 2.0Owen Avery2-0/+8
gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Handle ExternalStaticItem. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Use name resolver 2.0 in pattern checkerOwen Avery1-1/+15
gcc/rust/ChangeLog: * checks/errors/rust-hir-pattern-analysis.cc: Add includes. (PatternChecker::visit): Use name resolver 2.0 when enabled. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Use name resolver 2.0 for compiling break/continueOwen Avery1-4/+37
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Use name resolver 2.0 to lookup label definitions for break and continue statements when name resolution 2.0 is enabled. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Use name resolver 2.0 in const checkerOwen Avery2-4/+15
gcc/rust/ChangeLog: * checks/errors/rust-const-checker.cc: Add includes. (ConstChecker::visit): Use name resolver 2.0 to lookup function definitions when name resolution 2.0 is enabled. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Load unloaded modules during toplevel resolution 2.0Owen Avery2-1/+11
This may load conditionally compiled modules too eagerly. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Load unloaded modules before attempting to visit their items. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove issue-1089.rs. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Make const references to ForeverStack more usefulOwen Avery2-4/+102
gcc/rust/ChangeLog: * resolve/rust-forever-stack.h (ForeverStack::to_canonical_path): Make const. (ForeverStack::to_rib): Add const overload. (ForeverStack::reverse_iter): Add const overloads. (ForeverStack::ConstDfsResult): Add. (ForeverStack::dfs): Add const overload. (ForeverStack::dfs_rib): Likewise. * resolve/rust-forever-stack.hxx (ForeverStack::reverse_iter): Add const overloads. (ForeverStack::dfs): Add const overload. (ForeverStack::to_canonical_path): Make const. (ForeverStack::dfs_rib): Likewise. (ForeverStack::to_rib): Add const overload. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Use name resolver 2.0 in MarkLiveOwen Avery1-4/+27
gcc/rust/ChangeLog: * checks/lints/rust-lint-marklive.cc (MarkLive::visit_path_segment): Use name resolver 2.0 when enabled. (MarkLive::visit): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Handle const generic parameters during resolution 2.0Owen Avery2-0/+9
gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Handle ConstGenericParam. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Disambiguate generic args during name resolution 2.0Owen Avery2-0/+34
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Visit GenericArgs and GenericArg, the former because the latter involves a non-virtual member function call. * resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Fix compiler error on ast wrong implicit construct push_backbadumbatish1-1/+2
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Fix compiler error on ast wrong implicit construct push_back
2025-03-19gccrs: Provide input operand for gccrsbadumbatish5-14/+56
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_construct_inputs): Provide input operand for gccrs * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Move expr to In (expand_inline_asm_strings): Add comments to debug strings gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: Remove inout, functionality not supported. Remove redundant {} * rust/execute/torture/inline_asm_mov_x_5_ARM.rs: Add operand in * rust/execute/torture/inline_asm_mov_x_5_x86_64.rs: Likewise
2025-03-19gccrs: Use name resolver 2.0 during pattern typecheckingOwen Avery3-8/+26
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc: Add includes. (TypeCheckPattern::visit): Use name resolver 2.0 if enabled. * resolve/rust-name-resolution-context.cc (NameResolutionContext::lookup): Make const qualified. * resolve/rust-name-resolution-context.h (NameResolutionContext::lookup): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Allow identifiers and paths to reference types during nr2.0Owen Avery2-15/+24
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Allow IdentifierExpr and PathInExpression to reference types as well as values, remove ability for IdentifierExpr to reference labels. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Improve handling of InlineAsm in DefaultASTVisitorOwen Avery2-2/+40
gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit fields of InlineAsm. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove inline_asm_parse_output_operand.rs. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Insert static items into the value namespaceOwen Avery3-4/+20
gcc/rust/ChangeLog: * backend/rust-compile-item.cc (CompileItem::visit): Check canonical path of StaticItem properly when name resolution 2.0 is enabled. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert static items into the value namespace. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Rework InlineAsmOperandOwen Avery2-36/+150
Not thrilled with some of this boilerplate, but it does seem like an improvement. gcc/rust/ChangeLog: * ast/rust-expr.h (InlineAsmOperand): Replace multiple mutually-exclusive tl::optional fields with a std::unique_ptr and modify nested classes to allow this. Also, make getters return references where possible. * expand/rust-macro-builtins-asm.cc (parse_reg_operand_out): Pass location when constructing InlineAsmOperand. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Handle TypeAlias during toplevel resolution 2.0Owen Avery3-1/+10
gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Handle TypeAlias. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove type-alias1.rs. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Fix some issues with canonical path fetching in name resolution 2.0Owen Avery4-22/+132
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-enumitem.cc: Add includes. (TypeCheckEnumItem::visit): Fetch canonical paths properly when name resolution 2.0 is enabled. * typecheck/rust-hir-type-check-implitem.cc: Add includes. (TypeCheckImplItem::visit): Fetch canonical paths properly when name resolution 2.0 is enabled. * typecheck/rust-hir-type-check-item.cc: Add include. (TypeCheckItem::visit): Fetch canonical paths properly when name resolution 2.0 is enabled. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Improve Rib::Definition shadowingOwen Avery9-56/+187
gcc/rust/ChangeLog: * resolve/rust-finalize-imports-2.0.cc (GlobbingVisitor::visit): Replace calls to insert_shadowable with insert_globbed. * resolve/rust-forever-stack.h (ForeverStack::insert_globbed): Add. * resolve/rust-forever-stack.hxx (ForeverStack::insert_globbed): Add. (ForeverStack::dfs): Handle modifications to Rib::Definition fields. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Make IdentifierPattern-based declarations shadowable. * resolve/rust-name-resolution-context.cc (NameResolutionContext::insert_globbed): Add. * resolve/rust-name-resolution-context.h (NameResolutionContext::insert_globbed): Add. * resolve/rust-rib.cc (Rib::Definition::Definition): Use Rib::Definition::Mode to indicate shadowing mode instead of boolean, handle modifications to Rib::Definition fields. (Rib::Definition::is_ambiguous): Handle modifications to Rib::Definition fields. (Rib::Definition::to_string): Likewise. (Rib::Definition::Shadowable): Handle changed constructor signature. (Rib::Definition::NonShadowable): Likewise. (Rib::Definition::Globbed): Add. (Rib::insert): Handle changes to Rib::Definition fields. * resolve/rust-rib.h (Rib::Definition::Globbed): Add. (Rib::Definition::ids): Remove. (Rib::Definition::ids_shadowable): Add. (Rib::Definition::ids_non_shadowable): Add. (Rib::Definition::ids_globbed): Add. (Rib::Definition::get_node_id): Handle modifications to Rib::Definition fields. (Rib::Definition::Mode): Add. (Rib::Definition::Definition): Use Rib::Definition::Mode to indicate shadowing mode instead of boolean. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove shadow1.rs. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-19gccrs: Fix ICE when typechecking non-trait item when we expect onePhilip Herron5-17/+46
We just had an assertion here for this case where we expect a trait. This changes the assertion into error handling producing the correct error code with fixit suggestion like rustc. Fixes #2499 gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait): use error handling instead of assertion * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): reuse trait reference * typecheck/rust-hir-type-check-item.h: update prototype gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-2499.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-19gccrs: Add test case to show ICE is fixedPhilip Herron2-0/+4
This was resolved in: 18422c9c386 which was missing the name resolution step for unit-types. Fixes #2203 gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: * rust/compile/issue-2203.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-19gccrs: add test case to show impl block on ! worksPhilip Herron2-0/+14
The resolution with ! was fixed in: 09cfe530f9c this adds a test case to show the other issue is also fixed. Fixes #2951 gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 is crashing here * rust/compile/issue-2951.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-19rust: fix ICE during name resolution for impls on unit-typesPhilip Herron4-0/+26
The canonical paths need to support unit-types which are technically a TupleType with no fields. This handles this case and adds an unreachable. Fixes #3036 gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit): add unit-type catch * resolve/rust-ast-resolve-type.h: likewise gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-3036.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-19rust: Add support for Clone and Copy derive on generic typesPhilip Herron16-22/+783
When we generate derivations for Copy and Clone we need to make sure the associated impl block sets up the generic parameters and arguments correctly. This patch introduces the framework to copy chunks of the AST because we need to make sure these new AST nodes have their own associated id, calling clone on the nodes will just confuse name-resolution and subsequent mappings. Fixes #3139 gcc/rust/ChangeLog: * Make-lang.in: new objects * ast/rust-ast-builder.cc (Builder::generic_type_path_segment): new helper (Builder::single_generic_type_path): likewise (Builder::new_type): likewise (Builder::new_lifetime_param): likewise (Builder::new_type_param): likewise (Builder::new_lifetime): likewise (Builder::new_generic_args): likewise * ast/rust-ast-builder.h: new helper decls * ast/rust-ast.h: new const getters * ast/rust-path.h: likewise * ast/rust-type.h: likewise * expand/rust-derive-clone.cc (DeriveClone::clone_impl): take the types generics (DeriveClone::visit_tuple): likewise (DeriveClone::visit_struct): likewise (DeriveClone::visit_union): likewise * expand/rust-derive-clone.h: update header * expand/rust-derive-copy.cc (DeriveCopy::copy_impl): similarly take type generics (DeriveCopy::visit_struct): likewise (DeriveCopy::visit_tuple): likewise (DeriveCopy::visit_enum): likewise (DeriveCopy::visit_union): likewise * expand/rust-derive-copy.h: likewse * ast/rust-ast-builder-type.cc: New file. * ast/rust-ast-builder-type.h: New file. gcc/testsuite/ChangeLog: * rust/compile/issue-3139-1.rs: New test. * rust/compile/issue-3139-2.rs: New test. * rust/compile/issue-3139-3.rs: New test. * rust/compile/nr2/exclude: these all break nr2
2025-03-19gccrs: Remove some passing test from nr2 passing listPierre-Emmanuel Patry1-4/+0
gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove cast_generics.rs, issue-1131.rs, issue-1383.rs and unsafe10.rs Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Postpone break on error after name resolutionPierre-Emmanuel Patry1-3/+3
We need the top level to run at least once before breaking because it will be required by the other name resolution steps. gcc/rust/ChangeLog: * rust-session-manager.cc (Session::expansion): Break on error after top level name resolution. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Resolve TypeParam with name resolution 2.0Pierre-Emmanuel Patry2-0/+20
Resolve TypeParam unless it is Self. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Resolve TypeParam. * resolve/rust-toplevel-name-resolver-2.0.h: Add visit function prototype. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Add box definition to avoid errorPierre-Emmanuel Patry1-0/+2
Box definition is part of the standard library and cannot be found during name resolution. This simple definition prevent any error from being emitted. gcc/testsuite/ChangeLog: * rust/compile/box_syntax_feature_gate.rs: Add box land item definition. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: This test requires the standard libraryPierre-Emmanuel Patry1-0/+1
It requires the standard library and Copy to work correctly which we cannot provide. Stopping the compiler before the name resolution allow us to prevent an error whilst resolving Copy and keep the test's goal. gcc/testsuite/ChangeLog: * rust/compile/functions_without_body.rs: Add compile step argument. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Make node id getter const.Pierre-Emmanuel Patry1-1/+1
gcc/rust/ChangeLog: * ast/rust-ast.h: Node id getter could be const. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Change resolved type segmentPierre-Emmanuel Patry2-2/+12
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.h: Add visit function prototype. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change resolved type segment. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Update exclude list with working testsPierre-Emmanuel Patry1-26/+1
gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove working tests from nr2 exclude list. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Do not assert insertion resultPierre-Emmanuel Patry1-3/+3
We might have some duplicated name in some pattern and we should therefore not assert the non duplication of identifiers. gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove assertion and explicitely tells why we ignore the insertion result. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Move bir builder function implementationPierre-Emmanuel Patry3-251/+283
Move function implementation to their own file. gcc/rust/ChangeLog: * Make-lang.in: Add new rust-bir-builder-pattern file. * checks/errors/borrowck/rust-bir-builder-pattern.h: Remove implementation. * checks/errors/borrowck/rust-bir-builder-pattern.cc: New file. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Move failing test to xfailPierre-Emmanuel Patry1-1/+2
We want to begin experimenting with this new name resolution 2.0 algorithm as soon as possible. This test highlight a problem where the compiler should emit an error and should be fixed soon. gcc/testsuite/ChangeLog: * rust/compile/name_resolution21.rs: Move to... * rust/compile/xfail/name_resolution21.rs: ...here. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Make AST default visitor visit functions publicPierre-Emmanuel Patry1-1/+0
Make those functions public so they can be used within a lambda on GCC 4.8. gcc/rust/ChangeLog: * ast/rust-ast-visitor.h: Make visit functions public. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Add default resolver parent functions by defaultPierre-Emmanuel Patry1-0/+2
gcc/rust/ChangeLog: * resolve/rust-finalize-imports-2.0.h: Add parent member functions from default resolver. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Change lambda content with default visitor callPierre-Emmanuel Patry1-70/+13
We can reduce code duplication by using the default visitor functions from within the scoped lambda function. gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Use default visitor instead. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Remove regular visit codePierre-Emmanuel Patry2-123/+3
Regular visit code can be replaced with default visit functions. gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove default visit code and replace it with call to default visitor. * resolve/rust-default-resolver.h: Remove removed function's prototypes. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2025-03-19gccrs: Remove empty visit functionsPierre-Emmanuel Patry2-336/+1
We can let the default visitor visit those nodes anyway so we're sure all nodes can be reached. gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove empty visit function implementations. * resolve/rust-default-resolver.h: Remove corresponding prototypes. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>