Skip to content

Commit

Permalink
Fix ICE on error propagation with generic
Browse files Browse the repository at this point in the history
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 <benjamin.thos@epita.fr>
  • Loading branch information
Kamiinarii authored and philberty committed Sep 20, 2024
1 parent d65c6c9 commit 5d703a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gcc/rust/resolve/rust-ast-resolve-expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions gcc/rust/resolve/rust-ast-resolve-expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 &param,
Expand Down

0 comments on commit 5d703a3

Please sign in to comment.