[COMMITTED 098/144] gccrs: imports: Make FinalizeImports a resolver visitor as well

2025-03-19 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-finalize-imports-2.0.cc (FinalizeImports::go): Turn static method into method. (FinalizeImports::visit): New. * resolve/rust-finalize-imports-2.0.h (class FinalizeImports): Make FinalizeImports a

[COMMITTED 062/144] gccrs: Avoid accidental insertion into map

2025-03-19 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::check_bindings_consistency): Check if outer_bindings_map contains an entry before indexing. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-ast-resolve-pattern.cc | 3 ++

[COMMITTED 090/144] gccrs: rust fix ICE when hir lowering qualified path expressions without an as

2025-03-19 Thread arthur . cohen
From: Philip Herron Qualified path expressions usually are ::... but the as is optional this adds the extra checking in hir lowering to not hit that nullptr. Fixes #3082 gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerQualifiedPathInType::visit): check for valid as se

[COMMITTED 103/144] gccrs: Loop on expansion if a new export has been defined

2025-03-19 Thread arthur . cohen
From: Pierre-Emmanuel Patry When a use statement requires a reexported item it cannot find it in the same pass, an additional pass shall be performed. This means we need to detect whether a new item has been reexported and resolve until the end. gcc/rust/ChangeLog: * resolve/rust-early-

[COMMITTED 105/144] gccrs: Remove empty visit functions

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

[COMMITTED 104/144] gccrs: Mark virtual function override in default resolver

2025-03-19 Thread arthur . cohen
From: Pierre-Emmanuel Patry Those function prototype were not marked as override and throwing warning. gcc/rust/ChangeLog: * resolve/rust-default-resolver.h: Make most visit function override. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/resolve/rust-default-resolver.h | 178 +++

[COMMITTED 102/144] gccrs: Fix missing error on duplicated nodes

2025-03-19 Thread arthur . cohen
From: Pierre-Emmanuel Patry When we tried to insert a shadowable node and another shadowable node has been inserted before, we didn't emit any error if the node has already been inserted previously and failed silently. gcc/rust/ChangeLog: * resolve/rust-rib.cc (Rib::insert): Emit an err

[COMMITTED 106/144] gccrs: Remove regular visit code

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

[COMMITTED 107/144] gccrs: Change lambda content with default visitor call

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

[COMMITTED 126/144] gccrs: Improve Rib::Definition shadowing

2025-03-19 Thread arthur . cohen
From: Owen Avery 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

[COMMITTED 123/144] gccrs: add test case to show impl block on ! works

2025-03-19 Thread arthur . cohen
From: Philip Herron 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

[COMMITTED 130/144] gccrs: Insert static items into the value namespace

2025-03-19 Thread arthur . cohen
From: Owen Avery 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 i

[COMMITTED 129/144] gccrs: Rework InlineAsmOperand

2025-03-19 Thread arthur . cohen
From: Owen Avery 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

[COMMITTED 051/144] gccrs: Move strip double quotes, add scaffold expand

2025-03-19 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (strip_double_quotes): Move strip double quotes to parse phase (CompileAsm::asm_construct_string_tree): Likewise * backend/rust-compile-asm.h (strip_double_quotes): Likewise * expand/rust-

[COMMITTED 003/144] gccrs: [gccrs#3045] #[may_dangle] in safe impl

2025-03-19 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * ast/rust-ast.cc: Fix Attribute constructors to copy inner_attribute * checks/errors/rust-unsafe-checker.cc: Add pass for #[may_dangle] in safe impl's * hir/rust-ast-lower-item.cc: Add support for unsafe impl'

[COMMITTED 005/144] gccrs: ffi-polonius: Remove usage of extern types.

2025-03-19 Thread arthur . cohen
From: Arthur Cohen This will allow us to revert our dependency on extern types, which would help our godbolt build as well as our various builders. gcc/rust/ChangeLog: * checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: Remove extern type feature. * checks/errors

[PATCHSET] Update Rust frontend 19/03/2024 2/4

2025-03-19 Thread arthur . cohen
Hi everyone, This is the second of the patchsets we plan on upstreaming in the coming days. This one notably contains the commit which fixes PR119353, which had not yet been upstreamed but was present in our development repo for a while. We will continue working on improving our support for all di

[COMMITTED 002/144] gccrs: Add rustc test directory for testsuite adaptor

2025-03-19 Thread arthur . cohen
From: Muhammad Mahad gcc/testsuite/ChangeLog: * rust/rustc/README.md: information about rustc external directory. * rust/rustc/rustc.exp: New test. Signed-off-by: Muhammad Mahad --- gcc/testsuite/rust/rustc/README.md | 4 gcc/testsuite/rust/rustc/rustc.exp | 35 +

[COMMITTED 009/144] gccrs: Fix the parser's operand and flags storage

2025-03-19 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): Add construction for register_type * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Fix parsing logic & reassignment logic (parse_reg_operand_in): Fix parsing

