[COMMITTED 075/146] gccrs: nr2.0: Resolve lang item paths properly.

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): New. * resolve/rust-late-name-resolver-2.0.h: New. --- .../resolve/rust-late-name-resolver-2.0.cc| 20 +++ .../resolve/rust-late-name-resolver-2.0.h | 1 + 2 f

[COMMITTED 112/144] gccrs: Do not assert insertion result

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry 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

[COMMITTED 022/146] gccrs: fix ICE for placeholder which is not setup

2025-03-24 Thread arthur . cohen
From: Philip Herron We can have a case where the placeholder is not configred and the can_resolve check is not detecting this case which can lead to ICE. gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (PlaceholderType::can_resolve): check for empty mappings Signed-off-by: Philip Herron

[Bug rust/116561] [15 regression] gcc/testsuite/rust/execute/torture/iter1.rs:350:5: internal compiler error: 'verify_gimple' failed since r15-3328-g673a448aa24efedd5ac140ebf7bfe652d7a6a846

2025-03-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116561 Andrew Pinski changed: What|Removed |Added Resolution|--- |FIXED Status|NEW

[COMMITTED 122/141] gccrs: remove visitor which is not needed here

2025-03-24 Thread arthur . cohen
From: Philip Herron Just a small refactor to remove a visitor which is not needed. gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (ResolvePathRef::Compile): remove visitor (ResolvePathRef::ResolvePathRef): likewise (ResolvePathRef::visit): likewise *

[COMMITTED 123/141] gccrs: track DefId on ADT Types this could be useful information

2025-03-24 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): track DefId of origin * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): likewise (ADTType::ADTType): likewise (ADTType::get_id): likewise (ADTT

[COMMITTED 074/141] gccrs: add diagnostic for E0229 no associated type arguments allowed here

2025-03-24 Thread arthur . cohen
From: Philip Herron It seems bounds in qualified paths are not allowed to specify associated type bindings because its going to be associated with the impl block anyway. Fixes Rust-GCC#2369 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-base.h: add flag * typecheck/rust-hi

[COMMITTED 092/141] gccrs: derive(PartialEq): Also derive StructuralPartialEq

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-partial-eq.cc: Adapt signatures to generate two impls. * expand/rust-derive-partial-eq.h: Likewise. * expand/rust-derive.cc (DeriveVisitor::derive): Adapt to multiple item generation. gcc/testsuite/ChangeLog:

[COMMITTED 115/141] gccrs: nr2.0: Set the node id of the root node

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.h (ForeverStack::ForeverStack): Set the node id of the root node to that of the current crate. * resolve/rust-forever-stack.hxx (ForeverStack::find_starting_point): Use the node id of the ro

[COMMITTED 027/146] gccrs: typecheck: Remove unused parameter in TyTyCheckCallExpr

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * typecheck/rust-tyty-call.h: Remove unused context member. --- gcc/rust/typecheck/rust-tyty-call.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/rust/typecheck/rust-tyty-call.h b/gcc/rust/typecheck/rust-tyty-call.h in

[COMMITTED 081/141] gccrs: nr2.0: Resolve paths which start with Self

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx (ForeverStack::find_starting_point): Be more careful about applying ForeverStack::find_closest_module. (ForeverStack::resolve_segments): Allow traversal into parent nodes when not in a m

[COMMITTED 068/141] gccrs: remove bad type checking diagnostic

2025-03-24 Thread arthur . cohen
From: Philip Herron This was a bad diagnostic added when I was working on slices and iterators also the name of the function is also bad. This is all about setting up associated types based on the current context of the bounds assocated with the associated trait bounds on this function. The tell

[COMMITTED 134/141] gccrs: emit an error for type or const parameters on foreign items

2025-03-24 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): emit an error for type or const parameters on foreign items gcc/testsuite/ChangeLog: * rust/compile/extern_generics.rs

[COMMITTED 137/141] gccrs: nr2.0: Adjust visitors for struct expressions

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Make sure to always visit the struct name. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Avoid visiting the struct name twice. gcc/testsuite/ChangeLog:

[COMMITTED 140/141] gccrs: nr2.0: Fix StructExprFieldIdentifier handling

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add visitor for StructExprFieldIdentifier. * resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude:

