[committed 20/88] gccrs: moved operator.h to util/rust-operators.h

2023-04-05 Thread arthur . cohen
From: Abdul Rafey gcc/rust/ChangeLog: * ast/rust-ast.cc: Fix include list. * ast/rust-expr.h: Likewise. * hir/tree/rust-hir-expr.h: Likewise. * rust-backend.h: Likewise. * util/rust-lang-item.h: Likewise. * operator.h: Moved to... * util/ru

[committed 25/88] gccrs: parser: Allow parsing multiple reference types

2023-04-05 Thread arthur . cohen
From: Arthur Cohen The parser now recursively tries to parse a reference type after seeing a `&` or `&&` token. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_type): Handle double ampersan properly (Parser::parse_reference_type

[committed 26/88] gccrs: Move rust-buffered-queue.h to util folder #1766

2023-04-05 Thread arthur . cohen
From: MAHAD gcc/rust/ChangeLog: * rust-buffered-queue.h: Moved to... * util/rust-buffered-queue.h: ...here. Signed-off-by: Muhammad Mahad --- gcc/rust/{ => util}/rust-buffered-queue.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename gcc/rust/{ => util}/rust-buffere

[committed 22/88] gccrs: fixed indentations in AST pretty expanded dump of trait

2023-04-05 Thread arthur . cohen
From: Abdul Rafey gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): removed extra indentations in trait ast dump Signed-off-by: Abdul Rafey --- gcc/rust/ast/rust-ast-dump.cc | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.c

[committed 27/88] gccrs: Improve GroupedPattern lowering

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Lower AST::GroupedPattern to its inner pattern. Signed-off-by: Owen Avery --- gcc/rust/hir/rust-ast-lower-pattern.cc | 12 +--- 1 file changed, 1 insertion(+), 11 deletio

[committed 21/88] gccrs: fixed compiler error message on wildcard pattern within expression

2023-04-05 Thread arthur . cohen
From: Abdul Rafey gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::null_denotation): Add proper error when seeing wildcard var on right side of assignment. gcc/testsuite/ChangeLog: * rust/compile/issue-867.rs: New test. Signed-off-by: Abdul Rafey --- gcc/rust/p