[COMMITTED 001/144] gccrs: Properly striping struct fields when using attrs

2025-03-19 Thread arthur . cohen
From: Antonio Gomes gcc/rust/ChangeLog: * expand/rust-cfg-strip.cc: Strip struct expr fields and strip fields in struct definition * expand/rust-cfg-strip.h: Signatures for new function maybe_strip_struct_expr_fields gcc/testsuite/ChangeLog: * rust/compile

[COMMITTED 109/144] gccrs: Make AST default visitor visit functions public

2025-03-19 Thread arthur . cohen
From: Pierre-Emmanuel Patry 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 --- gcc/rust/ast/rust-ast-visitor.h | 1 - 1 file changed, 1 deletio

[COMMITTED 093/144] gccrs: toplevel: Build list of imports for Early to resolve

2025-03-19 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc: Comment out handle_use call and error emission. * resolve/rust-toplevel-name-resolver-2.0.h: Create ImportKind class. --- .../rust-toplevel-name-resolver-2.0.cc| 37

[COMMITTED 113/144] gccrs: Update exclude list with working tests

2025-03-19 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove working tests from nr2 exclude list. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/nr2/exclude | 27 +- 1 file changed, 1 insertion(+), 26 deletions(-)

[COMMITTED 028/144] gccrs: ast: Remove PathExpr abstract class

2025-03-19 Thread arthur . cohen
From: Arthur Cohen Inherit directly from ExprWithoutBlock instead. gcc/rust/ChangeLog: * ast/rust-ast.h (class PathExpr): Remove class. * ast/rust-path.h (class PathInExpression): Inherit from ExprWithoutBlock. (class QualifiedPathInExpression): Likewise. --- gcc/rust

[COMMITTED 133/144] gccrs: Use name resolver 2.0 during pattern typechecking

2025-04-04 Thread arthur . cohen
From: Owen Avery 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. *

[COMMITTED 047/144] gccrs: Minor fix to asm codegen pr

2025-04-04 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Use expr's is_simple_asm and is_inline_asm (CompileAsm::asm_is_simple): removed (CompileAsm::asm_is_inline): removed * backend/rust-compile-asm.h: Add docs to

[COMMITTED 071/144] gccrs: Used `IndexVec` for Loans

2025-04-04 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-place.h: Used `IndexVec` with ScopeId as index. * checks/errors/borrowck/rust-borrow-checker-diagnostics.cc (BorrowCheckerDiagnostics::get_loan): Convert Polonius::Loan to BIR::Loan, so

[COMMITTED 092/146] gccrs: ast: Add EnumItem::Kind

2025-04-04 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-item.h: Add EnumItem::Kind for differentiating all variants that may be used inside an enum declaration. --- gcc/rust/ast/rust-item.h | 52 1 file changed, 52 insertions(+) diff --git a

[COMMITTED 132/145] gccrs: Safe-guard InlineAsm structs

2025-04-05 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * ast/rust-expr.h (struct AnonConst): Safe-guard InlineAsm structs (struct InlineAsmOperand): Likewise. * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise.

[COMMITTED 007/141] gccrs: derive(Clone): Use lang item bounds on AssertParamIsCopy

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::visit_union): Use lang items for Copy and Sized bounds. gcc/testsuite/ChangeLog: * rust/compile/derive_macro6.rs: Add lang item attribute to Copy trait. --- gcc/rust/expand/rust-derive

[COMMITTED 058/141] gccrs: Fix compilation of trait-items which map to impl items

