Line data Source code
1 : // Copyright (C) 2020-2026 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_HIR_PATH_PROBE_EXPR_H
20 : #define RUST_HIR_PATH_PROBE_EXPR_H
21 :
22 : #include "rust-hir-path-probe.h"
23 :
24 : namespace Rust {
25 : namespace Resolver {
26 :
27 1555 : class PathProbeExpr : public TypeCheckBase
28 : {
29 : public:
30 : static std::set<PathProbeCandidate>
31 : Probe (TyTy::BaseType *receiver, const HIR::PathIdentSegment &segment_name);
32 :
33 : private:
34 : std::set<PathProbeCandidate> probe ();
35 : void probe_adt_impls (TyTy::ADTType *adt);
36 : void probe_fallback_impls ();
37 : void probe_bounds ();
38 :
39 : void process_enum_item_for_candidates (const TyTy::ADTType *adt);
40 :
41 : bool process_impl_item_candidate (HirId id, HIR::ImplItem *item,
42 : HIR::ImplBlock *impl);
43 :
44 : void process_associated_trait_for_candidates (const TraitReference *trait_ref,
45 : HIR::ImplBlock *impl);
46 :
47 : void
48 : process_predicate_for_candidates (const TyTy::TypeBoundPredicate &predicate);
49 :
50 : PathProbeExpr (TyTy::BaseType *receiver, const HIR::PathIdentSegment &query);
51 :
52 : bool is_receiver_generic () const;
53 :
54 : void insert_candidate (PathProbeCandidate candidate);
55 :
56 : TyTy::BaseType *receiver;
57 : const HIR::PathIdentSegment &search;
58 : std::set<PathProbeCandidate> candidates;
59 : };
60 :
61 : } // namespace Resolver
62 : } // namespace Rust
63 :
64 : #endif // RUST_HIR_PATH_PROBE_EXPR_H
|