[COMMITTED 111/145] gccrs: Partial support for operand

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): Partial support for operand * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. (parse_label): Likewise. * expand/rust-macro-builtins-asm.h (parse_label): Likewi

[COMMITTED 125/145] gccrs: Scaffold expected on parse_options and asm_arg

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (check_and_set): Scaffold expected on parse_options and asm_arg (parse_options): Likewise (parse_asm_arg): Likewise * expand/rust-macro-builtins-asm.h (check_and_set): Likewise

[COMMITTED 107/145] gccrs: Successful parse of in and inout, albeit with str

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Successful parse of in and inout, albeit with str (check_identifier): Likewise. (parse_asm_arg): Likewise. * expand/rust-macro-builtins-asm.h (parse_format_string):

[COMMITTED 117/145] gccrs: Fix optional trait parsing

2025-03-17 Thread arthur . cohen
From: dave gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Check for ?Trait in visitor gcc/testsuite/ChangeLog: * rust/compile/issue-2725.rs: New test. Signed-off-by: Dave Evans --- gcc/rust/typecheck/rust-hir-type-check-item.cc | 18

[COMMITTED 113/145] gccrs: Update parser to parse strings in the first stage

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Update parser to parse strings in the first stage (parse_label): not needed right now --- gcc/rust/expand/rust-macro-builtins-asm.cc | 62 +- 1 file changed, 1

[COMMITTED 112/145] gccrs: Scaffolding validation of asm!

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_asm): Scaffolding validation of asm! (validate): Likewise * expand/rust-macro-builtins-asm.h (validate): Likewise --- gcc/rust/expand/rust-macro-builtins-asm.cc | 31 +--

[COMMITTED 122/145] gccrs: Add RAW_STRING_LITERAL

2025-03-17 Thread arthur . cohen
From: ansh gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Handle case for RAW_STRING_LITERAL. * ast/rust-ast.cc (AttributeParser::parse_meta_item_inner): Likewise. (AttributeParser::parse_literal): Likewise. * ast/rust-ast

[COMMITTED 037/145] gccrs: Change lookup_hir_path_expr_seg return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Make the function's return type optional in order to differentiate between null pointers and missing value. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::insert_hir_path_expr_seg): Change call site to accomodate the new return type. (M

[COMMITTED 049/145] gccrs: Change lookup_ast_item's return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type within an optional. gcc/rust/ChangeLog: * metadata/rust-export-metadata.cc (ExportContext::emit_trait): Adapt call site to the new return type. (ExportContext::emit_function): Likewise. (ExportContext::e

[COMMITTED 054/145] gccrs: Make gccrs recognize negative_impls

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc (FeatureGate::visit): make gccrs recognize negative_impls * checks/errors/rust-feature-gate.h: likewise. * checks/errors/rust-feature.cc (Feature::create): likewise. * checks/errors/ru

[COMMITTED 046/145] gccrs: Change lookup_macro_def return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type within an optional. gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::insert_once): Change call site to accomodate the new return type. (Early::visit): Likewise. * resolve/rust-early-

[COMMITTED 059/145] gccrs: Add feature gate for box syntax

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry The box syntax is experimental even though it is used in the standard library. It should be feature gated to prevent anyone from using it in stable rust. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc (FeatureGate::visit): Allow visitor recu

[COMMITTED 055/145] gccrs: Corrected access specifiers

2025-03-17 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * ast/rust-expr.h (class OperatorExpr): Location should be private. * hir/tree/rust-hir-expr.h (class OperatorExpr): Likewise. Signed-off-by: Kushal Pal --- gcc/rust/ast/rust-expr.h | 2 +- gcc/rust/hir/tree/rust-hir-expr.h

[COMMITTED 060/145] gccrs: Add new test for box syntax

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Add a new test to prevent regressions on the box syntax as well as its feature gate. gcc/testsuite/ChangeLog: * rust/compile/box_syntax.rs: New test. * rust/compile/box_syntax_feature_gate.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- gcc/

[COMMITTED 021/145] gccrs: Change return type for lookup_hir_item to optional

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): Adapt function call to new return type. * backend/rust-mangle-v0.cc (v0_path): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::c

