aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/backend/rust-compile-expr.cc2
-rw-r--r--gcc/rust/hir/tree/rust-hir-expr.h26
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-expr.cc2
3 files changed, 23 insertions, 7 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index 92c224c..35861c1 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -1285,7 +1285,7 @@ CompileExpr::resolve_operator_overload (
// lookup the autoderef mappings
std::vector<Resolver::Adjustment> *adjustments = nullptr;
ok = ctx->get_tyctx ()->lookup_autoderef_mappings (
- expr.get_mappings ().get_hirid (), &adjustments);
+ expr.get_lvalue_mappings ().get_hirid (), &adjustments);
rust_assert (ok);
// apply adjustments for the fn call
diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h
index d16ac92..7cb86a6 100644
--- a/gcc/rust/hir/tree/rust-hir-expr.h
+++ b/gcc/rust/hir/tree/rust-hir-expr.h
@@ -4120,31 +4120,47 @@ class OperatorExprMeta
{
public:
OperatorExprMeta (HIR::CompoundAssignmentExpr &expr)
- : node_mappings (expr.get_mappings ()), locus (expr.get_locus ())
+ : node_mappings (expr.get_mappings ()),
+ lvalue_mappings (expr.get_expr ()->get_mappings ()),
+ locus (expr.get_locus ())
{}
OperatorExprMeta (HIR::ArithmeticOrLogicalExpr &expr)
- : node_mappings (expr.get_mappings ()), locus (expr.get_locus ())
+ : node_mappings (expr.get_mappings ()),
+ lvalue_mappings (expr.get_expr ()->get_mappings ()),
+ locus (expr.get_locus ())
{}
OperatorExprMeta (HIR::NegationExpr &expr)
- : node_mappings (expr.get_mappings ()), locus (expr.get_locus ())
+ : node_mappings (expr.get_mappings ()),
+ lvalue_mappings (expr.get_expr ()->get_mappings ()),
+ locus (expr.get_locus ())
{}
OperatorExprMeta (HIR::DereferenceExpr &expr)
- : node_mappings (expr.get_mappings ()), locus (expr.get_locus ())
+ : node_mappings (expr.get_mappings ()),
+ lvalue_mappings (expr.get_expr ()->get_mappings ()),
+ locus (expr.get_locus ())
{}
OperatorExprMeta (HIR::ArrayIndexExpr &expr)
- : node_mappings (expr.get_mappings ()), locus (expr.get_locus ())
+ : node_mappings (expr.get_mappings ()),
+ lvalue_mappings (expr.get_array_expr ()->get_mappings ()),
+ locus (expr.get_locus ())
{}
const Analysis::NodeMapping &get_mappings () const { return node_mappings; }
+ const Analysis::NodeMapping &get_lvalue_mappings () const
+ {
+ return lvalue_mappings;
+ }
+
Location get_locus () const { return locus; }
private:
const Analysis::NodeMapping node_mappings;
+ const Analysis::NodeMapping lvalue_mappings;
Location locus;
};
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index d96a85c..80f351a 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -365,7 +365,7 @@ TypeCheckExpr::resolve_operator_overload (
}
// store the adjustments for code-generation to know what to do
- context->insert_autoderef_mappings (expr.get_mappings ().get_hirid (),
+ context->insert_autoderef_mappings (expr.get_lvalue_mappings ().get_hirid (),
std::move (candidate.adjustments));
// now its just like a method-call-expr