diff options
-rw-r--r-- | gcc/rust/ast/rust-desugar-question-mark.cc | 3 | ||||
-rw-r--r-- | gcc/rust/ast/rust-desugar-try-block.cc | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-desugar-question-mark.cc b/gcc/rust/ast/rust-desugar-question-mark.cc index ef2bdb87..01400d8 100644 --- a/gcc/rust/ast/rust-desugar-question-mark.cc +++ b/gcc/rust/ast/rust-desugar-question-mark.cc @@ -18,7 +18,6 @@ #include "rust-desugar-question-mark.h" #include "rust-ast-builder.h" -#include "rust-ast-visitor.h" namespace Rust { namespace AST { @@ -28,6 +27,8 @@ DesugarQuestionMark::DesugarQuestionMark () {} void DesugarQuestionMark::go (std::unique_ptr<Expr> &ptr) { + rust_assert (ptr->get_expr_kind () == Expr::Kind::ErrorPropagation); + auto original = static_cast<ErrorPropagationExpr &> (*ptr); auto desugared = DesugarQuestionMark ().desugar (original); diff --git a/gcc/rust/ast/rust-desugar-try-block.cc b/gcc/rust/ast/rust-desugar-try-block.cc index cd03350..07f06aa 100644 --- a/gcc/rust/ast/rust-desugar-try-block.cc +++ b/gcc/rust/ast/rust-desugar-try-block.cc @@ -28,6 +28,8 @@ DesugarTryBlock::DesugarTryBlock () {} void DesugarTryBlock::go (std::unique_ptr<Expr> &ptr) { + rust_assert (ptr->get_expr_kind () == Expr::Kind::Try); + auto original = static_cast<TryExpr &> (*ptr); auto desugared = DesugarTryBlock ().desugar (original); |