2025-04-05 Thread arthur . cohen
From: Philip Herron When we have paths such as Try::from_error the Try references the Trait and then from_error references the from_error trait item. So this resolves directly to a trait implementation which has the type: fn (v: placeholder) -> Self Remember that a path such as: Try::from_er

[COMMITTED 08/35] gccrs: lower: Handle let-else properly

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/tree/rust-hir-stmt.h (class LetStmt): Add optional diverging else expression. * hir/tree/rust-hir-stmt.cc: Likewise. * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Add handling for lowering diverging else

[COMMITTED 115/146] gccrs: testsuite: Fix missing handling of little endian.

2025-04-05 Thread arthur . cohen
From: Arthur Cohen Some failures occur in the testsuite because we did not account for the little-endian case. gcc/testsuite/ChangeLog: * rust/compile/issue-1446.rs: Add swap_bytes function. * rust/compile/iterators1.rs: Remove unused {to, from}_le functions. --- gcc/testsuite

[COMMITTED 093/146] gccrs: Remove Rust::make_unique

2025-04-05 Thread arthur . cohen
From: Owen Avery Since our bootstrap requirement has been bumped to C++14, we don't need a custom implementation of std::make_unique anymore. gcc/rust/ChangeLog: * ast/rust-ast-builder-type.cc: Remove inclusion of rust-make-unique.h. * ast/rust-ast-builder.cc: Likewise.

[COMMITTED 068/146] gccrs: type-check: Remove unused capture in nr2.0

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Remove unused capture in lambda. --- gcc/rust/typecheck/rust-hir-type-check-type.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc

[COMMITTED 142/144] gccrs: Use name resolver 2.0 for compiling break/continue

2025-04-05 Thread arthur . cohen
From: Owen Avery 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 --- gcc/rust/backend/rus

[COMMITTED 09/35] gccrs: nr2.0: Fix test const_generics_3.rs

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/const_generics_3.rs: Modify test to run with name resolution 2.0 only and to handle the absence of a bogus resolution error. * rust/compile/nr2/exclude: Remove const_generics_3.rs. Signed-off-by: Owen Avery

