From 4b317956faa016e276647626b7df8a53451abde8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Gonz=C3=A1lez?= Date: Sat, 18 Sep 2021 04:30:13 -0500 Subject: [PATCH] Report error for missing closing tag token (#287) --- .../{element-missing-body.rs => non-closed-element.rs} | 0 ...{element-missing-body.stderr => non-closed-element.stderr} | 4 ++-- maud_macros/src/parse.rs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) rename maud/tests/warnings/{element-missing-body.rs => non-closed-element.rs} (100%) rename maud/tests/warnings/{element-missing-body.stderr => non-closed-element.stderr} (70%) diff --git a/maud/tests/warnings/element-missing-body.rs b/maud/tests/warnings/non-closed-element.rs similarity index 100% rename from maud/tests/warnings/element-missing-body.rs rename to maud/tests/warnings/non-closed-element.rs diff --git a/maud/tests/warnings/element-missing-body.stderr b/maud/tests/warnings/non-closed-element.stderr similarity index 70% rename from maud/tests/warnings/element-missing-body.stderr rename to maud/tests/warnings/non-closed-element.stderr index 8e9e813e..5f45772e 100644 --- a/maud/tests/warnings/element-missing-body.stderr +++ b/maud/tests/warnings/non-closed-element.stderr @@ -1,5 +1,5 @@ -error: unexpected end of input - --> $DIR/element-missing-body.rs:4:5 +error: expected `;`, found end of macro + --> $DIR/non-closed-element.rs:4:5 | 4 | / html! { 5 | | p diff --git a/maud_macros/src/parse.rs b/maud_macros/src/parse.rs index 86cd692a..bf78f2dd 100644 --- a/maud_macros/src/parse.rs +++ b/maud_macros/src/parse.rs @@ -542,7 +542,7 @@ impl Parser { semi_span: SpanRange::single_span(punct.span()), } } - _ => match self.markup() { + Some(_) => match self.markup() { ast::Markup::Block(block) => ast::ElementBody::Block { block }, markup => { let markup_span = markup.span(); @@ -553,6 +553,7 @@ impl Parser { ); } }, + None => abort_call_site!("expected `;`, found end of macro"), }; ast::Markup::Element { name, attrs, body } }