[committed 074/103] gccrs: ast: Dump slice type

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

[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 099/103] gccrs: Skip this debug test case which is failing on the latest mac-os devtools and its only for debug info

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/testsuite/ChangeLog: * rust/debug/chartype.rs: Skip testcases on Darwin architectures. --- gcc/testsuite/rust/debug/chartype.rs | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/rust/debug/chartype.rs b/gcc/testsui

[committed 101/103] gccrs: Repair 'gcc/rust/lang.opt' comment

2023-02-21 Thread arthur . cohen
From: Thomas Schwinge ... lost in #1527 commit 138a6260124740208b8f3aff2e38617f43b05fe8 "rust: Add -frust-compile-until option". gcc/rust/ChangeLog: * lang.opt: Fix ordering of file. --- gcc/rust/lang.opt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/rust/l

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

[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 088/103] gccrs: ast: Remove unused include in rust-ast-dump.cc

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc: Remove unused include. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 03a57d416c4..477805f

[committed 092/103] gccrs: Improve lexer dump

2023-02-21 Thread arthur . cohen
From: Raiki Tamura gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::Lexer): Add `dump_lex` boolean flag. (Lexer::skip_token): Dump tokens if flag is enabled. (Lexer::dump_and_skip): New function. * lex/rust-lex.h: Include optional.h and declare functions. * p

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

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

[PATCH] selftest: Move C-specific tests to c_family

2022-02-16 Thread Arthur Cohen
a better location. The offending functions have also been renamed in order to better fit the C family of tests, and are thus not called when performing general selftests anymore. Kindly, [1]: https://gcc.gnu.org/pipermail/gcc/2021-November/237703.html 2022-02-16 Arthur Cohen

[PATCH Rust front-end v3 01/46] Use DW_ATE_UTF for the Rust 'char' type

2022-10-26 Thread arthur . cohen
From: Tom Tromey The Rust 'char' type should use the DWARF DW_ATE_UTF encoding. --- gcc/dwarf2out.cc | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index e3920c898f5..a8bccbabca4 100644 --- a/gcc/dwarf2out.cc +++ b/

Rust frontend patches v3

2022-10-26 Thread arthur . cohen
This is the fixed version of our previous patch set for gccrs - We've adressed the comments raised in our previous emails. This patch set does not contain any work that was not previously included, such as closure support, the constant evaluator port, or the better implementation of target hooks b

[PATCH Rust front-end v3 06/46] gccrs: Add execution test cases

2022-10-26 Thread arthur . cohen
currently support the main shim yet so we have a C-style main function here returning zero which is not supported in Rustc. Co-authored-by: Arthur Cohen Co-authored-by: Thomas Schwinge Co-authored-by: Mark Wielaard Co-authored-by: Marc Poulhiès --- .../rust/execute/torture/block_expr1.rs

[PATCH Rust front-end v3 04/46] gccrs: Add link cases testsuite

2022-10-26 Thread arthur . cohen
From: Philip Herron This testsuite is heavily inspired from the lto testsuite which uses a pattern that each file is compiled to an object file and finally linked together. Since rust does not have headers/prototypes we rely on the ordering here so that all files numbered greater than zero get co

[PATCH Rust front-end v3 02/46] gccrs: Add nessecary hooks for a Rust front-end testsuite

2022-10-26 Thread arthur . cohen
From: Philip Herron This copy's over code from other front-end testsuites to enable testing for the rust front-end specifically. Co-authored-by: Marc Poulhiès Co-authored-by: Thomas Schwinge --- gcc/testsuite/lib/rust-dg.exp | 49 + gcc/testsuite/lib/rust.exp| 186 +++

[PATCH Rust front-end v3 11/46] gccrs: Add Rust AST visitors

2022-10-26 Thread arthur . cohen
From: The Other This patch contains the basic framework of our AST visitors, as well as one aimed at pretty-printing and exporting these AST nodes Co-authored-by: Philip Herron Co-authored-by: Arthur Cohen --- gcc/rust/ast/rust-ast-dump.cc| 1089 ++ gcc/rust

[PATCH Rust front-end v3 07/46] gccrs: Add gcc-check-target check-rust

2022-10-26 Thread arthur . cohen
From: Philip Herron This allows us to invoke the rust testsuite. ChangeLog: * Makefile.def: Add Rust language. * Makefile.in: Regenerate via autogen. --- Makefile.def | 1 + Makefile.in | 8 2 files changed, 9 insertions(+) diff --git a/Makefile.def b/Makefile.def ind

