[committed 044/103] gccrs: Refactor expression hir lowering into cc file

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * Make-lang.in: Add new object file for expression lowering. * ast/rust-expr.h: Move implementation of expr lowering to source file. * backend/rust-compile-block.h: Likewise. * backend/rust-compile-expr.cc (CompileExpr::visi

[committed 028/103] gccrs: ast: dump: ArrayExpr

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add dump code for ArrayExpr. --- gcc/rust/ast/rust-ast-dump.cc | 32 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/r

[committed 058/103] gccrs: intrinsics: Add `sorry_handler` intrinsic handler

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (sorry_handler): New intrinsic handler. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-3.rs: New test. --- gcc/rust/backend/rust-compile-intrinsic.cc | 10 ++ gcc/testsuite

[committed 059/103] gccrs: constexpr: Add `rust_sorry_at` in places relying on init values

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-constexpr.cc (build_anon_member_initialization): Workaround uninitialized values. (build_data_member_initialization): Likewise. --- gcc/rust/backend/rust-constexpr.cc | 96 +++--- 1 file

[committed 060/103] gccrs: intrinsics: Add early implementation for atomic_store_{seqcst, relaxed, release}

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::setup_atomic_fns): New function. (BuiltinsContext::setup): Call `setup_atomic_fns`. * backend/rust-builtins.h: Declare `setup_atomic_fns`. * backend/rust-compile-intrinsic.cc

[committed 032/103] gccrs: ast: dump TypeAlias

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add code for dumping type aliases. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-d

[committed 066/103] gccrs: ast: transform helper methods to visits and add methods to simplify repeated patterns

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::go): Use new API. (Dump::format_function_param): Refactor. (Dump::visit_items_joined_by_separator): New function. (Dump::emit_attrib): Refactor. (Dump::visit_as_line): New function.

[committed 031/103] gccrs: Refactor TraitResolver to not require a visitor

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::TraitResolver): Do not nullptr init `resolved_trait_reference` anymore. (TraitResolver::resolve_path): Simplify function and rename to... (TraitResolver::resolve_path_to

[committed 071/103] gccrs: typecheck: Fix overzealous `delete` call

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Fix extra call to `delete`. --- gcc/rust/typecheck/rust-tyty-call.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/rust/typecheck/rust-tyty-call.cc b/gcc/rust/typecheck

[committed 078/103] gccrs: ast: Dump tuple type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing tuple type visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.c

[committed 039/103] gccrs: Add check for recursive trait cycles

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Check if a trait query is currently in progress. * typecheck/rust-hir-type-check.h (class TraitQueryGuard): Add helpers around checking for trait querie

[committed 043/103] gccrs: Add missing fn_once_output langitem

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * util/rust-lang-item.h: Add handling for `fn_once_output`. --- gcc/rust/util/rust-lang-item.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h index c7e0e5c811d..02eeaee60d

[committed 084/103] gccrs: ast: Dump parenthesised type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/ru

[committed 054/103] gccrs: Support Closure calls as generic trait bounds

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Refactor checking of closures. (CompileExpr::generate_possible_fn_trait_call): New function. * backend/rust-compile-expr.h: Declare `generate_possible_fn_trait_call`. gcc/tests

[committed 056/103] gccrs: rust: Allow gccrs to build on x86_64-apple-darwin with clang/libc++

2023-02-21 Thread arthur . cohen
From: Simon Cook gcc/rust/ChangeLog: * util/rust-inline-visitor.h: Remove some offending system includes. --- gcc/rust/util/rust-inline-visitor.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/gcc/rust/util/rust-inline-visitor.h b/gcc/rust/util/rust-inline-visitor.h index 18920d

[committed 055/103] gccrs: Implement the inline visitor

2023-02-21 Thread arthur . cohen
From: YizhePKU gcc/rust/ChangeLog: * util/rust-inline-visitor.h: New file. --- gcc/rust/util/rust-inline-visitor.h | 95 + 1 file changed, 95 insertions(+) create mode 100644 gcc/rust/util/rust-inline-visitor.h diff --git a/gcc/rust/util/rust-inline-visitor

[committed 057/103] gccrs: builtins: Rename all bang macro handlers

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::assert): Rename to... (MacroBuiltin::assert_handler): ..this. (MacroBuiltin::file): Rename to... (MacroBuiltin::file_handler): ..this. (MacroBuiltin::column): Rename to

