[COMMITTED 010/145] gccrs: borrowck: Use std::ignore

2025-03-17 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Use std::ignore. --- .../errors/borrowck/rust-bir-builder-expr-stmt.cc | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/r

[COMMITTED 032/145] gccrs: Change lookup_hir_extern_item return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the return type with an optional and make the return type a pair with the parent hid. gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): Adapt code around new return type. * checks/errors/rust-cons

[COMMITTED 038/145] gccrs: Change lookup_hir_generic_param return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type with an optional. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::insert_hir_generic_param): Change call site to accomodate the new return type. (Mappings::lookup_hir_generic_param): Wrap the function's re

[COMMITTED 042/145] gccrs: Change lookup_hir_self_param return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type within an optional in order to differentiate null pointers from missing value. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::insert_hir_self_param): Adapt call site to new return type. (Mappings::lookup_

[COMMITTED 016/145] gccrs: Improve matching on non-enum ADTs

2025-03-17 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (check_match_scrutinee): Add assertion. * backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): Handle HIR::PathInExpression matching a non-enum. gcc/testsuite/ChangeLog:

[COMMITTED 034/145] gccrs: Change return type to optional in get_lang_item

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type with an optional. gcc/rust/ChangeLog: * typecheck/rust-autoderef.cc: Adapt calling code to new return type. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. (TypeCheckExpr::resol

[COMMITTED 043/145] gccrs: Change lookup_hir_struct_field return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type within an optional to differentiate between a null pointer and a missing value. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::insert_hir_struct_field): Change call site to accomodate new return type. (Ma

[COMMITTED 040/145] gccrs: Change lookup_hir_smt's return type with optional

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type within an optional in order to differentiate missing values from null pointers. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::insert_hir_stmt): Change call site to accomodate new return type. (Mappings::

[COMMITTED 109/145] gccrs: Fix visitor-related warnings

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Fix visitor-related warnings * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise.

[COMMITTED 139/145] gccrs: Update pattern with \r* for dg-output tests

2025-03-17 Thread arthur . cohen
From: badumbatish First scan with "rg -v '\\r' gcc/testsuite/rust | rg 'dg-output'" gcc/testsuite/ChangeLog: * rust/execute/torture/issue-2187.rs: Update pattern with \r* for dg-output tests * rust/execute/xfail/macro1.rs: Likewise --- gcc/testsuite/rust/execute/torture

[COMMITTED 134/145] rust: fix HIR dump for MatchExpr

2025-03-17 Thread arthur . cohen
From: Marc Poulhiès The visitor was still using the as_string() method. gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::do_matcharm): New. (Dump::do_matchcase): New. (Dump::visit(MatchExpr)): Adjust, don't use as_string. * hir/rust-hir-dump.h (Dump::do_matcharm

[COMMITTED 143/145] gccrs: Fix ffi and enum conventions

2025-03-17 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * ast/rust-fmt.h (enum ParseMode): Drop typedef in Cpp libgrust/ChangeLog: * libformat_parser/generic_format_parser/src/lib.rs: Remove repr(C) * libformat_parser/src/bin.rs: Use ffi * libformat_parser/src/lib

[COMMITTED 126/145] gccrs: Added tl::expected to parse_operand

