[Bug rust/116225] Rust test failures with -D_GLIBCXX_ASSERTIONS

2025-03-21 Thread sjames at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116225 Sam James changed: What|Removed |Added Resolution|--- |FIXED Status|UNCONFIRMED

[PATCHSET] Update Rust frontend 21/03/2024 3/4

2025-03-21 Thread arthur . cohen
Hi everyone, This is our the third patchset in the series for updating upstream GCC with the latest changes in our development repository. Most notably this contains handling for if-let statements by Marc Poulhiès, changes to our name-resolution pass rewrite, and massive changes to our AST and HI

[COMMITTED 010/146] rust: Desugar IfLet* into MatchExpr

2025-03-21 Thread arthur . cohen
From: Marc Poulhiès Replace the "regular" AST->HIR lowering for IfLet* with a desugaring into a MatchExpr. Desugar a simple if let: if let Some(y) = some_value { bar(); } into: match some_value { Some(y) => {bar();}, _ => () } Same applies for IfLetExprConseqElse (

[COMMITTED 002/146] gccrs: Insert trait names during toplevel resolution 2.0

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert trait names into the type namespace. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 3 +++ 1 file changed, 3 insertions(+) diff --g

[COMMITTED 005/146] gccrs: Rename some PathIdentSegment functions

2025-03-21 Thread arthur . cohen
From: Owen Avery This makes PathIdentSegment more similar to other classes used to represent path segments. gcc/rust/ChangeLog: * ast/rust-path.h (PathIdentSegment::is_super_segment): Rename to... (PathIdentSegment::is_super_path_seg): ...here. (PathIdentSegment:

[COMMITTED 009/146] gccrs: Fix name resolution 2.0 definition lookups in unsafe checker

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * checks/errors/rust-unsafe-checker.cc: Add includes. (UnsafeChecker::visit): Use 2.0 version of resolver when name resolution 2.0 is enabled. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-b

[COMMITTED 012/146] gccrs: Resolve SelfParam in name resolution 2.0

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Handle SelfParam. * resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-o

[COMMITTED 105/146] gccrs: cleanup our enum type layout to be closer to rustc

2025-03-21 Thread arthur . cohen
From: Philip Herron This changes our enum type layout so for example: enum Foo { A, B, C(char), D { x: i32, y: i32 }, } Used to get layed out like this in gccrs: union { struct A { int RUST$ENUM$DISR; }; struct B { int RUST$ENUM$DISR; }; struct C { int

[COMMITTED 070/146] gccrs: ast: Add LangItemPath class

2025-03-21 Thread arthur . cohen
From: Arthur Cohen This commit adds a new kind of Path, changes the base Path class and turns TypePath into a child of the base Path class. gcc/rust/ChangeLog: * ast/rust-path.h (class LangItemPath): New. (class TypePath): Adapt to accomodate LangItemPath. * ast/rust-as

[COMMITTED 072/146] gccrs: hir: Start adapting visitors to accept multiple kinds of Paths

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-item.h: Add new method to specifically get a type-path. * ast/rust-path.cc (LangItemPath::as_string): Implement properly. * hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt visitor to use the new Lan

[COMMITTED 142/146] gccrs: ast-builder: Add new methods for building structs

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.cc: Add new methods for constructing struct exprs. * ast/rust-ast-builder.h: Mention how to build tuple expressions. --- gcc/rust/ast/rust-ast-builder.cc | 12 ++-- gcc/rust/ast/rust-ast-builder.h | 5 +

[COMMITTED 141/146] gccrs: derive(Clone): Add deriving of simple enum variants

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-clone.cc: Clone enum identifier variants properly * expand/rust-derive-clone.h: Declare new functions used. --- gcc/rust/expand/rust-derive-clone.cc | 52 ++-- gcc/rust/expand/rust-derive-clone.h

[COMMITTED 133/146] gccrs: builder: Allow generating struct statements

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::struct_struct): New function. * ast/rust-ast-builder.h (vec): New function. --- gcc/rust/ast/rust-ast-builder.cc | 15 +++ gcc/rust/ast/rust-ast-builder.h | 31 +++

[COMMITTED 100/146] gccrs: nr2.0: Improve default, top-level, and late resolvers

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Make sure to scope visitation of the children of type definition items. * resolve/rust-default-resolver.h (DefaultResolver::visit): Add overrides for TupleStr

[COMMITTED 090/146] gccrs: Fix NR2.0 compiler ICE caused by Generics in Enums

2025-03-21 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc: Change the late name resolver to enter proper lexical scope during typechecking * resolve/rust-late-name-resolver-2.0.h: Add needed prototype to header * resolve/rust-toplevel

[COMMITTED 077/146] gccrs: fix bad not expression in rust

2025-03-21 Thread arthur . cohen
From: Philip Herron Fixes Rust-GCC#3229 gcc/rust/ChangeLog: * rust-gcc.cc (operator_to_tree_code): ! expressions are BIT_NOT_EXPR Signed-off-by: Philip Herron --- gcc/rust/rust-gcc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/

[COMMITTED 114/146] gccrs: Add ForeverStackStore

2025-03-21 Thread arthur . cohen
From: Owen Avery ForeverStackStore is meant to partially unify the internal states of per-namespace ForeverStack instances. This commit does not contain modifications to ForeverStack which would allow it to rely on a ForeverStackStore to store nodes, but a future commit should address this. gcc/

[COMMITTED 096/146] gccrs: nr2.0: Resolve type aliases inside trait definitions

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add visitor for TraitItemType. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclu

[COMMITTED 087/146] gccrs: lang-items: Collect trait functions that are lang items

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-collect-lang-items.cc (CollectLangItems::visit): Add visitor for collecting functions that might be lang items. * ast/rust-collect-lang-items.h: Likewise. --- gcc/rust/ast/rust-collect-lang-items.cc | 8 gcc/rus

[COMMITTED 020/146] gccrs: Use name resolver 2.0 for module descendance checks

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * checks/errors/privacy/rust-privacy-reporter.cc: Include rust-immutable-name-resolution-context.h. (is_child_module): Use ForeverStack::is_module_descendant if name resolution 2.0 is enabled. * resolve/rust-forever-sta

[COMMITTED 033/146] gccrs: Refactor HIR with optionals, references & newtypes

2025-03-21 Thread arthur . cohen
From: Pierre-Emmanuel Patry The HIR made heavy use of pair and other unamed types which can be difficult to read. gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Use FnParam getter. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile

[COMMITTED 029/146] gccrs: Fix bad handling for recursive type query

2025-03-21 Thread arthur . cohen
From: Philip Herron When resolving a type like this which is generic it causes the argument substitution to go through bounds checking which is expected. But this can call a type bounds probe which again calls a type query which will be on the Impl Type on an impl block which can result in a recu

[COMMITTED 036/146] gccrs: Fix Generic type retrieval

2025-03-21 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Forward an optional to the constructor. * hir/tree/rust-hir-item.cc (TypeParam::TypeParam): Use an optional in the constructor. (TypeParam::operator

[COMMITTED 016/146] gccrs: Remove usage of Resolver::get_builtin_types

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-context.cc (Context::setup_builtins): Use TypeCheckContext::get_builtins instead of Resolver::get_builtin_types, TypeCheckContext::lookup_type_by_node_id, and TypeCheckContext::lookup_type.

[COMMITTED 019/146] gccrs: Use name resolver 2.0 in VisibilityResolver

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * checks/errors/privacy/rust-visibility-resolver.cc: Add includes. (VisibilityResolver::resolve_module_path): Use name resolver 2.0 (when enabled) to lookup path resolutions. Signed-off-by: Owen Avery --- .../privacy/rust-vi

[COMMITTED 021/146] gccrs: Reorganize the CPU feature detection

2025-03-21 Thread arthur . cohen
From: Antoni Boucher Move the code from i386-rust.cc to i386-rust-and-jit.inc so that it can be reused by libgccjit. gcc/ChangeLog: * config/i386/i386-rust-and-jit.inc: New file. * config/i386/i386-rust.cc: Move code to i386-rust-and-jit.inc. --- gcc/config/i386/i386-rust-and-j

[COMMITTED 018/146] gccrs: fix bad type inference on local patterns

2025-03-21 Thread arthur . cohen
From: Philip Herron We do not need to inject inference variables on generic patterns with generic blocks. This will just cause unconstrained inference variables as they may not unify against something. Fixes Rust-GCC#2323 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-path.cc (Ty

[COMMITTED 023/146] gccrs: fix typechecking of Fn trait calls using ADT types

2025-03-21 Thread arthur . cohen
From: Philip Herron Fixes RustGcc#2953 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): fix the ty_id gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle these * rust/compile/issue-2953-1.rs: New test. * rust

[COMMITTED 025/146] gccrs: add test case to show issue is fixed

2025-03-21 Thread arthur . cohen
From: Philip Herron The original test case 1773 has been moved to a new issue 3242 which is still open and test-case is skipped. The original issue in 1773 is fixed so this will close out that issue Fixes Rust-Gcc#1773 gcc/testsuite/ChangeLog: * rust/compile/issue-1773.rs: new test cas

[COMMITTED 030/146] gccrs: Push ribs by kind rather than by value

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.h (ForeverStack::push): Accept argument of type Rib::Kind rather than Rib. * resolve/rust-forever-stack.hxx (ForeverStack::push): Likewise. * resolve/rust-name-resolution-context.cc

[COMMITTED 043/146] gccrs: Use nr2.0 in PrivacyReporter

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_for_privacy_violation): Use name resolver 2.0. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery --- ...

[COMMITTED 052/146] gccrs: improve handling of Self Type paths

2025-03-21 Thread arthur . cohen
From: Philip Herron TypePaths have special handling for Self where we can look at the current ctx for more acurate TypeAlias information if required. We cant do this for Impl contexts but not for Traits as we might as well fall back to the TypePathProbe. The other issue was the dyn type comming

[COMMITTED 045/146] gccrs: Use nr2.0 in typechecker

2025-03-21 Thread arthur . cohen
From: Owen Avery I probably missed a few spots, but this should cover most of the type checker. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc: Add includes. (TypeCheckExpr::visit): Use name resolver 2.0. (TypeCheckExpr::resolve_operator_overload): Likewise.

[COMMITTED 054/146] gccrs: ensure packed and aligned is applied properly

2025-03-21 Thread arthur . cohen
From: Philip Herron We cannot apply aligned or packed after layout_type is called you need to set this up first then call it. Fixes Rust-GCC#3260 gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): call lauout type directly * rust-backend.h (struct_

[COMMITTED 055/146] gccrs: lang-items: Move comment about arithmetic lang items

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-lang-item.h: Fix comment location to align with other comments. --- gcc/rust/util/rust-lang-item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h inde

[COMMITTED 064/146] gccrs: fix crash in hir dump

2025-03-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add missing check for no return value Signed-off-by: Philip Herron --- gcc/rust/hir/rust-hir-dump.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc

[COMMITTED 062/146] gccrs: add checks for division by zero and left shift overflow

2025-03-21 Thread arthur . cohen
From: Philip Herron These are ported from the c-family code c-warn.cc and c/c-typchk.cc Fixes Rust-GCC#2394 gcc/rust/ChangeLog: * backend/rust-constexpr.cc (eval_store_expression): check for null (eval_call_expression): remove bad warning * rust-gcc.cc (arithmetic_or_lo

[COMMITTED 079/146] gccrs: Made changes to AST::TraitImpl constructor for TypePath

2025-03-21 Thread arthur . cohen
From: Sri Ganesh Thota gcc/rust/ChangeLog: * ast/rust-item.h: I have changed helper constructor for typepath to be a delegating constructor. Signed-off-by: Sri Ganesh Thota --- gcc/rust/ast/rust-item.h | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff -

[COMMITTED 083/146] gccrs: resolve: Name resolve trait bounds properly

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit): Resolve additional trait bounds. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Error out properly on unresolved type-path instead of crashing

[COMMITTED 089/146] gccrs: ast-builder: Add more methods

2025-03-21 Thread arthur . cohen
From: Arthur Cohen This commit adds new methods for building pattern nodes, match expressions and more precise call expressions. gcc/rust/ChangeLog: * ast/rust-ast-builder.cc: Add new functions. * ast/rust-ast-builder.h: Declare them. --- gcc/rust/ast/rust-ast-builder.cc | 91

[COMMITTED 059/146] gccrs: ast: Use StackedContexts class in ContextualASTVisitor

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-visitor.h: Replace context with StackedContexts. * ast/rust-ast-visitor.cc (ContextualASTVisitor::visit): Use new APIs. * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Likewise. --- gcc/rust/ast/rust-as

[COMMITTED 058/146] gccrs: stacked-contexts: Add peek() method

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-stacked-contexts.h: Add new method to see what context we are currently in. --- gcc/rust/util/rust-stacked-contexts.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/gcc/rust/util/rust-stacked-contexts.h b/gcc/rust/util/rus

[COMMITTED 080/146] gccrs: add ptr to int and int to ptr type cast rules

2025-03-21 Thread arthur . cohen
From: Nobel Added rules to allow type casting pointer as integer types (u*,i*) and integer types to be casted as pointer. gcc/rust/ChangeLog: * typecheck/rust-casts.cc (TypeCastRules::cast_rules): Add rule. gcc/testsuite/ChangeLog: * rust/compile/ptr_int_cast.rs: New test. Si

[COMMITTED 061/146] gccrs: constant evaluation like these are coercion sites

2025-03-21 Thread arthur . cohen
From: Philip Herron The code here was wrongly assuming the decl type from the folding of the expression would be the type of the constant decl. This is not the case for unsized coercions for slices, where the expression here is a reference to an array then we require the coercion to fix the resul

[COMMITTED 112/146] gccrs: improve mutability checks

2025-03-21 Thread arthur . cohen
From: Philip Herron This ensures that we handle var decls readonly checks much better Addresses: Rust-GCC#807 Rust-GCC#3287 gcc/rust/ChangeLog: * checks/errors/rust-readonly-check.cc (check_decl): improve mut check (emit_error): helper (check_modify_expr): likewise

[COMMITTED 063/146] gccrs: add test case to show issue is fixed

2025-03-21 Thread arthur . cohen
From: Philip Herron Fixes Rust-GCC#266 gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-266.rs: New test. Signed-off-by: Philip Herron --- gcc/testsuite/rust/compile/issue-266.rs | 3 +++ gcc/testsuite/rust/compile/nr2/exclude |

[COMMITTED 073/146] gccrs: nr1.0: Resolve lang item paths properly.

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adapt resolver to lang item paths. * resolve/rust-ast-resolve-type.h: Likewise. --- gcc/rust/resolve/rust-ast-resolve-item.cc | 30 +-- gcc/rust/resolve/ru

[COMMITTED 069/146] gccrs: Fix ForeverStack::find_starting_point output parameter

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.h (ForeverStack::find_starting_point): Use type 'std::reference_wrapper &' instead of 'Node &' for parameter starting_point. * resolve/rust-forever-stack.hxx (ForeverStack::find_star

[COMMITTED 126/146] gccrs: lower: Properly lower non-generic lang item type path segments.

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Adapt code to lang item type path segments. --- gcc/rust/hir/rust-ast-lower-type.cc | 40 ++--- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a

[COMMITTED 118/146] gccrs: Add missing name resolution to static items in blocks

2025-03-21 Thread arthur . cohen
From: Philip Herron We need to add name resolution and hir lowering for items as part of blocks in order to typecheck and compile them correctly. Fixes Rust-GCC#3350 gcc/rust/ChangeLog: * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): hir lowering * hir/rust-ast-lower-stm

[COMMITTED 101/146] gccrs: fix ICE in borrows to invalid expressions

2025-03-21 Thread arthur . cohen
From: Philip Herron We need to check if the borrowed value is valid before creating the reference type. Otherwise this will lead to an ICE. Fixes Rust-GCC#3140 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): check for error * typecheck/rust-

Re: Rust: error[E0554]: `#![feature]` may not be used on the stable release channel

2025-03-21 Thread Thomas Schwinge
Hi! On 2025-03-17T20:03:48+, Iain Sandoe via Gcc wrote: >> On 17 Mar 2025, at 19:43, Toon Moene wrote: >> >> I was eager to try the new rust updates ... >> >> But I got this: >> >> error[E0554]: `#![feature]` may not be used on the stable release channel >> --> src/lib.rs:19:1 >> | >>

[COMMITTED 123/146] gccrs: collect-lang-items: Display attribute upon error finding it

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-collect-lang-items.cc (get_lang_item_attr): Show unknown attribute upon error. --- gcc/rust/ast/rust-collect-lang-items.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-collect-lang-items.cc b/

[COMMITTED 131/146] gccrs: ast-collector: Fix tuple struct pattern collection

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Visit tuple pattern items as separated by commas. --- gcc/rust/ast/rust-ast-collector.cc | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-col

[COMMITTED 128/146] gccrs: lang-item: Add LangItem::PrettyString

2025-03-21 Thread arthur . cohen
From: Arthur Cohen Which formats a lang item as it appears in source code. gcc/rust/ChangeLog: * util/rust-lang-item.cc (LangItem::PrettyString): New. * util/rust-lang-item.h: New. --- gcc/rust/util/rust-lang-item.cc | 6 ++ gcc/rust/util/rust-lang-item.h | 1 + 2 files ch

[COMMITTED 134/146] gccrs: derive(Clone): Manually generate AssertParamIsCopy struct for unions

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::visit_union): Manually generate the struct used for asserting a union implements Copy. --- gcc/rust/expand/rust-derive-clone.cc | 38 +--- 1 file changed, 34 insertions(+)

[COMMITTED 107/146] gccrs: match arms are a LUB

2025-03-21 Thread arthur . cohen
From: Philip Herron Unify rules are not the same as coercion rules. The coercion of ! is allowed to any type but not for a unify site which is different. Match arms are another least upper bound coercion. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): implemen

[COMMITTED 103/146] gccrs: fix ICE with hir dump on closure

2025-03-21 Thread arthur . cohen
From: Philip Herron Return type and parameter types are optional on closures. gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add null guard Signed-off-by: Philip Herron --- gcc/rust/hir/rust-hir-dump.cc | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --

[COMMITTED 116/146] gccrs: Fix scan-gimple testcases on LE platforms.

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/testsuite/ChangeLog: * rust/compile/macros/builtin/eager1.rs: Switch to scan-assembler directive as the GIMPLE dump does not contain strings on LE. * rust/compile/macros/builtin/recurse2.rs: Likewise. --- .../rust/compile/macros/builtin/eager1.rs

[COMMITTED 110/146] gccrs: add two more tests to test try-catch (unwind) code generation

2025-03-21 Thread arthur . cohen
From: liushuyu gcc/testsuite/ChangeLog: * rust/compile/try-catch-unwind-old.rs: add a test to test the older try intrinsics from plain old Rust to v1.78.0 * rust/compile/try-catch-unwind-new.rs: add a test to test the newer catch_unwind instrinsics since Rust v1.78

[COMMITTED 046/146] gccrs: Clean up some system includes

2025-03-21 Thread arthur . cohen
From: Pierre-Emmanuel Patry System includes shall use rust-system header instead. gcc/rust/ChangeLog: * ast/rust-stmt.h: Remove stdlib include and use rust-system instead. * backend/rust-compile-expr.cc: Likewise. * backend/rust-mangle-legacy.cc: Likewise. * back

[COMMITTED 146/146] gccrs: nr2.0: late: Better format PathInExpression resolution

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Improve formatting. --- .../resolve/rust-late-name-resolver-2.0.cc | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gcc/rust/resolve/rust-late-name-

[COMMITTED 057/146] gccrs: hir: Remove duplicate function in TraitItemFunc

2025-03-21 Thread arthur . cohen
From: Arthur Cohen Both TraitItemFunc::has_definition() and TraitItemFunc::has_block_defined() were exactly the same implementation, so remove one. gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h: Remove TraitItemFunc::has_block_defined() * backend/rust-compile-implitem.cc (Compi

[COMMITTED 140/146] gccrs: derive(Clone): Improve existing testcase

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/testsuite/ChangeLog: * rust/compile/derive_macro4.rs: Mark Copy and Clone as lang items. --- gcc/testsuite/rust/compile/derive_macro4.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/testsuite/rust/compile/derive_macro4.rs b/gcc/testsuite/rust/compil

[COMMITTED 124/146] gccrs: ast: Refactor how lang item paths are handled.

2025-03-21 Thread arthur . cohen
From: Arthur Cohen Lang item typepaths were not handled properly, and required a complete overhaul. All old classes that concerned lang item paths are now modified to use a simpler version of `AST::LangItemPath`, which has been removed. TypePath segments can now be lang items, as this is requied

[COMMITTED 119/146] gccrs: nr2.0: Early resolve pending eager macro invocations

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::visit): Resolve the pending eager invocations inside builtin macro invocations. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery

[COMMITTED 132/146] gccrs: lang-items: Mark Clone trait as a lang item in testsuite

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/testsuite/ChangeLog: * rust/compile/derive_macro1.rs: Add #[lang = "clone"] to Clone trait. * rust/compile/derive_macro3.rs: Likewise. * rust/compile/derive_macro6.rs: Likewise. * rust/execute/torture/derive_macro3.rs: Likewise. --- gcc/tes

[COMMITTED 135/146] gccrs: derive(Clone): Mark PhantomData as a lang item

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/testsuite/ChangeLog: * rust/compile/derive_macro4.rs: Make PhantomData a lang item. --- gcc/testsuite/rust/compile/derive_macro4.rs | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gcc/testsuite/rust/compile/derive_macro4.rs b/gcc/testsuite

[COMMITTED 139/146] gccrs: derive(Clone): Add note about Clone::clone()

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::clone_call): Mention using `clone_fn` lang item in the future. --- gcc/rust/expand/rust-derive-clone.cc | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/rus