[committed 061/103] gccrs: intrinsics: Add unchecked operation intrinsics

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (is_basic_integer_type): New function. (unchecked_op_inner): New handler. (unchecked_op_handler): New handler. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-6.rs: New test

[committed 062/103] gccrs: intrinsics: Use lambdas for wrapping_ intrinsics

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (wrapping_op_handler): Refactor to return an `std::function`. (wrapping_op_handler_inner): Rename. (wrapping_add_handler): Remove function. (wrapping_sub_handler): Likewise

[committed 064/103] gccrs: intrinsics: Implement atomic_load intrinsics

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::setup_atomic_fns): Declare atomic load intrinsics. * backend/rust-compile-intrinsic.cc (atomic_load_handler_inner): New handler. (atomic_load_handler): Likewise

[committed 072/103] gccrs: ast: add visit overload for references

2023-02-21 Thread arthur . cohen
From: Jakub Dupak This is currently needed for lifetimes to use the existing infrastructure. gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add new reference visitor wrapper. * ast/rust-ast-dump.h: Declare it. * ast/rust-item.h: Add mutable visibility getters.

[committed 077/103] gccrs: ast: Dump never type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing never type visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/a

[committed 079/103] gccrs: ast: Dump inferred type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 9393

[committed 081/103] gccrs: ast: Dump impl trait type one bound

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rus

[committed 082/103] gccrs: ast: Dump impl trait type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/

[committed 083/103] gccrs: ast: Dump trait object type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust

[committed 086/103] gccrs: ast: Dump type param type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast

[committed 094/103] gccrs: Refactor name resolver to take a Rib::ItemType

2023-02-21 Thread arthur . cohen
From: Philip Herron This allows us to track the type of declaration that is stored within a Rib. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add Rib argument. (ResolveExpr::resolve_closure_param): Likewise. * resolve/rust-ast-resolve-imp

[committed 098/103] gccrs: Fix undefined behaviour issues on macos

2023-02-21 Thread arthur . cohen
From: Philip Herron This adds missing copy constructors to HIR::PathExprSegment which were wrongly defaulting to empty vectors when apply specified generic arguments to method calls. gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h: Add const `get_method_name`. * hir/tree/rust-hir

[committed 087/103] gccrs: ast: Dump generic parameters

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. * ast/rust-ast-dump.h: Likewise. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 129 +++--- gcc/rust/ast/rust-ast-dump.h | 3 + 2 fil

[committed 103/103] gccrs: add math intrinsics

2023-02-21 Thread arthur . cohen
From: Raiki Tamura gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::setup_math_fns): New functions. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-math.rs: New test. --- gcc/rust/backend/rust-builtins.cc | 122 +++- .../rust/com

[committed 097/103] gccrs: Add initial support for argument capture of closures

2023-02-21 Thread arthur . cohen
From: Philip Herron When we have a closure expression that captures a parent function's variable we must setup the closure data to contain this. Ignoring moveability and mutability requires for now, this patch creates the closure structure with fields for each of the captured variables. When it c

[committed 090/103] gccrs: ast: Dump no comma after self in fn params if it is the last one

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix dumping of fn params. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/

[committed 093/103] gccrs: Get rid of make builtin macro

2023-02-21 Thread arthur . cohen
From: Philip Herron This macro is a mess and a helper method is much better for this case. gcc/rust/ChangeLog: * resolve/rust-name-resolver.cc (MKBUILTIN_TYPE): Remove macro. (Rib::Rib): Remove `mappings` field. (Resolver::generate_builtins): Use `setup_builtin` instead

[committed 096/103] gccrs: Add capture tracking to the type info for closures

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Pass captures properly to `TyTy::ClosureType` constructor. * typecheck/rust-tyty.cc (ClosureType::as_string): Fix string representation. (ClosureType::clone):

[committed 100/103] gccrs: Cleanup unused parameters to fix the bootstrap build

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Remove unused parameters. * backend/rust-constexpr.cc (constant_value_1): Likewise. (fold_non_dependent_init): Likewise. * backend/rust-tree.cc (publicly_uniquely_

[committed 102/103] gccrs: const evaluator: Remove get_nth_callarg

2023-02-21 Thread arthur . cohen
From: Arthur Cohen We only used one path of the C++ folder's get_nth_callarg function: CALL_EXPR_ARG. Replace all calls to get_nth_callarg by macro calls to CALL_EXPR_ARG gcc/rust/ChangeLog: * backend/rust-constexpr.cc (get_nth_callarg): Remove fun

Re: Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing)

