[COMMITTED 196/220] gccrs: Fix ICE for ast dump of deferred anon const

2025-08-05 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): check for value Signed-off-by: Philip Herron --- gcc/rust/ast/rust-ast-collector.cc | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-collector.c

[COMMITTED 202/220] gccrs: Prevent used after move on self param

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): Remove use after move. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/hir/rust-ast-lower-implitem.cc | 17 + 1 file changed, 9 insertions(+), 8 delet

[COMMITTED 206/220] gccrs: Remove more calls to the old TyTy::BaseType::can_eq interface

2025-08-05 Thread arthur . cohen
From: Philip Herron This old can_eq interface was an old method to try and check if types can match up by taking into account generics but its not maintained properly and we already have a new wrapper Resolver::types_compatable (type, type, locus, emit_errors) which just calls unify_site_and in

[COMMITTED 156/220] gccrs: Load modules during CfgStrip phase

2025-08-05 Thread arthur . cohen
From: Owen Avery TopLevel would ignore just-loaded modules but Early and ExpandVisitor wouldn't. The latter would produce errors when it hit attributes which should have been indirectly CfgStrip'd away. gcc/rust/ChangeLog: * expand/rust-cfg-strip.cc (CfgStrip::visit): Load unloaded

[COMMITTED 217/220] gccrs: Remove undefined behavior with static_cast

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * expand/rust-macro-builtins-helpers.cc (try_extract_string_literal_from_fragment): Perform static_cast to AST::LiteralExpr only after it's verified that an AST::Expr is a literal. Signed-off-by: Owen Avery --- gcc/rust/expa

[COMMITTED 213/220] gccrs: Catch parse failure in parse_path_meta_item

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast.cc (AttributeParser::parse_path_meta_item): Catch parse_expr returning nullptr and remove defunct comment. Signed-off-by: Owen Avery --- gcc/rust/ast/rust-ast.cc | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-)

[COMMITTED 173/220] gccrs: Add execute test for variable and identifiers

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/execute/inline_asm_inout_ident.rs: New test. * rust/execute/inline_asm_inout_var.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- .../rust/execute/inline_asm_inout_ident.rs| 23 ++ .../rust/e

[COMMITTED 187/220] gccrs: Do not warn about unused `self` parameter

2025-08-05 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * checks/lints/rust-lint-unused-var.cc (check_decl): Do not warn about unused `self` parameter. Signed-off-by: Ryutaro Okada <1015ry...@gmail.com> --- gcc/rust/checks/lints/rust-lint-unused-var.cc | 4 +++- 1 file cha

[COMMITTED 170/220] gccrs: Add pretty hir dump for inline assembly

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): Dump inline assembly fields * hir/tree/rust-hir-expr.h: Add non const getter and avoid operand copy from getters. * hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Use no

[COMMITTED 174/220] gccrs: nr1.0: Remove rust/typecheck support

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::TypeCheckBase): Remove initialization of resolver field. * typecheck/rust-hir-type-check-base.h (TypeCheckBase::resolver): Remove field. * typecheck/rust-h

[COMMITTED 220/220] gccrs: Add read-only check on HIR

2025-08-05 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * Make-lang.in (rust-readonly-check2.cc): Add read-only check on HIR * checks/errors/rust-readonly-check2.cc (ReadonlyChecker): Add read-only check on HIR * checks/errors/rust-readonly-check2.h (

[COMMITTED 194/220] gccrs: Add initial support for const generics

2025-08-05 Thread arthur . cohen
From: Philip Herron In order to support const generics we map the declarations to a ConstType this means we reuse all our existing type coercion, unification code and generic substitutions code to support this with minimal impact. This patch adds support for: 1. Default const generics 2. Infer

[COMMITTED 218/220] gccrs: Add check before calling `get_trait_ref()`

2025-08-05 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Add check before calling `get_trait_ref()` Signed-off-by: Ryutaro Okada <1015ry...@gmail.com> --- gcc/rust/hir/tree/rust-hir-visitor.cc | 3 ++- 1 file change

[COMMITTED 208/220] gccrs: remove old debug

2025-08-05 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc (SubstitutionRef::infer_substitions): remove debug Signed-off-by: Philip Herron --- gcc/rust/typecheck/rust-tyty-subst.cc | 7 --- 1 file changed, 7 deletions(-) diff --git a/gcc/rust/typecheck/rust-tyty-subs

[COMMITTED 198/220] gccrs: Support const generic inference variables

2025-08-05 Thread arthur . cohen
From: Philip Herron We already support const infer so this just creates a fresh tyty::infer_var for the const element type and then a ConstKind::Infer type for the const type wrapper and the existing plumbing handles this. Fixes Rust-GCC#3885 gcc/rust/ChangeLog: * typecheck/rust-hir-ty

[COMMITTED 203/220] gccrs: Initialize boolean flag correctly

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::ASTLoweringPattern): flag was not initialized in the constructor. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/hir/rust-ast-lower-pattern.cc | 4 +++- 1 file changed, 3 i