[PATCH Rust front-end v3 03/46] gccrs: Add Debug info testsuite

2022-10-26 Thread arthur . cohen
From: Philip Herron This testsuite is specifically about testcases which scan the asm debug info for results. Co-authored-by: Tom Tromey --- gcc/testsuite/rust/debug/chartype.rs | 10 ++ .../rust/debug/custom_link_section.rs | 13 gcc/testsuite/rust/debug/debug.ex

[PATCH Rust front-end v3 12/46] gccrs: Add Lexer for Rust front-end

2022-10-26 Thread arthur . cohen
From: The Other The lexer is refered to as a ManagedTokenSource within the parser, this lexer does not currently support unicode but serves as a starting point to do so. Co-authored-by: Philip Herron Co-authored-by: Arthur Cohen Co-authored-by: Mark Wielaard --- gcc/rust/lex/rust

[PATCH Rust front-end v3 09/46] gccrs: Add definitions of Rust Items in AST data structures

2022-10-26 Thread arthur . cohen
From: The Other This adds the proper definitions of our AST Item nodes. Co-authored-by: Philip Herron --- gcc/rust/ast/rust-item.h | 4382 ++ 1 file changed, 4382 insertions(+) create mode 100644 gcc/rust/ast/rust-item.h diff --git a/gcc/rust/ast/rust-item

[PATCH Rust front-end v3 20/46] gccrs: Add wrapper for make_unique

2022-10-26 Thread arthur . cohen
From: Philip Herron This is a wrapper for make_unique we can likely get rid of this as there are other implementations available or simply keep using the unique_ptr constructor. --- gcc/rust/util/rust-make-unique.h | 35 1 file changed, 35 insertions(+) create m

[PATCH Rust front-end v3 18/46] gccrs: Add HIR definitions and visitor framework

2022-10-26 Thread arthur . cohen
From: Philip Herron This patch implements the classes mentionned in the previous HIR patch, as well as a set of visitor frameworks used in handling that HIR. --- gcc/rust/hir/tree/rust-hir-full-decls.h | 232 + gcc/rust/hir/tree/rust-hir-full-test.cc | 5292 +++ gcc/rust/hir

[PATCH Rust front-end v3 22/46] gccrs: Add Rust ABI enum helpers

2022-10-26 Thread arthur . cohen
From: Philip Herron This is a simple helper over an enum of possible ABI options in Rust. --- gcc/rust/util/rust-abi.cc | 72 +++ gcc/rust/util/rust-abi.h | 45 2 files changed, 117 insertions(+) create mode 100644 gcc/rust/util/rust

[PATCH Rust front-end v3 24/46] gccrs: Add implementation of Optional

2022-10-26 Thread arthur . cohen
From: Arthur Cohen Add an Optional class to improve error handling --- gcc/rust/util/rust-optional-test.cc | 110 +++ gcc/rust/util/rust-optional.h | 278 2 files changed, 388 insertions(+) create mode 100644 gcc/rust/util/rust-optional-test.cc

[PATCH Rust front-end v3 23/46] gccrs: Add Base62 implementation

2022-10-26 Thread arthur . cohen
From: Arthur Cohen Used for V0 symbol mangling scheme which. --- gcc/rust/util/rust-base62.cc | 46 gcc/rust/util/rust-base62.h | 34 ++ 2 files changed, 80 insertions(+) create mode 100644 gcc/rust/util/rust-base62.cc create mode

[PATCH Rust front-end v3 31/46] gccrs: Add const checker

2022-10-26 Thread arthur . cohen
From: Arthur Cohen Similarly to the unsafe checker, constant evaluation can only be performed in a few contexts and include restrictions on the Rust language. Should the user fail to uphold those conditions, errors will be reported and the compilation pipeline interrupted. These contexts are as

[PATCH Rust front-end v3 25/46] gccrs: Add attributes checker

2022-10-26 Thread arthur . cohen
From: Arthur Cohen The attribute checker is responsible for checking the validity of various attributes including built-in ones. It is currently unfinished and will receive some modifications, as well as become the host of some existing code in the compiler which needs to be refactored. One of

[PATCH Rust front-end v3 26/46] gccrs: Add helpers mappings canonical path and lang items