2023-02-22 Thread Arthur Cohen
Hi Thomas, On 2/22/23 12:25, Thomas Schwinge wrote: Hi! Richard, you may remember your words from "ICE: SIGSEGV in optab_for_tree_code (optabs.c:407) with -O -fno-tree-scev-cprop -ftree-vectorize": Ideally we'd never use lang_hooks.types.type_for_mode (or _for_s

Re: [committed 034/103] gccrs: dump: Emit visibility when dumping items

2023-02-23 Thread Arthur Cohen
On Tue, 21 Feb 2023, arthur.co...@embecosm.com wrote: From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-dump.cc: Emit visibility when dumping items. --- gcc/rust/ast/rust-ast-dump.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast

Invitation: gccrs April monthly call @ Mon 3 Apr 2023 11am - 12pm (CEST) (gcc-rust@gcc.gnu.org)

2023-03-27 Thread arthur . cohen
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP= TRUE;CN=Arthur Cohen;X-NUM-GUESTS=0:mailto:arthur.co...@embecosm.com X-MICROSOFT-CDO-OWNERAPPTID:185812529 CREATED:20230327T104350Z DESCRIPTION:meet.jit.si/gccrs-community-call-march LAST-MODIFIED:20230327T104350Z LOCATION

[committed 02/88] gccrs: unsafe: check use of `target_feature` attribute

2023-04-05 Thread arthur . cohen
From: Prajwal S N The `target_feature` attribute is for conditional compilation and may or may not compile on all platforms. Using it requires an unsafe function or block. gcc/rust/ChangeLog: * checks/errors/rust-unsafe-checker.cc (check_target_attr): New function. (UnsafeCheck

Rust front-end update 2023-04-05

2023-04-05 Thread arthur . cohen
Hi everyone, This patchset contains around 80 commits concerning the Rust frontend. We have been hard at work trying to get the Rust core library to compile, and hope to push more commits in the coming days as we try and upstream a more recent version of gccrs. All of the team has done a tremendo

[committed 03/88] gccrs: Check for mutable references in const functions

2023-04-05 Thread arthur . cohen
From: Dave Use StackedContext instead. Fix error string Signed-off-by: Dave Evans (Squashed commits) Check for mutable references in const functions using StackedContext gcc/rust/ChangeLog: * checks/errors/rust-const-checker.cc (ConstChecker::visit): Use StackedContext clas

[committed 06/88] gccrs: Add name resolution to generic argument associated item bindings

2023-04-05 Thread arthur . cohen
From: Philip Herron When specifying generic arguments to Traits we can also specify the associated types using `` syntax we need to add name resolution to the type argument here and rely on the type resolution pass to ensure the associated type exists and to setup the associated types accordingly

[committed 01/88] gccrs: fatal_error_flag: Fix typo in error message

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Fix typo. --- gcc/rust/rust-session-manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index

[committed 07/88] gccrs: Support associated type bound arguments

2023-04-05 Thread arthur . cohen
From: Philip Herron This patch adds support for the GenercArgsBinding type, where you can specify the associated types of a trait bound using `` style syntax. Note that the type-resolution relys on the i32 impl for Add as type resolution will resolve the `a+a` to the core::ops::Add method so code

[committed 15/88] gccrs: Add HIR lowering for GroupedPattern

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Add proper visitor. * hir/rust-ast-lower-pattern.h: Declare it. Signed-off-by: Owen Avery --- gcc/rust/hir/rust-ast-lower-pattern.cc | 16 gcc/rust/hir/rust-ast-

[committed 16/88] gccrs: Add get_item method for HIR::GroupedPattern

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * hir/tree/rust-hir-pattern.h: Add get_item method. Signed-off-by: Owen Avery --- gcc/rust/hir/tree/rust-hir-pattern.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/gcc/rust/hir/tree/rust-hir-pattern.h b/gcc/rust/hir/tree/rust-hir-patt

[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 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 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 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 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 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 14/88] gccrs: Do not crash on empty macros expand. Fixes #1712

2023-04-05 Thread arthur . cohen
From: Lyra This commit fixes a compiler crash when expanding an empty macro into an existing AST. gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (transcribe_expression): Fix ICE when expanding empty macros. gcc/testsuite/ChangeLog: * rust/compile/macro45.rs: New t

[committed 05/88] gccrs: Implement declarative macro 2.0 parser

2023-04-05 Thread arthur . cohen
From: Raiki Tamura gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (class MacroItem): Remove forward declaration. * ast/rust-ast-full-test.cc (MacroRulesDefinition): Rework MacroRulesDefinition class * ast/rust-ast.h (class MacroItem): Remove abstract class.

[committed 11/88] gccrs: Change how CompileVarDecl outputs Bvariable's

2023-04-05 Thread arthur . cohen
From: Owen Avery This allows patterns to declare multiple/no variables gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::compile_locals_for_block): Allow patterns to declare zero or multiple variables. * backend/rust-compile-var-decl.h: Change function