[COMMITTED 074/146] gccrs: hir: Lower lang-item paths

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt to handle lang item paths. (ASTLowerTypePath::visit): Likewise. (ASTLowerTypePath::translate_type_path): New. (ASTLowerTypePath

[COMMITTED 108/146] gccrs: rust/intrinsic: add try intrinsic and panic strategy options

2025-04-05 Thread arthur . cohen
From: liushuyu gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc: add `try` intrinsic handler. * lang.opt: add `-frust-panic` option. * rust-lang.cc: enable exception handler code generation. * rust-session-manager.cc: add getter and setter for panic

[COMMITTED 071/146] gccrs: derive(Copy): Use new LangItemPath

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-copy.cc: Use new LangItemPath for derive(Copy). --- gcc/rust/expand/rust-derive-copy.cc | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/rust/expand/rust-derive-copy.cc b/gcc/rust/expand/rust

[COMMITTED 048/146] gccrs: empty match expressions should resolve to !

2025-04-05 Thread arthur . cohen
From: Philip Herron This is a special case in Rust and the ! type can unify with pretty much anything its almost a inference variable and a unit-type for special cases. Fixes Rust-GCC/gccrs#3231 Fixes Rust-GCC/gccrs#2567 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (check_match_s

[COMMITTED 12/35] gccrs: testsuite: Add more testcases for cfg() in core

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/testsuite/ChangeLog: * rust/compile/cfg-core1.rs: New test. * rust/compile/cfg-core2.rs: New test. --- gcc/testsuite/rust/compile/cfg-core1.rs | 12 gcc/testsuite/rust/compile/cfg-core2.rs | 12 2 files changed, 24 insertions

[COMMITTED 118/144] gccrs: Resolve TypeParam with name resolution 2.0

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry 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: Pier

[COMMITTED 038/146] gccrs: Refactor optional initializers

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Refactor some optional initializer in the lowering stage to make them more readable. gcc/rust/ChangeLog: * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Change the ternary expression with a more readable if. Signed-off-by: Pierre-Emmanuel Patr

[COMMITTED 081/144] gccrs: [gccrs#3141] Remove double negation by returning CompileExpr::Compile early

2025-04-05 Thread arthur . cohen
From: JoanVC Fixes gccrs#3141. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc Signed-off-by: Joan Vilardaga --- gcc/rust/backend/rust-compile-expr.cc | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/

[COMMITTED 014/146] gccrs: Make TyTy::TupleType::get_unit_type cache its return value

2025-04-05 Thread arthur . cohen
From: Owen Avery This removes a usage of Resolver::get_unit_type_node_id in rust-hir-type-check-expr.cc (the HIR::TupleExpr overload of TypeCheckExpr::visit). gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (TupleType::get_unit_type): Remove parameter, cache return value.

[COMMITTED 037/146] gccrs: FnParam cloning now keeps projections

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry FnParam type where monomorphized during cloning. gcc/rust/ChangeLog: * typecheck/rust-tyty.h: Reverse monomorphization during cloning and make a new function to explicitly monomorphize. * typecheck/rust-tyty.cc: Use monomorphization when requi

[COMMITTED 19/35] gccrs: Fix ICE when using super mid way though path

2025-04-05 Thread arthur . cohen
From: Philip Herron Fixes Rust-GCC#3568 gcc/rust/ChangeLog: * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): check for super mid path gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 puts out a different error multiple times * rust/compile/issu

[COMMITTED 007/146] gccrs: Use name resolver 2.0 in CompileTraitItem

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-implitem.cc (CompileTraitItem::visit): Use name resolver 2.0 (when enabled) to obtain canonical paths for instances of TraitItemConst and TraitItemFunc. Signed-off-by: Owen Avery --- gcc/rust/backend/r

[COMMITTED 008/146] gccrs: Improve path handling while testing name resolution 2.0

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/nr2/compile.exp: Handle paths using "file join" and "file split". * rust/compile/nr2/exclude: Remove debug-diagnostics-on.rs. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/nr2/compile.exp | 18

[COMMITTED 094/145] gccrs: Safegaurd InlineAsm's clone_expr_...

2025-04-05 Thread arthur . cohen
From: jjasmine Safegaurd InlineAsm's clone_expr_... with unreachable since we would never use them. gcc/rust/ChangeLog: * ast/rust-expr.h: Safegaurd InlineAsm's clone_expr_... with unreachable. --- gcc/rust/ast/rust-expr.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc

[COMMITTED 042/146] gccrs: Use a reference wrapper to please GCC 4.8

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Change call. (CompileExpr::resolve_operator_overload): Update function arguments. * backend/rust-compile-expr.h: Change the function's prototype to use a reference

[COMMITTED 078/146] gccrs: implement the TuplePattern and use it for function patterns

2025-04-05 Thread arthur . cohen
From: Philip Herron In order to handle the tuple pattern of: fn test ((x _) : (i32, i32)) -> i32 { x } we need to recognize that ABI wise this function still takes a tuple as the parameter to this function its just how we can address the "pattern" of the tuple changes. So reall if this was C i

[COMMITTED 015/146] gccrs: fix bad type inferencing on path's

2025-04-05 Thread arthur . cohen
From: Philip Herron This catch to inject inference variables into generic paths was a catch all 'hack' that we needed before we handled generics correctly as we do now. Fixes #3009 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): remove ha

[COMMITTED 076/146] gccrs: lang-item: Remove unused NodeId from LangItemPath

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-path.h: Adapt children of Path to fix some NodeId issues. --- gcc/rust/ast/rust-path.h | 76 +++- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust

[COMMITTED 11/35] gccrs: Lower raw string literals

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_literal): Lower raw string literals into normal string literals. gcc/testsuite/ChangeLog: * rust/compile/issue-3549.rs: New test. Signed-off-by: Owen Avery --- gcc/rust/

[COMMITTED 011/146] gccrs: Use name resolution 2.0 in TraitResolver

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc: Add includes. (TraitResolver::resolve_path_to_trait): Use name resolution 2.0 resolver when enabled. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by:

[COMMITTED 27/35] gccrs: nr2.0: Fix test macros/mbe/macro43.rs

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/macros/mbe/macro43.rs: Adjust test to pass with name resolution 2.0. * rust/compile/nr2/exclude: Remove macros/mbe/macro43.rs. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/macros/mbe/macro43.rs | 15 +

[COMMITTED 125/146] gccrs: tychk: resolve lang item type paths properly

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Adapt code to handle lang item type paths. --- .../typecheck/rust-hir-type-check-type.cc | 26 --- 1 file changed, 17 insertions(+), 9

[COMMITTED 067/146] gccrs: attributes: Add class for sharing methods on attributes.

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-attributes.h (class Attributes): New. * util/rust-attributes.cc: Implement Attributes::is_known(). * ast/rust-collect-lang-items.cc (is_known_attribute): Remove. (get_lang_item_attr): Call Attributes::is_known

[COMMITTED 120/146] gccrs: Remove dead code related to external functions

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Remove visitor for NamedFunctionParam. * ast/rust-ast-collector.h (TokenCollector::visit): Likewise. * ast/rust-ast-full-decls.h (class NamedFunctionParam): R

[COMMITTED 053/145] gccrs: Add system include to `gcc/rust/rust-system.h`

2025-04-05 Thread arthur . cohen
From: SIGMazer gcc/rust/ChangeLog: * rust-system.h: Add system include Signed-off-by: SIGMazer --- gcc/rust/rust-system.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/rust-system.h b/gcc/rust/rust-system.h index 7a6a72e5c64..986428b0819 100644 --- a/gcc/rust/rust-syst

[COMMITTED 041/146] gccrs: Use default constructor for default arguments

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry GCC 4.8 complains about the initializer list. gcc/rust/ChangeLog: * typecheck/rust-tyty.h: Change initializer list to default constructor call. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/typecheck/rust-tyty.h | 6 +++--- 1 file changed, 3 in

[COMMITTED 050/146] gccrs: Prepend crate name to functions with nr2

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Prepend crate name to function's ir name. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove passing tests from exclude list. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ba

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

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Those tests are now passing. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove two mangling tests from exclusion file. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/nr2/exclude | 2 -- 1 file changed, 2 deletions(-)

[COMMITTED 129/146] gccrs: mappings: Add get_lang_item_node

2025-04-05 Thread arthur . cohen
From: Arthur Cohen This method errors out if the lang item has not been declared yet. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::get_lang_item_node): New. * util/rust-hir-map.h: New function. --- gcc/rust/util/rust-hir-map.cc | 10 ++ gcc/rust/util/rust-hir

