diff options
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-expr.h | 10 | ||||
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-implitem.h | 26 | ||||
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-item.h | 13 | ||||
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-stmt.h | 13 |
4 files changed, 20 insertions, 42 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h index df836fc..e316868 100644 --- a/gcc/rust/hir/rust-ast-lower-expr.h +++ b/gcc/rust/hir/rust-ast-lower-expr.h @@ -102,12 +102,10 @@ public: void visit (AST::MacroInvocation &expr) override { - AST::ASTFragment &fragment = expr.get_fragment (); - - // FIXME - // this assertion might go away, maybe on failure's to expand a macro? - rust_assert (!fragment.get_nodes ().empty ()); - fragment.get_nodes ().at (0).accept_vis (*this); + rust_fatal_error ( + expr.get_locus (), + "macro expansion failed: No macro invocation should get lowered to HIR " + "as they should disappear during expansion"); } void visit (AST::TupleIndexExpr &expr) override diff --git a/gcc/rust/hir/rust-ast-lower-implitem.h b/gcc/rust/hir/rust-ast-lower-implitem.h index 3b901f6..5d674ca 100644 --- a/gcc/rust/hir/rust-ast-lower-implitem.h +++ b/gcc/rust/hir/rust-ast-lower-implitem.h @@ -54,15 +54,10 @@ public: void visit (AST::MacroInvocation &invoc) override { - if (!invoc.has_semicolon ()) - return; - - AST::ASTFragment &fragment = invoc.get_fragment (); - - // FIXME - // this assertion might go away, maybe on failure's to expand a macro? - rust_assert (!fragment.get_nodes ().empty ()); - fragment.get_nodes ().at (0).accept_vis (*this); + rust_fatal_error ( + invoc.get_locus (), + "macro expansion failed: No macro invocation should get lowered to HIR " + "as they should disappear during expansion"); } void visit (AST::TypeAlias &alias) override @@ -323,15 +318,10 @@ public: void visit (AST::MacroInvocation &invoc) override { - if (!invoc.has_semicolon ()) - return; - - AST::ASTFragment &fragment = invoc.get_fragment (); - - // FIXME - // this assertion might go away, maybe on failure's to expand a macro? - rust_assert (!fragment.get_nodes ().empty ()); - fragment.get_nodes ().at (0).accept_vis (*this); + rust_fatal_error ( + invoc.get_locus (), + "macro expansion failed: No macro invocation should get lowered to HIR " + "as they should disappear during expansion"); } void visit (AST::TraitItemFunc &func) override diff --git a/gcc/rust/hir/rust-ast-lower-item.h b/gcc/rust/hir/rust-ast-lower-item.h index 660a30c..6974ffc 100644 --- a/gcc/rust/hir/rust-ast-lower-item.h +++ b/gcc/rust/hir/rust-ast-lower-item.h @@ -53,15 +53,10 @@ public: void visit (AST::MacroInvocation &invoc) override { - if (!invoc.has_semicolon ()) - return; - - AST::ASTFragment &fragment = invoc.get_fragment (); - - // FIXME - // this assertion might go away, maybe on failure's to expand a macro? - rust_assert (!fragment.get_nodes ().empty ()); - fragment.get_nodes ().at (0).accept_vis (*this); + rust_fatal_error ( + invoc.get_locus (), + "macro expansion failed: No macro invocation should get lowered to HIR " + "as they should disappear during expansion"); } void visit (AST::Module &module) override diff --git a/gcc/rust/hir/rust-ast-lower-stmt.h b/gcc/rust/hir/rust-ast-lower-stmt.h index 484c638..d0a1d38 100644 --- a/gcc/rust/hir/rust-ast-lower-stmt.h +++ b/gcc/rust/hir/rust-ast-lower-stmt.h @@ -47,15 +47,10 @@ public: void visit (AST::MacroInvocation &invoc) override { - if (!invoc.has_semicolon ()) - return; - - AST::ASTFragment &fragment = invoc.get_fragment (); - - // FIXME - // this assertion might go away, maybe on failure's to expand a macro? - rust_assert (!fragment.get_nodes ().empty ()); - fragment.get_nodes ().at (0).accept_vis (*this); + rust_fatal_error ( + invoc.get_locus (), + "macro expansion failed: No macro invocation should get lowered to HIR " + "as they should disappear during expansion"); } void visit (AST::ExprStmtWithBlock &stmt) override |