[COMMITTED 183/220] gccrs: lower: Add assertions for desugared nodes

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc: Add rust_unreachable() when lowering desugared exprs. * hir/rust-ast-lower-base.h: Mention this. * hir/rust-ast-lower-block.h: Remove existing definitions. * hir/rust-ast-lower-expr.cc

[COMMITTED 211/220] gccrs: Fix object copying issue causing pointer inconsistency

2025-08-05 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): Fix object copying issue causing pointer inconsistency Signed-off-by: Ryutaro Okada <1015ry...@gmail.com> --- gcc/rust/hir/rust-ast-lower-implitem.cc | 2 +-

[COMMITTED 215/220] gccrs: Make AttributeParser rely more on Parser

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast.cc (AttributeParser::parse_meta_item_inner): Handle removal of AttributeParser-specific functions. (AttributeParser::parse_path_meta_item): Likewise. (AttributeParser::parse_meta_item_seq): Likewise. (Att

[COMMITTED 209/220] gccrs: Add test case showing method resolution with const-generics

2025-08-05 Thread arthur . cohen
From: Philip Herron gcc/testsuite/ChangeLog: * rust/execute/torture/const-generics-1.rs: New test. Signed-off-by: Philip Herron --- .../rust/execute/torture/const-generics-1.rs | 24 +++ 1 file changed, 24 insertions(+) create mode 100644 gcc/testsuite/rust/execute/t

[COMMITTED 168/220] gccrs: Implement compilation for SlicePattern against SliceType scrutinee

2025-08-05 Thread arthur . cohen
From: Yap Zhi Heng 006t.original output from compiling testsuite/rust/compile/match-slicepattern-slice.rs: ... RUSTTMP.3 = slice; if (RUSTTMP.3.len == 1 && *(RUSTTMP.3.data + 0 * 4) == 1) { { struct () RUSTTMP.4; { } goto ; } }

[COMMITTED 200/220] gccrs: Add rest pattern support for AST::SlicePattern

2025-08-05 Thread arthur . cohen
From: Yap Zhi Heng The main change can be found in ast/rust-pattern.h, which introduces 2 item types for AST::SlicePattern - one without rest pattern (SlicePatternItemsNoRest) & the other with it (SlicePatternItemsHasRest). This led to a number of cascading changes as seen in the changelog. g

[COMMITTED 214/220] gccrs: offset_of: Compile the offset properly

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Add proper handling of the node. * rust-backend.h (lookup_field): Declare it. * rust-gcc.cc (lookup_field): Add forked implementation from gcc/c/. gcc/testsuite/ChangeLog

[COMMITTED 193/220] gccrs: Add ConstType boiler plate to handle const generics

2025-08-05 Thread arthur . cohen
From: Philip Herron This patch is all about just putting in the boiler plate for the new BaseGeneric TyTy::ConstType. Nothing is really change but just the nessecary cogs added to the machine. gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): error_mark_no

[COMMITTED 199/220] gccrs: Fix ICE when extra const arguments supplied

2025-08-05 Thread arthur . cohen
From: Philip Herron The substitution code was not taking into account the const generic arguments for checking the max bounds of total available parameters. Fixes Rust-GCC#3546 gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc: fix check for total arguments gcc/testsuite/ChangeLog:

[COMMITTED 192/220] gccrs: Refactor the ParamType to a BaseGeneric base-type

