From 79d0f29464fc0aa68af7b317964aff4bc35af59a Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 4 Aug 2022 16:13:52 +0100 Subject: Fix ICE in audodref mappings when argument is a method call Similar to the fix in 405d9f1d135771015199546cd1c224ba589ab48d when we have arguments that our method calls. The id used for storing the autoderef mappings being the method call itself rather than the receiver argument it will cause an ICE when we are type checking all arguments for the case of: Foo(a, bar.baz(123)) This ensures we store the autoderef mappings directly on the reciever instead. --- gcc/rust/backend/rust-compile-expr.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/rust/backend') diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 35861c1..8576cf2 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -1035,9 +1035,11 @@ CompileExpr::visit (HIR::MethodCallExpr &expr) } // lookup the autoderef mappings + HirId autoderef_mappings_id + = expr.get_receiver ()->get_mappings ().get_hirid (); std::vector *adjustments = nullptr; - ok = ctx->get_tyctx ()->lookup_autoderef_mappings ( - expr.get_mappings ().get_hirid (), &adjustments); + ok = ctx->get_tyctx ()->lookup_autoderef_mappings (autoderef_mappings_id, + &adjustments); rust_assert (ok); // apply adjustments for the fn call -- cgit v1.1