[COMMITTED 026/146] gccrs: hir: Mark AttrVec::get_outer_attrs as override

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/tree/rust-hir.h: Add override qualifier to overriden method. --- gcc/rust/hir/tree/rust-hir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h index 8ce5cf4d102..8

[COMMITTED 086/146] gccrs: lang-item: Add Option::{None, Some}, Iterator::next, IntoIter::into_iter

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-lang-item.h: Add new lang items. * util/rust-lang-item.cc: Likewise. --- gcc/rust/util/rust-lang-item.cc | 6 ++ gcc/rust/util/rust-lang-item.h | 9 + 2 files changed, 15 insertions(+) diff --git a/gcc/rust/util/ru

[COMMITTED 136/146] gccrs: derive(Copy): Use copy lang item when deriving Copy.

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-copy.cc: Use lang item path. --- gcc/rust/expand/rust-derive-copy.cc | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gcc/rust/expand/rust-derive-copy.cc b/gcc/rust/expand/rust-derive-copy.cc index b

[COMMITTED 035/146] gccrs: Fixes some tests appearing with a moved variant

2025-03-21 Thread arthur . cohen
From: Pierre-Emmanuel Patry A variant being moved lead to a null being created and a segfault later down the line. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Call getter instead of size function. * checks/errors/privacy/rust-privacy-reporter