2025-08-05 Thread arthur . cohen
From: Philip Herron In order to support const generics we need to abstract away some of the specific ParamType to a BaseGeneric type so we can easily reuse our existing substitution bits for const generics which will mean creating a TyTy::ConstType to wrap up the gcc tree but also represent a con

[COMMITTED 201/220] gccrs: Retrieve token stream before vector move

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * expand/rust-macro-builtins-helpers.cc: Remove use after move. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/expand/rust-macro-builtins-helpers.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/expand

[COMMITTED 191/220] gccrs: simplify the is_eq on ADTType

2025-08-05 Thread arthur . cohen
From: Philip Herron We dont need to do this resolve we can just let the ParamType's sort this out. gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (ADTType::is_equal): let param::is_eq do this (FnType::is_equal): remove whitespace Signed-off-by: Philip Herron --- gcc/rust/typech

[COMMITTED 185/220] gccrs: Fix AttrInputMacro operator= overloading.

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast.cc (AttrInputMacro::operator=): Add return type. * ast/rust-expr.h: Likewise. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-ast.cc | 3 ++- gcc/rust/ast/rust-expr.h | 8 ++-- 2 files changed, 8 ins

[COMMITTED 176/220] gccrs: Fix infinite loop with missing comma

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry A missing comma between inline assembly templates did not throw an error and looped indefinitely. gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_format_strings): Emit an error when expecting a comma. gcc/testsuite/ChangeLog:

[COMMITTED 175/220] gccrs: Fix semicolon after some namespace

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Remove namespace comment after classes and structs. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-fact-collector.h: Remove spurious comment. * checks/errors/rust-feature.cc: Likewise. * util/optional.h: Likewise. * expa

[COMMITTED 197/220] gccrs: Fix ICE during hir dump of deferred anon constant

2025-08-05 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): check for expression * hir/tree/rust-hir.cc (AnonConst::as_string): likewise Signed-off-by: Philip Herron --- gcc/rust/hir/rust-hir-dump.cc | 5 - gcc/rust/hir/tree/rust-hir.cc | 5 - 2 files

[COMMITTED 207/220] gccrs: improve debug logging for unify site

2025-08-05 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-type-util.cc (unify_site_and): improve debug Signed-off-by: Philip Herron --- gcc/rust/typecheck/rust-type-util.cc | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/rust/typecheck/rust

[COMMITTED 189/220] gccrs: Fix ICE during const eval of const capacity

2025-08-05 Thread arthur . cohen
From: Philip Herron We assert that struct expressions during code-gen must be of TyTy::ADTType but we can simply just check for this and return error_mark_node to make this safe. Fixes Rust-GCC#3960 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): check for ADTT

[COMMITTED 171/220] gccrs: Parse input and output expression

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Previously inline assembly expected identifiers instead of expression. gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand_inout): Parse expressions and build split in out. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ex

[COMMITTED 190/220] gccrs: Refactor substitution param mapping to be more abstract

2025-08-05 Thread arthur . cohen
From: Philip Herron This is an initial patch required to refactor our generics code to be simpler and more abstract so we return the HIR::GenericParam in ParamMappings instead of assuming its a TypeParam so we can slowly introduce ConstGenericParam into this same flow. gcc/rust/ChangeLog:

[COMMITTED 195/220] gccrs: fix clang formatting

2025-08-05 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): formatting * typecheck/rust-tyty-variance-analysis-private.h: likewise * typecheck/rust-tyty.cc (VariantDef::clone): likewise (VariantDef::monomorphized_clone)

[COMMITTED 184/220] gccrs: desugar: Cleanup for-loop desugar implementation.

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-desugar-for-loops.cc: Remove functions implemented in AST::Builder. * ast/rust-desugar-for-loops.h: Likewise. --- gcc/rust/ast/rust-desugar-for-loops.cc | 23 --- gcc/rust/ast/rust-desugar-for-loops.h | 2

[COMMITTED 172/220] gccrs: Add input/output from inout and split in out

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Inline assembly was incomplete and input/output from inout or split in out were not handled. gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (get_out_expr): Return valid output from an operand. (CompileAsm::asm_construct_outputs): Handle eve