2022-10-26 Thread arthur . cohen
From: Philip Herron These are various helper classes used in the compiler pipeline. --- gcc/rust/util/rust-canonical-path.h | 195 + gcc/rust/util/rust-common.h | 53 ++ gcc/rust/util/rust-hir-map.cc | 980 ++ gcc/rust/util/rust-hir-map.h

[PATCH Rust front-end v3 38/46] gccrs: Add HIR to GCC GENERIC lowering entry point

2022-10-26 Thread arthur . cohen
From: Philip Herron This patch contains the entry point and utilities used for the lowering of HIR nodes to `tree`s. It also contains a constant evaluator, ported over from the C++ frontend. Co-authored-by: David Faust Co-authored-by: Faisal Abbas <90.abbasfai...@gmail.com> --- gcc/rust/backen

[PATCH Rust front-end v3 28/46] gccrs: Add Rust type information

2022-10-26 Thread arthur . cohen
From: Philip Herron Contains abstractions over Rust's types, used when performing the HIR's type-resolution. --- gcc/rust/typecheck/rust-tyty.cc | 2885 +++ gcc/rust/typecheck/rust-tyty.h | 2533 +++ 2 files changed, 5418 insertions(+) create

[PATCH Rust front-end v3 21/46] gccrs: Add port of FNV hash used during legacy symbol mangling

2022-10-26 Thread arthur . cohen
From: Philip Herron This hash was ported from the go runime as we needed a hash for the legacy symbol mangling system. Which means all symbols in Rust contain a hash of some metadata for uniqueness on generic functions. --- gcc/rust/util/fnv-hash.h | 95

[PATCH Rust front-end v3 30/46] gccrs: Add unsafe checks for Rust

2022-10-26 Thread arthur . cohen
From: Arthur Cohen The UnsafeChecker visitor verifies that unsafe actions are only performed in unsafe contexts. Otherwise, an error should be reported to the user and the compilation pipeline should be halted. These contexts, which include unsafe blocks or unsafe functions, are allowed to

[PATCH Rust front-end v3 41/46] gccrs: Add config-lang.in

2022-10-26 Thread arthur . cohen
From: Philip Herron This was a copy paste from gccgo front-end, we do not use any of the target_libs yet but we will need these when we support the libpanic crate. --- gcc/rust/config-lang.in | 34 ++ 1 file changed, 34 insertions(+) create mode 100644 gcc/rust/c

[PATCH Rust front-end v3 34/46] gccrs: Add unused variable scan

2022-10-26 Thread arthur . cohen
From: Philip Herron This is a simple walk_tree which acts on the monomorphized code. By walking the compiled translation unit of functions. --- gcc/rust/checks/lints/rust-lint-unused-var.cc | 98 +++ gcc/rust/checks/lints/rust-lint-unused-var.h | 36 +++ 2 files changed, 134

[PATCH Rust front-end v3 33/46] gccrs: Add dead code scan on HIR

2022-10-26 Thread arthur . cohen
From: Thomas Young In order to find dead code we use a depth first search and keep liveness variables, after type resolution. In this case, if a function is unused and it calls another function the 2nd function is now unused since the caller is not used etc. The algorithm is a depth first search.

[PATCH Rust front-end v3 45/46] gccrs: Compiler proper interface kicks off the pipeline

2022-10-26 Thread arthur . cohen
From: Philip Herron This is a wrapper to get out of C land in the rust-lang.cc and into our class hierarchy for the rust front-end. We expect that the front-end only support one source file input as the expansion pass will attempt to resolve that relative pass and parse accordingly. The main mis

[PATCH Rust front-end v3 32/46] gccrs: Add privacy checks

2022-10-26 Thread arthur . cohen
From: Arthur Cohen This pass is responsible for resolving the privacy of items and verifying that access to these items is performed within the limits of that privacy. By default, items in Rust are private and only public to the current module and its submodules. However, the user can annotate

[PATCH Rust front-end v3 35/46] gccrs: Add metadata ouptput pass

2022-10-26 Thread arthur . cohen
From: Philip Herron Extern crates statements to tell the front-end to look for another library. The mechanism here is heavily inspired from gccgo, so when we compile a library for example we invoke: gccrs -g -O2 -frust-crate=mylib -c src/lib.rs -o src/mylib.o All going well this object file w

[PATCH Rust front-end v3 40/46] gccrs: Add GCC Rust front-end Make-lang.in

2022-10-26 Thread arthur . cohen
From: Philip Herron This is the Makefile for our front-end. --- gcc/rust/Make-lang.in | 399 ++ 1 file changed, 399 insertions(+) create mode 100644 gcc/rust/Make-lang.in diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in new file mode 100644 ind

