gccrs: Initial Type resolution for closures
authorPhilip Herron <philip.herron@embecosm.com>
Tue, 18 Oct 2022 12:21:40 +0000 (13:21 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 21 Feb 2023 11:36:39 +0000 (12:36 +0100)
commit740a1997228d0b568afa11b1afe89128d9afff37
tree0aa7fde752e1fcc0dd946a743836fb30ad215460
parent898240946ca2e351889015d36a60498e40b4a9fc
gccrs: Initial Type resolution for closures

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.
* typecheck/rust-hir-type-check-expr.h: Declare `resolve_fn_trait_call` and
`resolve_possible_fn_trait_call_method_name`.
* typecheck/rust-hir-type-check.h: Declare `get_context_type`.
* typecheck/rust-tyctx.cc (TypeCheckContextItem::get_context_type): New function.
* typecheck/rust-tyty-cmp.h: Visit closures properly.
* typecheck/rust-tyty-rules.h: Likewise.
* typecheck/rust-tyty.cc (BaseType::bounds_compatible): Add commented out assertin.
(ClosureType::as_string): Implement it.
(ClosureType::clone): Fix closure cloning.
(ClosureType::setup_fn_once_output): New function.
* typecheck/rust-tyty.h: Improve `ClosureType` class and declare `setup_fn_once_output`.
gcc/rust/hir/tree/rust-hir-expr.h
gcc/rust/typecheck/rust-hir-type-check-expr.cc
gcc/rust/typecheck/rust-hir-type-check-expr.h
gcc/rust/typecheck/rust-hir-type-check.h
gcc/rust/typecheck/rust-tyctx.cc
gcc/rust/typecheck/rust-tyty-cmp.h
gcc/rust/typecheck/rust-tyty-rules.h
gcc/rust/typecheck/rust-tyty.cc
gcc/rust/typecheck/rust-tyty.h