[COMMITTED 047/145] gccrs: Change lookup_macro_invocation's return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type within an optional and remove the out reference argument. gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Adapt the function call to match its new prototype. * resolve/rust-early

[COMMITTED 051/145] gccrs: Remove useless cstddef header from rust-fmt

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-fmt.h: Remove useless cstddef header from rust-fmt --- gcc/rust/ast/rust-fmt.h | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/rust/ast/rust-fmt.h b/gcc/rust/ast/rust-fmt.h index fe933eabdd3..31100ea8f84 100644 --- a/gcc/rust/ast/rus

[COMMITTED 048/145] gccrs: Change lookup_visibility's return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the return type within an optional. gcc/rust/ChangeLog: * checks/errors/privacy/rust-privacy-reporter.cc: Change call site to accomodate new return type. * checks/errors/privacy/rust-pub-restricted-visitor.cc: Likewise. * util/rus

[COMMITTED 019/145] gccrs: Change lookup_hir_to_node return type to optional

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Optional are more convenient to use and avoid uninitialized data. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::generate_closure_function): Adapt code for new optional return type. * checks/errors/privacy/rust-privacy-report

[COMMITTED 011/145] gccrs: Remove unnecessary SIDE_EFFECTS/READONLY macros

2025-03-17 Thread arthur . cohen
From: Mael Cravero Closes #2357 gcc/rust/ChangeLog: * rust-gcc.cc: remove unnecessary TREE_SIDE_EFFECTS and TREE_READONLY macros used in arithmetic overflow checks. Signed-off-by: Mael Cravero --- gcc/rust/rust-gcc.cc | 17 - 1 file changed, 17 deletions(-) d

[COMMITTED 023/145] gccrs: Change return type of lookup_hir_extern_block

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the return type to an optional in order to easily differentiate between a null pointer and an missing value. gcc/rust/ChangeLog: * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_function_call): Adapt function call to new return typ

[COMMITTED 025/145] gccrs: Change return type of lookup_impl_block_type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the return type to an optional. gcc/rust/ChangeLog: * typecheck/rust-type-util.cc (query_type): Adapt code to accomodate the new return type. * util/rust-hir-map.cc (Mappings::lookup_impl_block_type): Change the function's retur

[COMMITTED 027/145] gccrs: Change crate_num_to_nodeid return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the function's return type to an optional. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-toplevel.h: Adapt the code to the new return type. * rust-session-manager.cc (Session::load_extern_crate): Likewise. * util/rust-hir-map.c

[COMMITTED 020/145] gccrs: Change return type of resolve_nodeid_to_stmt

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the return type to an optional. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::resolve_nodeid_to_stmt): Change the return type and remove pointer out argument. * util/rust-hir-map.h: Update function prototype. Signed-off-by: Pie

[COMMITTED 041/145] gccrs: Change lookup_hir_param return type with optional

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

[COMMITTED 036/145] gccrs: Change lookup_hir_expr return type to optional

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type with an optional in order to differentiate missing values from null pointers. gcc/rust/ChangeLog: * backend/rust-mangle-v0.cc (v0_path): Adapt call site to new returned type. * util/rust-hir-map.cc (Mappings::lo

[COMMITTED 030/145] gccrs: Change lookup_local_defid return type to optional

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Make the API more convenient by changing the function's return type. We can now differentiate between a stored null pointer and a missing value. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::insert_defid_mapping): Adapt call to new return type

[COMMITTED 024/145] gccrs: Change return type for lookup_hir_impl_block

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the return type to an optiona. This allows to differentiate between missing hir impl block and null pointers. gcc/rust/ChangeLog: * typecheck/rust-type-util.cc (query_type): Change call to the function in order to accomodate the new return type

[COMMITTED 029/145] gccrs: Change return type of lookup_defid

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the return type to an optional. gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): Change calling code to accomodate new return type. * checks/errors/privacy/rust-privacy-reporter.cc: Li

[COMMITTED 056/145] gccrs: Allow rustc_const_stable and rustc_const_unstable

2025-03-17 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::builtin_transcribers): Add entries for "rustc_const_stable" and "rustc_const_unstable". * util/rust-attributes.cc (__definitions): Add entries for RUSTC_CONST_STABLE and