[PATCH Rust front-end v3 39/46] gccrs: These are wrappers ported from reusing gccgo

2022-10-26 Thread arthur . cohen
From: Philip Herron The wrappers over linemap and location will eventually disappear here but served as a useful starting point for us. We have wrappers over the diagnostics system which we might be able to get rid of as well. --- gcc/rust/rust-diagnostics.cc | 244 ++

[PATCH Rust front-end v3 42/46] gccrs: Add lang-spec.h

2022-10-26 Thread arthur . cohen
From: Philip Herron This specifies the extensions of the Rust language. --- gcc/rust/lang-specs.h | 26 ++ 1 file changed, 26 insertions(+) create mode 100644 gcc/rust/lang-specs.h diff --git a/gcc/rust/lang-specs.h b/gcc/rust/lang-specs.h new file mode 100644 index 000

[PATCH Rust front-end v3 43/46] gccrs: Add lang.opt

2022-10-26 Thread arthur . cohen
From: Philip Herron We have some rust specific langugage options note -fwrapv is enabled by default in the code. We are trying to respect options such as -Wunused-result which we get by porting over c++ no-discard for rust's must-use attribute, so we have enabled these by default directly here. -

[PATCH Rust front-end v3 44/46] gccrs: Add compiler driver

2022-10-26 Thread arthur . cohen
From: Philip Herron Our compiler driver is pretty simple so far, the key piece to enforce is that a compilation unit in Rust is the whole crate so the process for compiling rust means pointing the compiler at the main entry point such as src/lib.rs or src/main.rs where the expansion pass takes ov

[PATCH Rust front-end v3 46/46] gccrs: Add README, CONTRIBUTING and compiler logo

2022-10-26 Thread arthur . cohen
From: Philip Herron We still need to write out documentation section but these README's will help in the mean time. --- gcc/rust/CONTRIBUTING.md | 130 +++ gcc/rust/README.md | 264 +++ gcc/rust/logo.png| Bin 0 -> 70864 bytes 3 f

Re: [PATCH Rust front-end v3 35/46] gccrs: Add metadata ouptput pass

2022-10-27 Thread Arthur Cohen
On 10/26/22 23:04, David Malcolm wrote: %{On Wed, 2022-10-26 at 10:18 +0200, arthur.co...@embecosm.com wrote: From: Philip Herron Extern crates statements to tell the front-end to look for another library. The mechanism here is heavily inspired from gccgo, so when we compile a library for exam

Re: [PATCH Rust front-end v3 40/46] gccrs: Add GCC Rust front-end Make-lang.in

2022-10-27 Thread Arthur Cohen
tches. Sorry about the annoyance. (...snip...) Kindly, -- Arthur Cohen Toolchain Engineer Embecosm GmbH Geschäftsführer: Jeremy Bennett Niederlassung: Nürnberg Handelsregister: HR-B 36368 www.embecosm.de Fürther Str. 27 90429 Nürnberg Tel.: 091 - 128 707 040 Fax: 091 - 128 70

Re: Rust frontend patches v3

2022-10-28 Thread Arthur Cohen
Hi David, On 10/26/22 23:15, David Malcolm wrote: On Wed, 2022-10-26 at 10:17 +0200, arthur.co...@embecosm.com wrote: This is the fixed version of our previous patch set for gccrs - We've adressed the comments raised in our previous emails. [...snip...] (Caveat: I'm not a global reviewer) S

Re: Rust frontend patches v3

2022-10-28 Thread Arthur Cohen
On 10/28/22 15:06, David Malcolm wrote: On Fri, 2022-10-28 at 13:48 +0200, Arthur Cohen wrote: Hi David, On 10/26/22 23:15, David Malcolm wrote: On Wed, 2022-10-26 at 10:17 +0200, arthur.co...@embecosm.com wrote: This is the fixed version of our previous patch set for gccrs - We&#x

Re: Frontend access to target features (was Re: [PATCH] libgccjit: Add ability to get CPU features)

2024-03-19 Thread Arthur Cohen
Hi, On 3/5/24 16:09, David Malcolm wrote: On Thu, 2023-11-09 at 19:33 -0500, Antoni Boucher wrote: Hi. See answers below. On Thu, 2023-11-09 at 18:04 -0500, David Malcolm wrote: On Thu, 2023-11-09 at 17:27 -0500, Antoni Boucher wrote: Hi. This patch adds support for getting the CPU features