[committed 28/88] gccrs: Remove HIR::GroupedPattern

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-fnparam.h (CompileFnParam::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor. (CompilePatternB

[committed 29/88] gccrs: Optimize HIR::ReferencePattern

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * hir/tree/rust-hir-pattern.h (class ReferencePattern): Remove has_two_amps field. * hir/tree/rust-hir-full-test.cc (ReferencePattern::as_string): Remove usage of ReferencePattern::has_two_amps. Signed-off-by: Owen Avery ---

[committed 30/88] gccrs: Implement lowering ReferencePattern from AST to HIR

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-pattern.h: (ReferencePattern::is_double_reference): Add method. (ReferencePattern::get_is_mut): Add method. * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Add ReferencePattern visitor. *

[committed 34/88] gccrs: Removed comment copy-pasted from gcc/tree.def

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Removed copy-pasted comment. Signed-off-by: Owen Avery --- gcc/rust/backend/rust-compile-expr.cc | 24 1 file changed, 24 deletions(-) diff --git a/gcc/rust/backend/rus

[committed 36/88] gccrs: Move TypePredicateItem impl out of the header

2023-04-05 Thread arthur . cohen
From: Philip Herron This moves the implementation code out of the header and into its respective cc file. Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-bounds.cc (TypeBoundPredicateItem::error): refactor (TypeBoundPredicateItem::is_error): likewise

[committed 38/88] gccrs: Refactor SubstitutionRef base class into its own CC file

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * Make-lang.in: update the makefile * typecheck/rust-tyty.cc (SubstitutionParamMapping::need_substitution): likewise (SubstitutionParamMapping::override_context): likewise (SubstitutionRef::ge

[committed 32/88] gccrs: parser: Fix parsing of closure param list

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_closure_expr): Advance tokens properly when parsing closure param list. gcc/testsuite/ChangeLog: * rust/compile/closure_move_expr.rs: New test. --- gcc/rust/parse/rust-parse-impl.h

[committed 37/88] gccrs: Refactor TyVar and TypeBoundPredicates

2023-04-05 Thread arthur . cohen
From: Philip Herron This extract these helpers into seperate files Signed-off-by: Philip Herron gcc/rust/ChangeLog: * Make-lang.in: update makefile * typecheck/rust-tyty.cc (TyVar::TyVar): move to new file (TyVar::get_tyty): likewise (TyVar::get_implicit_infer_

[committed 33/88] gccrs: Add support for feature check.

2023-04-05 Thread arthur . cohen
From: mxlol233 This commit implements a very basic feature checking module. gcc/rust/ChangeLog: * Make-lang.in: Add object files: `rust-feature.o` and `rust-feature-gate.o` * checks/errors/rust-feature-gate.cc: New file. * checks/errors/rust-feature-gate.h: New file.

[committed 51/88] gccrs: Fix nullptr dereference

2023-04-05 Thread arthur . cohen
From: Philip Herron When we check if this is concrete the guard checks to ensure the argument is non null but the check here is wrongly returning early when the check is non null meaning when it is null and therefore not concrete it will end up doing a null dereference. Signed-off-by: Philip Her

[committed 31/88] gccrs: parser: Improve parsing of complex generic arguments

2023-04-05 Thread arthur . cohen
From: Arthur Cohen The parser was missing code for handling complex type arguments such as type paths or nested generics. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_generic_arg): Handle type paths and nested generics properly. gcc/testsuite/ChangeLog

[committed 40/88] gccrs: Refactor BaseType, InferType and ErrorType impl into cc file

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (BaseType::BaseType): refactor (BaseType::~BaseType): likewise (BaseType::get_ref): likewise (BaseType::set_ref): likewise (BaseType::get_ty_ref): likewise

[committed 52/88] gccrs: Add missing Sized, Copy and Clone lang item mappings

2023-04-05 Thread arthur . cohen
From: Philip Herron We need these lang items to be defined and later down the line the mappings will be used to implement proper copy and clone logic. Fixes #1786 Signed-off-by: Philip Herron gcc/rust/ChangeLog: * util/rust-lang-item.h: gcc/testsuite/ChangeLog: * rust/compi

[committed 35/88] gccrs: Add another test case for passing associated type-bounds

2023-04-05 Thread arthur . cohen
From: Philip Herron This demonstrates that this also works for custom algebraic data types too. gcc/testsuite/ChangeLog: * rust/execute/torture/issue-1720-2.rs: New test. Signed-off-by: Philip Herron --- .../rust/execute/torture/issue-1720-2.rs | 30 +++ 1 file c

[committed 42/88] gccrs: Refactor PathProbeType code into CC file

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-path-probe.cc (PathProbeCandidate::Candidate::Candidate): refactor (PathProbeCandidate::PathProbeCandidate): likewise (PathProbeCandidate::as_string): likewise (PathProbeC

[committed 44/88] gccrs: Rename rust-tyctx.cc to rust-typecheck-context.cc

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * Make-lang.in: update name * typecheck/rust-tyctx.cc: Moved to... * typecheck/rust-typecheck-context.cc: ...here. --- gcc/rust/Make-lang.in | 2 +- gcc/rust/

[committed 41/88] gccrs: Refactor PathProbe into cc file

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-path-probe.cc (PathProbeType::PathProbeType): refactor (PathProbeType::Probe): likewise (PathProbeType::visit): likewise (PathProbeType::process_enum_item_for_candiates):

[committed 61/88] gccrs: expander: Add documentation for `expand_eager_invocations`

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (MacroExpander::expand_eager_invocations): Add documentation explaining the algorithm. --- gcc/rust/expand/rust-macro-expand.cc | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git

[committed 46/88] gccrs: Refactor handle_substitutions to take a reference

2023-04-05 Thread arthur . cohen
From: Philip Herron This patch changes the recusive substitution code to take a reference instead of a copy. This is important as the callback field is going to be made non-copyable in a future patch and this pipeline is for recursive substitutions so its ok to reuse the same mappings here. Sign

[committed 47/88] gccrs: Clear the substitution callbacks when copying ArgumentMappings

2023-04-05 Thread arthur . cohen
From: Philip Herron When we set the callback on substitutions this is not safe to be copied around since we store the used argument mappings and can reuse them in different contexts. This clears the callback on copy's to make it safer. Signed-off-by: Philip Herron gcc/rust/ChangeLog:

[committed 66/88] gccrs: Add variadic argument type checking

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Add variadic argument type checking. (TypeCheckCallExpr::visit): Fix comment spelling ("varadic"). gcc/testsuite/ChangeLog: * rust/execute/torture/overflow1.rs: Fix te

[committed 49/88] gccrs: Remove monomorphization hack to setup possible associated types

2023-04-05 Thread arthur . cohen
From: Philip Herron During CallExpr argument type checking we may be calling a default implementation of a trait function this will require any possible associated types to be resolved and setup. This monomoprhization call does this but it will premtivly do extra unification of types which will t

[committed 39/88] gccrs: Refactor all substitution mapper code implementation into its own CC file

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-substitution-mapper.cc (SubstMapper::SubstMapper): refactor (SubstMapper::Resolve): likewise (SubstMapper::InferSubst): likewise (SubstMapper::have_generic_args): likewise

[committed 43/88] gccrs: Refactor all code out of the rust-tyty.h header

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.h: refactor * typecheck/rust-tyctx.cc (TypeCheckContext::iterate): refactor (TypeCheckContext::have_loop_context): likewise (TypeCheckContext::push_new_loop_cont

[committed 69/88] gccrs: lex: Prevent directories in RAIIFile

2023-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry RAIIFile constructor was accepting directory filename. This lead to unattended directory opening in some part of the code (load_file_bytes) wich resulted in ice. Since RAIIFile are used for the lexer, removing the ability to open directories with RAIIFile fixes those i

[committed 45/88] gccrs: Rename header rust-hir-trait-ref.h to rust-hir-trait-reference.h

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-trait-ref.h: Moved to... * typecheck/rust-hir-trait-reference.h: ...here. * typecheck/rust-hir-trait-resolve.cc: refactor * typecheck/rust-hir-trait-resolve.h (RUST_HIR_TRA

[committed 53/88] gccrs: Fix higher ranked trait bounds computation of self

2023-04-05 Thread arthur . cohen
From: Philip Herron This updates the higher ranked trait bounds computation to handle ambigious cases. When we have a slice for example: let slice = &a[1..3]; This works by reusing the Index operator overload from libcore, so when the index range of 1..3 is computed, the type system needs to

[committed 70/88] gccrs: testsuite: Add empty string macro test

2023-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Add two new tests with empty string for include_str and include_bytes macros. gcc/testsuite/ChangeLog: * rust/compile/issue-1830_bytes.rs: New test. * rust/compile/issue-1830_str.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/

[committed 54/88] gccrs: Remove bad error message on checking function arguments

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): remove error message gcc/testsuite/ChangeLog: * rust/compile/func3.rs: update test case --- gcc/rust/typecheck/rust-tyty-call.cc | 5 - gcc/tes

[committed 48/88] gccrs: Add missing param subst callback

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc: add missing callback --- gcc/rust/typecheck/rust-tyty-subst.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty

[committed 56/88] gccrs: Add support for TuplePattern in let statements

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * hir/tree/rust-hir-pattern.h (TuplePatternItemsRanged::get_lower_patterns): Add method. (TuplePatternItemsRanged::get_upper_patterns): Add method. * backend/rust-compile-pattern.cc (CompilePatternLet::visit): Implement

[committed 74/88] gccrs: Add new virtual function HIR::ImplItem::get_impl_item_name

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h: implement virtual function * hir/tree/rust-hir.h: add virtual function --- gcc/rust/hir/tree/rust-hir-item.h | 17 - gcc/rust/hir/tree/rust-hir.h | 2 ++ 2 fi

[committed 50/88] gccrs: Refactor the type unification code

2023-04-05 Thread arthur . cohen
From: Philip Herron This refactors the unification systems to be a consistent interface using switch statements and simple functions instead of the old clunky visitor system. This is more maintainable as it is harder to miss cases when we can take advantages of switch statements. Signed-off-by:

[committed 55/88] gccrs: Add general TypeBounds checks

2023-04-05 Thread arthur . cohen
From: Philip Herron Existing tests are updated to use libcore copy and clone implementation. Addresses #1725 Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::go): ensure the bounds are checked gcc/testsuite/ChangeLog: * rust/compile/t

[committed 58/88] gccrs: parser: Expose parse_macro_invocation as public API

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * parse/rust-parse.h: Move `parse_macro_invocation` to public API. --- gcc/rust/parse/rust-parse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 2f767bb2a53

[committed 81/88] gccrs: Fix up DejaGnu directives in 'rust/compile/issue-1830_{bytes, str}.rs' test cases [#1838]

2023-04-05 Thread arthur . cohen
From: Thomas Schwinge 'dg-excess-errors' "indicates that the test is expected to fail due to compiler messages that are not handled by 'dg-error', [etc.]". It's argument doesn't specify the message to match but just just a comment. Here, however, we'd like to match specific compiler messages, s

[committed 59/88] gccrs: expansion: Add `get_token_slice` to `MacroInvocLexer` class

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-invoc-lexer.cc (MacroInvocLexer::get_token_slice): Add API to retrieve token slices when lexing macro expansions. * expand/rust-macro-invoc-lexer.h: Declare `get_token_slice`. --- gcc/rust/expand/rust-macro

[committed 57/88] gccrs: rust-item: include rust-expr.h

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-item.h (class BlockExpr): Remove forward declaration of class `BlockExpr`. --- gcc/rust/ast/rust-item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h

[committed 62/88] gccrs: typecheck: Refactor rust-hir-trait-reference.h

2023-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry Move function body to their own cc file instead of keeping them in the header file. gcc/rust/ChangeLog: * Make-lang.in: Add `rust-hir-trait-reference.o`. * typecheck/rust-hir-trait-reference.h: Remove multiple function body. * typecheck/rust-h

[committed 60/88] gccrs: macros: Perform macro expansion in a fixed-point fashion.

2023-04-05 Thread arthur . cohen
From: Arthur Cohen This commit changes our macro expansion system from an eager and recursive macro expansion to a fixed-point like system. Instead of, when seeing a macro invocation, expanding it and all of the macros within it, we now perform multiple passes of expansion on the entire crate

[committed 63/88] gccrs: cli: Update safety warning message

2023-04-05 Thread arthur . cohen
From: Pierre-Emmanuel Patry The compiler's warning message about the safety flag did not match cargo-gccrs environment variable name anymore. gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Update the environment variable name. Signed-off-by: Pierre-Emma

[committed 64/88] gccrs: Update copyright years.

2023-04-05 Thread arthur . cohen
From: Thomas Schwinge gcc/rust/ChangeLog: * ast/rust-ast-fragment.cc: Update copyright years. * ast/rust-ast-fragment.h: Likewise. * ast/rust-macro.cc: Likewise. * checks/errors/rust-feature-gate.cc: Likewise. * checks/errors/rust-feature-gate.h: Likewise.

[committed 67/88] gccrs: Add test

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/variadic.rs: New test. Signed-off-by: Owen Avery --- gcc/testsuite/rust/compile/variadic.rs | 8 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/rust/compile/variadic.rs diff --git a/gcc/testsuite/rus

[committed 65/88] gccrs: Add feature gate for "rust-intrinsic".

2023-04-05 Thread arthur . cohen
From: mxlol233 This commit implemented a feature gate to check `intrinsics`. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc: Add implementation for `void FeatureGate::visit (AST::ExternBlock &block)`. Add `valid_feature` construction process in `FeatureGate::ch

[committed 71/88] gccrs: Add support for parsing empty tuple patterns.

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_grouped_or_tuple_pattern): Add support for empty tuple patterns. gcc/testsuite/ChangeLog: * rust/compile/parse_empty_tuple_pattern.rs: New test. Signed-off-by: Owen Avery --- gcc/rust/pars

[committed 68/88] gccrs: Simplify WildcardPattern let statement handling

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternLet::visit): Simplify WildcardPattern compilation for let statements. * backend/rust-compile-var-decl.h: (CompileVarDecl::visit): Remove variable declaration for WildcardPatter

[committed 72/88] gccrs: Implemented UTF-8 checking for include_str!()

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::include_str_handler): Add check for valid UTF-8. gcc/testsuite/ChangeLog: * rust/compile/builtin_macro_include_str.rs: Include test of invalid UTF-8. * rust/compile/inval

[committed 73/88] gccrs: Extract query_type from TypeCheckBase to be a simple extern

2023-04-05 Thread arthur . cohen
From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * Make-lang.in: add new dependancy * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::query_type): refactor * typecheck/rust-hir-type-check-base.h: refactor * typecheck/rust-hir-type-chec

[committed 78/88] gccrs: builtins: Return empty list of tokens instead of nullptr

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::include_handler): Do not return nullptr token in expansion of `include!()` gcc/testsuite/ChangeLog: * rust/compile/empty.in: New test. * rust/compile/include_empty.rs: New

[committed 77/88] gccrs: Add trailing newline

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.h: Add trailing newline before EOF. Signed-off-by: Owen Avery --- gcc/rust/checks/errors/rust-feature-gate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/checks/errors/rust-feature-g

[committed 76/88] gccrs: Fix regression in testcase

2023-04-05 Thread arthur . cohen
From: Philip Herron Fixes #776 Signed-off-by: Philip Herron gcc/testsuite/ChangeLog: * rust/compile/torture/traits10.rs: Fix test-case --- .../rust/compile/torture/traits10.rs | 64 ++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/gcc/testsu

[committed 84/88] gccrs: ast: Refactor TraitItem to keep Location info

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast.h: Keep location in TraitItem base class * ast/rust-item.h (class TraitItemFunc): Use base class location instead. (class TraitItemMethod): Likewise. (class TraitItemConst): Likewise. (class

[committed 80/88] gccrs: Add AST::AltPattern class

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add AltPattern visitor. * ast/rust-ast-dump.h: (Dump::visit): Add AltPattern visitor. * ast/rust-ast-full-decls.h (class AltPattern): Add declaration. * ast/rust-ast

[committed 79/88] gccrs: Fix formatting

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * ast/rust-pattern.h: Fix formatting. Signed-off-by: Owen Avery --- gcc/rust/ast/rust-pattern.h | 70 ++--- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/r

[committed 85/88] gccrs: diagnostic: Refactor Error class

2023-04-05 Thread arthur . cohen
From: Arthur Cohen The class now allows for more variants including a `Hint` one which then gets emitted by calling `rust_inform`. This allows us to display hints/tips/notes in backtracking contexts such as the parser. gcc/rust/ChangeLog: * rust-diagnostics.h (struct Error): Add new

[committed 82/88] gccrs: rename rust-hir-full-tests.cc

2023-04-05 Thread arthur . cohen
From: SainiAditya1 gcc/rust/Changelog: * hir/tree/rust-hir-full-test.cc: Moved to... * hir/tree/rust-hir.cc: ...here. * Make-lang.in: Rename rust-hir-full-test. Signed-off-by: SainiAditya1 --- gcc/rust/Make-lang.in| 2 +- gcc/rust/hi

[committed 75/88] gccrs: Support for Sized builtin marker trait

2023-04-05 Thread arthur . cohen
From: Philip Herron When implementing general bounds checking as part of unify calls, we did not check associated types on bounds which lead to alot of missed error checking. This now recursively checks the bounds and the associated types with a decent error message. This also required us to impl

[committed 87/88] gccrs: Address unsafe with/without block handling ambiguity

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_expr_stmt): Remove hypothetical unsafe + expr_stmt_without_block handling. Signed-off-by: Owen Avery --- gcc/rust/parse/rust-parse-impl.h | 15 +++ 1 file changed, 3 insertions(+), 12 de

[committed 83/88] gccrs: add test case to show our query-type system is working

2023-04-05 Thread arthur . cohen
From: Philip Herron Fixes #1361 Signed-off-by: Philip Herron gcc/testsuite/ChangeLog: * rust/compile/issue-1361.rs: New test. --- gcc/testsuite/rust/compile/issue-1361.rs | 8 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/rust/compile/issue-1361.rs diff

[committed 88/88] gccrs: Fix issue with parsing unsafe block expression statements

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_stmt): Handle unsafe expression statements. gcc/testsuite/ChangeLog: * rust/compile/issue-1422.rs: New test. Signed-off-by: Owen Avery --- gcc/rust/parse/rust-parse-impl.h | 10

[committed 86/88] gccrs: Added AST Node AST::InlineAsm

2023-04-05 Thread arthur . cohen
From: M V V S Manoj Kumar Addresses #1567 Created a AST node InlineAsm similar to the one found in rustc. As there is no Symbol struct/class in gccrs I have made every instance of Symbol a string. gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (class InlineAsm):Added class declaration.

Re: Rust front-end update 2023-04-05

2023-04-06 Thread Arthur Cohen
veryone who has helped us. All the best, Arthur - Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht Münche

Re: Rust: Work around 'error[E0658]: `let...else` statements are unstable'

2024-11-25 Thread Arthur Cohen
the `String::leak` method is also slightly easier to use. Let me know and I'm happy to reapply the PR. Best, Arthur On 11/23/24 9:09 PM, Thomas Schwinge wrote: Hi! On 2024-08-01T16:56:01+0200, Arthur Cohen wrote: Compile libformat_parser and link to it. --- /dev/null +++ b/lib

Re: Rust: Work around 'error[E0658]: `let...else` statements are unstable'

2024-12-05 Thread Arthur Cohen
Hi Thomas! On 12/4/24 13:35, Thomas Schwinge wrote: Hi Arthur! On 2024-11-25T11:24:08+0100, Arthur Cohen wrote: Thanks, this patch (and your other one on the matter) looks good Oh, wow -- I passed the first non-trivial Rust programming I've done! :-D ;-) but I have a slight issue wi

Re: Rust: libformat_parser: Lower minimum Rust version to 1.49

2024-12-09 Thread Arthur Cohen
Hi Thomas, On 12/9/24 10:59 AM, Thomas Schwinge wrote: Hi! On 2024-12-05T13:37:13+0100, Arthur Cohen wrote: On 12/4/24 13:35, Thomas Schwinge wrote: On 2024-11-25T11:24:08+0100, Arthur Cohen wrote: [...] We had previously done something similar to adapt to Rust 1.72 when we originally

[COMMITTED 039/144] gccrs: Scaffolding asm codegen

2025-03-19 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * backend/rust-compile-block.h: Scaffolding asm codegen * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-expr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (Expr

[COMMITTED 015/144] gccrs: Add location to BIR::Loan

2025-03-19 Thread arthur . cohen
From: Kushal Pal This commit adds location_t to BIR::Loan, this location will point to location is source code where the borrow occured, this information will be useful for reporting borrow-checking errors. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-internal.h:

[COMMITTED 021/144] gccrs: [gccrs#2324] Add error message for E0532

2025-03-19 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc: Emit E0532 when trying to reference a Tuple or Struct variant using a non Tuple or Struct pattern. gcc/testsuite/ChangeLog: * rust/compile/issue-2324-1.rs: add test for E053

[COMMITTED 012/144] gccrs: Set up the hir lowering for operand

2025-03-19 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * hir/rust-ast-lower-expr.cc (from_operand): Set up the lowering for operand (ASTLoweringExpr::visit): Likewise * hir/tree/rust-hir-expr.h (struct InlineAsmRegOrRegClass): Not necessary, kept from ast (struct A

[COMMITTED 024/144] gccrs: Subset errors with locations

2025-03-19 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * checks/errors/borrowck/rust-borrow-checker-diagnostics.cc (BorrowCheckerDiagnostics::report_subset_errors): Highlight lifetime locations while reporting subset errors. (BorrowCheckerDiagnostics::get_lifetime_param): Helper fu

[COMMITTED 023/144] gccrs: Map locations to placeholder regions

2025-03-19 Thread arthur . cohen
From: Kushal Pal Mapped placeholder regions to their respective HIR nodes so we can fetch locations during error reporting. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder.h: Map regions to their respective HIR nodes. * checks/errors/borrowck/rust-bir.h (st

[COMMITTED 065/144] gccrs: Use FreeRegions inplace of `std::vector`

2025-03-19 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-internal.h: Use FreeRegions instead of making a temporary vector of FreeRegion. * checks/errors/borrowck/rust-bir-builder.h: Likewise. * checks/errors/borrowck/rust-bir-fact-collector.h

[COMMITTED 016/144] gccrs: Implement resolve expr for inline asm ast

2025-03-19 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Implement resolve expr for inline asm ast (translate_operand): Likewise. * resolve/rust-ast-resolve-expr.h: Likewise. --- gcc/rust/resolve/rust-ast-resolve-expr.cc | 67

[COMMITTED 020/144] gccrs: Eager expansion for include* gccrs#1805 gccrs#1865

2025-03-19 Thread arthur . cohen
From: Liam Naddell gcc/rust/ChangeLog: * expand/rust-expand-visitor.h: remove auto keyword * expand/rust-macro-builtins-helpers.cc: allow for changing macro invoc types on eager expansions to semicoloned macros * expand/rust-macro-builtins-helpers.

[COMMITTED 059/144] gccrs: Rehaul, Apply code review from Arthur

2025-03-19 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::visit): Change API, public/private, comments, formatting from code review (CompileAsm::asm_build_expr): Likewise. (CompileAsm::tree_codegen_asm): Likewise. * backend/r

[COMMITTED 075/144] gccrs: Used `IndexVec` for place_map

2025-03-19 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Use strong type instead of size_t. (Dump::visit_place): Likewise. (Dump::visit_scope): Likewise. * checks/errors/borrowck/rust-bir-dump.h (class Dump): Use I

[COMMITTED 028/144] gccrs: ast: Remove PathExpr abstract class

2025-03-19 Thread arthur . cohen
From: Arthur Cohen Inherit directly from ExprWithoutBlock instead. gcc/rust/ChangeLog: * ast/rust-ast.h (class PathExpr): Remove class. * ast/rust-path.h (class PathInExpression): Inherit from ExprWithoutBlock. (class QualifiedPathInExpression): Likewise. --- gcc/rust

[COMMITTED 042/144] gccrs: Setting up interfaces for codegen

2025-03-19 Thread arthur . cohen
From: jjasmine gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Setting up interfaces for codegen * hir/tree/rust-hir-expr.h: Likewise. --- gcc/rust/backend/rust-compile-expr.cc | 6 -- gcc/rust/hir/tree/rust-hir-expr.h | 26 +

[COMMITTED 066/144] gccrs: Strong type LoanId

2025-03-19 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): Use new API, i.e get_loan_id() instead of get_loan(). * checks/errors/borrowck/rust-bir-fact-collector.h (points): Use value of LoanId in Polonius facts. * checks

[COMMITTED 127/144] gccrs: Fix some issues with canonical path fetching in name resolution 2.0

2025-03-19 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-enumitem.cc: Add includes. (TypeCheckEnumItem::visit): Fetch canonical paths properly when name resolution 2.0 is enabled. * typecheck/rust-hir-type-check-implitem.cc: Add includes. (Type

[COMMITTED 140/144] gccrs: Load unloaded modules during toplevel resolution 2.0

2025-03-19 Thread arthur . cohen
From: Owen Avery This may load conditionally compiled modules too eagerly. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Load unloaded modules before attempting to visit their items. gcc/testsuite/ChangeLog: * rust/compile/

[COMMITTED 051/144] gccrs: Move strip double quotes, add scaffold expand

2025-03-19 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (strip_double_quotes): Move strip double quotes to parse phase (CompileAsm::asm_construct_string_tree): Likewise * backend/rust-compile-asm.h (strip_double_quotes): Likewise * expand/rust-

[COMMITTED 027/144] gccrs: ast: PathPattern: Remove `remove_all_segments` method

2025-03-19 Thread arthur . cohen
From: Arthur Cohen This method was used only for stripping PathPattern AST nodes during `cfg-strip`, which seems like a misnomer and makes it a good candidate for simplification. gcc/rust/ChangeLog: * ast/rust-path.h (class PathInExpression): Remove `remove_all_segments` method

[COMMITTED 072/144] gccrs: Used `IndexVec` for BasicBlocks

2025-03-19 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Use strong type as index and remove access to numeric value. * checks/errors/borrowck/rust-bir-builder-internal.h (struct BuilderContext):

[COMMITTED 091/144] gccrs: nr2.0: default-visitor: Conditionally visit type in self parameters.

2025-03-19 Thread arthur . cohen
From: Arthur Cohen This could trigger an assertions as `get_type` on `SelfParam` asserts that the self param does have a given type, which is not always the case. gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Do not visit self's type

[COMMITTED 080/144] gccrs: [gccrs#3141] Fix incorrect handling of overflow in numeric types

2025-03-19 Thread arthur . cohen
From: JoanVC Fixes gccrs#3141. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc: Fix range checking for both integers and floats. * hir/tree/rust-hir-expr.h: Add "negative_number" boolean to LiteralExpr class. gcc/testsuite/ChangeLog: * rust/compile/issue-3141.rs:

[COMMITTED 031/144] gccrs: attributes: Start handling prelude_import properly

2025-03-19 Thread arthur . cohen
From: Arthur Cohen This commit adds basic handling for the `#[prelude_import]` attribute, without doing anything functionality wise. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc (FeatureGate::visit): Add base feature gating for `#[feature(prelude_import

[COMMITTED 134/144] gccrs: Provide input operand for gccrs

2025-03-19 Thread arthur . cohen
From: badumbatish gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_construct_inputs): Provide input operand for gccrs * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Move expr to In (expand_inline_asm_strings): Add com

[COMMITTED 142/144] gccrs: Use name resolver 2.0 for compiling break/continue

2025-03-19 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Use name resolver 2.0 to lookup label definitions for break and continue statements when name resolution 2.0 is enabled. Signed-off-by: Owen Avery --- gcc/rust/backend/rus

[COMMITTED 084/144] gccrs: Fix ICE on error propagation with generic

2025-03-19 Thread arthur . cohen
From: "benjamin.thos" add a resolve expr visitor on error propagation to avoid internal compiler error when used with generics gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add implementation of error propagation visitor * resolve/rust-ast-

[COMMITTED 099/144] gccrs: early: Do not emit errors for unresolved imports, store them instead

2025-03-19 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Store errors for later. --- gcc/rust/resolve/rust-early-name-resolver-2.0.cc | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gcc/rust

[COMMITTED 087/144] gccrs: Add extra assertions to tl::optional

2025-03-19 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * util/optional.h (optional): Add assertions to dereference operator overloads when C++14 is available. Signed-off-by: Owen Avery --- gcc/rust/util/optional.h | 86 1 file changed, 79 inserti

[COMMITTED 093/144] gccrs: toplevel: Build list of imports for Early to resolve

2025-03-19 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc: Comment out handle_use call and error emission. * resolve/rust-toplevel-name-resolver-2.0.h: Create ImportKind class. --- .../rust-toplevel-name-resolver-2.0.cc| 37

[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

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