[COMMITTED 143/146] gccrs: derive(Clone): Implement clone for enum tuple variants

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::variant_match_path): New function. (DeriveClone::clone_enum_identifier): Rename. (DeriveClone::clone_enum_tuple): New function. (DeriveClone::visit_enum): Visit tuple variants prop

[COMMITTED 138/146] gccrs: derive(Clone): Use lang item for PhantomData in Clone

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::visit_union): Create a lang item path instead of a regular path. --- gcc/rust/expand/rust-derive-clone.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/expand/rust-

[COMMITTED 113/146] gccrs: gcc/rust/ChangeLog:

2025-03-21 Thread arthur . cohen
From: Om Swaroop Nayak <96killera...@gmail.com> * ast/rust-collect-lang-items.cc (get_lang_item_attr): "removed checker fn" * util/rust-attributes.cc (Attributes::is_lang_item): "added fn" * util/rust-attributes.h: "added fn" Signed-off-by: Om Swaroop Nayak <96killera...@

[COMMITTED 122/146] gccrs: attributes: Add #[derive] as a built-in attribute

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-attribute-values.h: Declare new attribute value. * util/rust-attributes.cc: Use it. --- gcc/rust/util/rust-attribute-values.h | 1 + gcc/rust/util/rust-attributes.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/gcc

