[PR testsuite/116860] Testsuite adjustment for recently added tests
[official-gcc.git] / gcc / rust / typecheck / rust-hir-type-check-item.h
blobc5b94db2cb5d25f926656064469184a4c59f73c3
1 // Copyright (C) 2020-2025 Free Software Foundation, Inc.
3 // This file is part of GCC.
5 // GCC is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 3, or (at your option) any later
8 // version.
10 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 // for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with GCC; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
19 #ifndef RUST_HIR_TYPE_CHECK_ITEM
20 #define RUST_HIR_TYPE_CHECK_ITEM
22 #include "rust-hir-type-check-base.h"
23 #include "rust-hir-visitor.h"
25 namespace Rust {
26 namespace Resolver {
28 class TypeCheckItem : private TypeCheckBase, private HIR::HIRVisItemVisitor
30 public:
31 static TyTy::BaseType *Resolve (HIR::Item &item);
33 static TyTy::BaseType *ResolveImplItem (HIR::ImplBlock &impl_block,
34 HIR::ImplItem &item);
36 static TyTy::BaseType *ResolveImplBlockSelf (HIR::ImplBlock &impl_block);
38 static TyTy::BaseType *ResolveImplBlockSelfWithInference (
39 HIR::ImplBlock &impl, location_t locus,
40 TyTy::SubstitutionArgumentMappings *infer_arguments);
42 void visit (HIR::Module &module) override;
43 void visit (HIR::Function &function) override;
44 void visit (HIR::TypeAlias &alias) override;
45 void visit (HIR::TupleStruct &struct_decl) override;
46 void visit (HIR::StructStruct &struct_decl) override;
47 void visit (HIR::Enum &enum_decl) override;
48 void visit (HIR::Union &union_decl) override;
49 void visit (HIR::StaticItem &var) override;
50 void visit (HIR::ConstantItem &constant) override;
51 void visit (HIR::ImplBlock &impl_block) override;
52 void visit (HIR::ExternBlock &extern_block) override;
53 void visit (HIR::Trait &trait_block) override;
55 // nothing to do
56 void visit (HIR::ExternCrate &) override {}
57 void visit (HIR::UseDeclaration &) override {}
59 protected:
60 std::pair<std::vector<TyTy::SubstitutionParamMapping>,
61 TyTy::RegionConstraints>
62 resolve_impl_block_substitutions (HIR::ImplBlock &impl_block,
63 bool &failure_flag);
65 void validate_trait_impl_block (
66 HIR::ImplBlock &impl_block, TyTy::BaseType *self,
67 std::vector<TyTy::SubstitutionParamMapping> &substitutions);
69 TyTy::BaseType *resolve_impl_item (HIR::ImplBlock &impl_block,
70 HIR::ImplItem &item);
72 TyTy::BaseType *resolve_impl_block_self (HIR::ImplBlock &impl_block);
74 private:
75 TypeCheckItem ();
77 TyTy::BaseType *infered;
80 } // namespace Resolver
81 } // namespace Rust
83 #endif // RUST_HIR_TYPE_CHECK_ITEM