[COMMITTED 169/220] gccrs: Add indexed positional argument support in asm

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): Handle transformation for indexed positional arguments. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/expand/rust-macro-builtins-asm.cc | 5 + 1 file change

[COMMITTED 212/220] gccrs: Avoid including rust-parse-impl.h in rust-parse.h

2025-08-05 Thread arthur . cohen
From: Owen Avery This should reduce incremental compile times when modifying rust-parse-impl.h and not rust-parse.h. gcc/rust/ChangeLog: * Make-lang.in (GRS_OBJS): Add entries. * parse/rust-parse-impl.h: Adjust header comment. (Parser::parse_lifetime_params_objs): Fix bu

[COMMITTED 181/220] gccrs: desugar: Add for-loop desugar to ExpressionYeast

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-desugar-for-loops.h: Adapt API and remove visitor. * ast/rust-desugar-for-loops.cc: Likewise. * ast/rust-expression-yeast.cc: Call DesugarForLoop. * ast/rust-expression-yeast.h: Declare dispatch_loops function

[COMMITTED 153/220] gccrs: Use MacroInvocLexer in AttributeParser

2025-08-05 Thread arthur . cohen
From: Owen Avery This should make it easier for us to handle attribute meta items of the form '=' where the expression isn't a literal. Some low hanging fruit remains here, but I think I should keep this patch small as I had some trouble debugging it as-is (see: Rust::Token::as_string vs Rust::

[COMMITTED 178/220] gccrs: ast: Add OffsetOf node

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast.h: Add OffsetOf expression kind. * ast/rust-builtin-ast-nodes.h (class OffsetOf): Add node. * ast/rust-ast.cc: Define it. * ast/rust-ast-collector.cc: Add visitor for OffsetOf. * ast/rust-ast

[COMMITTED 210/220] gccrs: Parse expression instead of literal in attributes

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast.cc (AttributeParser::parse_path_meta_item): Parse expression instead of literal. Update variant name. (MetaItemPathLit::to_attribute): Remove function. (AttributeParser::parse_path_meta_item): Update n

[COMMITTED 182/220] gccrs: desugar: Add assertions for try-blocks and question-mark

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-desugar-question-mark.cc (DesugarQuestionMark::go): Add assertion for the expr's type. * ast/rust-desugar-try-block.cc (DesugarTryBlock::go): Likewise. --- gcc/rust/ast/rust-desugar-question-mark.cc | 3 ++- gcc

[COMMITTED 146/220] gccrs: Implement compilation for SlicePattern matching against ArrayType scrutinee