[COMMITTED 095/146] gccrs: tychk: Add more support for additional trait bounds in functions

2025-03-21 Thread arthur . cohen
From: Arthur Cohen This commit correctly lowers and typechecks parenthesized types, which are used for trait objects with additional bounds. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveType::visit): New visitor to handle ParenthesizedType. * resolve/

[COMMITTED 098/146] gccrs: use StackedContexts for block context

2025-03-21 Thread arthur . cohen
From: Prajwal S N Replaces the DIY vector stack with a StackedContexts object for block scopes in the type checker context. Fixes #3284. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.h (class TypeCheckContext): add header file and use StackedContexts for blocks *

[COMMITTED 097/146] gccrs: ast: Add new Kind enums for more precise downcasting

2025-03-21 Thread arthur . cohen
From: Arthur Cohen This commit adds things like Item::Kind, Expr::Kind, etc, and implements the associated `get_*_kind` functions. It also removes the more generic AST::Kind enum we were using, which was incomplete and painful to use. gcc/rust/ChangeLog: * ast/rust-ast.h: Add new Kind

[COMMITTED 031/146] gccrs: Improve handling of static items in toplevel 2.0

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Use DefaultResolver::visit and avoid a call to Identifier::as_string while handling instances of StaticItem. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-topleve

[COMMITTED 028/146] gccrs: asm: Fix clang warnings