[COMMITTED 028/145] gccrs: Change crate name retrieval function return types

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change their return type to a const reference in order to avoid copies when possible. Also wrap this new return type into an optional. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Adapt the code to the new r

[COMMITTED 064/145] gccrs: Add two new tests related to may_dangle attribute

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry First test checks the may_dangle outer atttribute on generic params can be parsed. The second one tests whether may_dangle attributes are correctly feature gated. gcc/testsuite/ChangeLog: * rust/compile/dropck_eyepatch_feature_gate.rs: New test. * rus

[COMMITTED 053/145] gccrs: Add system include to `gcc/rust/rust-system.h`

2025-03-17 Thread arthur . cohen
From: SIGMazer gcc/rust/ChangeLog: * rust-system.h: Add system include Signed-off-by: SIGMazer --- gcc/rust/rust-system.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/rust-system.h b/gcc/rust/rust-system.h index 7a6a72e5c64..986428b0819 100644 --- a/gcc/rust/rust-syst

[COMMITTED 136/145] gccrs: Fix nightly rustc warnings

2025-03-17 Thread arthur . cohen
From: Kushal Pal libgrust/ChangeLog: * libformat_parser/Cargo.toml: Used crate-type instead of depricated crate_type. * libformat_parser/generic_format_parser/src/lib.rs: Remove dead code. * libformat_parser/src/lib.rs: Likewise. Signed-off-by: Kushal Pal

