Re: [PING, v2] Add '-Wno-complain-wrong-lang', and use it in 'gcc/testsuite/lib/target-supports.exp:check_compile' and elsewhere

2023-02-21 Thread Joseph Myers
On Tue, 21 Feb 2023, Thomas Schwinge wrote: > Is the attached v2 > "Add '-Wno-complain-wrong-lang', and use it in > 'gcc/testsuite/lib/target-supports.exp:check_compile' and elsewhere" > OK? OK. -- Joseph S. Myers jos...@codesourcery.com -- Gcc-rust mailing list Gcc-rust@gcc.gnu.org

Update copyright years. (was: [committed 003/103] gccrs: dump: Emit visibility when dumping items)

2023-02-21 Thread Thomas Schwinge
Hi! On 2023-02-21T13:00:53+0100, arthur.co...@embecosm.com wrote: > --- a/gcc/rust/ast/rust-ast-dump.cc > +++ b/gcc/rust/ast/rust-ast-dump.cc > @@ -1,4 +1,4 @@ > -// Copyright (C) 2020-2023 Free Software Foundation, Inc. > +// Copyright (C) 2020-2022 Free Software Foundation, Inc. > ---

[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

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

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

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

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

[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

[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

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

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

[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

[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

[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

[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

[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

[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

[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

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

[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

[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

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

[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

[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

[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

[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

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

[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

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

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

[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

[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

[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

[committed 085/103] gccrs: ast: Dump trait object 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 | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc

[committed 021/103] gccrs: Support type resolution on super traits on dyn objects

2023-02-21 Thread arthur . cohen
From: Philip Herron When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914 gcc/rust/ChangeLog: * backend/rust-compile.cc:

[committed 067/103] gccrs: ast: refer correctly to arguments in docs-strings

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.h: Fix documentation. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.h b/gcc/rust/ast/rust-ast-dump.h index

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

[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

[committed 095/103] gccrs: Add closure binding's tracking to name resolution

2023-02-21 Thread arthur . cohen
From: Philip Herron When we have a closure block referencing variables in a parent function, we must track what these are. We do this by having a context of closures so if we have a variable reference and its declared in a rib whose node id is less than the node id of the closure's node id we

[committed 091/103] gccrs: Remove default location. Add visibility location to create_* functions

2023-02-21 Thread arthur . cohen
From: Dave gcc/rust/ChangeLog: * ast/rust-item.h: Remoe default location for Visibility class. * parse/rust-parse-impl.h (Parser::parse_visibility): Pass proper location when instantiating visibilities. --- gcc/rust/ast/rust-item.h | 33

[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

[committed 080/103] gccrs: ast: Dump bare function type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak + Return FunctionQualifiers as ref to work in ast dump gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. * ast/rust-ast-dump.h: Add missing getter declaration. * ast/rust-ast-full-test.cc (BareFunctionType::as_string): Fix

[committed 076/103] gccrs: ast: Dump raw pointer type

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

[committed 075/103] gccrs: ast: Dump array type

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

[committed 073/103] gccrs: ast: Dump where clause and recursively needed nodes

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 missing visitors. * ast/rust-ast-dump.h: Likewise. * ast/rust-ast.h: Add `get_lifetime_bounds` method. *

[committed 068/103] gccrs: ast: Dump unit struct

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add handling for unit structures. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc

[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

[committed 063/103] gccrs: intrinsics: Cleanup error handling around atomic_store_*

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (check_for_basic_integer_type): New function. (build_atomic_builtin_name): Use HIR Type instead of `tree`. (atomic_store_handler_inner): Cleanup error handling. (unchecked_op_inner):

[committed 065/103] gccrs: ast: visitor pattern -> overload syntax compatibility layer

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add new visit function for overloading. * ast/rust-ast-dump.h: Add documentation for layer. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 7 +++ gcc/rust/ast/rust-ast-dump.h | 8

[committed 069/103] gccrs: add lang item "phantom_data"

2023-02-21 Thread arthur . cohen
From: Raiki Tamura gcc/rust/ChangeLog: * util/rust-lang-item.h: Add handling for `phantom_data` lang item. gcc/testsuite/ChangeLog: * rust/compile/torture/phantom_data.rs: New test. --- gcc/rust/util/rust-lang-item.h | 9 +

[committed 053/103] gccrs: Add missing type resolution for function type segments

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): Add missing implementation. --- gcc/rust/typecheck/rust-tyty-bounds.cc | 69 +++--- 1 file changed, 62 insertions(+), 7 deletions(-) diff

[committed 070/103] gccrs: add Location to AST::Visibility

2023-02-21 Thread arthur . cohen
From: Dave gcc/rust/ChangeLog: * ast/rust-item.h: Add location member. * hir/rust-ast-lower.cc (translate_visibility): Pass location argument. * hir/tree/rust-hir-item.h: Fix constructor to accept Location argument. --- gcc/rust/ast/rust-item.h | 19

[committed 012/103] gccrs: ast: dump: add emit_generic_params helper

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): move generic params dump ... (Dump::emit_generic_params): ... here. * ast/rust-ast-dump.h (emit_generic_params): New. --- gcc/rust/ast/rust-ast-dump.cc | 30 +-

[committed 013/103] gccrs: ast: dump: add format_{tuple, struct}_field helpers

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::format_tuple_field): New. (Dump::format_struct_field): New. * ast/rust-ast-dump.h (format_tuple_field): New. (format_struct_field): New. --- gcc/rust/ast/rust-ast-dump.cc | 17 +

[committed 007/103] gccrs: ast: dump If expressions

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Implement visitor for If expressions. --- gcc/rust/ast/rust-ast-dump.cc | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc

[committed 011/103] gccrs: Support looking up super traits for trait items

2023-02-21 Thread arthur . cohen
From: Philip Herron When supporting calls to super traits we need to allow lookups based on the super traits as specified on the TraitReferences. Fixes #1555 gcc/rust/ChangeLog: * typecheck/rust-hir-trait-ref.h (lookup_trait_item): Add lookup in super_trait.

[committed 035/103] gccrs: dump: Dump items within modules

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Dump items in modules properly. --- gcc/rust/ast/rust-ast-dump.cc | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc

[committed 038/103] gccrs: dump: Dump macro rules definition

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitors for macro definition dumping. (get_delimiters): New function. * ast/rust-ast-dump.h: Declare `get_delimiters` and add documentation. * ast/rust-macro.h: Add

[committed 046/103] gccrs: Add name resolution for closures

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Visit closure properly when name resolving. (ResolveExpr::resolve_closure_param): Implement closure name resolving. * resolve/rust-ast-resolve-expr.h: Declare

[committed 042/103] gccrs: ast: Improve Fragment API

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-fragment.cc (Fragment::Fragment): Add better APIs. (Fragment::complete): New function. (Fragment::unexpanded): New function. * ast/rust-ast-fragment.h: Declare new APIs and add documentation. *

[committed 036/103] gccrs: dump: Fix module dumping

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix formatting when dumping modules. --- gcc/rust/ast/rust-ast-dump.cc | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc

[committed 052/103] gccrs: Add missing hir lowering to function type-path segments

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * Make-lang.in: Compile rust-ast-lower-type.cc. * ast/rust-path.h: Add `get_locus` method to `TypePathFunction`. * hir/rust-ast-lower-base.cc (ASTLowerTypePath::visit): Move implementation to rust-ast-lower-type.cc.

[committed 045/103] gccrs: Formatting cleanup in HIR lowering pattern

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::ASTLoweringPattern): Improve formatting. (ASTLoweringPattern::translate): Likewise. * hir/rust-ast-lower-pattern.h: Likewise. * resolve/rust-ast-resolve-expr.h:

[committed 030/103] gccrs: ast: dump: RangeExprs

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add dump for RangeExprs. --- gcc/rust/ast/rust-ast-dump.cc | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc

[committed 051/103] gccrs: Add missing name resolution to Function type-path segments

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Add missing handling of function case. --- gcc/rust/resolve/rust-ast-resolve-type.cc | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git

[committed 026/103] gccrs: ast: dump: minor fixups to IfExpr formatting

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix IfExpr formatting. --- gcc/rust/ast/rust-ast-dump.cc | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index

[committed 029/103] gccrs: ast: dump: various simple Exprs

2023-02-21 Thread arthur . cohen
From: David Faust Adds dump for: - BorrowExpr - DereferenceExpr - ErrorPropagationExpr - NegationExpr - TypeCastExpr - GroupedExpr gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add dump for, BorrowExpr, DereferenceExpr, ErrorPropagationExpr, NegationExpr,

[committed 050/103] gccrs: Closure support at CallExpr

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * backend/rust-compile-context.h: Add new functions: `insert_closure_decl` and `lookup_closure_decl`. * backend/rust-compile-expr.cc (CompileExpr::visit): Start compiling Closures properly.

[committed 025/103] gccrs: ast: dump: fix extra newline in block without tail

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix block formatting. --- gcc/rust/ast/rust-ast-dump.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index

[committed 049/103] gccrs: Initial Type resolution for closures

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h: Add `get_params` method. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Typecheck closure nodes. (TypeCheckExpr::resolve_fn_trait_call): New function. *

[committed 047/103] gccrs: Refactor method call type checking

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Simplify method call type checking by removing visitor and instead using one static cast. Use the new interface. * typecheck/rust-tyty-call.cc

[committed 048/103] gccrs: Add closures to lints and error checking

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * checks/errors/rust-const-checker.cc (ConstChecker::visit): Visit closures properly. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/lints/rust-lint-marklive.h: Likewise. ---

[committed 033/103] gccrs: Support outer attribute handling on trait items just like normal items

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-ast-lower-base.h (class ItemWrapper): New class. * hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Use `ItemWrapper` class. (ASTLoweringBase::handle_doc_item_attribute): Likewise.

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

2023-02-21 Thread arthur . cohen
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/rust-ast-dump.cc index fdcd97561bb..b7557bdee0c 100644

[committed 037/103] gccrs: ast: Module: unloaded module and inner attributes

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Properly handle unloaded modules. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 41 +++ 1 file changed, 32 insertions(+), 9 deletions(-) diff --git

[committed 024/103] gccrs: Method resolution must support multiple candidates

2023-02-21 Thread arthur . cohen
From: Philip Herron This patch fixes bad method resolution in our operator_overload_9 case. When we have a reference to something and we deref we must resolve to the mutable reference impl block. The interface we are using to resolve methods is the can_eq interface which allows for permissive

[committed 027/103] gccrs: ast: dump: ComparisonExpr and LazyBooleanExpr

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add dumps for ComparisonExpr and LazyBooleanExpr. --- gcc/rust/ast/rust-ast-dump.cc | 50 +-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git

[committed 023/103] gccrs: Add ABI mappings for rust-call to map to ABI::RUST

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * util/rust-abi.cc (get_abi_from_string): Add missing "rust-call" possibility for ABI variant. --- gcc/rust/util/rust-abi.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/rust/util/rust-abi.cc b/gcc/rust/util/rust-abi.cc index

[committed 018/103] gccrs: rust-ast-resolve-item: Add note about resolving glob uses

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Add note for glob import resolving. --- gcc/rust/resolve/rust-ast-resolve-item.cc | 8 1 file changed, 8 insertions(+) diff --git

[committed 022/103] gccrs: Add mappings for fn_once lang item

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

[committed 015/103] gccrs: intrinsics: Add data prefetching intrinsics

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::setup): Declare prefetch intrinsics. * backend/rust-compile-intrinsic.cc (enum class Prefetch): Add kinds of prefetch intrinsics. (prefetch_data_handler): New function.

[committed 019/103] gccrs: ast: Add accept_vis() method to `GenericArg`

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-path.h: Add `accept_vis` method to `GenericArg` class. --- gcc/rust/ast/rust-path.h | 17 + 1 file changed, 17 insertions(+) diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h index

[committed 014/103] gccrs: ast: dump structs, enums and unions

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fill empty functions for structs, enums and unions. --- gcc/rust/ast/rust-ast-dump.cc | 135 -- 1 file changed, 127 insertions(+), 8 deletions(-) diff --git

[committed 006/103] gccrs: ast: dump assignment and compound assignment expr

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Dump assignment and compound assignment expressions. --- gcc/rust/ast/rust-ast-dump.cc | 56 +-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git

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

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::emit_visibility): New function. (Dump::visit): Call into `emit_visibility`. (Dump::format_function_common): Likewise. * ast/rust-ast-dump.h: Declare `emit_visibility`. ---

[committed 002/103] gccrs: visibility: Rename get_public_vis_type -> get_vis_type

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-item.h: Rename get_public_vis_type. * hir/rust-ast-lower.cc (translate_visibility): Use new name. --- gcc/rust/ast/rust-item.h | 2 +- gcc/rust/hir/rust-ast-lower.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)

Rust front-end update

2023-02-21 Thread arthur . cohen
Hi everyone, This series contain the majority of gccrs commits which were present on our GitHub repository but did not have a Changelog entry yet. We have cleaned, rebased, tested and fixed all of these to contain proper Changelog entries as well as DCO signoff for big contributions. All of

[committed 010/103] gccrs: Ensure uniqueness on Path probe's

2023-02-21 Thread arthur . cohen
From: Philip Herron When we lookup names in paths such as Foo::bar, foo is a type we resolve and then we lookup 'bar' based on what type Foo is which includes probing relevant bounds of this type. We currently return a vector of possible candidates and this patch changes it so that we return a

[committed 001/103] gccrs: Fix missing dead code analysis ICE on local enum definition

2023-02-21 Thread arthur . cohen
From: Philip Herron When resolving local enum's within a Block the name resolution info is not at the top of the stack so this patch introduces a new mappings class for miscellaneous name resolutions which can be used during path analaysis. Fixes #1272 gcc/rust/ChangeLog: *

[committed 009/103] gccrs: Track DefId on ADT variants

2023-02-21 Thread arthur . cohen
From: Philip Herron We must track the DefID on variants for algebraic data types as this will allow us to enforce unique'ness on path queries relating to this. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Adjust VariantDef ctor

[committed 008/103] gccrs: builtins: Move implementation into source file

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * Make-lang.in: Add `rust-builtins.o` as target * backend/rust-builtins.h: Refactor to new file. * backend/rust-builtins.cc: New file. --- gcc/rust/Make-lang.in | 1 + gcc/rust/backend/rust-builtins.cc | 143

[committed 004/103] gccrs: Add catch for recusive type queries

2023-02-21 Thread arthur . cohen
From: Philip Herron When we have a type query where by generic substitution occurs we can hit the case where we need to Probe the bounds of the substited item to determine whether the the bounds are compatible this can cause us to end up querying the same type recursively. Fixes #1550

[committed 005/103] gccrs: testing: try loop in const function

2023-02-21 Thread arthur . cohen
From: Faisal Abbas Signed-off-by: Faisal Abbas <90.abbasfai...@gmail.com> gcc/testsuite/ChangeLog: * rust/compile/const9.rs: New test. Signed-off-by: Faisal Abbas --- gcc/testsuite/rust/compile/const9.rs | 18 ++ 1 file changed, 18 insertions(+) create mode 100644

  1   2   >