Re: [PATCH] build: Check for cargo when building rust language

2024-04-09 Thread Arthur Cohen
Morning all, On 4/9/24 09:47, John Paul Adrian Glaubitz wrote: Hello, On Mon, 2024-04-08 at 18:33 +0200, pierre-emmanuel.pa...@embecosm.com wrote: The rust frontend requires cargo to build some of it's components, it's presence was not checked during configuration. Isn't this creating a hen-

Re: [PATCH] build: Check for cargo when building rust language

2024-04-09 Thread Arthur Cohen
Hi Iain! On 4/9/24 10:55, Iain Sandoe wrote: Hi Arthur, On 9 Apr 2024, at 11:40, Arthur Cohen wrote: On 4/9/24 09:47, John Paul Adrian Glaubitz wrote: Hello, On Mon, 2024-04-08 at 18:33 +0200, pierre-emmanuel.pa...@embecosm.com wrote: The rust frontend requires cargo to build some of

Re: [PATCH] build: Check for cargo when building rust language

2024-04-09 Thread Arthur Cohen
On 4/9/24 12:09, Iain Sandoe wrote: Hi Arthur, On 9 Apr 2024, at 13:01, Arthur Cohen wrote: On 4/9/24 10:55, Iain Sandoe wrote: Hi Arthur, On 9 Apr 2024, at 11:40, Arthur Cohen wrote: On 4/9/24 09:47, John Paul Adrian Glaubitz wrote: Hello, On Mon, 2024-04-08 at 18:33 +0200, pierre

Re: [PATCH] build: Check for cargo when building rust language

2024-04-09 Thread Arthur Cohen
Hi Andrew, On 4/9/24 16:12, Andrew Pinski wrote: On Mon, Apr 8, 2024 at 9:39 AM wrote: From: Pierre-Emmanuel Patry Hello, The rust frontend requires cargo to build some of it's components, it's presence was not checked during configuration. NOTE cargo itself is a huge security hole. If a

[COMMITTED 01/25] gccrs: Parse normal functions with `self` parameter correctly

2024-02-07 Thread arthur . cohen
From: Kushal Pal Fixes #2812 gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_function): Skip token if its a COMMA. gcc/testsuite/ChangeLog: * rust/compile/issue-2812.rs: New test. Signed-off-by: Kushal Pal --- gcc/rust/parse/rust-parse-impl.h |

[COMMITTED 02/25] gccrs: Implement quick-check for Unicode

2024-02-07 Thread arthur . cohen
From: Raiki Tamura gcc/rust/ChangeLog: * rust-lang.cc (run_rust_tests): Add test. * rust-system.h: Add . * util/make-rust-unicode.py: Output NFC_Quick_Check table. * util/rust-codepoint.h (struct Codepoint): Add is_supplementary method. * util/rust

[COMMITTED 07/25] gccrs: TyTy: Store region constraints

2024-02-07 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Add region constraints. (TypeCheckImplItem::visit): Add region constraints. * typecheck/rust-hir-type-check-implitem.h: Add region constraints.

[COMMITTED 12/25] gccrs: Fix ICE accessing empty vector without check

2024-02-07 Thread arthur . cohen
From: Philip Herron Fixes #2747 gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): fix gcc/testsuite/ChangeLog: * rust/compile/issue-2747.rs: New test. --- gcc/rust/typecheck/rust-tyty-subst.cc| 3 ++- gcc/testsuite/rus

[COMMITTED 03/25] gccrs: Typecheck: lifetime interning and resolution tool

2024-02-07 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.h (class Lifetime): add interned lifetime class * typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext): add resolution tool (TypeCheckContext::intern_lifetime): add method

[COMMITTED 06/25] gccrs: Typecheck: add regions (lifetimes) to TyTy

2024-02-07 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc: add regions * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): add regions, resolve generic lifetimes * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit

[COMMITTED 11/25] gccrs: add test cases to prove type inference is working

2024-02-07 Thread arthur . cohen
From: Philip Herron Fixes #2772 gcc/testsuite/ChangeLog: * rust/compile/issue-2772-1.rs: New test. * rust/compile/issue-2772-2.rs: New test. --- gcc/testsuite/rust/compile/issue-2772-1.rs | 20 gcc/testsuite/rust/compile/issue-2772-2.rs | 20 +++

