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

[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 106/145] gccrs: Scaffolding HIRFullVisitor for inline asm

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-ast-visitor.h: Scaffolding HIRFullVisitor for inline asm * ast/rust-ast.cc (InlineAsm::accept_vis): Likewise. * hir/tree/rust-hir-visitor.h (RUST_HIR_VISITOR_H): Likewise. * hir/tree/rust-hir.cc (InlineAsm::acc

[COMMITTED 100/145] gccrs: Refactoring for inline asm pr

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-expr.h (struct AnonConst): major refactoring of inline asm, mostly concerns naming convention, trinary conditionals, warnings, adding rust_unreachables in not-yet supported errors. (struct InlineAsmRegOrRegClas

[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 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 097/145] gccrs: Renamed parseAsmArg to conform to other function names

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parseAsmArg): Renamed parseAsmArg to conform to other function names (parse_asm_arg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parseAsmArg): Likewise.

[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 101/145] gccrs: Slim down the test cases

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/testsuite/ChangeLog: * rust/compile/inline_asm_faulty_clobber.rs: compress the test * rust/compile/inline_asm_nop.rs: compress the test * rust/compile/inline_asm_faulty_clobber_1.rs: Removed. * rust/compile/inline_asm_faulty_clob

[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 005/145] gccrs: borrowck: Polonius dump

2025-03-17 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint): Polonius facts dump. (struct Facts): Polonius facts dump. * checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Polonius facts dump. (Dump::

[COMMITTED 002/145] gccrs: git: Ignore libgrust build folders

2025-03-17 Thread arthur . cohen
From: Arthur Cohen ChangeLog: * .gitignore: Add libgrust target folders to the ignore list. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index f044fe16b5f..7150fc3b29c 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ stamp-* /g

[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 044/145] gccrs: Change lookup_hir_pattern return type

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

[COMMITTED 065/145] gccrs: Add outer attributes to struct expr fields

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Struct fields can have outer attributes on their field for various purpose, this behavior should be reflected upon struct expr fields. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Output field attributes. * ast/rust

[COMMITTED 058/145] gccrs: Parse box expressions

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Add support for old box expression syntax. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Add visit member function for BoxExpr nodes. * ast/rust-ast-collector.h: Add visit function prototype. * ast/rust-ast-v

[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 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 068/145] gccrs: Prevent raw reference from being lowered silently

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry We do not handle those kind of references yet, we shall not let them pass as a regular reference. gcc/rust/ChangeLog: * ast/rust-expr.h: Add a getter for mutability. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Panic when a raw refer

[COMMITTED 052/145] gccrs: Add call and method call default visitors

2025-03-17 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): New for AST::CallExpr and AST::MethodCallExpr. * resolve/rust-default-resolver.h (DefaultResolver::visit): Likewise. Signed-off-by: Owen Avery --- gcc/rust

[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 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 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 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 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 057/145] gccrs: Improve handling of ConstantItem during name resolution 2.0

2025-03-17 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Scope with Rib::Kind::ConstantItem instead of Rib::Kind::Item. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Remove redundancy in ov

[COMMITTED 062/145] gccrs: Allow multiple outer attributes on generic params

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Previously generic params only allowed one outer attribute in front of them. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Visit outer attributes. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Change outer

[COMMITTED 063/145] gccrs: Add dropck_eyepatch feature gate for may_dangle

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Add a new feature gate for may_dangle generic param outer attributes. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc: Visit and gate may_dangle attributes. * checks/errors/rust-feature-gate.h: Update visit function prototype

[COMMITTED 061/145] gccrs: Fix generic parameter parsing

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Generic parameter parsing failed when an outer attribute was used on it. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_generic_param): Change token reference to be the last token after all outer attributes have been parsed. Sig

[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 072/145] gccrs: Add exclusive_range_pattern feature gate

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry This syntax is experimental and shall be explicitely enabled in the crate attributes as it cannot be used in stable rust. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc (FeatureGate::visit): Gate the excluded pattern. * checks/errors

[COMMITTED 076/145] gccrs: Introduce first implementation of parse_clobber_abi

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): title. (parseAsmArg): title. * expand/rust-macro-builtins-asm.h (parse_clobber_abi): title. --- gcc/rust/expand/rust-macro-builtins-asm.cc | 76 +- gcc/rust/ex

[COMMITTED 077/145] gccrs: Working on parse_options for a bit more

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_options): title. --- gcc/rust/expand/rust-macro-builtins-asm.cc | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc b/gcc/rust/expand/

