diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 495b4d32e065..4184cba7db3e 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -335,7 +335,7 @@ declare_lint! { pub mod parser { declare_lint! { pub QUESTION_MARK_MACRO_SEP, - Warn, + Allow, "detects the use of `?` as a macro separator" } } diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 9748e2947eeb..4b077aa8dd4c 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1807,6 +1807,7 @@ mod tests { raw_identifier_spans: Lock::new(Vec::new()), registered_diagnostics: Lock::new(ErrorMap::new()), non_modrs_mods: Lock::new(vec![]), + buffered_lints: Lock::new(vec![]), } } diff --git a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs b/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs index 664e9eeb3e04..f1777745e06c 100644 --- a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs +++ b/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs @@ -20,7 +20,7 @@ extern crate rustc_plugin; use syntax::feature_gate::Features; use syntax::parse::token::{NtExpr, NtPat}; -use syntax::ast::{Ident, Pat}; +use syntax::ast::{Ident, Pat, NodeId}; use syntax::tokenstream::{TokenTree}; use syntax::ext::base::{ExtCtxt, MacResult, MacEager}; use syntax::ext::build::AstBuilder; @@ -41,7 +41,9 @@ fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree]) cx.parse_sess, &Features::new(), &[], - Edition::Edition2015); + Edition::Edition2015, + // not used... + NodeId::new(0)); let map = match TokenTree::parse(cx, &mbe_matcher, args.iter().cloned().collect()) { Success(map) => map, Failure(_, tok) => { diff --git a/src/test/ui/issue-39388.stderr b/src/test/ui/issue-39388.stderr index a38d38a51ade..dc19487f3af6 100644 --- a/src/test/ui/issue-39388.stderr +++ b/src/test/ui/issue-39388.stderr @@ -1,7 +1,7 @@ -error: expected one of: `*`, `+`, or `?` +error: expected `*` or `+` --> $DIR/issue-39388.rs:14:22 | -LL | (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected one of: `*`, `+`, or `?` +LL | (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+` | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs index 4b3dfbdc2e8a..2e06b4bd5c24 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs @@ -14,12 +14,16 @@ // compile-flags: --edition=2015 // compile-pass +#![warn(rust_2018_compatibility)] + macro_rules! bar { ($(a)?*) => {} //~WARN using `?` as a separator + //~^WARN this was previously accepted } macro_rules! baz { ($(a)?+) => {} //~WARN using `?` as a separator + //~^WARN this was previously accepted } fn main() { diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr index 0ab4138864e0..db1872c24134 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr @@ -1,12 +1,24 @@ warning: using `?` as a separator is deprecated and will be a hard error in an upcoming edition - --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:18:10 + --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:20:10 | LL | ($(a)?*) => {} //~WARN using `?` as a separator | ^ + | +note: lint level defined here + --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:17:9 + | +LL | #![warn(rust_2018_compatibility)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: #[warn(question_mark_macro_sep)] implied by #[warn(rust_2018_compatibility)] + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = note: for more information, see issue #48075 warning: using `?` as a separator is deprecated and will be a hard error in an upcoming edition - --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:22:10 + --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:25:10 | LL | ($(a)?+) => {} //~WARN using `?` as a separator | ^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = note: for more information, see issue #48075