[COMMITTED 17/25] gccrs: Add testcase to show issue is already fixed

2024-02-07 Thread arthur . cohen
From: Philip Herron Fixes #2782 gcc/testsuite/ChangeLog: * rust/compile/issue-2782.rs: New test. Signed-off-by: Philip Herron --- gcc/testsuite/rust/compile/issue-2782.rs | 12 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/rust/compile/issue-2782.rs

[COMMITTED 15/25] gccrs: refactor inference variable computation into a seperate method

2024-02-07 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): refactor * typecheck/rust-hir-type-check.h: new prototype * typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables): x --- gcc/rust/typechec

[COMMITTED 04/25] gccrs: TyTy: Region (lifetime) representation

2024-02-07 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * typecheck/rust-tyty-region.h: New file. Signed-off-by: Jakub Dupak --- gcc/rust/typecheck/rust-tyty-region.h | 110 ++ 1 file changed, 110 insertions(+) create mode 100644 gcc/rust/typecheck/rust-tyty-region.h diff --gi

[COMMITTED 18/25] gccrs: fix bug in pattern check for tuples

2024-02-07 Thread arthur . cohen
From: Philip Herron We can point to generic parent types which means we need to do the shallow resolve thing that rustc does. We have destructure which is similar to get what the parameter type points to. Fixes #2775 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeC

[COMMITTED 09/25] gccrs: Set the default ABI to C for extern blocks and extern functions

2024-02-07 Thread arthur . cohen
From: Nobel Singh Previously, the default ABI was set to Rust, which is not correct for extern blocks and extern functions. This patch changes the default ABI to C for these cases. gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers): Change defau

[COMMITTED 21/25] gccrs: Add missing visitors for AST::Function.

2024-02-07 Thread arthur . cohen
From: Kushal Pal To use AST::Function instead of AST::TraitItemFunc and AST::TraitItemMethod, we need to provide similar visitors during lowering and resolving phase. gcc/rust/ChangeLog: * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): Provide visitor for AST::Functi

[COMMITTED 22/25] gccrs: Fix inconsistent formatting.

2024-02-07 Thread arthur . cohen
From: Kushal Pal gcc/testsuite/ChangeLog: * rust/compile/issue-2040.rs: Enclose 'const' in single quotes. Signed-off-by: Kushal Pal --- gcc/testsuite/rust/compile/issue-2040.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/rust/compile/issue

[COMMITTED 16/25] gccrs: Move the Implementation of implitem lowering into its own file.

2024-02-07 Thread arthur . cohen
From: Nobel Singh This patch moves the implementation of the implitem lowering from rust-ast-lower-implitem.h into the rust-ast-lower-implitem.cc file. gcc/rust/ChangeLog: * Make-lang.in: Add rust-ast-lower-implitem.cc to list of objects. * hir/rust-ast-lower-implitem.h (RUST_AS

[COMMITTED 10/25] gccrs: add testcase to prove issue has already been fixed

2024-02-07 Thread arthur . cohen
From: Philip Herron Fixes #1483 gcc/testsuite/ChangeLog: * rust/compile/issue-1483.rs: New test. --- gcc/testsuite/rust/compile/issue-1483.rs | 28 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/rust/compile/issue-1483.rs diff --git a/gcc/t

[COMMITTED 05/25] gccrs: HIR: Add mising getter

2024-02-07 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h: Add missing getter Signed-off-by: Jakub Dupak --- gcc/rust/hir/tree/rust-hir-item.h | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index 7

[COMMITTED 13/25] gccrs: remove old generics hack to reuse generic symbols from previous seg

2024-02-07 Thread arthur . cohen
From: Philip Herron This patch introduces one regression because generics are getting better understood over time. The code here used to apply generics with the same symbol from previous segments which was a bit of a hack with out limited inference variable support. The regression looks like it w

[COMMITTED 08/25] gccrs: TyTy: Store reference to type before any substitutions

2024-02-07 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (BaseType::BaseType): Store orig ref. (BaseType::get_orig_ref): Add getter. * typecheck/rust-tyty.h: Store orig ref. Signed-off-by: Jakub Dupak --- gcc/rust/typecheck/rust-tyty.cc | 10 -- gcc/rust/

[COMMITTED 14/25] gccrs: remove similar hack in type paths as we had in path expressions

2024-02-07 Thread arthur . cohen
From: Philip Herron This keeps the resolution code in line with paths. Addresses #2723 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc: remove hack --- gcc/rust/typecheck/rust-hir-type-check-type.cc | 16 1 file changed, 16 deletions(-) diff --git a/gcc/r

[COMMITTED 19/25] gccrs: Use AssociatedItem in place of TraitItem

2024-02-07 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * ast/rust-ast.h: Replace TraitItem with AssociatedItem. * ast/rust-item.h (class Trait): Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * parse/rust-parse-impl.h (Parser::parse_trait): Like

[COMMITTED 24/25] gccrs: Remove obsolete classes and functions.

2024-02-07 Thread arthur . cohen
From: Kushal Pal Trait functions now use AST::Function class, so classes AST::TraitItemFunc, AST::TraitItemMethod, AST::TraitFunctionDecl, AST::TraitMethodDecl and their related functions can be removed. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Re

[COMMITTED 20/25] gccrs: Add checks for Trait functions

2024-02-07 Thread arthur . cohen
From: Kushal Pal Since we want to use AST::Function class for trait functions as well, we need to check against specific conditions in ASTValidation phase. gcc/rust/ChangeLog: * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add checks for Trait functions. Signed-

[COMMITTED 25/25] gccrs: Fix macro parsing for trait items.

2024-02-07 Thread arthur . cohen
From: Kushal Pal gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_trait_item): Handle macros in trait items similar to how its handled for trait implementation items. Signed-off-by: Kushal Pal --- gcc/rust/parse/rust-parse-impl.h | 37 --