2025-03-17 Thread arthur . cohen
From: jjasmine Added tl::expected to parse_operand by implementing the validation inside the parse_reg_operand function. gcc/rust/ChangeLog: * ast/rust-expr.h: Added tl::expected to parse_operand * expand/rust-macro-builtins-asm.cc (parse_reg): Likewise. (parse_r

[COMMITTED 128/145] gccrs: Add WARN_UNUSED_RESULT parse error

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.h (enum InlineAsmParseError): Add WARN_UNUSED_RESULT parse error (enum WARN_UNUSED_RESULT): Likewise. Signed-off-by: badumbatish --- gcc/rust/expand/rust-macro-builtins-asm.h | 3 ++- 1 file changed, 2

[COMMITTED 082/144] gccrs: Create new test system for name resolution 2.0

2025-03-19 Thread arthur . cohen
From: Owen Avery This runs the standard compile/**.rs tests with name resolution 2.0 enabled. The exclude file can be used to exclude tests which are not yet working with name resolution 2.0. gcc/testsuite/ChangeLog: * rust/compile/nr2/compile.exp: New test. * rust/compile/nr2/e

[COMMITTED 088/144] gccrs: Remove some overloaded methods from DefaultResolver.

2025-03-19 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove some empty overloads which DefaultASTVisitor::visit should be able to handle. * resolve/rust-default-resolver.h (DefaultResolver::visit): Likewise. gc

[COMMITTED 083/144] gccrs: Check if the type has been correctly resolved

2025-03-19 Thread arthur . cohen
From: Pierre-Emmanuel Patry We did not check the optional was valid, this lead to rogue dereference and undefined behaviors. gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add optional check. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/resol

[COMMITTED 136/144] gccrs: Disambiguate generic args during name resolution 2.0

2025-03-19 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Visit GenericArgs and GenericArg, the former because the latter involves a non-virtual member function call. * resolve/rust-late-name-resolver-2.0.h (Late::visit):

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

2025-03-21 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 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 015/146] gccrs: fix bad type inferencing on path's

2025-03-21 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 006/146] gccrs: Use name resolution 2.0 in TraitItemReference

2025-03-21 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 008/146] gccrs: Improve path handling while testing name resolution 2.0

2025-03-21 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 011/146] gccrs: Use name resolution 2.0 in TraitResolver

2025-03-21 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 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 005/146] gccrs: Rename some PathIdentSegment functions

2025-03-22 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 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 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

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

[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

[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 084/146] gccrs: typecheck: Add note about erorring out on additional trait bounds.

2025-03-21 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 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

[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 093/146] gccrs: Remove Rust::make_unique

2025-03-21 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 092/146] gccrs: ast: Add EnumItem::Kind

2025-03-21 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 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 054/144] gccrs: Perform lowering hir output operand to tree

2025-03-20 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Add debug comment (CompileAsm::asm_construct_outputs): Perform lowering hir output operand to tree --- gcc/rust/backend/rust-compile-asm.cc | 12 +++- 1 file

[COMMITTED 025/144] gccrs: Move errors with locations

2025-03-20 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * checks/errors/borrowck/rust-borrow-checker-diagnostics.cc (BorrowCheckerDiagnostics::report_move_errors): Specify locations for code causing errors and related moves. gcc/testsuite/ChangeLog: * rust/borrowck/test_move.rs: T

[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 027/146] gccrs: typecheck: Remove unused parameter in TyTyCheckCallExpr

2025-03-21 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

[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

[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 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 037/146] gccrs: FnParam cloning now keeps projections

2025-03-21 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 003/146] gccrs: Fix variable shadowing in late 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): Visit the initialization expressions of let statements before visiting their patterns. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-b

[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 014/146] gccrs: Make TyTy::TupleType::get_unit_type cache its return value

2025-03-21 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 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 050/146] gccrs: Prepend crate name to functions with nr2

2025-03-21 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 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 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 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 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 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 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 048/146] gccrs: empty match expressions should resolve to !

2025-03-21 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 094/146] gccrs: lower: Correctly lower parenthesized types

2025-03-21 Thread arthur . cohen
From: Arthur Cohen This is useful for handling multiple trait bounds, and required for better handling of auto traits. gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLoweringType::visit): Add implementation for ParenthesizedType. * hir/rust-ast-lower-type.h

[COMMITTED 091/146] gccrs: nr2.0: Handle "Self" properly in trait definitions

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit implicit Self parameters of traits. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Resolve implicit Self parameters of traits. * resolve/rust-

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

2025-03-21 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 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 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

[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

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

2025-03-21 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 075/146] gccrs: nr2.0: Resolve lang item paths properly.

2025-03-21 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

[COMMITTED 111/146] gccrs: Visit the trait paths of trait implementations

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): When visiting a TraitImpl, visit its trait path. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery --- gcc/rust/ast/rust-as

[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 115/146] gccrs: testsuite: Fix missing handling of little endian.

2025-03-21 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 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 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

[COMMITTED 130/146] gccrs: ast-collector: Adapt to lang item type path segments

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Fix collector to better handle lang item type path segments. --- gcc/rust/ast/rust-ast-collector.cc | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff

[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

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

2025-03-21 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 076/146] gccrs: lang-item: Remove unused NodeId from LangItemPath

2025-03-21 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 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 104/146] gccrs: nr2.0: Resolve Self inside impl blocks

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert a definition for Self when visiting InherentImpl and TraitImpl instances. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Add visitor

[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

[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 109/146] gccrs: rust/intrinsic: add new "catch_unwind" variant of API

2025-03-21 Thread arthur . cohen
From: liushuyu gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc: add the new `catch_unwind` variant of the `try` intrinsic: this variant can be seen on Rust 1.78+ and returns `()` instead of `i32`. --- gcc/rust/backend/rust-compile-intrinsic.cc | 57 +++

[COMMITTED 145/146] gccrs: derive(Clone): Add lang item typepaths failure testcases to nr2 exclude

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Add failing lang item typepaths tests. * rust/execute/torture/derive_macro4.rs: Mark Clone as lang item. --- gcc/testsuite/rust/compile/nr2/exclude | 5 + gcc/testsuite/rust/execute/torture

[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 117/146] gccrs: Revert "gcc/rust/ChangeLog:"

2025-03-21 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 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 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 066/146] gccrs: lang-items: Add lang-items AST collector

2025-03-21 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 017/146] gccrs: Improve handling of struct expressions in nr2.0

2025-03-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Handle StructExprStruct and use ForeverStack::resolve_path instead of ForeverStack::get to resolve struct expression paths. * resolve/rust-late-name-resolver-2.0.h

[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

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

2025-03-21 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 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 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

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

2025-03-21 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 065/146] gccrs: lang-items: Store NodeId mappings for lang items

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-hir-map.h: Keep a NodeId mappings for lang items. * util/rust-hir-map.cc (Mappings::insert_lang_item_node): New function. (Mappings::lookup_lang_item_node): Likewise. --- gcc/rust/util/rust-hir-map.cc | 22

[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

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

2025-03-21 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 137/146] gccrs: ast-builder: Add new methods around type paths.

2025-03-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-builder.cc: New functions. * ast/rust-ast-builder.h: Declare them. --- gcc/rust/ast/rust-ast-builder.cc | 57 ++-- gcc/rust/ast/rust-ast-builder.h | 13 +++- 2 files changed, 67 insertions

[COMMITTED 043/141] gccrs: lang-items: Add structural_{peq, teq}

2025-03-24 Thread arthur . cohen
From: Arthur Cohen These lang items are used when deriving Eq and PartialEq, and will be checked when compiling pattern matching. gcc/rust/ChangeLog: * util/rust-lang-item.cc: New items. * util/rust-lang-item.h: Likewise. gcc/testsuite/ChangeLog: * rust/compile

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

<    3   4   5   6   7   8   9   10   11   12   >