Debian Codegraph @

gcc/rust/typecheck/rust-type-util.h

raw
1 // Copyright (C) 2020-2025 Free Software Foundation, Inc.
2
3 // This file is part of GCC.
4
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.
9
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.
14
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/>.
18
19 #ifndef RUST_TYPE_UTIL
20 #define RUST_TYPE_UTIL
21
22 #include "rust-mapping-common.h"
23 #include "rust-tyty.h"
24
25 namespace Rust {
26 namespace Resolver {
27
28 bool
29 query_type (HirId reference, TyTy::BaseType **result);
30
31 bool
32 types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
33 location_t unify_locus, bool emit_errors);
34
35 TyTy::BaseType *
36 unify_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
37 location_t unify_locus);
38
39 TyTy::BaseType *
40 unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
41 location_t unify_locus, bool emit_errors, bool commit_if_ok,
42 bool implicit_infer_vars, bool cleanup);
43
44 TyTy::BaseType *
45 coercion_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
46 location_t coercion_locus);
47
48 TyTy::BaseType *
49 try_coercion (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
50 location_t coercion_locus);
51
52 TyTy::BaseType *
53 cast_site (HirId id, TyTy::TyWithLocation from, TyTy::TyWithLocation to,
54 location_t cast_locus);
55
56 AssociatedImplTrait *
57 lookup_associated_impl_block (const TyTy::TypeBoundPredicate &bound,
58 const TyTy::BaseType *binding,
59 bool *ambigious = nullptr);
60
61 } // namespace Resolver
62 } // namespace Rust
63
64 #endif // RUST_TYPE_UTIL