aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/rust-ast-lower-expr.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-10-14 09:08:10 +0000
committerGitHub <noreply@github.com>2021-10-14 09:08:10 +0000
commite5a7ee485675419eaf4e47adf112a27f403cc1a0 (patch)
tree2b448df48a9790b1ddc335809e40cb52434a16bd /gcc/rust/hir/rust-ast-lower-expr.h
parent3057d98a4e3fc777b06e51cd678723f5c5b4c898 (diff)
parentc0669ceb147179448b280744ab94120b56639d45 (diff)
downloadgcc-e5a7ee485675419eaf4e47adf112a27f403cc1a0.zip
gcc-e5a7ee485675419eaf4e47adf112a27f403cc1a0.tar.gz
gcc-e5a7ee485675419eaf4e47adf112a27f403cc1a0.tar.bz2
Merge #738
738: Refactor HIR to use new Mutability enum r=philberty a=dafaust 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 Co-authored-by: David Faust <david.faust@oracle.com>
Diffstat (limited to 'gcc/rust/hir/rust-ast-lower-expr.h')
-rw-r--r--gcc/rust/hir/rust-ast-lower-expr.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h
index 1d0b6cc..586ec0a 100644
--- a/gcc/rust/hir/rust-ast-lower-expr.h
+++ b/gcc/rust/hir/rust-ast-lower-expr.h
@@ -649,11 +649,10 @@ public:
mappings->get_next_hir_id (crate_num),
UNKNOWN_LOCAL_DEFID);
- translated
- = new HIR::BorrowExpr (mapping,
- std::unique_ptr<HIR::Expr> (borrow_lvalue),
- expr.get_is_mut (), expr.get_is_double_borrow (),
- expr.get_outer_attrs (), expr.get_locus ());
+ translated = new HIR::BorrowExpr (
+ mapping, std::unique_ptr<HIR::Expr> (borrow_lvalue),
+ expr.get_is_mut () ? Mutability::Mut : Mutability::Imm,
+ expr.get_is_double_borrow (), expr.get_outer_attrs (), expr.get_locus ());
}
void visit (AST::DereferenceExpr &expr) override