[COMMITTED 133/145] gccrs: [gccrs#3051] Remove unnecessary #include from rust-expr.h

2025-03-17 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * ast/rust-expr.h: Remove unnecessary include. Signed-off-by: Liam Naddell --- gcc/rust/ast/rust-expr.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 8fc89d87878..25afe235e4e

[COMMITTED 140/145] gccrs: [gccrs#3046] ICE on failing to find enum variant

2025-03-17 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc: Fix ICE caused by not finding enum variant by adding new error message gcc/testsuite/ChangeLog: * rust/compile/issue-3046.rs: Add test for new error message Signed-off-by: Lia

[COMMITTED 013/145] gccrs: Remove unused Context parameter for some backend methods

2025-03-17 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::compile_function_body): Adjust unit_expression calls. (HIRCompileBase::unit_expression): Remove unused Context parameter. * backend/rust-compile-base.h (HI

[COMMITTED 008/145] gccrs: borrowck: Polonius error reporting

2025-03-17 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs: Error reporting. * checks/errors/borrowck/ffi-polonius/src/lib.rs: Error reporting. * checks/errors/borrowck/polonius/rust-polonius-ffi.h (struct FactsView):

[COMMITTED 015/145] gccrs: Add testcases for handling struct as scrutinee for match expr

2025-03-17 Thread arthur . cohen
From: Nobel Singh gcc/testsuite/ChangeLog: * rust/compile/issue-2906.rs: New test. * rust/execute/torture/issue-2906.rs: New test. Signed-off-by: Nobel Singh --- gcc/testsuite/rust/compile/issue-2906.rs | 10 ++ .../rust/execute/torture/issue-2906.rs| 34 +

[PATCHSET] Update Rust frontend 17/03/2024 1/4

2025-03-17 Thread arthur . cohen
Hi everyone, This patchset is the first of four similarly-sized patchsets aimed at updating upstream with our most recent changes to the Rust frontend. We plan on upstreaming small patchsets every week up to the release of 15.1. This first set's main change is the addition of the polonius borrow

[COMMITTED 026/145] gccrs: Change return type of lookup_crate_name

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the function's return type to use an optional. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-toplevel.h: Adapt the code to the new return type. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Likewise. *

[COMMITTED 017/145] gccrs: Visit constant items without expressions properly

2025-03-17 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Verify constant item has expression before attempting to visit the later. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-default-resolver.cc | 15 +---

[COMMITTED 022/145] gccrs: Change return type of lookup_hir_trait_item

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the return type to an optional instead of returning a null pointer. This allows easier tracking of rogue null pointers in the map. This commit also fixes a bug in trait associated function mangling, the function was using an already invalidated pointer. gcc/rus

[COMMITTED 018/145] gccrs: Change lookup_node_to_hir return type to optional

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Previous API was using a boolean and a pointer, this was not practical and could be replaced with an optional. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Change call to use the returned optional. (CompileExpr::gen

[COMMITTED 014/145] gccrs: Handle structs as scrutinee for match expressions

2025-03-17 Thread arthur . cohen
From: Nobel Singh gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (check_match_scrutinee): Handle structs Signed-off-by: Nobel Singh --- gcc/rust/backend/rust-compile-expr.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/rust/backend/rust-compile-expr.

[COMMITTED 096/145] gccrs: Big Refactor after meeting

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmRegOrRegClass): Remove union (struct InlineAsmOperand): Make instances of inside struct. * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Change signature with inlineAsmCtx.

[COMMITTED 124/145] gccrs: Finish expected parse_reg_operand

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Finish expected parse_reg_operand (parse_reg_operand_unexpected): Likewise * expand/rust-macro-builtins-asm.h (parse_reg_operand_unexpected): Likewise Signed-off-by: b

[COMMITTED 130/145] gccrs: Clean up monadic operations on expected<>

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_asm): Clean up monadic operations on expected<> Signed-off-by: badumbatish --- gcc/rust/expand/rust-macro-builtins-asm.cc | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/g

[COMMITTED 070/145] gccrs: Add some test for raw_ref_op to prevent regressions

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Add a test for the feature gate, as well as some test to ensure the raw keyword stays weak. Also add some tests to check whether the raw_ref_op syntax is parsed correctly. gcc/testsuite/ChangeLog: * rust/compile/not_raw_ref_op.rs: New test. * rust/com

[COMMITTED 103/145] gccrs: Partial unsafe support for inline asm

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Partial unsafe support for inline asm * checks/errors/rust-unsafe-checker.h: Likewise. * hir/tree/rust-hir-expr.h: Likewise. * hir/tree/rust-hir.cc (InlineAsm

[COMMITTED 090/145] gccrs: Add checks for duplicate options in inline asm

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (check_and_set): Add checks for duplicate options in inline asm (parse_options): likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_options.rs: New test. --- gcc/rust/expan

[COMMITTED 119/145] gccrs: expand: Switch semicolon boolean to an enum instead.

2025-03-17 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-fragment.h (enum class): Add InvocKind and AsmKind enums. * ast/rust-macro.h: Switch semicolon boolean to InvocKind enum. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * expand/rust-macro

[COMMITTED 102/145] gccrs: Add support for AST to HIR inline asm translation

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-expr.h: Add support for AST to HIR inline asm translation * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::v

[COMMITTED 104/145] gccrs: Fix warnings

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Fix compile warnings. (parse_options): Likewise. (parse_asm): Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_options.rs: --- gcc/rust/expan

[COMMITTED 110/145] gccrs: Refactoring and supporting more parse_reg_operand

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): Refactoring and supporting more parse_reg_operand * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. (rust_debug): Likewise. --- gcc/rust/ast/rust-expr.h

[COMMITTED 108/145] gccrs: Add potentially_nonpromoted_keywords set str

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Add potentially_nonpromoted_keywords set str (check_identifier): likewise * expand/rust-macro-builtins-asm.h (parse_format_string): likewise gcc/testsuite/ChangeLo

[COMMITTED 123/145] gccrs: Finish incorporating expected of parse_reg_operand

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Finish incorporating expected of parse_reg_operand (parse_reg): Likewise. (parse_reg_operand): Likewise. (parse_reg_operand_in): Likewise. (parse_reg_operan

[COMMITTED 093/145] gccrs: Rename InlineAsmOptions to InlineAsmOption

2025-03-17 Thread arthur . cohen
From: jjasmine Rename InlineAsmOptions to InlineAsmOption for clarity gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (enum class): Rename InlineAsmOptions to InlineAsmOption for clarity * ast/rust-expr.h (enum class): Likewise. * expand/rust-macro-builtins-asm.c

[COMMITTED 137/145] gccrs: Introduce new class to handle borrow errors

2025-03-17 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * Make-lang.in: Compile new file. * checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Use new class to report errors. * checks/errors/borrowck/rust-borrow-checker-diagnostics.cc: New file. * checks/erro

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

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

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

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

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

<    8   9   10   11   12   13   14   >