2025-03-21 Thread arthur . cohen
From: Arthur Cohen Fixes a couple of warnings thrown by clang, with mismatched class/struct usages and unused members. gcc/rust/ChangeLog: * ast/rust-expr.h: Remove invalid usage of `struct`. * backend/rust-compile-asm.h: Remove unused `translated` member. * backend/rust

[COMMITTED 127/146] gccrs: lang-items: Collect struct lang items.

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

[COMMITTED 121/146] gccrs: ast: Fix warning about copy elision for moved expr

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast.cc (BlockExpr::normalize_tail_expr): Remove overzealous std::move --- gcc/rust/ast/rust-ast.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc index 25e5

[COMMITTED 088/146] gccrs: ast: Add new constructors for PathInExpression

2025-03-21 Thread arthur . cohen
From: Arthur Cohen This commit adds two new constructors for AST::PathInExpression: One using a provided lang-item, and one with an already built std::unique_ptr gcc/rust/ChangeLog: * ast/rust-path.h: Add two new constructors. --- gcc/rust/ast/rust-path.h | 21 - 1

[COMMITTED 099/146] gccrs: fix ICE during HIR dump

2025-03-21 Thread arthur . cohen
From: Philip Herron These hir nodes have optional expressions which need guarded gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::do_qualifiedpathtype): add guard (Dump::do_traitfunctiondecl): likewise (Dump::visit): likewise Signed-off-by: Philip Herron --- gcc/rust