[COMMITTED 084/146] gccrs: typecheck: Add note about erorring out on additional trait bounds.

2025-04-05 Thread arthur . cohen
From: Arthur Cohen If additional trait bounds aren't auto traits, then the typechecker must error out (Rust-GCC#3008) gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc: Add TODO note. --- gcc/rust/typecheck/rust-hir-type-check-type.cc | 5 + 1 file changed, 5 inser

[COMMITTED 027/141] gccrs: Add debug dump to old name resolver

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry It might be necessary to compare both name resolution' internal states during the transition. This new debug representation could help with that. gcc/rust/ChangeLog: * resolve/rust-name-resolver.h: Add new degug dump for old name resolver. Signed-off

[COMMITTED 072/141] gccrs: enum type layout needs to respect the enum repr type

2025-04-05 Thread arthur . cohen
From: Philip Herron Addresses Rust-GCC#3352 gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::get_implicit_enumeral_node_type): use repr (TyTyResolveCompile::visit): update prototype * backend/rust-compile-type.h: likewise Signed-off-by: P

[COMMITTED 007/144] gccrs: Move mbe macro tests to their own directory

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/compile/macro-delim.rs: Move to... * rust/compile/macros/mbe/macro-delim.rs: ...here. * rust/compile/macro-issue1053-2.rs: Move to... * rust/compile/macros/mbe/macro-issue1053-2.rs: ...here. * rus

[COMMITTED 13/35] gccrs: Fix validation of constant items

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Allow constant items lacking expressions if and only if they're associated with a trait definition, not a trait implementation. gcc/testsuite/ChangeLog: *

[COMMITTED 117/146] gccrs: Revert "gcc/rust/ChangeLog:"

2025-04-05 Thread arthur . cohen
From: CohenArthur This reverts commit 600fd806b8821ea24103ea0f31d666077245c6b7. --- gcc/rust/ast/rust-collect-lang-items.cc | 7 ++- gcc/rust/util/rust-attributes.cc| 8 gcc/rust/util/rust-attributes.h | 2 -- 3 files changed, 6 insertions(+), 11 deletions(-) diff -

