protected:
Context *get_context () { return ctx; }
- tree coercion_site (HirId id, tree rvalue, const TyTy::BaseType *actual,
- const TyTy::BaseType *expected, Location lvalue_locus,
+ tree coercion_site (HirId id, tree rvalue, TyTy::BaseType *actual,
+ TyTy::BaseType *expected, Location lvalue_locus,
Location rvalue_locus);
- tree coercion_site1 (tree rvalue, const TyTy::BaseType *actual,
- const TyTy::BaseType *expected, Location lvalue_locus,
+ tree coercion_site1 (tree rvalue, TyTy::BaseType *actual,
+ TyTy::BaseType *expected, Location lvalue_locus,
Location rvalue_locus);
tree coerce_to_dyn_object (tree compiled_ref, const TyTy::BaseType *actual,
// Shared methods in compilation
tree
-HIRCompileBase::coercion_site (HirId id, tree rvalue,
- const TyTy::BaseType *rval,
- const TyTy::BaseType *lval,
- Location lvalue_locus, Location rvalue_locus)
+HIRCompileBase::coercion_site (HirId id, tree rvalue, TyTy::BaseType *rval,
+ TyTy::BaseType *lval, Location lvalue_locus,
+ Location rvalue_locus)
{
std::vector<Resolver::Adjustment> *adjustments = nullptr;
bool ok = ctx->get_tyctx ()->lookup_autoderef_mappings (id, &adjustments);
}
tree
-HIRCompileBase::coercion_site1 (tree rvalue, const TyTy::BaseType *rval,
- const TyTy::BaseType *lval,
- Location lvalue_locus, Location rvalue_locus)
+HIRCompileBase::coercion_site1 (tree rvalue, TyTy::BaseType *rval,
+ TyTy::BaseType *lval, Location lvalue_locus,
+ Location rvalue_locus)
{
if (rvalue == error_mark_node)
return error_mark_node;
- const TyTy::BaseType *actual = rval->destructure ();
- const TyTy::BaseType *expected = lval->destructure ();
+ TyTy::BaseType *actual = rval->destructure ();
+ TyTy::BaseType *expected = lval->destructure ();
if (expected->get_kind () == TyTy::TypeKind::REF)
{
static bool
resolve_operator_overload_fn (
- Analysis::RustLangItem::ItemType lang_item_type, const TyTy::BaseType *ty,
+ Analysis::RustLangItem::ItemType lang_item_type, TyTy::BaseType *ty,
TyTy::FnType **resolved_fn, HIR::ImplItem **impl_item,
Adjustment::AdjustmentType *requires_ref_adjustment);
}
Adjustment
-Adjuster::try_deref_type (const TyTy::BaseType *ty,
+Adjuster::try_deref_type (TyTy::BaseType *ty,
Analysis::RustLangItem::ItemType deref_lang_item)
{
HIR::ImplItem *impl_item = nullptr;
}
Adjustment
-Adjuster::try_raw_deref_type (const TyTy::BaseType *ty)
+Adjuster::try_raw_deref_type (TyTy::BaseType *ty)
{
bool is_valid_type = ty->get_kind () == TyTy::TypeKind::REF;
if (!is_valid_type)
}
Adjustment
-Adjuster::try_unsize_type (const TyTy::BaseType *ty)
+Adjuster::try_unsize_type (TyTy::BaseType *ty)
{
bool is_valid_type = ty->get_kind () == TyTy::TypeKind::ARRAY;
if (!is_valid_type)
static bool
resolve_operator_overload_fn (
- Analysis::RustLangItem::ItemType lang_item_type, const TyTy::BaseType *ty,
+ Analysis::RustLangItem::ItemType lang_item_type, TyTy::BaseType *ty,
TyTy::FnType **resolved_fn, HIR::ImplItem **impl_item,
Adjustment::AdjustmentType *requires_ref_adjustment)
{
{}
bool
-AutoderefCycle::cycle (const TyTy::BaseType *receiver)
+AutoderefCycle::cycle (TyTy::BaseType *receiver)
{
- const TyTy::BaseType *r = receiver;
+ TyTy::BaseType *r = receiver;
while (true)
{
rust_debug ("autoderef try 1: {%s}", r->debug_str ().c_str ());
}
bool
-AutoderefCycle::try_autoderefed (const TyTy::BaseType *r)
+AutoderefCycle::try_autoderefed (TyTy::BaseType *r)
{
try_hook (*r);
};
// ctor for all adjustments except derefs
- Adjustment (AdjustmentType type, const TyTy::BaseType *actual,
- const TyTy::BaseType *expected)
+ Adjustment (AdjustmentType type, TyTy::BaseType *actual,
+ TyTy::BaseType *expected)
: Adjustment (type, actual, expected, nullptr, nullptr,
AdjustmentType::ERROR)
{}
static Adjustment get_op_overload_deref_adjustment (
- AdjustmentType type, const TyTy::BaseType *actual,
- const TyTy::BaseType *expected, TyTy::FnType *fn, HIR::ImplItem *deref_item,
+ AdjustmentType type, TyTy::BaseType *actual, TyTy::BaseType *expected,
+ TyTy::FnType *fn, HIR::ImplItem *deref_item,
Adjustment::AdjustmentType requires_ref_adjustment)
{
rust_assert (type == DEREF || type == DEREF_MUT);
AdjustmentType get_type () const { return type; }
- const TyTy::BaseType *get_actual () const { return actual; }
- const TyTy::BaseType *get_expected () const { return expected; }
+ TyTy::BaseType *get_actual () const { return actual; }
+ TyTy::BaseType *get_expected () const { return expected; }
std::string as_string () const
{
HIR::ImplItem *get_deref_hir_item () const { return deref_item; }
private:
- Adjustment (AdjustmentType type, const TyTy::BaseType *actual,
- const TyTy::BaseType *expected, TyTy::FnType *deref_operator_fn,
+ Adjustment (AdjustmentType type, TyTy::BaseType *actual,
+ TyTy::BaseType *expected, TyTy::FnType *deref_operator_fn,
HIR::ImplItem *deref_item,
Adjustment::AdjustmentType requires_ref_adjustment)
: type (type), actual (actual), expected (expected),
{}
AdjustmentType type;
- const TyTy::BaseType *actual;
- const TyTy::BaseType *expected;
+ TyTy::BaseType *actual;
+ TyTy::BaseType *expected;
// - only used for deref operator_overloads
//
TyTy::BaseType *adjust_type (const std::vector<Adjustment> &adjustments);
static Adjustment
- try_deref_type (const TyTy::BaseType *ty,
+ try_deref_type (TyTy::BaseType *ty,
Analysis::RustLangItem::ItemType deref_lang_item);
- static Adjustment try_raw_deref_type (const TyTy::BaseType *ty);
+ static Adjustment try_raw_deref_type (TyTy::BaseType *ty);
- static Adjustment try_unsize_type (const TyTy::BaseType *ty);
+ static Adjustment try_unsize_type (TyTy::BaseType *ty);
private:
const TyTy::BaseType *base;
virtual ~AutoderefCycle ();
- virtual bool select (const TyTy::BaseType &autoderefed) = 0;
+ virtual bool select (TyTy::BaseType &autoderefed) = 0;
// optional: this is a chance to hook in to grab predicate items on the raw
// type
virtual void try_hook (const TyTy::BaseType &);
- virtual bool cycle (const TyTy::BaseType *receiver);
+ virtual bool cycle (TyTy::BaseType *receiver);
- bool try_autoderefed (const TyTy::BaseType *r);
+ bool try_autoderefed (TyTy::BaseType *r);
bool autoderef_flag;
std::vector<Adjustment> adjustments;
}
bool
-TypeCoercionRules::select (const TyTy::BaseType &autoderefed)
+TypeCoercionRules::select (TyTy::BaseType &autoderefed)
{
rust_debug (
"autoderef type-coercion select autoderefed={%s} can_eq expected={%s}",
TypeCoercionRules (TyTy::BaseType *expected, Location locus, bool emit_errors,
bool allow_autoderef);
- bool select (const TyTy::BaseType &autoderefed) override;
+ bool select (TyTy::BaseType &autoderefed) override;
bool do_coercion (TyTy::BaseType *receiver);
{}
std::set<MethodCandidate>
-MethodResolver::Probe (const TyTy::BaseType *receiver,
+MethodResolver::Probe (TyTy::BaseType *receiver,
const HIR::PathIdentSegment &segment_name,
bool autoderef_flag)
{
}
bool
-MethodResolver::select (const TyTy::BaseType &receiver)
+MethodResolver::select (TyTy::BaseType &receiver)
{
struct impl_item_candidate
{
};
static std::set<MethodCandidate>
- Probe (const TyTy::BaseType *receiver,
- const HIR::PathIdentSegment &segment_name,
+ Probe (TyTy::BaseType *receiver, const HIR::PathIdentSegment &segment_name,
bool autoderef_flag = false);
static std::vector<predicate_candidate> get_predicate_items (
void try_hook (const TyTy::BaseType &r) override;
- bool select (const TyTy::BaseType &receiver) override;
+ bool select (TyTy::BaseType &receiver) override;
private:
// search