From c0669ceb147179448b280744ab94120b56639d45 Mon Sep 17 00:00:00 2001 From: David Faust Date: Wed, 13 Oct 2021 09:50:13 -0700 Subject: Refactor HIR to use new Mutability enum Introduce a new header rust/util/rust-common.h and move the enum previously Rust::TyTy::TypeMutability there as Rust::Mutability. Update the following objects to use Mutability enum rather than a bool: - HIR::IdentifierPattern - HIR::ReferencePattern - HIR::StructPatternFieldIdent - HIR::BorrowExpr - HIR::RawPointerType - HIR::ReferenceType - HIR::StaticItem - HIR::ExternalStaticItem Also add a HIR::SelfParam::get_mut () helper, mapping its internal custom mutability to the common Rust::Mutability. Fixes: #731 --- gcc/rust/backend/rust-compile-fnparam.h | 2 +- gcc/rust/backend/rust-compile-var-decl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/rust/backend') diff --git a/gcc/rust/backend/rust-compile-fnparam.h b/gcc/rust/backend/rust-compile-fnparam.h index e3f9558..9ef72ef 100644 --- a/gcc/rust/backend/rust-compile-fnparam.h +++ b/gcc/rust/backend/rust-compile-fnparam.h @@ -40,7 +40,7 @@ public: void visit (HIR::IdentifierPattern &pattern) override { - if (!pattern.is_mut) + if (!pattern.is_mut ()) decl_type = ctx->get_backend ()->immutable_type (decl_type); translated diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h index ee4e65b..bd15a0c 100644 --- a/gcc/rust/backend/rust-compile-var-decl.h +++ b/gcc/rust/backend/rust-compile-var-decl.h @@ -54,7 +54,7 @@ public: void visit (HIR::IdentifierPattern &pattern) override { - if (!pattern.is_mut) + if (!pattern.is_mut ()) translated_type = ctx->get_backend ()->immutable_type (translated_type); translated -- cgit v1.1