[COMMITTED 138/141] gccrs: Modify multiple definition error

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Modify error message. * resolve/rust-ast-resolve-implitem.h (ResolveToplevelImplItem::visit): Likewise. (ResolveTopLevelTraitItems::visit): Likewise. (Res

[COMMITTED 136/141] gccrs: Prevent multiple resolution insertion

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::clone_impl): Avoid using the same node id multiple times. (DeriveClone::clone_enum_identifier): Likewise. (DeriveClone::clone_enum_tuple): Likewise. * expand/rust-deri

[COMMITTED 135/141] gccrs: nr2.0: Fix test self-path2.rs

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Adjust the error message for a lower self segment in the middle of a path. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. gcc

[COMMITTED 129/141] gccrs: Insert crate name in canonical path

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx: Insert a new segment with the crate's name as canonical's path prefix. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/resolve/rust-forever-stack.hxx | 7 ++- 1 file changed, 6 insertions(+

[COMMITTED 133/141] gccrs: Fix modules with same name as builtins causing ICE (#3315)

2025-03-24 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * resolve/rust-forever-stack.h (ForeverStack): Add a dedicated prelude node for the Language prelude * resolve/rust-forever-stack.hxx (ForeverStack): Add support code for the prelude node * resolve/rust-late-name-re

[COMMITTED 132/141] gccrs: nr2.0: Check compile/torture/*.rs tests

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/nr2/compile.exp: Adjust to cover tests in the torture subdirectory. * rust/compile/nr2/exclude: Add entries. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/nr2/compile.exp | 6 ++ gcc/testsuite/rus

[COMMITTED 139/141] gccrs: nr2.0: Adjust indentifier expression handling

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Make sure to return early after a resolution error, improve the resolution error message, fix a typo, handle ambiguous resolutions, and remove an old comment. gcc/testsui

[COMMITTED 100/141] gccrs: derive(Hash): Add implementation.

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * Make-lang.in: Compile it. * expand/rust-derive.cc (DeriveVisitor::derive): Call it. * expand/rust-derive-hash.cc: New file. * expand/rust-derive-hash.h: New file. gcc/testsuite/ChangeLog: * rust/compile/derive-has

[COMMITTED 099/141] gccrs: derive(Debug): Use builder's ptrify function instead

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-debug.cc (ptrify): Remove function. --- gcc/rust/expand/rust-derive-debug.cc | 8 1 file changed, 8 deletions(-) diff --git a/gcc/rust/expand/rust-derive-debug.cc b/gcc/rust/expand/rust-derive-debug.cc index f3754745

[COMMITTED 127/141] gccrs: Remove finalize import visitor

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry This visitor is not used anymore. gcc/rust/ChangeLog: * resolve/rust-finalize-imports-2.0.cc (FinalizeImports::FinalizeImports): Remove constructor. (FinalizeImports::go): Remove function. (FinalizeImports::visit): Likewise. *

[COMMITTED 125/141] gccrs: Move import mapping resolution to in tree visit

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Import mapping was relying on resolve_path which in turn relies on the cursor function. This means the mapping resolver should be called from the correct scope instead of being called from the crate scope. gcc/rust/ChangeLog: * resolve/rust-early-name-resolve

[COMMITTED 126/141] gccrs: Remove tests from exclusion list

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove issue-1786 and issue-3033 from exclusion list. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/nr2/exclude | 2 -- 1 file changed, 2 deletions(-) diff --git a/gcc/tests

[COMMITTED 120/141] gccrs: Add a test for enum variant name resolution

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Highlight the fact that a value inside an enum definition refers to a struct outside of the enum and not to the enum variant's name directly. gcc/testsuite/ChangeLog: * rust/compile/enum_variant_name.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- g

[COMMITTED 064/141] gccrs: nr2.0: Resolve instances of TypePath more accurately

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * util/rust-unwrap-segment.cc: New file. * util/rust-unwrap-segment.h: New file. * Make-lang.in: Add rust-unwrap-segment.o to the object list. * resolve/rust-forever-stack.hxx: Include rust-unwrap-segment.h. (ForeverSta

[COMMITTED 096/141] gccrs: Fix expansion of macros inside modules

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Override DefaultASTVisitor in order to expand a module's items, rather than directly visit them. * expand/rust-expand-visitor.h (ExpandVisitor::visit): Add overrid

[COMMITTED 039/146] gccrs: Fix FnParam pattern location ternary logic

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Condition was inverted, we should retrieve the locus only if we have a pattern. gcc/rust/ChangeLog: * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Do not get a reference if the pattern does not exist. (TypeCheckMethodCallExpr::check

[COMMITTED 062/141] gccrs: Add warning about default visitor usage

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry We already lost some time on this unusual pattern, a comment will hopefully prevent this from happening again. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add warning about current code. Signed-off-by: Pierre-E

[COMMITTED 112/141] gccrs: Reduce usage of rust-session-manager.h

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * util/rust-edition.cc: New file. * util/rust-edition.h: New file. * Make-lang.in: Add rust-edition.o to the object list. * ast/rust-pattern.cc: Remove inclusion of rust-session-manager.h. * expand/rust-macro-e

[COMMITTED 110/141] gccrs: lower: Error out when lowering ErrorPropagationExpr

2025-03-24 Thread arthur . cohen
From: Arthur Cohen Adapt functions for lowering nodes that should never reach the lowering phase to cause an unreachable, and mark them as final so as it not possible to override them in other visitors. gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc: Adapt functions for ErrorPropaga

[COMMITTED 050/141] gccrs: ast: builder: Add Return expression builder

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.h: Declare it. * ast/rust-ast-builder.cc (Builder::return_expr): Define it. --- gcc/rust/ast/rust-ast-builder.cc | 7 +++ gcc/rust/ast/rust-ast-builder.h | 4 2 files changed, 11 insertions(+) diff --git a/

[COMMITTED 121/141] gccrs: Fix some small issues

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (assume_handler): Fix copy/paste error. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Fix spelling mistake. Signed-off-by: Owen Avery --- gcc/rust/backend/rust-comp

[COMMITTED 107/141] gccrs: nr2.0: Handle lang item type path segments

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx (ForeverStack::find_starting_point): Stop when hitting a lang item segment. (ForeverStack::resolve_segments): Resolve lang item segments. (ForeverStacl::resolve_path): Handle single segm

[COMMITTED 118/141] gccrs: Add enum variant string information to definition

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry New enum variant status now appears in the string representation of the resolver's definition. gcc/rust/ChangeLog: * resolve/rust-rib.cc (Rib::Definition::to_string): Add enum variant status. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/resolv

[COMMITTED 071/141] gccrs: add variant_count intrinsic

2025-03-24 Thread arthur . cohen
From: Philip Herron Addresses Rust-GCC#3348 gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (variant_count_handler): new intrinsic gcc/testsuite/ChangeLog: * rust/execute/torture/enum_intrinsics2.rs: New test. Signed-off-by: Philip Herron --- gcc/rust/backend/rust-

[COMMITTED 119/141] gccrs: Remove nr2 exhaustiveness test from exclusion list

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove test. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/nr2/exclude | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust

[COMMITTED 117/141] gccrs: Keep definition provenance to skip enum variants

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Enum variants shouldn't be accessed directly even from within an enum. This commit keeps the provenance for enum variants definition so we can skip them when resolving a value within an enum definition. gcc/rust/ChangeLog: * resolve/rust-forever-stack.h: Add

[COMMITTED 104/141] gccrs: lower: Always crash when lowering macro invocations

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add base implementation for visitor. --- gcc/rust/hir/rust-ast-lower-base.cc | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/rust/hir/rust-ast-lower

[COMMITTED 101/141] gccrs: hir-dump: Fix more segfaults in the HIR dump

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/rust-hir-dump.cc: Check unique_ptr members are present before visiting them. * hir/tree/rust-hir-path.h: Add `has_{type, trait}` methods to QualifiedPathInType. --- gcc/rust/hir/rust-hir-dump.cc | 19 ++

[COMMITTED 109/141] gccrs: ast: Add base for desugaring try expressions

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * Make-lang.in: Compile it. * ast/rust-desugar-question-mark.cc: New file. * ast/rust-desugar-question-mark.h: New file. gcc/testsuite/ChangeLog: * rust/compile/try-expr1.rs: New test. --- gcc/rust/Make-lang.in

[COMMITTED 069/141] gccrs: Get rid of duplicate interface gccrs#3396

2025-03-24 Thread arthur . cohen
From: GS-GOAT <86884129+gs-g...@users.noreply.github.com> gcc/rust/ChangeLog: * typecheck/rust-autoderef.cc (insert_implicit_type): Update single-parameter call to pass explicit HirId. * typecheck/rust-hir-type-check-expr.cc: Same. * typecheck/rust-hir-type

[COMMITTED 088/141] gccrs: ast-builder: Add new methods for creating operator expressions

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::literal_bool): New method. (Builder::comparison_expr): Likewise. (Builder::boolean_operation): Likewise. * ast/rust-ast-builder.h: Declare them. --- gcc/rust/ast/rust-ast-builder.cc | 46 +

[COMMITTED 063/141] gccrs: inline-asm: Fix some warnings

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (strip_double_quotes): Special case empty strings ("\"\""). (parse_reg_operand): Remove use of the `struct` keyword. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Like

[COMMITTED 093/141] gccrs: derive(Eq): Also derive StructuralEq

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-eq.cc: Adapt functions to return two generated impls. * expand/rust-derive-eq.h: Likewise. * expand/rust-derive.cc (DeriveVisitor::derive): Likewise. --- gcc/rust/expand/rust-derive-eq.cc | 68 +

[COMMITTED 040/141] gccrs: Add option_env! support

2025-03-24 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * expand/rust-macro-builtins-utility.cc: Add macro expansion for option_env with eager expansion * expand/rust-macro-builtins.cc: Add option_env to builtin list * expand/rust-macro-builtins.h: Add option_env handler to header

[COMMITTED 098/141] gccrs: ast: builder: Add new builder methods

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::statementify): New. (Builder::function): Add generic params optional argument. (Builder::path_in_expression): Add opening_scope_resolution optional argument. (Builder::block): Add function

[COMMITTED 087/141] gccrs: ast-builder: Improve function generation.

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::block): Change return type. (Builder::loop): Use new APIs. * ast/rust-ast-builder.h: Change return type of block functions. --- gcc/rust/ast/rust-ast-builder.cc | 22 +++--- gcc/ru

[COMMITTED 130/141] gccrs: Fix canonical path parent resolution

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry The algorithm was comparing using the wrong id, this lead to some mangling errors as an erroneous parent was selected. gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx: Fix the id comparison. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/resolve/ru

[COMMITTED 085/141] gccrs: nr2.0: Run DefaultResolver::visit on PathInExpression

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): When visiting a PathInExpression instance, call into DefaultResolver::visit, ensuring generic arguments are visited. gcc/testsuite/ChangeLog: * rust/compile/nr2/

[COMMITTED 090/141] gccrs: derive(PartialEq): Add partial implementation

2025-03-24 Thread arthur . cohen
From: Arthur Cohen We are still missing some deriving for enums, as part of our codegen and nameres for rebinding struct field patterns is missing. gcc/rust/ChangeLog: * expand/rust-derive-partial-eq.cc: New file. * expand/rust-derive-partial-eq.h: New file. * expand/ru

[COMMITTED 089/141] gccrs: derive(Clone): chore: Cleanup

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-clone.cc: Cleanup implementation, avoid repetitions. * expand/rust-derive-clone.h: Likewise. --- gcc/rust/expand/rust-derive-clone.cc | 34 ++-- gcc/rust/expand/rust-derive-clone.h | 8 ---

[COMMITTED 141/141] gccrs: support generic super traits recursively

2025-03-24 Thread arthur . cohen
From: Philip Herron In order to handle generic super traits on any trait bound we need to ensure we track the TypeBoundPredicate as part of the TraitReference instead of just the raw TraitReferences because these will have any applied generics enplace. Then for any TypeBoundPredicate it takes a

[COMMITTED 084/141] gccrs: nr2.0: Fix issue with external crates

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): When visiting an external crate declaration, handle failed crate name lookups. This can happen when Session::load_extern_crate fails to load a crate during the

[COMMITTED 086/141] gccrs: derive(Eq): Add implementation.

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive.cc (DeriveVisitor::derive): Call into DeriveEq. * expand/rust-derive-eq.cc: New file. * expand/rust-derive-eq.h: New file. * Make-lang.in: Compile them. gcc/testsuite/ChangeLog: * rust/compile/d

[COMMITTED 083/141] gccrs: Add comments to resolve_segments

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx (ForeverStack::resolve_segments): Add comments explaining the behaviour of a while loop. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-forever-stack.hxx | 11 +++ 1 file changed, 11 ins

[COMMITTED 128/141] gccrs: Add a function to get the crate number from node id

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::lookup_crate_num): Add function to retrieve crate number from it's node id. (Mappings::node_is_crate): change function with call to lookup_crate_num to avoid looping through all crat

[COMMITTED 113/141] gccrs: nr2.0: Make sure PathInExpression is default resolved

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Call DefaultResolver::visit earlier, in order to ensure it is called even if Late::visit returns early. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entri

[COMMITTED 124/141] gccrs: check for recursion trait cycle with bounds checks

2025-03-24 Thread arthur . cohen
From: Philip Herron We need to be careful when doing bounds check as to not create a recusive trait resolution. This patch checks for that case and fixes a bad type is equal check on ADT Types which was caught with a regression here. Fixes Rust-GCC#3126 gcc/rust/ChangeLog: * typecheck/

[COMMITTED 080/141] gccrs: initial setup for new OpaqueType to represent Impl types

2025-03-24 Thread arthur . cohen
From: Philip Herron This completes the initial setup and boilerplate for the new type in the typesystem. This is not functional yet but its a big patch already. gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): new tyty::OpaqueType * backend/rust-c

[COMMITTED 076/141] gccrs: fix name resolution for generics where type param is declared later

2025-03-24 Thread arthur . cohen
From: Philip Herron Rust allows you to use generics within type bounds when they are declared later on. This changes the name resolution to walk the genric params in two passes to ensure the type parameters are setup before drilling down into the type parameters This issue has exposed another ty

[COMMITTED 116/141] gccrs: Add rib kind debug representation

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Rib kind had no string representation, and thus were not used in the debug string representation. gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx: Output rib kind. * resolve/rust-rib.h: Add function to get string representation from a rib

[COMMITTED 114/141] gccrs: expansion: Correctly expand $crate metavar

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-expand.cc: Use new SubstituteCtx API. * expand/rust-macro-expand.h: Likewise. * expand/rust-macro-substitute-ctx.cc: Implement proper expansion of $crate. * expand/rust-macro-substitute-ctx.h: Adapt APIs

[COMMITTED 111/141] gccrs: session-manager: Call into DesugarQuestionMark

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Call DesugarQuestionMark::go(). --- gcc/rust/rust-session-manager.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc inde

[COMMITTED 046/141] gccrs: ast-builder: Add new methods for functions, traits and tuples.

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.cc: New methods. * ast/rust-ast-builder.h: Declare them. --- gcc/rust/ast/rust-ast-builder.cc | 62 gcc/rust/ast/rust-ast-builder.h | 36 +-- 2 files changed, 96 inser

[COMMITTED 044/141] gccrs: scan-deadcode: Do not warn unused fields if they start with '_'

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * checks/lints/rust-lint-scan-deadcode.h: Check if the field name starts with an underscore before warning. --- gcc/rust/checks/lints/rust-lint-scan-deadcode.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/

[COMMITTED 106/141] gccrs: expansion: Expand generic args in generic type path segments

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Correctly visit the generic args of a generic type path segment. gcc/testsuite/ChangeLog: * rust/compile/issue-2015.rs: New test. --- gcc/rust/expand/rust-expand-visitor.cc

[COMMITTED 103/141] gccrs: nr2.0: Implement macro_use for modules

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc: Include rust-attribute-values.h. (Early::visit): If a module has a macro_use attribute, avoid pushing a new textual macro scope. gcc/testsuite/ChangeLog: * rust/compile/nr2/e

[COMMITTED 077/141] gccrs: self paths are patterns but we dont have mappings for it

2025-03-24 Thread arthur . cohen
From: Philip Herron With simple patterns we dont introduce any more inference varaibles as they are already declared in a specific way. This would only lead to more unconstrained inference varaibles than is required. Fixes Rust-GCC#3022 gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc

[COMMITTED 105/141] gccrs: name-resolution: early: Remove overzealous overrides

2025-03-24 Thread arthur . cohen
From: Arthur Cohen Some empty overrides were incorrectly being set-up instead of using the correct behavior from DefaultASTVisitor. gcc/rust/ChangeLog: * resolve/rust-early-name-resolver.cc: Remove definitions. * resolve/rust-early-name-resolver.h: Remove declarations. --- gcc

[COMMITTED 041/141] gccrs: Fix an issue with ForeverStack::dfs_rib

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx (ForeverStack::dfs_rib): Fix const implementation. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-forever-stack.hxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/rust/reso

[COMMITTED 066/141] gccrs: ast: Add DesugarForLoop class

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-desugar-for-loops.cc: New file. * ast/rust-desugar-for-loops.h: New file. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Make lowering of for-loops an unreachable. * Make-lang.in: Compile it. gcc/

[COMMITTED 060/141] gccrs: derive(Default): Add implementation

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive.cc (DeriveVisitor::derive): Call DeriveDefault. * expand/rust-derive-default.cc: New file. * expand/rust-derive-default.h: New file. * Make-lang.in: Compile them. gcc/testsuite/ChangeLog: * rust

[COMMITTED 045/141] gccrs: ast-builder: Add new functions to create type paths.

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::type_path): New functions. * ast/rust-ast-builder.h: Declare them. --- gcc/rust/ast/rust-ast-builder.cc | 21 - gcc/rust/ast/rust-ast-builder.h | 4 2 files changed, 24 insertio

[COMMITTED 057/141] gccrs: Fix bad generic substitution error on fn/adt types

2025-03-24 Thread arthur . cohen
From: Philip Herron When passing generics around we try to adjust them because there are cases where the names are adjusted from other generics this can fail for traits because of the implicit Self and we just need to continue on without adjustment. Fxies Rust-GCC#3382 gcc/rust/ChangeLog:

[COMMITTED 054/141] gccrs: Fix ICE during path probe

2025-03-24 Thread arthur . cohen
From: Philip Herron It is valid for the query to fail here so its valid to not assert here. gcc/rust/ChangeLog: * typecheck/rust-hir-path-probe.cc (PathProbeType::visit): remove assertion Signed-off-by: Philip Herron --- gcc/rust/typecheck/rust-hir-path-probe.cc | 12 ++-- 1

[COMMITTED 038/141] gccrs: add support for ref literal patterns

2025-03-24 Thread arthur . cohen
From: Philip Herron Fixes Rust-GCC#3174 gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternBindings::visit): make recursive * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): handle ref flag gcc/testsuite/ChangeLog: * rust/compile

[COMMITTED 032/141] gccrs: Make foreverstack debug string const

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Those function should not change anything within the foreverstack, it can therefore be made const. gcc/rust/ChangeLog: * resolve/rust-forever-stack.h: Make debug functions const. * resolve/rust-forever-stack.hxx: Likewise. Signed-off-by: Pierre-Emman

[COMMITTED 037/141] gccrs: lang-items: Add From::from

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-lang-item.h: Declare it. * util/rust-lang-item.cc: Use it. --- gcc/rust/util/rust-lang-item.cc | 2 ++ gcc/rust/util/rust-lang-item.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/gcc/rust/util/rust-lang-item.cc b/gcc

[COMMITTED 034/141] gccrs: Compile unit struct with constructor

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Do not use query system for unit struct but compile it's constructor instead. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/backend/rust-compile-resolv

[COMMITTED 001/141] gccrs: typecheck: Separate assemble_builtin_candidate in two

2025-03-24 Thread arthur . cohen
From: Arthur Cohen This paves the way for adding trait bounds that aren't necessarily Sized. gcc/rust/ChangeLog: * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::add_trait_bound): New function. * typecheck/rust-hir-type-bounds.h: Declare it. (TypeBoundsProbe::assemble_

[COMMITTED 097/141] gccrs: Remove some member functions from SingleASTNode

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast.h (SingleASTNode::take_trait_item): Remove. (SingleASTNode::take_impl_item): Remove. (SingleASTNode::take_trait_impl_item): Remove. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Replace

[COMMITTED 035/141] gccrs: Remove some passing test from exclude file

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Those tests are now passing. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove some tests. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/nr2/exclude | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/

[COMMITTED 108/141] gccrs: Adjust unknown macro error message

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::visit): Adjust error produced when macro resolution fails. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. gcc/testsuite/ChangeLog:

[COMMITTED 065/141] gccrs: ast: builder: Fix arguments of Builder::let

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.h: Mark all arguments as &&. * ast/rust-ast-builder.cc (Builder::let): Likewise. --- gcc/rust/ast/rust-ast-builder.cc | 4 ++-- gcc/rust/ast/rust-ast-builder.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletion

[COMMITTED 067/141] gccrs: session manager: Call into DesugarForLoops

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Call the visitor. --- gcc/rust/rust-session-manager.cc | 4 1 file changed, 4 insertions(+) diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 3adde297a4e

[COMMITTED 082/141] gccrs: Add type check on if-expr

2025-03-24 Thread arthur . cohen
From: Benjamin Thos Check if an if-expr returns void type or a coercible type like an early return. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add check on if-expr. gcc/testsuite/ChangeLog: * rust/compile/implicit_returns_err3.r

[COMMITTED 078/141] gccrs: improve error diagnostic for bad type-resolution in CallExpr

2025-03-24 Thread arthur . cohen
From: Philip Herron We have the type information for the resolved call lets tell the user about it in the diagnostic and apply the correct error code. Fixes Rust-GCC#2035 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): improve error diag gcc/testsu

[COMMITTED 073/141] gccrs: remove name resolution inserts from type-path

2025-03-24 Thread arthur . cohen
From: Philip Herron We resolve path segments and inserted their resolution into the name resolution space which was an old hack to use this as information in code-gen/check-passes in order to help things move forward but this is not nessecary gcc/rust/ChangeLog: * typecheck/rust-hir-typ

[COMMITTED 070/141] gccrs: add discriminant value intrinsic

2025-03-24 Thread arthur . cohen
From: Philip Herron This is pretty nasty piece of rust in my opinion the return type of this intrinsic results into a lang item associated type: ::Discriminant This is a special case which needs to support mapping onto the repr type of the associated ADT that is passed in, but defaults to isz

[COMMITTED 042/141] gccrs: nr2.0: late: Add proper handling for lang item PathInExpressions

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Special case lang item paths. --- gcc/rust/resolve/rust-late-name-resolver-2.0.cc | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/rust/resolve/rust-late-name-re

[COMMITTED 102/141] gccrs: Adjust type path resolution error message

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Adjust error message to match the 2.0 name resolver. gcc/testsuite/ChangeLog: * rust/compile/additional-trait-bounds2.rs: Adjust expected errors.

[COMMITTED 095/141] gccrs: Remove PathInExpression::get_pattern_node_id

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-path.h (PathInExpression::get_pattern_node_id): Remove. Signed-off-by: Owen Avery --- gcc/rust/ast/rust-path.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h index c253703

[COMMITTED 094/141] gccrs: derive(Eq): Create copies of Eq typepath to avoid NodeId confusion

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-eq.cc: Copy `Eq` typepath. --- gcc/rust/expand/rust-derive-eq.cc | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/rust/expand/rust-derive-eq.cc b/gcc/rust/expand/rust-derive-eq.cc index 47a8350d2ff.

[COMMITTED 091/141] gccrs: expand: Allow built-in derives to generate multiple items

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive.cc (DeriveVisitor::derive): Return a vector of items. * expand/rust-derive.h: Change return type. * expand/rust-expand-visitor.cc: Insert all generated items into the AST. --- gcc/rust/expand/rust-derive.cc

[COMMITTED 039/141] gccrs: ast: Add new Expr::Kinds

2025-03-24 Thread arthur . cohen
From: Arthur Cohen Collapses all of the OperatorExprs into Expr instead of first having to check for OperatorExpr and then check for each OperatorExpr::Kind. gcc/rust/ChangeLog: * ast/rust-ast.h: Add new Expr::Kinds. * ast/rust-expr.h: Implement missing get_expr_kind(), Add ge

[COMMITTED 026/141] gccrs: Labels shall be pushed within label namespace

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Labels were using the wrong namespace. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Change label push function from type rib to label rib. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): L

  1   2   >