aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
AgeCommit message (Collapse)AuthorFilesLines
2023-02-21gccrs: Support Closure calls as generic trait boundsPhilip Herron1-0/+3
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/testsuite/ChangeLog: * rust/execute/torture/closure2.rs: New test.
2023-02-21gccrs: Closure support at CallExprPhilip Herron1-0/+10
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. (CompileExpr::generate_closure_function): New function. (CompileExpr::generate_closure_fntype): Likewise. * backend/rust-compile-expr.h: Declare `generate_closure_function` and `generate_closure_fntype`. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Visit closure types properly. * backend/rust-mangle.cc (legacy_mangle_name): Add support for closures. * backend/rust-tree.h (RS_CLOSURE_FLAG): Add new tree macro. (RS_CLOSURE_TYPE_P): And checking for it on tree nodes. * typecheck/rust-tyty.cc (ClosureType::is_equal): Add implementation. gcc/testsuite/ChangeLog: * rust/execute/torture/closure1.rs: New test.
2023-02-21gccrs: Refactor expression hir lowering into cc filePhilip Herron1-2/+1
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::visit): Likewise. * backend/rust-compile-expr.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-const-checker.h: Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.h: Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-expr.h (RUST_AST_LOWER_EXPR): Likewise. * hir/rust-ast-lower.cc (ASTLoweringBase::lower_closure_param): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h: Likewise. * hir/tree/rust-hir-expr.h (class ClosureExpr): Likewise. (class ClosureExprInner): Likewise. (class ClosureExprInnerTyped): Likewise. * hir/tree/rust-hir-full-decls.h (class ClosureExprInner): Likewise. (class ClosureExprInnerTyped): Likewise. * hir/tree/rust-hir-full-test.cc (ClosureExprInnerTyped::as_string): Likewise. (ClosureExprInner::as_string): Likewise. (ClosureExprInner::accept_vis): Likewise. (ClosureExpr::accept_vis): Likewise. (ClosureExprInnerTyped::accept_vis): Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * hir/tree/rust-hir.h (class Expr): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * hir/rust-ast-lower-expr.cc: New file.
2023-01-31gccrs: Cleanup formatting of backend expression visitorPhilip Herron1-5/+12
gcc/rust/ChangeLog: * backend/rust-compile-expr.h: Formatting.
2023-01-16Update copyright years.Jakub Jelinek1-1/+1
2022-12-13gccrs: Add HIR to GCC GENERIC lowering for all nodesPhilip Herron1-0/+148
This patch implements the lowering mentioned in the previous patch for all HIR nodes. gcc/rust/ * backend/rust-compile-block.cc: New. * backend/rust-compile-block.h: New. * backend/rust-compile-expr.cc: New. * backend/rust-compile-expr.h: New. * backend/rust-compile-extern.h: New. * backend/rust-compile-fnparam.cc: New. * backend/rust-compile-fnparam.h: New. * backend/rust-compile-implitem.cc: New. * backend/rust-compile-implitem.h: New. * backend/rust-compile-intrinsic.cc: New. * backend/rust-compile-intrinsic.h: New. * backend/rust-compile-item.cc: New. * backend/rust-compile-item.h: New. * backend/rust-compile-pattern.cc: New. * backend/rust-compile-pattern.h: New. * backend/rust-compile-resolve-path.cc: New. * backend/rust-compile-resolve-path.h: New. * backend/rust-compile-stmt.cc: New. * backend/rust-compile-stmt.h: New. * backend/rust-compile-struct-field-expr.cc: New. * backend/rust-compile-struct-field-expr.h: New. * backend/rust-compile-type.cc: New. * backend/rust-compile-type.h: New. * backend/rust-compile-var-decl.h: New. Co-authored-by: David Faust <david.faust@oracle.com>