From 5d703a35cae07de269119ad0eed3f1f7a4726046 Mon Sep 17 00:00:00 2001 From: "benjamin.thos" Date: Thu, 12 Sep 2024 17:10:49 +0000 Subject: [PATCH] Fix ICE on error propagation with generic add a resolve expr visitor on error propagation to avoid internal compiler error when used with generics gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add implementation of error propagation visitor * resolve/rust-ast-resolve-expr.h: Add prototype of error propagation Signed-off-by: benjamin.thos --- gcc/rust/resolve/rust-ast-resolve-expr.cc | 7 +++++++ gcc/rust/resolve/rust-ast-resolve-expr.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.cc b/gcc/rust/resolve/rust-ast-resolve-expr.cc index cc7c11ccf22c..9c2be4a57160 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.cc +++ b/gcc/rust/resolve/rust-ast-resolve-expr.cc @@ -23,6 +23,7 @@ #include "rust-ast-resolve-pattern.h" #include "rust-ast-resolve-path.h" #include "diagnostic.h" +#include "rust-expr.h" namespace Rust { namespace Resolver { @@ -94,6 +95,12 @@ ResolveExpr::visit (AST::MethodCallExpr &expr) ResolveExpr::go (*param, prefix, canonical_prefix); } +void +ResolveExpr::visit (AST::ErrorPropagationExpr &expr) +{ + ResolveExpr::go (expr.get_propagating_expr (), prefix, canonical_prefix); +} + void ResolveExpr::visit (AST::AssignmentExpr &expr) { diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.h b/gcc/rust/resolve/rust-ast-resolve-expr.h index 12b4868e31e2..374ffb06fd5a 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.h +++ b/gcc/rust/resolve/rust-ast-resolve-expr.h @@ -22,6 +22,7 @@ #include "rust-ast-resolve-base.h" #include "rust-ast.h" #include "rust-ast-resolve-pattern.h" +#include "rust-expr.h" namespace Rust { namespace Resolver { @@ -80,6 +81,7 @@ class ResolveExpr : public ResolverBase void visit (AST::RangeFromToInclExpr &expr) override; void visit (AST::ClosureExprInner &expr) override; void visit (AST::ClosureExprInnerTyped &expr) override; + void visit (AST::ErrorPropagationExpr &expr) override; protected: void resolve_closure_param (AST::ClosureParam ¶m,