2025-08-05 Thread arthur . cohen
From: Yap Zhi Heng Example GIMPLE output from compiling testsuite/rust/compile/match-pattern-array.rs: ... a[0] = 0; a[1] = 1; RUSTTMP.3 = a; _1 = RUSTTMP.3[0]; _2 = _1 == 0; _3 = RUSTTMP.3[1]; _4 = _3 == 1; _5 = _2 & _4; if (_5 != 0) goto ; else goto ; : { {

[COMMITTED 205/220] gccrs: Ensure we track the const generic substitution on the param mappings

2025-08-05 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc: track the const generic * typecheck/rust-tyty.cc (ConstType::is_equal): finish the is_equal Signed-off-by: Philip Herron --- gcc/rust/typecheck/rust-tyty-subst.cc | 7 +-- gcc/rust/typecheck/rust-tyty

[COMMITTED 159/220] gccrs: ast: Use AnonConst for array type sizes

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-expr.h: Add handling for deferred consts. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast.cc (AnonConst::as_string): Likewise. (ArrayType::as_string): Likewise. * ast/rust

[COMMITTED 180/220] gccrs: hir: Add OffsetOf node

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h (class OffsetOf): New. * hir/tree/rust-hir-expr.cc: Define its methods. * hir/tree/rust-hir-expr-abstract.h: Add ExprType::OffsetOf. * hir/tree/rust-hir-full-decls.h (class OffsetOf): Declare it

[COMMITTED 186/220] gccrs: desugar: Add base for desugaring while-let loops

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * Make-lang.in: * ast/rust-expression-yeast.cc (ExpressionYeast::dispatch_loops): Call DesugarWhileLet. * ast/rust-desugar-while-let.cc: New file. * ast/rust-desugar-while-let.h: New file. gcc/testsuite/ChangeLog

[COMMITTED 177/220] gccrs: Error message field member was not properly updated

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * rust-diagnostics.h (struct Error): Add disambiguation. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/rust-diagnostics.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/rust/rust-diagnostics.h b/gcc/r

[COMMITTED 135/220] gccrs: Fix narrowing of Loan (size_t) into LoanId (uint32)

2025-08-05 Thread arthur . cohen
From: Marc Poulhiès Fix narrowing: -../../gcc/rust/checks/errors/borrowck/rust-borrow-checker-diagnostics.cc:145:46: warning: narrowing conversion of ‘loan’ from ‘Rust::Polonius::Loan’ {aka ‘long unsigned int’} to ‘uint32_t’ {aka ‘unsigned int’} [-Wnarrowing] gcc/rust/ChangeLog:

[COMMITTED 158/220] gccrs: nr2.0: Handle glob imports of enum variants.

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): Adapt for enums. (Early::finalize_glob_import): Likewise. * resolve/rust-early-name-resolver-2.0.h: Likewise. * resolve/rust-finalize-imports-2.0.cc

[COMMITTED 134/220] gccrs: Improve LiteralPattern type checking

2025-08-05 Thread arthur . cohen
From: Yap Zhi Heng This change is made to ensure that LiteralPatterns in SlicePattern are type-checked against the scrutinee array/slice's element type properly. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc(TypeCheckPattern::visit(LiteralPattern)): Ch

[COMMITTED 152/220] gccrs: return error node when this fails during constexpr case

2025-08-05 Thread arthur . cohen
From: Philip Herron Not adding the test case here we emit more errors than rustc for the error type node so its just noisy and dejagnu is being a pain. Fixes Rust-GCC#3933 gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): return error_mark_node Sig

[COMMITTED 151/220] gccrs: Add initial support for deffered operator overload resolution

2025-08-05 Thread arthur . cohen
From: Philip Herron In the test case: fn test (len: usize) -> u64 { let mut i = 0; let mut out = 0; if i + 3 < len { out = 123; } out } The issue is to determine the correct type of 'i', out is simple because it hits a coercion site in the resturn position

[COMMITTED 204/220] gccrs: Initialize boolean flag correctly

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Flag was left uninitialized within default constructor. gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::Dump): Initialize flag. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/hir/rust-hir-dump.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[COMMITTED 163/220] gccrs: ast: Visit block labels if they are present

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit a block's loop label if it exists. --- gcc/rust/ast/rust-ast-visitor.cc | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rus

[COMMITTED 150/220] gccrs: Fix ICE with duplicate root item main function

2025-08-05 Thread arthur . cohen
From: Philip Herron Rust seems to allow duplicate HIR::Item 'main' functions but it needs to be a root item to be the true main entry point. This means we can use the canonical path to determine if this is a root one where its CrateName::main or CrateName::Module::main. Fixes Rust-GCC#3978 gcc/

[COMMITTED 149/220] gccrs: Improve parsing of simple paths

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_simple_path): Be more careful about skipping SCOPE_RESOLUTION tokens. (Parser::parse_simple_path_segment): Allow parsing from a starting offset. (Parser::parse_use_tree): Handle

[COMMITTED 129/220] gccrs: ast: Check before visiting a while-let's label

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check that the WhileLet has a label before visiting it. gcc/testsuite/ChangeLog: * rust/compile/while_let_without_label.rs: New test. --- gcc/rust/ast/rust-ast-visitor.cc

[COMMITTED 126/220] gccrs: Change enum to enum class

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * parse/rust-parse-impl.h: Add enum prefix. * parse/rust-parse.h (enum ParseSelfError): Change from enum... (enum class): To enum class. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/parse/rust-parse-impl.h | 6 --

[COMMITTED 164/220] gccrs: Handle IfLetExprConseqElse in DefaultResolver

2025-08-05 Thread arthur . cohen
From: Owen Avery This relies on the DefaultASTVisitor visitor for IfLetExprConseqElse performing a virtual call of the visitor for IfLetExpr, which doesn't hold when DefaultASTVisitor is generated by the X-macro-DSL-system I have in another patch. gcc/rust/ChangeLog: * resolve/rust-defa

