Line data Source code
1 : // Copyright (C) 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_IMPL_TRAIT_H
20 : #define RUST_HIR_PATH_PROBE_IMPL_TRAIT_H
21 :
22 : #include "rust-hir-path-probe.h"
23 :
24 : namespace Rust {
25 : namespace Resolver {
26 :
27 1280 : class PathProbeImplTrait : public TypeCheckBase, public HIR::HIRImplVisitor
28 : {
29 : public:
30 : static std::set<PathProbeCandidate>
31 : Probe (TyTy::BaseType *receiver, const HIR::PathIdentSegment &segment_name,
32 : const TraitReference *trait_reference);
33 :
34 : void visit (HIR::TypeAlias &alias) override;
35 : void visit (HIR::ConstantItem &constant) override;
36 : void visit (HIR::Function &function) override;
37 :
38 : private:
39 : PathProbeImplTrait (TyTy::BaseType *receiver,
40 : const HIR::PathIdentSegment &query,
41 : const TraitReference *trait_reference);
42 :
43 : void process_trait_impl_items_for_candidates ();
44 : void process_impl_item_candidate (HirId id, HIR::ImplItem *item,
45 : HIR::ImplBlock *impl);
46 :
47 : Analysis::Mappings &mappings;
48 : TyTy::BaseType *receiver;
49 : const HIR::PathIdentSegment &search;
50 : const TraitReference *trait_reference;
51 : std::set<PathProbeCandidate> candidates;
52 : HIR::ImplBlock *current_impl;
53 : };
54 :
55 : } // namespace Resolver
56 : } // namespace Rust
57 :
58 : #endif // RUST_HIR_PATH_PROBE_IMPL_TRAIT_H
|