[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 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 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 047/141] gccrs: derive-visitor: Add method for setting up derived impl generics

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive.cc (DeriveVisitor::setup_impl_generics): New method. * expand/rust-derive.h: Declare it, define DeriveVisitor::ImplGenerics struct. --- gcc/rust/expand/rust-derive.cc | 74 ++ gcc/rust/

[COMMITTED 019/141] gccrs: lang-items: Add LangItem::IsEnumVariant

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-lang-item.cc (LangItem::IsEnumVariant): New function. * util/rust-lang-item.h: Declare it. --- gcc/rust/util/rust-lang-item.cc | 9 + gcc/rust/util/rust-lang-item.h | 5 - 2 files changed, 13 insertions(+), 1 deleti

[COMMITTED 052/141] gccrs: Fix bug in type resolution of paths

2025-03-24 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): Use NameResolutionContext::resolve_path instead of ForeverStack::resolve_path. (Early::visit): Likewise. (Early::visit_attributes): Likewis

[COMMITTED 029/141] gccrs: Remove query mode on CompileItem

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry Query mode was a hack to catch up some compile errors early, it was deemed to be removed at some time. Recent changes to NR1 highlighted an incompatibility with it hence it's removal. gcc/rust/ChangeLog: * backend/rust-compile-item.h: Remove query mode.

[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 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 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 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 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 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 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 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 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 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 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

[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 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 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 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 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 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 017/141] gccrs: lang-items: Collect enum variants as lang items

2025-03-24 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-collect-lang-items.h: Declare visitor. * ast/rust-collect-lang-items.cc (CollectLangItems::visit): New. --- gcc/rust/ast/rust-collect-lang-items.cc | 9 + gcc/rust/ast/rust-collect-lang-items.h | 1 + 2 files changed, 10

[COMMITTED 079/141] gccrs: Add name resolution and HIR lowering for ImplTraitType's

2025-03-24 Thread arthur . cohen
From: Philip Herron Our AST has ImplTraitType for multiple bounds and a singular ImplTraitTypeOneBound, this patch desugars these into a simple HIR::ImplTraitType. It also does the name resolution for this. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-struct.h: remove

[COMMITTED 031/141] gccrs: Clone expr instead of taking it

2025-03-24 Thread arthur . cohen
From: Pierre-Emmanuel Patry We're reusing the value, it could therefore not be taken be should be cloned. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Clone expr instead of taking it. Signed-off-by: Pierre-Emmanuel Patry --- gcc/

[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 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 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 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 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

[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

[Bug rust/108124] Rust: ASAN&UBSAN issues when tests are run

2025-03-24 Thread sjames at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108124 Sam James changed: What|Removed |Added Blocks||86656, 63426 Keywords|

[COMMITTED 003/141] gccrs: lang-item:Add LangItem::Kind::RECEIVER

2025-03-24 Thread arthur . cohen
From: lishin Add and implement a lang item (receiver) in source code. gcc/rust/ChangeLog: * util/rust-lang-item.cc: Add receiver to map. * util/rust-lang-item.h: Define LangItem::Kind::RECEIVER. gcc/testsuite/ChangeLog: * rust/compile/issue-2954.rs: New test. Signed-o

[PATCHSET] Update Rust frontend 24/03/2024 4/4

2025-03-24 Thread arthur . cohen
Hi everyone! Here is the last batch of our split patchset which aimed at synchronizing upstream with our development repo. Both repositories are now the same, with the latest patch pushed today corresponding to the latest pull-request merged this weekend on our side. Moving forward, I will be upst

<    1   2