[COMMITTED 23/25] gccrs: Parse trait functions as `AST::Function`.

2024-02-07 Thread arthur . cohen
From: Kushal Pal To use AST::Function for trait functions, we can parse trait functions using available parse_function(). gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_trait_item): Use parse_function() to parse trait functions. Signed-off-by: Kushal Pal --- gcc

Re: [COMMITTED 07/25] gccrs: TyTy: Store region constraints

2024-02-07 Thread Arthur Cohen
On 2/7/24 16:26, Bernhard Reutner-Fischer wrote: On Wed, 7 Feb 2024 12:43:53 +0100 arthur.co...@embecosm.com wrote: diff --git a/gcc/rust/typecheck/rust-hir-type-check-implitem.h b/gcc/rust/typecheck/rust-hir-type-check-implitem.h index 067465ec77a..4d178440775 100644 --- a/gcc/rust/typecheck

Re: [PATCH] gccrs: Avoid *.bak suffixed tests - use dg-skip-if instead

2024-02-15 Thread Arthur Cohen
Hi Jakub, On 2/15/24 10:10, Jakub Jelinek wrote: On Fri, Feb 09, 2024 at 11:03:38AM +0100, Jakub Jelinek wrote: On Wed, Feb 07, 2024 at 12:43:59PM +0100, arthur.co...@embecosm.com wrote: From: Philip Herron This patch introduces one regression because generics are getting better understood o

[PATCHSET] Update Rust frontend 21/02/2024

2024-02-21 Thread arthur . cohen
Hey everyone, Here is the latest patchset of the Rust frontend, taken directly from our development branch. The patches have been built, tested and bootstrapped on x86-64. [COMMITTED 1/9] gccrs: Fix typo in RegionConstraints instance [COMMITTED 2/9] gccrs: Add testcase for matches!() macro [COM

[COMMITTED 2/9] gccrs: Add testcase for matches!() macro

2024-02-21 Thread arthur . cohen
From: Arthur Cohen This adds a testcase for issue #2129. gcc/testsuite/ChangeLog: * rust/execute/torture/matches_macro.rs: New test. --- .../rust/execute/torture/matches_macro.rs | 30 +++ 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/rust

[COMMITTED 3/9] gccrs: Fix rebinding imports

2024-02-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-ast-resolve-item.cc (flatten_glob): Use Import class. (flatten_rebind): Likewise. (flatten_list): Likewise. (flatten): Likewise. (flatten_use_dec_to_paths): Likewise. (flatten_use_dec_to_i

[COMMITTED 6/9] gccrs: add powi intrinsics

2024-02-21 Thread arthur . cohen
From: Marc Poulhiès gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::register_rust_mappings): Add powi and reformat. * backend/rust-builtins.h: Add missing copyright header. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-math.rs: Adju

[COMMITTED 8/9] gccrs: Add variadic check on function params

2024-02-21 Thread arthur . cohen
From: 0xn4utilus gcc/rust/ChangeLog: * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add variadic check on all parameters. gcc/testsuite/ChangeLog: * rust/compile/issue-2850.rs: New test. Signed-off-by: 0xn4utilus --- gcc/rust/checks/errors/rust-ast-va

[COMMITTED 1/9] gccrs: Fix typo in RegionConstraints instance

2024-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-implitem.h: Fix typo in field (region_costraints -> region_constraints). --- gcc/rust/typecheck/rust-hir-type-check-implitem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/r

[COMMITTED 7/9] gccrs: Fix lookup of TuplePattern sub-pattern types

2024-02-21 Thread arthur . cohen
From: Owen Avery gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternLet::visit): Lookup type of sub-pattern, not tuple pattern itself. gcc/testsuite/ChangeLog: * rust/compile/issue-2847-b.rs: New test. Signed-off-by: Owen Avery --- gcc/rust/

