aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/rust-ast-lower-expr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/hir/rust-ast-lower-expr.cc')
-rw-r--r--gcc/rust/hir/rust-ast-lower-expr.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.cc b/gcc/rust/hir/rust-ast-lower-expr.cc
index 515d36a..a0eb5e3 100644
--- a/gcc/rust/hir/rust-ast-lower-expr.cc
+++ b/gcc/rust/hir/rust-ast-lower-expr.cc
@@ -628,6 +628,9 @@ ASTLoweringExpr::visit (AST::ContinueExpr &expr)
void
ASTLoweringExpr::visit (AST::BorrowExpr &expr)
{
+ if (expr.is_raw_borrow ())
+ rust_unreachable ();
+
HIR::Expr *borrow_lvalue
= ASTLoweringExpr::translate (expr.get_borrowed_expr ());
@@ -638,9 +641,8 @@ ASTLoweringExpr::visit (AST::BorrowExpr &expr)
auto *borrow_expr
= new HIR::BorrowExpr (mapping, std::unique_ptr<HIR::Expr> (borrow_lvalue),
- expr.get_is_mut () ? Mutability::Mut
- : Mutability::Imm,
- expr.get_outer_attrs (), expr.get_locus ());
+ expr.get_mutability (), expr.get_outer_attrs (),
+ expr.get_locus ());
if (expr.get_is_double_borrow ())
{
@@ -652,9 +654,8 @@ ASTLoweringExpr::visit (AST::BorrowExpr &expr)
borrow_expr
= new HIR::BorrowExpr (mapping,
std::unique_ptr<HIR::Expr> (borrow_expr),
- expr.get_is_mut () ? Mutability::Mut
- : Mutability::Imm,
- expr.get_outer_attrs (), expr.get_locus ());
+ expr.get_mutability (), expr.get_outer_attrs (),
+ expr.get_locus ());
}
translated = borrow_expr;