blob: 2b843a258138b190f261e3e22febe18c763f652e [file]
// Copyright (C) 2020-2026 Free Software Foundation, Inc.
// This file is part of GCC.
// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3, or (at your option) any later
// version.
// GCC is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// You should have received a copy of the GNU General Public License
// along with GCC; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#ifndef RUST_HIR_PATH_PROBE_EXPR_H
#define RUST_HIR_PATH_PROBE_EXPR_H
#include "rust-hir-path-probe.h"
namespace Rust {
namespace Resolver {
class PathProbeExpr : public TypeCheckBase
{
public:
static std::set<PathProbeCandidate>
Probe (TyTy::BaseType *receiver, const HIR::PathIdentSegment &segment_name);
private:
std::set<PathProbeCandidate> probe ();
void probe_adt_impls (TyTy::ADTType *adt);
void probe_fallback_impls ();
void probe_bounds ();
void process_enum_item_for_candidates (const TyTy::ADTType *adt);
bool process_impl_item_candidate (HirId id, HIR::ImplItem *item,
HIR::ImplBlock *impl);
void process_associated_trait_for_candidates (const TraitReference *trait_ref,
HIR::ImplBlock *impl);
void
process_predicate_for_candidates (const TyTy::TypeBoundPredicate &predicate);
PathProbeExpr (TyTy::BaseType *receiver, const HIR::PathIdentSegment &query);
bool is_receiver_generic () const;
void insert_candidate (PathProbeCandidate candidate);
TyTy::BaseType *receiver;
const HIR::PathIdentSegment &search;
std::set<PathProbeCandidate> candidates;
};
} // namespace Resolver
} // namespace Rust
#endif // RUST_HIR_PATH_PROBE_EXPR_H