[COMMITTED 5/9] gccrs: Add testcase for #[rustc_const_stable]

2024-02-21 Thread arthur . cohen
From: Arthur Cohen To ensure we don't introduce regressions back to issue #2314 gcc/testsuite/ChangeLog: * rust/compile/rustc_const_stable.rs: New test. --- gcc/testsuite/rust/compile/rustc_const_stable.rs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 gcc/testsuite

[COMMITTED 9/9] Update copyright years.

2024-02-21 Thread arthur . cohen
From: Sahil Yeole Signed-off-by: Sahil Yeole --- gcc/rust/ast/rust-ast-builder.cc | 2 +- gcc/rust/ast/rust-ast-builder.h | 2 +- gcc/rust/ast/rust-ast-collector.cc| 2 +- gcc/rust/ast/rust-ast-collector.h

[COMMITTED 4/9] gccrs: expand: Fix formatting for "macro not found" error

2024-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-expand.h (struct MacroExpander): Nitpick: fix formatting of emitted error. --- gcc/rust/expand/rust-macro-expand.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/rust/expand/rust-macro

[PATCHSET] Fix Rust bootstrap for future libgrust changes

2024-01-11 Thread Arthur Cohen
Hi everyone, Sorry about this - two simple changes to Makefile.def we had missed during our first libgrust/ patchset, plus the associated regen of Makefile.in in each commit. Let me know if I should squash them together. I'll follow them up with our entire patchset. Best, Arthur

[PATCH 1/2] gccrs: fixup: Fix bootstrap build

2024-01-11 Thread Arthur Cohen
From: Pierre-Emmanuel Patry The bootstrap was failing due to a missing target which was not available during the bootstrap. ChangeLog: * Makefile.def: Add libgrust target to bootstrap. * Makefile.in: Regenerate. Signed-off-by: Pierre-Emmanuel Patry --- Makefile.def | 2 +-

[PATCH 2/2] gccrs: fixup: Fix missing build dependency

2024-01-11 Thread Arthur Cohen
From: Pierre-Emmanuel Patry Fix the missing dependency between the gcc and libgrust. ChangeLog: * Makefile.def: Add a dependency to libgrust for all-gcc. * Makefile.in: Regenerate the file. Signed-off-by: Pierre-Emmanuel Patry --- Makefile.def | 1 + Makefile.in | 10 ++

Re: [PATCH 2/2] gccrs: fixup: Fix missing build dependency

2024-01-11 Thread Arthur Cohen
Hi Richard, On 1/11/24 15:23, Richard Biener wrote: On Thu, 11 Jan 2024, Arthur Cohen wrote: From: Pierre-Emmanuel Patry Fix the missing dependency between the gcc and libgrust. ChangeLog: * Makefile.def: Add a dependency to libgrust for all-gcc. * Makefile.in: Regenerate

[COMMITTED] rust_debug: Cast size_t values to unsigned long before printing.

2024-01-18 Thread Arthur Cohen
Using %lu to format size_t values breaks 32 bit targets, and %zu is not supported by one of the hosts GCC aims to support - HPUX gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): Cast size_t value to unsigned long. * expand/rust-p

Re: [COMMITTED] rust_debug: Cast size_t values to unsigned long before printing.

2024-01-18 Thread Arthur Cohen
Hi Rainer, On 1/18/24 10:13, Rainer Orth wrote: Arthur Cohen writes: Using %lu to format size_t values breaks 32 bit targets, and %zu is not supported by one of the hosts GCC aims to support - HPUX But we do have uses of %zu in gcc/rust already! diff --git a/gcc/rust/expand/rust-proc

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