[COMMITTED 051/146] gccrs: fix crash in hir dump with missing guards

2025-04-05 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add missing null checks Signed-off-by: Philip Herron --- gcc/rust/hir/rust-hir-dump.cc | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rus

[COMMITTED 044/144] gccrs: Scaffolding code

2025-04-05 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::add_stmt): Scaffolding code. (CompileAsm::asm_build_asm_stmt): Likewise. (CompileAsm::asm_build_expr): Likewise. (CompileAsm::asm_construct_string_tree): Likewise. * b

[COMMITTED 066/146] gccrs: lang-items: Add lang-items AST collector

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * Make-lang.in: Add new object file. * rust-session-manager.cc (Session::compile_crate): Call CollectLangItems. * ast/rust-collect-lang-items.cc: New file. * ast/rust-collect-lang-items.h: New file. --- gcc/rust/Make

[COMMITTED 004/146] gccrs: Add a newline to the end of nr2/exclude

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Add trailing newline along with comment. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/nr2/exclude | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/rust/compile/

[COMMITTED 006/146] gccrs: Use name resolution 2.0 in TraitItemReference

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.cc: Add includes. (TraitItemReference::get_type_from_fn): Use ForeverStack::to_canonical_path when name resolution 2.0 is enabled. Signed-off-by: Owen Avery --- gcc/rust/typecheck/rust-hir-typ

[COMMITTED 131/144] gccrs: Improve handling of InlineAsm in DefaultASTVisitor

2025-04-05 Thread arthur . cohen
From: Owen Avery 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 --- gcc/rust/ast/ru

[COMMITTED 047/146] gccrs: fix crashes in hir dump since move to references

2025-04-05 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add guards Signed-off-by: Philip Herron --- gcc/rust/hir/rust-hir-dump.cc | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hi

[COMMITTED 087/144] gccrs: Add extra assertions to tl::optional

2025-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * util/optional.h (optional): Add assertions to dereference operator overloads when C++14 is available. Signed-off-by: Owen Avery --- gcc/rust/util/optional.h | 86 1 file changed, 79 inserti

[COMMITTED 075/141] gccrs: fix unconstrained generics check to handle recursive generics

2025-04-05 Thread arthur . cohen
From: Philip Herron Generics can be constrained within other generic types so this check needs to be recursive. Fixes Rust-GCC#3031 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-base.cc (walk_types_to_constrain): recursive walker * typecheck/rust-tyty.cc (BaseType::get_s

[COMMITTED 040/146] gccrs: Add optional template arguments to please GCC4.8

2025-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Clang on macos as well as GCC 4.8 complains when those templates are missing. gcc/rust/ChangeLog: * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Add template to tl::optional. * hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit):

[COMMITTED 010/141] gccrs: lang-items: Add Result and Try lang items

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-lang-item.h: Add handling for Result::Ok, Result::Err, Try, Try::into_result, Try::from_ok, Try::from_err. * util/rust-lang-item.cc: Likewise. gcc/testsuite/ChangeLog: * rust/compile/try-trait.rs: New test

[COMMITTED 049/146] gccrs: Prevent execution of some nr1.0 functions with nr2.0

2025-04-04 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-name-resolver.cc: Include options.txt. (Resolver::insert_resolved_name): Assert that name resolution 2.0 is disabled. (Resolver::lookup_resolved_name): Likewise. (Resolver::insert_resolved_type): Likewise

[COMMITTED 017/144] gccrs: Add location to BIR::Statement of kind RETURN

2025-03-26 Thread arthur . cohen
From: Kushal Pal This commit adds location_t to BIR::Statement where type is RETURN. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Add location parameter. * checks/errors/borrowck/rust-bir-builder.h: Likewise.

[COMMITTED 106/146] gccrs: Allow float type to be casted as integer type

2025-03-27 Thread arthur . cohen
From: Nobel gccrs now should be able to cast float types as numeric. gcc/rust/ChangeLog: * typecheck/rust-casts.cc (TypeCastRules::cast_rules): Add rule. gcc/testsuite/ChangeLog: * rust/compile/cast_float_as_integer.rs: New test. Signed-off-by: Nobel Singh --- gcc/rust/type

