From de2446d5766e98b23e1aaaea0890b157b2d565d5 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Sun, 16 Feb 2025 01:42:05 +0000 Subject: gccrs: initial setup for new OpaqueType to represent Impl types This completes the initial setup and boilerplate for the new type in the typesystem. This is not functional yet but its a big patch already. gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): new tyty::OpaqueType * backend/rust-compile-type.h: likewise * checks/errors/borrowck/rust-bir-fact-collector.h: likewise * checks/errors/borrowck/rust-bir-place.h: likewise * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_base_type_privacy): likewise * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise * typecheck/rust-hir-type-check-type.h: likewise * typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit): likewise * typecheck/rust-substitution-mapper.h: likewise * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): likewise * typecheck/rust-tyty-call.h: likewise * typecheck/rust-tyty-cmp.h (class OpaqueCmp): likewise * typecheck/rust-tyty-variance-analysis-private.h: likewise * typecheck/rust-tyty-visitor.h: likewise * typecheck/rust-tyty.cc (TypeKindFormat::to_string): likewise (BaseType::is_unit): likewise (BaseType::destructure): likewise (BaseType::has_substitutions_defined): likewise (BaseType::needs_generic_substitutions): likewise (OpaqueType::OpaqueType): likewise (OpaqueType::can_resolve): likewise (OpaqueType::accept_vis): likewise (OpaqueType::as_string): likewise (OpaqueType::get_name): likewise (OpaqueType::can_eq): likewise (OpaqueType::clone): likewise (OpaqueType::resolve): likewise (OpaqueType::is_equal): likewise (OpaqueType::handle_substitions): likewise * typecheck/rust-tyty.h (enum TypeKind): likewise (class OpaqueType): likewise * typecheck/rust-unify.cc (UnifyRules::go): likewise (UnifyRules::expect_inference_variable): likewise (UnifyRules::expect_adt): likewise (UnifyRules::expect_str): likewise (UnifyRules::expect_reference): likewise (UnifyRules::expect_pointer): likewise (UnifyRules::expect_param): likewise (UnifyRules::expect_array): likewise (UnifyRules::expect_slice): likewise (UnifyRules::expect_fndef): likewise (UnifyRules::expect_fnptr): likewise (UnifyRules::expect_tuple): likewise (UnifyRules::expect_bool): likewise (UnifyRules::expect_char): likewise (UnifyRules::expect_int): likewise (UnifyRules::expect_uint): likewise (UnifyRules::expect_float): likewise (UnifyRules::expect_isize): likewise (UnifyRules::expect_usize): likewise (UnifyRules::expect_placeholder): likewise (UnifyRules::expect_projection): likewise (UnifyRules::expect_dyn): likewise (UnifyRules::expect_opaque): likewise * typecheck/rust-unify.h: likewise Signed-off-by: Philip Herron --- gcc/rust/backend/rust-compile-type.cc | 6 ++++++ gcc/rust/backend/rust-compile-type.h | 1 + 2 files changed, 7 insertions(+) (limited to 'gcc/rust/backend') diff --git a/gcc/rust/backend/rust-compile-type.cc b/gcc/rust/backend/rust-compile-type.cc index f5065ac..30849db 100644 --- a/gcc/rust/backend/rust-compile-type.cc +++ b/gcc/rust/backend/rust-compile-type.cc @@ -731,6 +731,12 @@ TyTyResolveCompile::visit (const TyTy::DynamicObjectType &type) type.get_ident ().locus); } +void +TyTyResolveCompile::visit (const TyTy::OpaqueType &type) +{ + translated = error_mark_node; +} + tree TyTyResolveCompile::create_dyn_obj_record (const TyTy::DynamicObjectType &type) { diff --git a/gcc/rust/backend/rust-compile-type.h b/gcc/rust/backend/rust-compile-type.h index 46047a8..b8976e9 100644 --- a/gcc/rust/backend/rust-compile-type.h +++ b/gcc/rust/backend/rust-compile-type.h @@ -56,6 +56,7 @@ public: void visit (const TyTy::ProjectionType &) override; void visit (const TyTy::DynamicObjectType &) override; void visit (const TyTy::ClosureType &) override; + void visit (const TyTy::OpaqueType &) override; public: static hashval_t type_hasher (tree type); -- cgit v1.1