Daily bump.
[official-gcc.git] / gcc / rust / typecheck / rust-hir-trait-resolve.h
blob916abe6c9d0992cc557d756f0c4e7bb9e7fd61c1
1 // Copyright (C) 2021-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_TRAIT_RESOLVE_H
20 #define RUST_HIR_TRAIT_RESOLVE_H
22 #include "rust-hir-type-check-type.h"
23 #include "rust-hir-visitor.h"
25 namespace Rust {
26 namespace Resolver {
28 class ResolveTraitItemToRef : public TypeCheckBase,
29 private HIR::HIRTraitItemVisitor
31 public:
32 static TraitItemReference
33 Resolve (HIR::TraitItem &item, TyTy::BaseType *self,
34 std::vector<TyTy::SubstitutionParamMapping> substitutions);
36 void visit (HIR::TraitItemType &type) override;
38 void visit (HIR::TraitItemConst &cst) override;
40 void visit (HIR::TraitItemFunc &fn) override;
42 private:
43 ResolveTraitItemToRef (
44 TyTy::BaseType *self,
45 std::vector<TyTy::SubstitutionParamMapping> &&substitutions);
47 TraitItemReference resolved;
48 TyTy::BaseType *self;
49 std::vector<TyTy::SubstitutionParamMapping> substitutions;
52 class TraitResolver : public TypeCheckBase
54 public:
55 static TraitReference *Resolve (HIR::TypePath &path);
57 static TraitReference *Resolve (HIR::Trait &trait);
59 static TraitReference *Lookup (HIR::TypePath &path);
61 private:
62 TraitResolver ();
64 TraitReference *resolve_path (HIR::TypePath &path);
66 TraitReference *resolve_trait (HIR::Trait *trait_reference);
68 TraitReference *lookup_path (HIR::TypePath &path);
70 bool resolve_path_to_trait (const HIR::TypePath &path,
71 HIR::Trait **resolved) const;
74 } // namespace Resolver
75 } // namespace Rust
77 #endif // RUST_HIR_TRAIT_RESOLVE_H