about summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-10 21:42:20 +0000
committerbors <bors@rust-lang.org>2018-12-10 21:42:20 +0000
commitda1527cb06c7245f83ca51903ea2a27631820215 (patch)
tree70ec3fd00841fe2fa1ea298bd5f399ca5a98f602 /src/libsyntax_ext
parent1137d29d5e551e377579c5a601fe7c444057d00c (diff)
parenta11de4171c1712a0c42d05207f4f01fb49c40d0d (diff)
downloadrust-da1527cb06c7245f83ca51903ea2a27631820215.tar.gz
rust-da1527cb06c7245f83ca51903ea2a27631820215.zip
Auto merge of #56688 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #56491 (emit error with span for empty asserts)
 - #56633 (Fix right arrow size for crate filter)
 - #56641 (fix span for invalid number of parameters in trait method)
 - #56656 (Fix typo)
 - #56661 (Add regression test for ICE)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/assert.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax_ext/assert.rs b/src/libsyntax_ext/assert.rs
index e3bd2ca0131..a2384b59048 100644
--- a/src/libsyntax_ext/assert.rs
+++ b/src/libsyntax_ext/assert.rs
@@ -24,6 +24,14 @@ pub fn expand_assert<'cx>(
     tts: &[TokenTree],
 ) -> Box<dyn MacResult + 'cx> {
     let mut parser = cx.new_parser_from_tts(tts);
+
+    if parser.token == token::Eof {
+        cx.struct_span_err(sp, "macro requires a boolean expression as an argument")
+            .span_label(sp, "boolean expression required")
+            .emit();
+        return DummyResult::expr(sp);
+    }
+
     let cond_expr = panictry!(parser.parse_expr());
     let custom_msg_args = if parser.eat(&token::Comma) {
         let ts = parser.parse_tokens();