[committed 08/88] gccrs: Reuse TypeCheckPattern on LetStmt's

2023-04-05 Thread arthur . cohen
From: Owen Avery Update Rust type-checking to reuse TypeCheckPattern on HIR::LetStmt's. This will unify the paths and improve error handling. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Cleanup LetStmt type checking. Signed-off-by: Owen

[committed 23/88] gccrs: macro: Allow builtin `MacroInvocation`s within the AST

2023-04-05 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-macro.h (enum class): Add `BuiltinMacro` enum class. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Mention switching on `macro.kind` once builtin macro invocations are properly handled. * parse

[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 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 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 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 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 10/88] gccrs: diagnostics: Add underline for tokens in diagnostics.

2023-04-05 Thread arthur . cohen
From: mxlol233 Currently, the diagnostics only point to the corresponding token's start position by carets, and lack of underlines for full token. This commit add support for such underlines in diagnostics by encoding range information in location_t. gcc/rust/ChangeLog: * lex/rust-lex.

[committed 04/88] gccrs: rust: add bound parsing in parse_generic_arg.

2023-04-05 Thread arthur . cohen
From: mxlol233 gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_generic_arg): Add proper bound parsing. gcc/testsuite/ChangeLog: * rust/compile/bounds.rs: New test. Signed-off-by: Xiao Ma --- gcc/rust/parse/rust-parse-impl.h | 17 + gcc/tests

[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 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 19/88] gccrs: Rename file rust-ast-full-test.cc to rust-ast.cc

2023-04-05 Thread arthur . cohen
From: Parthib gcc/rust/ChangeLog: * Make-lang.in: Rename object file. * ast/rust-ast-full-test.cc: Moved to... * ast/rust-ast.cc: ...here. --- gcc/rust/Make-lang.in | 2 +- gcc/rust/ast/{rust-ast-full-test.cc => rust-ast.cc} | 0 2 files cha

[committed 18/88] gccrs: Added missing GroupedPattern visitors for code generation

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Add proper visitor. (CompilePatternBindings::visit): Likewise. * backend/rust-compile-pattern.h: Declare them. Signed-off-by: Owen Avery --- gcc/rust/b

[committed 17/88] gccrs: Add type resolution for grouped patterns

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add proper visitor. Signed-off-by: Owen Avery --- gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff -

[committed 13/88] gccrs: Support GroupedPattern during name resolution

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-ast-resolve-pattern.h: Support GroupedPattern properly. Signed-off-by: Owen Avery --- gcc/rust/resolve/rust-ast-resolve-pattern.h | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/rust/resolve/rust-ast-resolve-pattern.h b

[committed 09/88] gccrs: Add get_locus function for abstract class MetaItemInner.

2023-04-05 Thread arthur . cohen
From: mxlol233 This commit adds virtual function get_locus to base class MetaItemInner, which is helpful when we need to print diagnostics on some sub-classes of MetaItemInner. gcc/rust/ChangeLog: * ast/rust-ast.h: Add get_locus method. * ast/rust-expr.h: Likewise. * as

[committed 24/88] gccrs: Create and use CompilePatternLet visitor for compiling let statments

2023-04-05 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternLet::visit): New function. * backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise. * backend/rust-compile-pattern.h (class CompilePatternLet): New visitor. Signed-off-by: Owen A

[committed 12/88] gccrs: testsuite: Handle Windows carriage returns properly

2023-04-05 Thread arthur . cohen
From: Arthur Cohen In dg-output, check for \r* carriage returns to make sure execution tests pass on windows platforms gcc/testsuite/ChangeLog: * rust/execute/torture/builtin_macro_cfg.rs: Handle carriage returns properly. * rust/execute/torture

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

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