[PATCH][15.2] nr2.0: late: Correctly initialize funny_error member

2025-04-29 Thread arthur . cohen
From: Arthur Cohen Hi everyone, We noticed inconsistent errors when running name-resolution 2.0 on certain files, where an invalid error was triggered and the message was from the `funny_ice` error finalizer function we had added as an easter egg. We realized yesterday that the undefined value

Re: [COMMITTED 09/42] gccrs: Add llvmInlineAsm node

2025-04-28 Thread Arthur Cohen
+{} + void ResolverBase::visit (AST::TypeParam &) {} diff --git a/gcc/rust/resolve/rust-ast-resolve-base.h b/gcc/rust/resolve/rust-ast-resolve-base.h index ab74e84f079..5bb9e4f1822 100644 --- a/gcc/rust/resolve/rust-ast-resolve-base.h +++ b/gcc/rust/resolve/rust-ast-resolve-base.h @@ -110,6 +11

Re: [COMMITTED 09/42] gccrs: Add llvmInlineAsm node

2025-04-28 Thread Arthur Cohen
Hi Andrew, On 4/28/25 6:05 PM, Andrew Pinski wrote: On Mon, Apr 28, 2025 at 8:48 AM wrote: From: Pierre-Emmanuel Patry InlineAsm node does not support memory clobbers. A few review on this. I think this should just be called extended rather than referencing LLVM here. This node exists s

[COMMITTED 35/42] gccrs: Add pattern bindings

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add binding creation in visitor. * resolve/rust-late-name-resolver-2.0.h: Add function prototypes. * resolve/rust-name-resolution-context.h: Add binding context

[COMMITTED 42/42] gccrs: Fix narrowing conversion warnings

2025-04-28 Thread arthur . cohen
From: Owen Avery Fixes PR#119641 gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-place.h (IndexVec::size_type): Add. (IndexVec::MAX_INDEX): Add. (IndexVec::size): Change the return type to the type of the internal value used by the index type.

[COMMITTED 33/42] gccrs: Add hash function for Identifiers

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast.h: Add hash function. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-ast.h | 13 + 1 file changed, 13 insertions(+) diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 94585dc1344.

[COMMITTED 38/42] gccrs: Use specialized param visit function for params

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry This commit introduce a new public function to visit function parameters in the default visitor. It allows visitors derived from DefaultVisitor to override only a small part of the default visitor. gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisi

[COMMITTED 31/42] gccrs: Add fn_once and Sized lang items to the test

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/compile/multiple_bindings1.rs: Add missing lang items. Signed-off-by: Pierre-Emmanuel Patry --- .../rust/compile/multiple_bindings1.rs| 29 --- 1 file changed, 19 insertions(+), 10 deletions(-) diff -