[COMMITTED 161/220] gccrs: chore: ast: Fix formatting in rust-expr.h

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-expr.h: Fix formatting. --- gcc/rust/ast/rust-expr.h | 89 +++- 1 file changed, 43 insertions(+), 46 deletions(-) diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index c875d6914b3

[COMMITTED 122/220] gccrs: Remove -frust-name-resolution-2.0 usage in tests

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/additional-trait-bounds2nr2.rs: Remove -frust-name-resolution-2.0 usage. * rust/compile/const_generics_3.rs: Likewise. * rust/compile/enum_variant_name.rs: Likewise. * rust/compile/generics9.rs: Like

[COMMITTED 145/220] gccrs: Add size checking to SlicePattern

2025-08-05 Thread arthur . cohen
From: Yap Zhi Heng gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc(TypeCheckPattern::visit(SlicePattern)): Implement size checking for SlicePattern when type checking against array parent Signed-off-by: Yap Zhi Heng --- .../typecheck/rust-hir-type-chec

[COMMITTED 120/220] gccrs: Implement compilation support for TuplePatternItems::RANGED

2025-08-05 Thread arthur . cohen
From: Zhi Heng Example GIMPLE output of the match statement for match-restpattern-tuple-1.rs: ... RUSTTMP.2 = x; _1 = RUSTTMP.2.__0; _2 = _1 == 1; _3 = RUSTTMP.2.__3; _4 = _3 == 4; _5 = _2 & _4; if (_5 != 0) goto ; else goto ; : { { } goto ; } : if (1 != 0) goto ; else goto ; : {

[COMMITTED 162/220] gccrs: desugar: Add desugar dispatch for all desugars

2025-08-05 Thread arthur . cohen
From: Arthur Cohen Since we are doing more and more "external" desugars, as in desugars that take a pointer and replace it with another one, rather than modifying it from within, having an external visitor dispatch to the proper desugar helps with code clarity. gcc/rust

[COMMITTED 112/220] gccrs: nr2.0: Add more checks for alternate patterns

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (visit_identifier_as_pattern): Handle is_ref and is_mut. (Late::visit): Likewise. * resolve/rust-name-resolution-context.cc (BindingLayer::insert_ident): Likewise. (Bindi

[COMMITTED 113/220] gccrs: nr2.0: Adjust resolution of modules

2025-08-05 Thread arthur . cohen
From: Owen Avery This prioritizes resolution in the language prelude over resolution as a module. gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx (ForeverStack::resolve_path): Resolve final segments which point to modules. * resolve/rust-toplevel-name-resolver-2.0.c

[COMMITTED 111/220] gccrs: Add locus getters

2025-08-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-expr.h: Add getter to locus field. * ast/rust-pattern.h (tokenid_to_rangekind): Likewise. * hir/tree/rust-hir-item.h: Likewise. * hir/tree/rust-hir-visibility.h: Likewise. Signed-off-by: Pierre-Emmanuel P

[COMMITTED 142/220] gccrs: Add test case to show issue is fixed

2025-08-05 Thread arthur . cohen
From: Philip Herron Fixes Rust-GCC#1048 gcc/testsuite/ChangeLog: * rust/compile/issue-1048.rs: New test. Signed-off-by: Philip Herron --- gcc/testsuite/rust/compile/issue-1048.rs | 8 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/rust/compile/issue-1048.r

[COMMITTED 154/220] gccrs: fix bad monomophization of generic paths

2025-08-05 Thread arthur . cohen
From: Philip Herron When we have generic paths like T::foobar during codegen sometimes we need to enforce an extra lookup for this generic parameter type to the mono morphized underlying type. Fixes Rust-GCC#3915 Fixes Rust-GCC#1247 gcc/rust/ChangeLog: * backend/rust-compile-resolve-pa

[COMMITTED 109/220] gccrs: Implement type checking for ItemType::RANGED in TuplePattern

2025-08-05 Thread arthur . cohen
From: Zhi Heng This patch implements the previously unimplemented type checking for RANGED item type for TuplePattern, which serves as the start for implementing compilation of RestPattern. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit(TuplePat

[COMMITTED 157/220] gccrs: mappings: Change mappings to allow other items as item containers.

2025-08-05 Thread arthur . cohen
From: Arthur Cohen This is important for importing enum variants as items. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::insert_ast_module): Rename to... (Mappings::insert_glob_container): ...this. (Mappings::lookup_ast_module): Rename to... (Mappings

[COMMITTED 160/220] gccrs: hir: Handle deferred const inference variables

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Handle defered consts. * hir/tree/rust-hir-expr.cc (AnonConst::AnonConst): Likewise. (AnonConst::operator=): Likewise. * hir/tree/rust-hir-expr.h: Likewise

[COMMITTED 140/220] gccrs: add test case to show issue is fixed

2025-08-05 Thread arthur . cohen
From: Philip Herron Fixes Rust-GCC#3599 gcc/testsuite/ChangeLog: * rust/compile/issue-3599.rs: New test. Signed-off-by: Philip Herron --- gcc/testsuite/rust/compile/issue-3599.rs | 8 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/rust/compile/issue-3599.r

[COMMITTED 155/220] gccrs: Specialize ExpandVisitor::expand_macro_children

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_items): Adjust call to expand_macro_children. (ExpandVisitor::expand_inner_stmts): Likewise. (ExpandVisitor::visit): Likewise. * expand/rust-expand-vi

[COMMITTED 108/220] gccrs: Update C++ version check in rust-lang.cc

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * rust-lang.cc: Move version check from C++11 to C++14. Signed-off-by: Owen Avery --- gcc/rust/rust-lang.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc index 35003ab327b..9

[COMMITTED 143/220] gccrs: attributes: Add #[test] and #[simd_test]

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-attribute-values.h: Add declarations for them. * util/rust-attributes.cc: Add definitions. --- gcc/rust/util/rust-attribute-values.h | 4 gcc/rust/util/rust-attributes.cc | 5 - 2 files changed, 8 insertions(+), 1

[COMMITTED 128/220] gccrs: Parse try expressions

2025-08-05 Thread arthur . cohen
From: Owen Avery This doesn't do anything beyond creating TryExpr and parsing them, so try expressions shouldn't be able to make it past AST lowering yet. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Add visitor for TryExpr. * ast/rust-ast-col

[COMMITTED 147/220] gccrs: Reject loop in const/static context

2025-08-05 Thread arthur . cohen
From: lishin gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Add a catch for const/static. gcc/testsuite/ChangeLog: * rust/compile/loop_constant_context.rs: New test. * rust/compile/issue-3618.rs: Signed-off-by: lishin --- gcc/rust/backend/r

[COMMITTED 102/220] gccrs: Fix bug with non compiled const decl

2025-08-05 Thread arthur . cohen
From: Philip Herron There was a sily bug where if you reorder this test case to declare A before B this test would work but its meant to work in any order. So this fixes the bug during code gen to fall back to our query compile system if this is needed. Fixes Rust-GCC#3525 gcc/rust/ChangeLog:

[COMMITTED 141/220] gccrs: Add test case to show we emit better errors now

2025-08-05 Thread arthur . cohen
From: Philip Herron Fixes Rust-GCC#3144 gcc/testsuite/ChangeLog: * rust/compile/issue-3144.rs: New test. Signed-off-by: Philip Herron --- gcc/testsuite/rust/compile/issue-3144.rs | 29 1 file changed, 29 insertions(+) create mode 100644 gcc/testsuite/rust/co

[COMMITTED 127/220] gccrs: Allow format_args to accept a raw string literal

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * expand/rust-macro-builtins-format-args.cc (format_args_parse_arguments): Accept a RAW_STRING_LITERAL token as the first argument. Signed-off-by: Owen Avery --- gcc/rust/expand/rust-macro-builtins-format-args.cc | 11 +-- 1

[COMMITTED 097/220] gccrs: Fix silly ordering bug in trait reference resolution

2025-08-05 Thread arthur . cohen
From: Philip Herron Ensure proper ordering when resolving trait references to prevent incorrect type resolution in certain contexts. gcc/rust/ChangeLog: * typecheck/rust-hir-trait-reference.cc (TraitReference::on_resolved): ensure associated types are done first * typec

[COMMITTED 139/220] gccrs: Fix ICE when handling bad constructor

2025-08-05 Thread arthur . cohen
From: Philip Herron We just had a typo returning ok true when it should have been false. Fixes Rust-GCC#3876 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): fix typo gcc/testsuite/ChangeLog: * rust/compile/issue-3876.rs: New test.

[COMMITTED 137/220] gccrs: nr2.0: Check before visiting a for-loop's label

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Check for a label before visiting it. --- gcc/rust/resolve/rust-late-name-resolver-2.0.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/rust/resolve

[COMMITTED 116/220] gccrs: ast: builder: Remove ASTTypeBuilder

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * Make-lang.in: Remove object file for ASTTypeBuilder. * ast/rust-ast-builder.h: Remove function. * ast/rust-ast-builder.cc (Builder::new_type): Likewise. (Builder::new_const_param): Use reconstruct_type() instead

[COMMITTED 096/220] gccrs: Fix bug with bad type bindings not looking at super traits

2025-08-05 Thread arthur . cohen
From: Philip Herron When resolving type bounds, we need to examine super traits to properly determine if type bindings are valid in the current context. gcc/rust/ChangeLog: * typecheck/rust-tyty-bounds.cc: Check super traits for type bindings. * typecheck/rust-tyty.h: Add helper

[COMMITTED 130/220] gccrs: nr2.0: Add proper handling for WhileLet loops.

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): New visitor. * resolve/rust-late-name-resolver-2.0.h: Declare it. * resolve/rust-name-resolution-context.h (enum class): New binding context. --- .../resolve/rust-late-name

[COMMITTED 131/220] gccrs: Do proper const folding during typechecking for array capacities

2025-08-05 Thread arthur . cohen
From: Philip Herron This patch adds proper folding to the const expression for array capacity we already have the const folding mechanics and the query system needed to handle cases where the capacity is a function call in a const context. This leverages and pulls the gcc tree capacity into the

[COMMITTED 107/220] gccrs: Implement default HIR visitor class

2025-08-05 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * Make-lang.in: Scaffolding new rust-hir-visitor files * hir/tree/rust-hir-visitor.h (DefaultHIRVisitor): Declare default HIR visitor * hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor): Define default HIR vis