[COMMITTED 071/145] gccrs: Parse exclusive range pattern

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Exclusive range pattern were not handled by the parser as this an experimental feature. gcc/rust/ChangeLog: * ast/rust-pattern.cc (tokenid_to_rangekind): Add a new function to get a range kind from the current token type. (RangePattern::as_str

[PATCH 2/4] rust: Use error_operand_p in rust-gcc.cc

2025-03-17 Thread 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: * rust-gcc.cc (Bvariable::

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

[PATCH 3/4] rust: use range for inside rust-gcc.cc [PR119341]

2025-03-17 Thread 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 range fors. (func

[PATCH 1/4] rust: Use REAL_TYPE_P instead of manual checking

2025-03-17 Thread Andrew Pinski
This moves is_floating_point over to using REAL_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 x86_64-linux-gnu. gcc/r

[PATCH 4/4] rust: Add comment inside block [PR119342]

2025-03-17 Thread 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/119342 * rust-g

[Bug rust/119341] New: statement_list in rust-gcc.cc can use range for

2025-03-17 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119341 Bug ID: 119341 Summary: statement_list in rust-gcc.cc can use range for Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: internal-improvement Severity: normal

[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

[Bug rust/119341] statement_list in rust-gcc.cc can use range for

2025-03-17 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119341 Andrew Pinski changed: What|Removed |Added URL||https://gcc.gnu.org/piperma

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

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

[COMMITTED 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 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 045/145] gccrs: Change lookup_canonical_path's return path

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Change the function's return type to wrap it within an optional. gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Change call site to accomodate new return type. * backend/rust-compile-base.h: Change parameter to use a reference. *

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

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

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

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

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

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

[COMMITTED 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 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 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 050/145] gccrs: mingw: Fix build with patch from Liu Hao

2025-03-17 Thread arthur . cohen
From: Arthur Cohen This commit adds Liu Hao's patch from https://github.com/lhmouse/MINGW-packages/blob/5859d27b2b6101204a08ad9702cb2937f8797be9/mingw-w64-gcc/0100-rust-fix.patch gcc/rust/ChangeLog: * checks/errors/borrowck/rust-borrow-checker.cc (mkdir_wrapped): Remove. (Borrow

[COMMITTED 074/145] gccrs: Almost done with top level parsing

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (struct AsmParseError): title. (enum InlineAsmDirSpec): title. (enum InlineAsmOptions): title. (struct AsmArg): title. (parseAsmArg): title. (parse_global_asm): title. (

[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 075/145] gccrs: Working on parseAsmArg

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (enum InlineAsmRegOrRegClass): title. (parseAsmArg): title. (check_identifier): title. (parse_operand): title. (parse_options): title. (parse_reg): title. (parseDirSpec

[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 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 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 088/145] gccrs: Parsing of options(...) done.

2025-03-17 Thread arthur . cohen
From: jjasmine This is without any mutually exclusive options checked, or any relationship with reg_operands. Very primitive. gcc/rust/ChangeLog: * ast/rust-expr.h: parsing of options(...) * expand/rust-macro-builtins-asm.cc (check_and_set): likewise. (parse_opti

[COMMITTED 099/145] gccrs: Got AST::Fragment to be created from InlineAsm

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-expr.h (struct AnonConst): Got AST::Fragment to be created from InlineAsm. (struct InlineAsmOperand): Likewise. (class InlineAsm): Likewise. * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise.

[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 116/145] gccrs: Partial second layer of expected in parsing asm

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parseDirSpec): Partial second layer of expected in parsing asm (parse_clobber_abi): Likewise (parse_operand): Likewise (parse_reg_operand): Likewise (parse_asm_arg): Likewise

[COMMITTED 080/145] gccrs: Introduced is_global_asm to InlineAsm AST

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-expr.h: Introduced is_global_asm to InlineAsm AST --- gcc/rust/ast/rust-expr.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index a5afbffee99..84fb5e8ab33 100644 --- a/gcc/rust/ast/r

[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 135/145] gccrs: Added FFIVector to get Polonius output on C++ side

2025-03-17 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * Make-lang.in: Compile new file, rust-polonius.cc * checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: Opaque type to represent FFIVector from C++. * checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs: C

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

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

[COMMITTED 084/145] gccrs: Top level parsing test for asm!

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/testsuite/ChangeLog: * rust/compile/inline_asm_ident_first.rs: New test. --- gcc/testsuite/rust/compile/inline_asm_ident_first.rs | 10 ++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/rust/compile/inline_asm_ident_first.rs diff --git a/g

[COMMITTED 089/145] gccrs: Wraps inline_asm tests in unsafe {}

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/testsuite/ChangeLog: * rust/compile/inline_asm_faulty_clobber.rs: Wraps inline_asm tests in unsafe {} * rust/compile/inline_asm_faulty_clobber_1.rs: likewise. * rust/compile/inline_asm_faulty_clobber_2.rs: likewise. * rust/compile/inline

[COMMITTED 091/145] gccrs: Resolve static decl warning

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.h (parseAsmArg): Resolve static decl warning (parse_nonglobal_asm): Resolve static decl warning --- gcc/rust/expand/rust-macro-builtins-asm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deleti

[COMMITTED 081/145] gccrs: Make InlineAsm non-abstract for usage in parsing.

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * ast/rust-expr.h: Make InlineAsm non-abstract for usage in parsing. --- gcc/rust/ast/rust-expr.h | 44 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust

[COMMITTED 121/145] gccrs: Added ExprType::InlineAsm

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h: Added ExprType::InlineAsm * hir/tree/rust-hir.h: Added ExprType::InlineAsm --- gcc/rust/hir/tree/rust-hir-expr.h | 3 +-- gcc/rust/hir/tree/rust-hir.h | 1 + 2 files changed, 2 insertions(+), 2 d

[COMMITTED 120/145] gccrs: Add test case for using asm! outside of unsafe {}

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/testsuite/ChangeLog: * rust/compile/inline_asm_outside_unsafe.rs: New test. --- .../rust/compile/inline_asm_outside_unsafe.rs | 11 +++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/rust/compile/inline_asm_outside_unsafe.rs diff -

[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 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 115/145] gccrs: Expected first layer done

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg): Expected first layer done (parse_reg_operand): Likewise. (parse_asm_arg): Likewise. (parse_format_strings): Likewise. (parse_asm): Likewise. (validate): Lik

[COMMITTED 144/145] gccrs: [gccrs#2987] Patch ICE when deriving Clone and Copy

2025-03-17 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * expand/rust-expand-visitor.cc: Fix ICE caused by unique_ptr UB and buggy iterator use gcc/testsuite/ChangeLog: * rust/compile/issue-2987.rs: Add test for deriving Clone and Copy at the same time Signed-off-by: Liam Naddell

[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 098/145] gccrs: Working towards parse_reg and parse_reg_operand

2025-03-17 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg): Working towards parse_reg and parse_reg_operand (parse_reg_operand): Working towards parse_reg and parse_reg_operand (parse_asm_arg): Add todo about errors

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

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

[COMMITTED 138/145] gccrs: Improve error messages for operator expressions

2025-03-17 Thread arthur . cohen
From: Antonio Gomes gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h: Add new get_operator_str method in ArithmeticOrLogicalExpr and CompoundAssignmentExpr * hir/tree/rust-hir.cc: Likewise * typecheck/rust-hir-type-check-expr.cc: Improve error message for ope

[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 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 031/145] gccrs: Change return type of lookup trait defid functions.

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the return type with an optional. gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): Update code around lookup return type. * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_boun

[COMMITTED 033/145] gccrs: Change lookup_module function return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the return type into an optional. gcc/rust/ChangeLog: * checks/errors/privacy/rust-visibility-resolver.cc: Update function call to match the new return type. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):

[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 035/145] gccrs: Change lookup_hir_implitem return type

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the return type within an optional. Now return the parent id within a pair instead of taking an out reference. gcc/rust/ChangeLog: * backend/rust-compile-item.cc (CompileItem::visit): Change call site to accept new return type. * backend/

[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 039/145] gccrs: Change lookup_hir_type return type with an optional

2025-03-17 Thread arthur . cohen
From: Pierre-Emmanuel Patry Wrap the function's return type with an optional in order to tell appart a null pointer from a missing value. gcc/rust/ChangeLog: * util/rust-hir-map.cc (Mappings::insert_hir_type): Change call site to accomodate the new return type. (Mappings

[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 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 001/145] gccrs: contrib: Add libgrust to update-copyright.py script

2025-03-17 Thread arthur . cohen
From: Sahil Yeole contrib/ChangeLog: * update-copyright.py: Add libgrust folder. Signed-off-by: Sahil Yeole --- contrib/update-copyright.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/update-copyright.py b/contrib/update-copyright.py index 0e45609d5eb..838c44f33eb 100

[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 009/145] gccrs: borrowck: Testsuite

2025-03-17 Thread arthur . cohen
From: Jakub Dupak gcc/testsuite/ChangeLog: * rust/borrowck/borrowck.exp: New test. * rust/borrowck/position_dependant_outlives.rs: New test. * rust/borrowck/reference.rs: New test. * rust/borrowck/return_ref_to_local.rs: New test. * rust/borrowck/subset.rs

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

  1   2   >