[COMMITTED 102/146] gccrs: add support for lang_item eq and PartialEq trait

2025-03-27 Thread arthur . cohen
From: Philip Herron The Eq and Partial Ord are very similar to the operator overloads we support for add/sub/etc... but they differ in that usually the function call name matches the name of the lang item. This time we need to have support to send in a new path for the method call on the lang ite

[COMMITTED 082/146] gccrs: parser: Add testcases for multiline strings

2025-03-25 Thread arthur . cohen
From: Arthur Cohen Regression checks for Rust-GCC#1399 gcc/testsuite/ChangeLog: * rust/compile/multiline-string.rs: New test. * rust/execute/torture/multiline-string.rs: New test. --- gcc/testsuite/rust/compile/multiline-string.rs| 14 ++ .../rust/execute

[COMMITTED 060/146] gccrs: Remove bad assertion in name resolution

2025-03-25 Thread arthur . cohen
From: Philip Herron This was a handy debug assertion but only works for valid rust code. This needs to handle the case where the type is not resolved which is a valid case. Fixes Rust-GCC#2423 gcc/rust/ChangeLog: * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): remove assertio

[COMMITTED 001/146] gccrs: Fix bad recursive operator overload call

2025-03-26 Thread arthur . cohen
From: Philip Herron When we are typechecking the impl block for DerefMut for &mut T the implementation follows the usual operator overload check but this ended up just resolving directly to the Trait definition which ends up being recursive which we usually handle. The issue we had is that a dere

[COMMITTED 061/144] gccrs: Fix v0-mangle1.rs test when run with ASAN

2025-03-27 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * util/rust-canonical-path.h (CanonicalPath::CanonicalPath): Properly initialize crate_num with copy constructor. gcc/testsuite/ChangeLog: * rust/compile/v0-mangle1.rs: Make v0-mangle test more crate_num agnostic. Si

[COMMITTED 056/146] gccrs: mappings: Move lang_item definitions to .cc

2025-03-27 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-hir-map.h: Move definitions from header... * util/rust-hir-map.cc: ...to source file. --- gcc/rust/util/rust-hir-map.cc | 19 +++ gcc/rust/util/rust-hir-map.h | 18 ++ 2 files changed, 21

[COMMITTED 003/146] gccrs: Fix variable shadowing in late resolution 2.0

2025-03-28 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Visit the initialization expressions of let statements before visiting their patterns. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-b

[COMMITTED 23/32] gccrs: Migrate error state to optionals

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::self_ref_param): Remove error state and use optional. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check label before visiting. * ast/rust-ast.cc (ContinueExpr::as

[COMMITTED 28/32] gccrs: Rename label getter in ContinueExpr

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Call unchecked getter. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast.cc (ContinueExpr::as_string): Likewise. * hir

[COMMITTED 26/32] gccrs: Adapt testcase to name resolution 2.0

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry Name resolution 2.0 behavior matches more closely rustc's behavior and trying to prevent undeclared label error emission would break some other test. gcc/testsuite/ChangeLog: * rust/compile/invalid_label_name.rs: Adapt test to nr2. Signed-off-by: Pierre-Emma

[COMMITTED 24/32] gccrs: Fix unresolved label error message

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Change error message to match rustc. gcc/testsuite/ChangeLog: * rust/compile/undeclared_label.rs: Change test expected string. Signed-off-by: Pierre-Emmanue

[COMMITTED 27/32] gccrs: Change optional to expected for parse_loop_label

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_loop_label): Change function return type to expected. (Parser::parse_labelled_loop_expr): Adapt call location to new return type. * parse/rust-parse.h (enum class): Up

[COMMITTED 17/32] gccrs: Resolve labels

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Lower label only if it exists. * hir/tree/rust-hir-expr.cc (BlockExpr::BlockExpr): Make loop label optional. (BaseLoopExpr::BaseLoopExpr): Likewise.

[COMMITTED 32/32] gccrs: nr2.0: Adjust test macro6.rs

2025-04-08 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/macros/mbe/macro6.rs: Remove call of undefined function. * rust/compile/nr2/exclude: Remove macros/mbe/macro6.rs. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/macros/mbe/macro6.rs | 2 +- gcc/testsuit

<    6   7   8   9   10   11   12   13   14   15   >