From 1137fb193583971f35e1d4b3cfcb25725948da4f Mon Sep 17 00:00:00 2001 From: Michael Lamparski Date: Wed, 7 Feb 2018 09:32:26 -0500 Subject: libsyntax/ext: trailing commas in builtin macros Most notably this changes 'syntax::ext::base::get_single_str_from_tts' to accept a trailing comma, and revises the documentation so that this aspect is not surprising. I made this change under the understanding that this crate is private rustc implementation detail (I hope this is correct!). After reviewing all call sites, I believe the revised semantics are closer to the intended spirit of the function. --- src/libsyntax_ext/cfg.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libsyntax_ext') diff --git a/src/libsyntax_ext/cfg.rs b/src/libsyntax_ext/cfg.rs index 1d8dc406468..1eeba9b30b8 100644 --- a/src/libsyntax_ext/cfg.rs +++ b/src/libsyntax_ext/cfg.rs @@ -28,6 +28,8 @@ pub fn expand_cfg<'cx>(cx: &mut ExtCtxt, let mut p = cx.new_parser_from_tts(tts); let cfg = panictry!(p.parse_meta_item()); + let _ = p.eat(&token::Comma); + if !p.eat(&token::Eof) { cx.span_err(sp, "expected 1 cfg-pattern"); return DummyResult::expr(sp); -- cgit 1.4.1-3-g733a5