[COMMITTED 27/42] gccrs: Remove error state for GenericArg

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Remove error kind and change function call. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Change call name. * ast/rust-path.cc (ConstGenericParam::as_strin

[COMMITTED 37/42] gccrs: Remove passing test from exclusion list

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove passing test from exclusion list. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/nr2/exclude | 2 -- 1 file changed, 2 deletions(-) diff --git a/gcc/testsuite/rust/compile/nr2

[COMMITTED 41/42] gccrs: Visit visibility in UseDeclaration

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry Default visitor should visit all it's children. gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit visibility. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-ast-visitor.cc | 1 + 1 file changed, 1 insertion(+) dif

[COMMITTED 39/42] gccrs: Completely duplicate path node

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry Both nodes had the same id, this led to a resolution conflict. gcc/rust/ChangeLog: * expand/rust-derive-clone.cc (DeriveClone::clone_enum_struct): Clone path to avoid using the same nodeid. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude

[COMMITTED 28/42] gccrs: Prevent forward declaration in type parameters

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Add visit function for TypeParam. * resolve/rust-default-resolver.h: Add function prototype. * resolve/rust-forever-stack.h: Add function to check for forw

[COMMITTED 40/42] gccrs: Some assorted tweaks and bug fixes

2025-04-28 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit the loop labels of WhileLetLoopExpr instances before visiting their scrutinee expressions. * resolve/rust-early-name-resolver-2.0.cc (Early::resolve_gl

[COMMITTED 23/42] gccrs: prealloc the initilizer vector

2025-04-28 Thread arthur . cohen
From: Philip Herron There are two cases when initilizing an array, this is the const context which means we need to build the array ctor, which means using lots of memory, its super inefficient because we are using a big wrapper over the GCC internals here but preallocating the vectors here cause

[COMMITTED 36/42] gccrs: Use stacked context for nested bindings.

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry Binding context may be stacked when a new binding group is introduced within a const expression. gcc/rust/ChangeLog: * resolve/rust-name-resolution-context.h: Use BindingLayer instead. * resolve/rust-name-resolution-context.cc (BindingLayer::BindingLa

[COMMITTED 30/42] gccrs: Change expected error output to match nr2

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry Name resolution 2.0 message describes the context around the unresolved items and should therefore be kept. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove test from exclusion list. * rust/compile/use_1.rs: Change expected output and remov

[COMMITTED 26/42] gccrs: Change error message to match expected test output

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change error message. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove passing test from exclusion list. Signed-off-by: Pierre-Emmanuel Patry --- gcc/ru

[COMMITTED 34/42] gccrs: Add binding context class

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry We need to differentiate bindings types, so the same binding cannot be reused multiple time in a product binding. gcc/rust/ChangeLog: * resolve/rust-name-resolution-context.h (struct Binding): Add Binding struct to differentiate Or and Product binding

[COMMITTED 22/42] gccrs: Fix ICE with empty generic arguments

2025-04-28 Thread arthur . cohen
From: Philip Herron We have an assertion when accessing generic args if there are any which is really useful so this adds the missing guards for the case where they are specified but empty. Fixes Rust-GCC#3649 gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): ad

[COMMITTED 29/42] gccrs: Update generics9 expected error message

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/compile/generics9.rs: Change expected error message. * rust/compile/nr2/exclude: Remove test from exclusion list. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/generics9.rs | 3 ++- gcc/testsuite

[COMMITTED 25/42] gccrs: nr2.0: Improve error handling

2025-04-28 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::build_import_mapping): Avoid outputting an "unresolved import" error if other errors are outputted during resolution. * resolve/rust-early-name-resolver-2.0.h (Early::re

[COMMITTED 32/42] gccrs: Add equality operator for identifiers

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast.h: Add equality operator. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-ast.h | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 55f178d782c..94585

[COMMITTED 21/42] gccrs: Adjust segment start position errors

2025-04-28 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Adjust error messages. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. * resolve/rust-forever-stack.hxx (check_leading_

[COMMITTED 18/42] gccrs: nr2.0: Remove unnecessary copy of Node

2025-04-28 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx (ForeverStack::resolve_path): Pass instance of Node to lambda by reference instead of by value. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-forever-stack.hxx | 2 +- 1 file changed, 1 inserti

[COMMITTED 24/42] gccrs: nr2.0: Fix derive-debug1.rs

2025-04-28 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/derive-debug1.rs: Adjust a path. * rust/compile/nr2/exclude: Remove derive-debug1.rs. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/derive-debug1.rs | 2 +- gcc/testsuite/rust/compile/nr2/exclude | 1 - 2

[COMMITTED 17/42] gccrs: Fix ICE in struct expressions

2025-04-28 Thread arthur . cohen
From: Philip Herron The error handling here was done long ago when we didnt know how to do any error handling very well. This removed bad fatal_errors and adds in some nice rich_location error diagnostics instead. Fixes Rust-GCC#3628 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-

[COMMITTED 08/42] gccrs: Emit error with old asm syntax in new asm blocks

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_asm_arg): Emit error message. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/expand/rust-macro-builtins-asm.cc | 8 1 file changed, 8 insertions(+) diff --git a/gcc/rust/exp

[COMMITTED 19/42] gccrs: Add test case to show ice is fixed

2025-04-28 Thread arthur . cohen
From: Philip Herron Fixes Rust-GCC#3652 gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 does not error on the T it should require Self::T * rust/compile/issue-3652.rs: New test. Signed-off-by: Philip Herron --- gcc/testsuite/rust/compile/issue-3652.rs | 7 +++ g

[COMMITTED 13/42] gccrs: Add gimple test for black box intrinsic

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/compile/black_box.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/black_box.rs | 28 + 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/rust/compile/

[COMMITTED 20/42] gccrs: Fix ICE when handling case of unknown field in HIR::FieldAccess

2025-04-28 Thread arthur . cohen
From: Philip Herron We were wrongly adding the assertion that this must not be an enum but this is a pointless assertion we only care that there are variant in the ADT and if the field exists in the first variant. Fixes Rust-GCC#3581 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-

[COMMITTED 10/42] gccrs: Parse and lower llvm asm node

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry Add a new HIR LlvmInlineAsm HIR node as well as some structures to represent it's options and operands. Lower AST::LlvmInlineAsm node to it and then create a tree from that node. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Remove

[COMMITTED 07/42] gccrs: Add check for placeholder (infer) type in return position

2025-04-28 Thread arthur . cohen
From: Philip Herron It is not allowed to have a declared inference variable in the return position of a function as this may never get infered you need good points of truth. Ideally if we get a student for GSoC 25 we will get the Default Hir Visitor so that we can grab the HIR::InferredType locu

[COMMITTED 14/42] gccrs: Add test case to show issue is fixed

2025-04-28 Thread arthur . cohen
From: Philip Herron This was already fixed in: bb01719f0e1 but we require fn_once lang item to be defined as we are working on libcore support still. Fixes Rust-GCC#3711 gcc/testsuite/ChangeLog: * rust/compile/issue-3711.rs: New test. Signed-off-by: Philip Herron --- gcc/testsuite/r

[COMMITTED 15/42] gccrs: Add test case to show ICE is fixed

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

[COMMITTED 12/42] gccrs: Add execute test for black_box intrinsic

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/testsuite/ChangeLog: * rust/execute/black_box.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/execute/black_box.rs | 30 + 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/rust/execute/

[COMMITTED 05/42] gccrs: Fix crash in hir dump as labels are optional

2025-04-28 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add guard for optional label Signed-off-by: Philip Herron --- gcc/rust/hir/rust-hir-dump.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir

[COMMITTED 11/42] gccrs: Add LlvmInlineAsm node dump

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Dump llvm inline asm tokens. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-ast-collector.cc | 39 +- 1 file changed, 38 insertions(+),

[COMMITTED 04/42] gccrs: Update comments in repr parsing code

2025-04-28 Thread arthur . cohen
From: Yap Zhi Heng gcc/rust/ChangeLog: * typecheck/rust-tyty.h: Remove extra redundant comment. * typecheck/rust-hir-type-check-base.cc: Update comment on repr handling. Signed-off-by: Yap Zhi Heng --- gcc/rust/typecheck/rust-hir-type-check-base.cc | 3 ++- gcc/rust/ty

[COMMITTED 03/42] gccrs: Implement integer representation for enums

2025-04-28 Thread arthur . cohen
From: Zhi Heng gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-base.cc: Set enum representing type properly if repr is an integer type. * typecheck/rust-hir-type-check-item.cc: Update comments. Signed-off-by: Yap Zhi Heng --- gcc/rust/typecheck/rust-hir-type-check-

[COMMITTED 16/42] gccrs: nr2.0: Handle StructPatternFieldIdent

2025-04-28 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Handle StructPatternFieldIdent. * resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entr

[COMMITTED 06/42] gccrs: Fix ICE when checking shift's which are behind array refs

2025-04-28 Thread arthur . cohen
From: Philip Herron I copied a bad form of this check from the c front-end this updates it to ensure the rhs is an INTEGER_CST and the lhs needs checked in the first place. Fixes Rust-GCC#3664 gcc/rust/ChangeLog: * rust-gcc.cc (arithmetic_or_logical_expression): Ensure this is an inte

[COMMITTED 09/42] gccrs: Add llvmInlineAsm node

2025-04-28 Thread arthur . cohen
From: Pierre-Emmanuel Patry InlineAsm node does not support memory clobbers. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Make visitor unreachable. * ast/rust-ast-collector.h: Add visit for LlvmInlineAsmNode. * ast/rust-ast-visitor.cc

[COMMITTED 01/42] gccrs: Fix segv in unsafe chcker

2025-04-28 Thread arthur . cohen
From: Philip Herron Trait constants were missing type resolution step, this adds that as if it was a normal constant. The unsafe checker was missing a null check. Fixes Rust-GCC#3612 gcc/rust/ChangeLog: * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): add null check

[COMMITTED 02/42] gccrs: Implement typecheck for zero-variant enums

2025-04-28 Thread arthur . cohen
From: Zhi Heng gcc/rust/ChangeLog: * typecheck/rust-tyty.h: Add new `ReprKind` enum to `ReprOptions`. * typecheck/rust-hir-type-check-base.cc: Handle setting of `repr_kind`. * typecheck/rust-hir-type-check-item.cc: New check for zero-variant enums.

Re: [wwwdocs] gcc-15: Add changes for Rust frontend

2025-04-26 Thread Arthur Cohen
Patch has been committed and pushed upstream. Best, Arthur On 4/25/25 4:30 PM, arthur.co...@embecosm.com wrote: From: Arthur Cohen Content was validated using the Nu HTML checker per the contributing doc. --- htdocs/gcc-15/changes.html | 57 ++ 1 file

[wwwdocs] gcc-15: Add changes for Rust frontend

2025-04-25 Thread arthur . cohen
From: Arthur Cohen Content was validated using the Nu HTML checker per the contributing doc. --- htdocs/gcc-15/changes.html | 57 ++ 1 file changed, 57 insertions(+) diff --git a/htdocs/gcc-15/changes.html b/htdocs/gcc-15/changes.html index 3e3c6655

[COMMITTED 15/19] gccrs: Add `#[track_caller]` as known attribute

2025-04-15 Thread arthur . cohen
From: beamandala gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::builtin_transcribers): Add entry for track_caller. * util/rust-attribute-values.h: add `TRACK_CALLER` attribute. * util/rust-attributes.cc: add `track_caller` attribute definition.

[COMMITTED 05/19] gccrs: typecheck: Properly select methods when dealing with specialization

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (is_default_fn): New. (emit_ambiguous_resolution_error): New. (handle_multiple_candidates): Properly handle multiple candidates in the case of specialization. (TypeCheckExpr

[COMMITTED 18/19] gccrs: attributes: Handle external tool annotations like rustfmt::

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-attribute-values.h: Add RUSTFMT value. * util/rust-attributes.cc: Define the attribute. * util/rust-attributes.h (enum CompilerPass): Add EXTERNAL variant. * expand/rust-macro-builtins.cc: Fix formatting

[COMMITTED 17/19] gccrs: nr2.0: Only insert derive macros if they exist

2025-04-14 Thread arthur . cohen
From: Arthur Cohen This causes an assertion failure when compiling core with nr2.0, but should probably be improved. I'm not sure how this code enables built-in derive macros to be resolved so this is a temporary fix. gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (

[COMMITTED 13/19] gccrs: Fix const checking of enum discriminants

2025-04-14 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * checks/errors/rust-const-checker.cc (ConstChecker::visit): Visit the enum items of enums. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Resolve enum discriminants during nr1.0. gcc/testsuite/ChangeLog: *

[COMMITTED 08/19] gccrs: ast: Add get_locus() to DelimTokenTree

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast.h (DelimTokenTree::get_locus): New function. --- gcc/rust/ast/rust-ast.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 09e0fce4f19..91611ec6a62 100644 --- a/gcc/rust/ast

[COMMITTED 04/19] rust: Add comment inside block [PR119342]

2025-04-14 Thread arthur . cohen
From: Andrew Pinski Inside a BLOCK node, all of the variables of the scope/block are chained together and that connects them to the block. This just adds a comment to that effect as reading the code it is not so obvious why they need to be chained together. gcc/rust/ChangeLog: PR rust/1

[COMMITTED 19/19] gccrs: lang-items: Add ManuallyDrop

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-lang-item.h: Add new manually_drop lang item. * util/rust-lang-item.cc: Likewise. --- gcc/rust/util/rust-lang-item.cc | 1 + gcc/rust/util/rust-lang-item.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/gcc/rust/util

[COMMITTED 16/19] gccrs: attributes: Add missing attributes used in `core`

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * util/rust-attribute-values.h: Add missing attributes. * util/rust-attributes.cc: Likewise. * util/rust-attributes.h (enum CompilerPass): Mention adding something for const functions. --- gcc/rust/util/rust-attribute

[COMMITTED 12/19] gccrs: format_args: Allow extraneous commas, improve safety

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-builtins-format-args.cc (format_args_parse_arguments): Improve safety, allow extra commas after end of argument list. gcc/testsuite/ChangeLog: * rust/compile/format_args_extra_comma.rs: New test

[COMMITTED 14/19] gccrs: install.texi: Mention Rust requirement for building gccrs

2025-04-14 Thread arthur . cohen
From: Arthur Cohen Addresses PR#117869 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117869 gcc/ChangeLog: * doc/install.texi: Add requirements for building gccrs. --- gcc/doc/install.texi | 6 ++ 1 file changed, 6 insertions(+) diff --git a/gcc/doc/install.texi b/gcc/doc

[COMMITTED 09/19] gccrs: session: Desugar question mark operator after expansion instead.

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Call the visitor later in the pipeline. --- gcc/rust/rust-session-manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust

[COMMITTED 11/19] gccrs: expansion: Desugar doc comments into attributes before expansion

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Call into TokenTreeDesugar. * expand/rust-token-tree-desugar.cc: New file. * expand/rust-token-tree-desugar.h: New file. * Make-lang.in: Compile them

[COMMITTED 01/19] rust: Use FLOAT_TYPE_P instead of manual checking

2025-04-14 Thread arthur . cohen
From: Andrew Pinski This moves is_floating_point over to using FLOAT_TYPE_P instead of manually checking. Note before it would return true for all COMPLEX_TYPE but complex types' inner type could be integral. Also fixes up the comment to be in more of the GNU style. Bootstrapped and tested on x

[COMMITTED 10/19] gccrs: expansion: Only add fragments if the matcher succeeded

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (MacroExpander::match_n_matches): Do not insert fragments and substack fragments if the matcher failed. gcc/testsuite/ChangeLog: * rust/compile/macros/mbe/macro-issue3708.rs: New test. --- gcc/rust

[COMMITTED 06/19] gccrs: nr2.0: Do not resolve modules this run if they are unloaded

2025-04-14 Thread arthur . cohen
From: Arthur Cohen Instead, mark the visitor as dirty and wait for the next round of the fixed point to take care of them. This avoids issues with module items being loaded while not being stripped yet. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit

[COMMITTED 02/19] rust: Use error_operand_p in rust-gcc.cc

2025-04-14 Thread arthur . cohen
From: Andrew Pinski Just a simple cleanupof the code to use error_operand_p instead of directly comparing against error_mark_node. This also moves some cdoe around when dealing with error_operand_p just to be faster and/or slightly tighten up the code slightly. gcc/rust/ChangeLog: * ru

[COMMITTED 03/19] rust: use range for inside rust-gcc.cc [PR119341]

2025-04-14 Thread arthur . cohen
From: Andrew Pinski There are some places inside rust-gcc.cc which are candidates to use range for instead of iterators directly. This changes the locations I saw and makes the code slightly more readable. gcc/rust/ChangeLog: PR rust/119341 * rust-gcc.cc (function_type): Use ran

[COMMITTED 07/19] gccrs: ast: Support outer attributes for AST::RangeExpr

2025-04-14 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-expr.h (class RangeExpr): Add empty outer attributes and allow getting them and setting them. --- gcc/rust/ast/rust-expr.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/rust/ast/rust

[COMMITTED 04/32] gccrs: Fix ICE when resolving lifetimes without name

2025-04-10 Thread arthur . cohen
From: Philip Herron We dont need to assert here the lifetime code already supports this case. Fixes Rust-GCC#3657 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-base.cc: remove assertion gcc/testsuite/ChangeLog: * rust/compile/issue-3657.rs: New test. Signed-off-by: Phi

[COMMITTED 07/32] gccrs: Fix ICE on invalid match arms

2025-04-10 Thread arthur . cohen
From: Philip Herron We hit assertions on empty enum or unknown variant, this catches the error and emits a new diagnostic. Fixes Rust-GCC#3656 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): emit error gcc/testsuite/ChangeLog: * rust

[COMMITTED 21/32] gccrs: Remove unused error constructor and getter

2025-04-10 Thread arthur . cohen
From: Pierre-Emmanuel Patry These constructor for eroneous state are not in use anymore since we replaced this error state with an optional in the parent nodes. gcc/rust/ChangeLog: * ast/rust-expr.h: Remove error getter and constructor. Signed-off-by: Pierre-Emmanuel Patry --- gcc/ru

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

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

[COMMITTED 10/32] gccrs: feature: Add min_specialization feature

2025-04-10 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * checks/errors/rust-feature.cc (Feature::create): Handle `#![feature(min_specialization)]`. * checks/errors/rust-feature.h: Likewise. --- gcc/rust/checks/errors/rust-feature.cc | 4 gcc/rust/checks/errors/rust-feature.h | 1 + 2

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

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

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

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

[COMMITTED 31/32] gccrs: nr2.0: Adjust test issue-2812.rs

2025-04-08 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/issue-2812.rs: Avoid multiple definition error. * rust/compile/nr2/exclude: Remove issue-2812.rs. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/issue-2812.rs | 4 ++-- gcc/testsuite/rust/compile/nr2/exclude

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

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

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

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

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

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

[COMMITTED 22/32] gccrs: Update ast visitor with proper check for looplabel

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry The visitor was visiting loop label even when they did not exist. gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Add check for loop label before visiting it. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-ast-

[COMMITTED 30/32] gccrs: fix ICE segfault with empty feature gate

2025-04-08 Thread arthur . cohen
From: Matty Kuhn This patch fixes an issue where an empty feature gate would segfault, instead of reporting a syntax error to the user. gcc/rust/ChangeLog: * ast/rust-ast.h: (AST::Attribute): add empty_input function * checks/errors/rust-feature-gate.cc: (FeatureGate::visit): ch

[COMMITTED 25/32] gccrs: Resolve labels within break or continue expressions

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add call to label resolution if there is one label. (Late::resolve_label): Look for labels and emit an error message on failure. * resolve/rust-late-nam

[COMMITTED 13/32] gccrs: nr2.0: Remove duplicate self visit

2025-04-08 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Remove explicit visitation of a function's self parameter, as if it exists it'll be visited as one of the function parameters. gcc/testsuite/ChangeLog: * rust/comp

[COMMITTED 29/32] gccrs: Rename label getter to unchecked

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Update label getter call. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast.cc (BreakExpr::as_string): Likewise. * hir/rust-as

[COMMITTED 12/32] gccrs: Fix ICE for reserved lifetime name

2025-04-08 Thread arthur . cohen
From: Philip Herron This is a reserved name so this changes the assertion to a diagnostic. Fixes Rust-GCC#3647 gcc/rust/ChangeLog: * typecheck/rust-typecheck-context.cc (TypeCheckContext::lookup_lifetime): emit error gcc/testsuite/ChangeLog: * rust/compile/issue-3647.rs: New

[COMMITTED 18/32] gccrs: Add check for label

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit loop label only if it exists. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove passing test. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/r

[COMMITTED 20/32] gccrs: Make loop label truly optional

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry A loop label error state was in use to represent missing loop label but this may be easily forgotten and the optional nature of the label was misrepresented. gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::block): Call with a nullopt instead o

[COMMITTED 14/32] gccrs: nr2.0: Improve test script

2025-04-08 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/nr2/compile.exp: Avoid absolute paths in output, adjust phrasing of output, and avoid false XPASS output when tests are run in parallel. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/nr2/compile.exp |

[COMMITTED 19/32] gccrs: Visit loop label before predicate expression

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry If the label is referenced within the while predicate expression it has to be resolved before the latter. gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Change default visit order. gcc/testsuite/ChangeLog: * rust/c

[COMMITTED 05/32] gccrs: Fix ICE when there are 2 functions named main

2025-04-08 Thread arthur . cohen
From: Philip Herron We need to setup the main_identifier_node for MAIN_DECL_P checks in the middle-end. But it is valid to have a main function/method on impl blocks. So we need to flag if this is a "root" item or not, which is one that is jsut an HIR::Function on part of the Crate::items as oppp

[COMMITTED 11/32] gccrs: hir: Add default qualifier to function, lower it properly

2025-04-08 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast.cc (Function::Function): Rename is_default -> has_default. (Function::operator=): Likewise. * ast/rust-item.h (class Function): Add `is_default` method. * hir/rust-ast-lower-implitem.cc (ASTLowerImplI

[COMMITTED 09/32] gccrs: Fix ICE when hitting invalid types for generics

2025-04-08 Thread arthur . cohen
From: Philip Herron We need to check upfront if the type is valid or not. Then error with a decent message. Fixes Rust-GCC#3643 Fixes Rust-GCC#3646 Fixes Rust-GCC#3654 Fixes Rust-GCC#3663 Fixes Rust-GCC#3671 gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePat

[COMMITTED 16/32] gccrs: Revert part of 44ffe1193269

2025-04-08 Thread arthur . cohen
From: Pierre-Emmanuel Patry This commit got rid of msvc specific code and remove the else clause, this triggered warning with tl::expected::value function. gcc/rust/ChangeLog: * util/expected.h: Use gcc_unreachable within gcc context. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust

[COMMITTED 08/32] gccrs: Fix ICE on raw reference

2025-04-08 Thread arthur . cohen
From: Philip Herron This patch adds support for raw references which enforce the pointer type away from a reference type. Fixes Rust-GCC#3667 gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::address_expression): allow optional type * backend/rust-compile-bas

[COMMITTED 17/32] gccrs: Resolve labels

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

[COMMITTED 15/32] gccrs: refactoring rust_error_at "redefined multiple times"

2025-04-08 Thread arthur . cohen
From: Sri Ganesh Thota gcc/rust/ChangeLog: * resolve/rust-ast-resolve-base.h (redefined_error): created a function for rust_error_at for redefined at multiple times. * resolve/rust-ast-resolve-implitem.h: changed rust_error_at to redefined_error. * resolve/rust-

[COMMITTED 01/32] gccrs: Evaluate the enum's discriminant in a const context

2025-04-08 Thread arthur . cohen
From: Ryutaro Okada <1015ry...@gmail.com> gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc: Evaluate the enum's discriminant in a const context gcc/testsuite/ChangeLog: * rust/compile/enum_discriminant1.rs: New test. Signed-off-by: Ryutaro Okada <1015ry...@gmail.com>

[COMMITTED 06/32] gccrs: Fix recusive type query and nullptr on type path

2025-04-08 Thread arthur . cohen
From: Philip Herron This was a small fix to sort out the segfault to check for nullptr on the TypePath cases for query type. But when this happened opened up a few bugs that were hidden under the carpet namely: compile/issue-2905-{1,2}.rs which has a recursive type query which needs to ne handled

[COMMITTED 02/32] gccrs: nr2.0: Handle global paths

2025-04-08 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-forever-stack.h (ForeverStack::ForeverStack): Initialize extern_prelude. (ForeverStack::resolve_path): Add parameter has_opening_scope_resolution. (ForeverStack::extern_prelude): Add field. * reso

[COMMITTED 03/32] gccrs: Fix ICE when doing shift checks on const decl

2025-04-08 Thread arthur . cohen
From: Philip Herron Const decls are just delcarations wrapping the value into the DECL_INITIAL and the shift checks we have assume no decls are involved and its just flat values. This patch simply unwraps the constant values if they exist. Fixes Rust-GCC#3665 gcc/rust/ChangeLog: * rust

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

2025-04-05 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 106/141] gccrs: expansion: Expand generic args in generic type path segments

2025-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Correctly visit the generic args of a generic type path segment. gcc/testsuite/ChangeLog: * rust/compile/issue-2015.rs: New test. --- gcc/rust/expand/rust-expand-visitor.cc

  1   2   3   4   5   6   7   8   9   10   >