aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-10-20 16:21:37 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-10-22 10:13:06 +0100
commita1b0df02414eb323dac53dc07702861a9d4b63b6 (patch)
tree9ab8a073a48489d04d51e1c9ee2c9c2ae0f7fee8 /gcc/rust/backend/rust-compile.cc
parent5f19fb535c95f2afef30f8eb976907d5f0986041 (diff)
downloadgcc-a1b0df02414eb323dac53dc07702861a9d4b63b6.zip
gcc-a1b0df02414eb323dac53dc07702861a9d4b63b6.tar.gz
gcc-a1b0df02414eb323dac53dc07702861a9d4b63b6.tar.bz2
Constify BaseType::get_root since this should not change ownership
Diffstat (limited to 'gcc/rust/backend/rust-compile.cc')
-rw-r--r--gcc/rust/backend/rust-compile.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index 23a035f..56d3e40 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -234,8 +234,8 @@ CompileExpr::visit (HIR::MethodCallExpr &expr)
if (is_dyn_dispatch)
{
- TyTy::DynamicObjectType *dyn
- = static_cast<TyTy::DynamicObjectType *> (receiver->get_root ());
+ const TyTy::DynamicObjectType *dyn
+ = static_cast<const TyTy::DynamicObjectType *> (receiver->get_root ());
size_t offs = 0;
const Resolver::TraitItemReference *ref = nullptr;
@@ -763,8 +763,8 @@ HIRCompileBase::coercion_site (Bexpression *compiled_ref,
if (root_expected_kind == TyTy::TypeKind::DYNAMIC
&& root_actual_kind != TyTy::TypeKind::DYNAMIC)
{
- TyTy::DynamicObjectType *dyn
- = static_cast<TyTy::DynamicObjectType *> (expected->get_root ());
+ const TyTy::DynamicObjectType *dyn
+ = static_cast<const TyTy::DynamicObjectType *> (expected->get_root ());
return coerce_to_dyn_object (compiled_ref, actual, expected, dyn, locus);
}
@@ -773,9 +773,9 @@ HIRCompileBase::coercion_site (Bexpression *compiled_ref,
Bexpression *
HIRCompileBase::coerce_to_dyn_object (Bexpression *compiled_ref,
- TyTy::BaseType *actual,
- TyTy::BaseType *expected,
- TyTy::DynamicObjectType *ty,
+ const TyTy::BaseType *actual,
+ const TyTy::BaseType *expected,
+ const TyTy::DynamicObjectType *ty,
Location locus)
{
Btype *dynamic_object = TyTyResolveCompile::compile (ctx, ty);
@@ -814,7 +814,7 @@ HIRCompileBase::coerce_to_dyn_object (Bexpression *compiled_ref,
std::vector<Resolver::Adjustment> adjustments;
while (e->get_kind () == TyTy::TypeKind::REF)
{
- auto r = static_cast<TyTy::ReferenceType *> (e);
+ auto r = static_cast<const TyTy::ReferenceType *> (e);
e = r->get_base ();
if (r->is_mutable ())
@@ -845,7 +845,8 @@ HIRCompileBase::coerce_to_dyn_object (Bexpression *compiled_ref,
Bexpression *
HIRCompileBase::compute_address_for_trait_item (
- const Resolver::TraitItemReference *trait_item_ref, TyTy::BaseType *receiver)
+ const Resolver::TraitItemReference *trait_item_ref,
+ const TyTy::BaseType *receiver)
{
TyTy::BaseType *item_type = trait_item_ref->get_tyty ();
rust_assert (item_type->get_kind () == TyTy::TypeKind::FNDEF);