[COMMITTED 125/220] gccrs: Remove reinterpret_cast usages in DefaultASTVisitor

2025-08-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Replace usages of reinterpret_cast with static_cast. Signed-off-by: Owen Avery --- gcc/rust/ast/rust-ast-visitor.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --gi

[COMMITTED 216/220] gccrs: Recognize rustc_args_required_const attribute

2025-08-05 Thread arthur . cohen
From: Owen Avery This doesn't handle rustc_args_required_const, but it does allow us to recognize it as a valid attribute. gcc/rust/ChangeLog: * util/rust-attribute-values.h (Attributes::RUSTC_ARGS_REQUIRED_CONST): New constexpr variable. * util/rust-attributes.cc (__def

[COMMITTED 104/220] gccrs: Add getter for outer attributions

2025-08-05 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h (MatchArm::get_outer_attrs): Add getter for outer attributions Signed-off-by: Ryutaro Okada <1015ry...@gmail.com> --- gcc/rust/hir/tree/rust-hir-expr.h | 2 ++ 1 file changed, 2 insertions(+) diff

[COMMITTED 079/220] gccrs: chore: Fix formatting

2025-08-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-derive.cc: Fix formatting after fork update. --- gcc/rust/expand/rust-derive.cc | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/rust/expand/rust-derive.cc b/gcc/rust/expand/rust-derive.cc index

[COMMITTED 123/220] gccrs: nr1.0: Remove rust/backend support

2025-08-05 Thread arthur . cohen
From: Owen Avery This is the first patch in a set intended to fully remove name resolution 1.0. As such, it should leave name resolution 1.0 technically available but broken. gcc/rust/ChangeLog: * backend/rust-compile-context.cc (Context::Context): Remove initialization of resol

[COMMITTED 219/220] gccrs: Call base class's accept_vis method

2025-08-05 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Call base class's accept_vis method Signed-off-by: Ryutaro Okada <1015ry...@gmail.com> --- gcc/rust/hir/tree/rust-hir-visitor.cc | 8 1 file changed,

  1   2   3   4   5   6   7   8   9   10   >