about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authormark <markm@cs.wisc.edu>2018-06-15 21:49:00 -0500
committermark <markm@cs.wisc.edu>2018-07-23 21:54:43 -0500
commit8eb4941e30d2a40bc03840dd0d99beb5aaf8159d (patch)
treec2b4f35f76ad4697f92741e5b6fa6ce5cf4d6bce /src/test
parent2a7ae04a6872edd8a1bffa620fde53a2eb2964e1 (diff)
Implement 2015 vs 2018 `?` kleene op + test
Diffstat (limited to 'src/test')
-rw-r--r--src/test/parse-fail/issue-33569.rs2
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs7
-rw-r--r--src/test/run-pass/macro-at-most-once-rep.rs49
-rw-r--r--src/test/ui/feature-gate-macro_at_most_once_rep.stderr11
-rw-r--r--src/test/ui/issue-39388.rs2
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs28
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.stderr18
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs (renamed from src/test/ui/feature-gate-macro_at_most_once_rep.rs)18
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr18
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs34
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr12
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs45
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr71
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2018.rs53
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-2018.stderr74
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-ambig.rs53
-rw-r--r--src/test/ui/macros/macro-at-most-once-rep-ambig.stderr80
17 files changed, 371 insertions, 204 deletions
diff --git a/src/test/parse-fail/issue-33569.rs b/src/test/parse-fail/issue-33569.rs
index af90d0a83c9..15d491719a6 100644
--- a/src/test/parse-fail/issue-33569.rs
+++ b/src/test/parse-fail/issue-33569.rs
@@ -13,7 +13,7 @@
 macro_rules! foo {
     { $+ } => { //~ ERROR expected identifier, found `+`
                 //~^ ERROR missing fragment specifier
-        $(x)(y) //~ ERROR expected one of: `*`, `+`, or `?`
+        $(x)(y) //~ ERROR expected `*` or `+`
     }
 }
 
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 fd8f7b9e384..664e9eeb3e0 100644
--- a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs
+++ b/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs
@@ -29,11 +29,9 @@ use syntax::ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal};
 use syntax::ext::tt::macro_parser::{Success, Failure, Error};
 use syntax::ext::tt::macro_parser::parse_failure_msg;
 use syntax::ptr::P;
-use syntax_pos::Span;
+use syntax_pos::{Span, edition::Edition};
 use rustc_plugin::Registry;
 
-use std::cell::RefCell;
-
 fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree])
         -> Box<MacResult + 'static> {
 
@@ -42,7 +40,8 @@ fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree])
                                     true,
                                     cx.parse_sess,
                                     &Features::new(),
-                                    &[]);
+                                    &[],
+                                    Edition::Edition2015);
     let map = match TokenTree::parse(cx, &mbe_matcher, args.iter().cloned().collect()) {
         Success(map) => map,
         Failure(_, tok) => {
diff --git a/src/test/run-pass/macro-at-most-once-rep.rs b/src/test/run-pass/macro-at-most-once-rep.rs
index b7e942f9383..dcf2222ba6d 100644
--- a/src/test/run-pass/macro-at-most-once-rep.rs
+++ b/src/test/run-pass/macro-at-most-once-rep.rs
@@ -18,6 +18,8 @@
 //
 // This test focuses on non-error cases and making sure the correct number of repetitions happen.
 
+// compile-flags: --edition=2018
+
 #![feature(macro_at_most_once_rep)]
 
 macro_rules! foo {
@@ -32,57 +34,10 @@ macro_rules! foo {
     } }
 }
 
-macro_rules! baz {
-    ($($a:ident),? ; $num:expr) => { { // comma separator is meaningless for `?`
-        let mut x = 0;
-
-        $(
-            x += $a;
-         )?
-
-        assert_eq!(x, $num);
-    } }
-}
-
-macro_rules! barplus {
-    ($($a:ident)?+ ; $num:expr) => { {
-        let mut x = 0;
-
-        $(
-            x += $a;
-         )+
-
-        assert_eq!(x, $num);
-    } }
-}
-
-macro_rules! barstar {
-    ($($a:ident)?* ; $num:expr) => { {
-        let mut x = 0;
-
-        $(
-            x += $a;
-         )*
-
-        assert_eq!(x, $num);
-    } }
-}
-
 pub fn main() {
     let a = 1;
 
     // accept 0 or 1 repetitions
     foo!( ; 0);
     foo!(a ; 1);
-    baz!( ; 0);
-    baz!(a ; 1);
-
-    // Make sure using ? as a separator works as before
-    barplus!(a ; 1);
-    barplus!(a?a ; 2);
-    barplus!(a?a?a ; 3);
-    barstar!( ; 0);
-    barstar!(a ; 1);
-    barstar!(a?a ; 2);
-    barstar!(a?a?a ; 3);
 }
diff --git a/src/test/ui/feature-gate-macro_at_most_once_rep.stderr b/src/test/ui/feature-gate-macro_at_most_once_rep.stderr
deleted file mode 100644
index 9ca71d937f8..00000000000
--- a/src/test/ui/feature-gate-macro_at_most_once_rep.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075)
-  --> $DIR/feature-gate-macro_at_most_once_rep.rs:14:20
-   |
-LL | macro_rules! m { ($(a)?) => {} }
-   |                    ^^^
-   |
-   = help: add #![feature(macro_at_most_once_rep)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issue-39388.rs b/src/test/ui/issue-39388.rs
index 6da04937408..15eef429eab 100644
--- a/src/test/ui/issue-39388.rs
+++ b/src/test/ui/issue-39388.rs
@@ -11,7 +11,7 @@
 #![allow(unused_macros)]
 
 macro_rules! assign {
-    (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected one of: `*`, `+`, or `?`
+    (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+`
         $($a)* = $($b)*
     }
 }
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs
new file mode 100644
index 00000000000..fd7925ea3ee
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs
@@ -0,0 +1,28 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test behavior of `?` macro _kleene op_ under the 2015 edition. Namely, it doesn't exist, even
+// with the feature flag.
+
+// gate-test-macro_at_most_once_rep
+// compile-flags: --edition=2015
+
+#![feature(macro_at_most_once_rep)]
+
+macro_rules! bar {
+    ($(a)?) => {} //~ERROR expected `*` or `+`
+}
+
+macro_rules! baz {
+    ($(a),?) => {} //~ERROR expected `*` or `+`
+}
+
+fn main() {}
+
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.stderr
new file mode 100644
index 00000000000..5f687900421
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.stderr
@@ -0,0 +1,18 @@
+error: expected `*` or `+`
+  --> $DIR/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs:20:10
+   |
+LL |     ($(a)?) => {} //~ERROR expected `*` or `+`
+   |          ^
+   |
+   = note: `?` is not a macro repetition operator
+
+error: expected `*` or `+`
+  --> $DIR/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs:24:11
+   |
+LL |     ($(a),?) => {} //~ERROR expected `*` or `+`
+   |           ^
+   |
+   = note: `?` is not a macro repetition operator
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/feature-gate-macro_at_most_once_rep.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs
index bdce1952a9a..90bc19739b8 100644
--- a/src/test/ui/feature-gate-macro_at_most_once_rep.rs
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs
@@ -1,4 +1,4 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,12 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test that `?` macro Kleene operator can not be used when the `macro_at_most_once_rep` feature
-// gate is not used.
+// Test behavior of `?` macro _kleene op_ under the 2015 edition. Namely, it doesn't exist.
 
-macro_rules! m { ($(a)?) => {} }
-//~^ ERROR using the `?` macro Kleene operator for "at most one" repetition is unstable
+// compile-flags: --edition=2015
 
-fn main() {
-    m!();
+macro_rules! bar {
+    ($(a)?) => {} //~ERROR expected `*` or `+`
 }
+
+macro_rules! baz {
+    ($(a),?) => {} //~ERROR expected `*` or `+`
+}
+
+fn main() {}
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr
new file mode 100644
index 00000000000..8681b5d5be5
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr
@@ -0,0 +1,18 @@
+error: expected `*` or `+`
+  --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:16:10
+   |
+LL |     ($(a)?) => {} //~ERROR expected `*` or `+`
+   |          ^
+   |
+   = note: `?` is not a macro repetition operator
+
+error: expected `*` or `+`
+  --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:20:11
+   |
+LL |     ($(a),?) => {} //~ERROR expected `*` or `+`
+   |           ^
+   |
+   = note: `?` is not a macro repetition operator
+
+error: aborting due to 2 previous errors
+
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
new file mode 100644
index 00000000000..4b3dfbdc2e8
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs
@@ -0,0 +1,34 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test behavior of `?` macro _separator_ under the 2015 edition. Namely, `?` can be used as a
+// separator, but you get a migration warning for the edition.
+
+// compile-flags: --edition=2015
+// compile-pass
+
+macro_rules! bar {
+    ($(a)?*) => {} //~WARN using `?` as a separator
+}
+
+macro_rules! baz {
+    ($(a)?+) => {} //~WARN using `?` as a separator
+}
+
+fn main() {
+    bar!();
+    bar!(a);
+    bar!(a?a);
+    bar!(a?a?a?a?a);
+
+    baz!(a);
+    baz!(a?a);
+    baz!(a?a?a?a?a);
+}
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
new file mode 100644
index 00000000000..0ab4138864e
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr
@@ -0,0 +1,12 @@
+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
+   |
+LL |     ($(a)?*) => {} //~WARN using `?` as a separator
+   |          ^
+
+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
+   |
+LL |     ($(a)?+) => {} //~WARN using `?` as a separator
+   |          ^
+
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs b/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs
new file mode 100644
index 00000000000..f3107d4f1e4
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs
@@ -0,0 +1,45 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Feature gate test for macro_at_most_once_rep under 2018 edition.
+
+// gate-test-macro_at_most_once_rep
+// compile-flags: --edition=2018
+
+macro_rules! foo {
+    ($(a)?) => {}
+    //~^ERROR using the `?` macro Kleene operator for
+    //~|ERROR expected `*` or `+`
+}
+
+macro_rules! baz {
+    ($(a),?) => {} //~ERROR expected `*` or `+`
+}
+
+macro_rules! barplus {
+    ($(a)?+) => {}
+    //~^ERROR using the `?` macro Kleene operator for
+    //~|ERROR expected `*` or `+`
+}
+
+macro_rules! barstar {
+    ($(a)?*) => {}
+    //~^ERROR using the `?` macro Kleene operator for
+    //~|ERROR expected `*` or `+`
+}
+
+pub fn main() {
+    foo!();
+    foo!(a);
+    foo!(a?); //~ ERROR no rules expected the token `?`
+    foo!(a?a); //~ ERROR no rules expected the token `?`
+    foo!(a?a?a); //~ ERROR no rules expected the token `?`
+}
+
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr b/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr
new file mode 100644
index 00000000000..22f1c94fced
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr
@@ -0,0 +1,71 @@
+error[E0658]: using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075)
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:17:10
+   |
+LL |     ($(a)?) => {}
+   |          ^
+   |
+   = help: add #![feature(macro_at_most_once_rep)] to the crate attributes to enable
+
+error: expected `*` or `+`
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:17:10
+   |
+LL |     ($(a)?) => {}
+   |          ^
+
+error: expected `*` or `+`
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:23:11
+   |
+LL |     ($(a),?) => {} //~ERROR expected `*` or `+`
+   |           ^
+   |
+   = note: `?` is not a macro repetition operator
+
+error[E0658]: using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075)
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:27:10
+   |
+LL |     ($(a)?+) => {}
+   |          ^
+   |
+   = help: add #![feature(macro_at_most_once_rep)] to the crate attributes to enable
+
+error: expected `*` or `+`
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:27:10
+   |
+LL |     ($(a)?+) => {}
+   |          ^
+
+error[E0658]: using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075)
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:33:10
+   |
+LL |     ($(a)?*) => {}
+   |          ^
+   |
+   = help: add #![feature(macro_at_most_once_rep)] to the crate attributes to enable
+
+error: expected `*` or `+`
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:33:10
+   |
+LL |     ($(a)?*) => {}
+   |          ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:41:11
+   |
+LL |     foo!(a?); //~ ERROR no rules expected the token `?`
+   |           ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:42:11
+   |
+LL |     foo!(a?a); //~ ERROR no rules expected the token `?`
+   |           ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:43:11
+   |
+LL |     foo!(a?a?a); //~ ERROR no rules expected the token `?`
+   |           ^
+
+error: aborting due to 10 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018.rs b/src/test/ui/macros/macro-at-most-once-rep-2018.rs
new file mode 100644
index 00000000000..958a7e0cdf4
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2018.rs
@@ -0,0 +1,53 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that `?` is a Kleene op and not a macro separator in the 2018 edition.
+
+// compile-flags: --edition=2018
+
+#![feature(macro_at_most_once_rep)]
+
+macro_rules! foo {
+    ($(a)?) => {}
+}
+
+macro_rules! baz {
+    ($(a),?) => {} //~ERROR the `?` macro repetition operator
+}
+
+macro_rules! barplus {
+    ($(a)?+) => {} // ok. matches "a+" and "+"
+}
+
+macro_rules! barstar {
+    ($(a)?*) => {} // ok. matches "a*" and "*"
+}
+
+pub fn main() {
+    foo!();
+    foo!(a);
+    foo!(a?); //~ ERROR no rules expected the token `?`
+    foo!(a?a); //~ ERROR no rules expected the token `?`
+    foo!(a?a?a); //~ ERROR no rules expected the token `?`
+
+    barplus!(); //~ERROR unexpected end of macro invocation
+    barplus!(a); //~ERROR unexpected end of macro invocation
+    barplus!(a?); //~ ERROR no rules expected the token `?`
+    barplus!(a?a); //~ ERROR no rules expected the token `?`
+    barplus!(a+);
+    barplus!(+);
+
+    barstar!(); //~ERROR unexpected end of macro invocation
+    barstar!(a); //~ERROR unexpected end of macro invocation
+    barstar!(a?); //~ ERROR no rules expected the token `?`
+    barstar!(a?a); //~ ERROR no rules expected the token `?`
+    barstar!(a*);
+    barstar!(*);
+}
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018.stderr b/src/test/ui/macros/macro-at-most-once-rep-2018.stderr
new file mode 100644
index 00000000000..0a15bdb1068
--- /dev/null
+++ b/src/test/ui/macros/macro-at-most-once-rep-2018.stderr
@@ -0,0 +1,74 @@
+error: the `?` macro repetition operator does not take a separator
+  --> $DIR/macro-at-most-once-rep-2018.rs:22:10
+   |
+LL |     ($(a),?) => {} //~ERROR the `?` macro repetition operator
+   |          ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018.rs:36:11
+   |
+LL |     foo!(a?); //~ ERROR no rules expected the token `?`
+   |           ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018.rs:37:11
+   |
+LL |     foo!(a?a); //~ ERROR no rules expected the token `?`
+   |           ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018.rs:38:11
+   |
+LL |     foo!(a?a?a); //~ ERROR no rules expected the token `?`
+   |           ^
+
+error: unexpected end of macro invocation
+  --> $DIR/macro-at-most-once-rep-2018.rs:40:5
+   |
+LL |     barplus!(); //~ERROR unexpected end of macro invocation
+   |     ^^^^^^^^^^^
+
+error: unexpected end of macro invocation
+  --> $DIR/macro-at-most-once-rep-2018.rs:41:14
+   |
+LL |     barplus!(a); //~ERROR unexpected end of macro invocation
+   |              ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018.rs:42:15
+   |
+LL |     barplus!(a?); //~ ERROR no rules expected the token `?`
+   |               ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018.rs:43:15
+   |
+LL |     barplus!(a?a); //~ ERROR no rules expected the token `?`
+   |               ^
+
+error: unexpected end of macro invocation
+  --> $DIR/macro-at-most-once-rep-2018.rs:47:5
+   |
+LL |     barstar!(); //~ERROR unexpected end of macro invocation
+   |     ^^^^^^^^^^^
+
+error: unexpected end of macro invocation
+  --> $DIR/macro-at-most-once-rep-2018.rs:48:14
+   |
+LL |     barstar!(a); //~ERROR unexpected end of macro invocation
+   |              ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018.rs:49:15
+   |
+LL |     barstar!(a?); //~ ERROR no rules expected the token `?`
+   |               ^
+
+error: no rules expected the token `?`
+  --> $DIR/macro-at-most-once-rep-2018.rs:50:15
+   |
+LL |     barstar!(a?a); //~ ERROR no rules expected the token `?`
+   |               ^
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/ui/macros/macro-at-most-once-rep-ambig.rs b/src/test/ui/macros/macro-at-most-once-rep-ambig.rs
deleted file mode 100644
index a5660f8b41f..00000000000
--- a/src/test/ui/macros/macro-at-most-once-rep-ambig.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// The logic for parsing Kleene operators in macros has a special case to disambiguate `?`.
-// Specifically, `$(pat)?` is the ZeroOrOne operator whereas `$(pat)?+` or `$(pat)?*` are the
-// ZeroOrMore and OneOrMore operators using `?` as a separator. These tests are intended to
-// exercise that logic in the macro parser.
-//
-// Moreover, we also throw in some tests for using a separator with `?`, which is meaningless but
-// included for consistency with `+` and `*`.
-//
-// This test focuses on error cases.
-
-#![feature(macro_at_most_once_rep)]
-
-macro_rules! foo {
-    ($(a)?) => {}
-}
-
-macro_rules! baz {
-    ($(a),?) => {} // comma separator is meaningless for `?`
-}
-
-macro_rules! barplus {
-    ($(a)?+) => {}
-}
-
-macro_rules! barstar {
-    ($(a)?*) => {}
-}
-
-pub fn main() {
-    foo!(a?a?a); //~ ERROR no rules expected the token `?`
-    foo!(a?a); //~ ERROR no rules expected the token `?`
-    foo!(a?); //~ ERROR no rules expected the token `?`
-    baz!(a?a?a); //~ ERROR no rules expected the token `?`
-    baz!(a?a); //~ ERROR no rules expected the token `?`
-    baz!(a?); //~ ERROR no rules expected the token `?`
-    baz!(a,); //~ ERROR unexpected end of macro invocation
-    baz!(a?a?a,); //~ ERROR no rules expected the token `?`
-    baz!(a?a,); //~ ERROR no rules expected the token `?`
-    baz!(a?,); //~ ERROR no rules expected the token `?`
-    barplus!(); //~ ERROR unexpected end of macro invocation
-    barplus!(a?); //~ ERROR unexpected end of macro invocation
-    barstar!(a?); //~ ERROR unexpected end of macro invocation
-}
diff --git a/src/test/ui/macros/macro-at-most-once-rep-ambig.stderr b/src/test/ui/macros/macro-at-most-once-rep-ambig.stderr
deleted file mode 100644
index d382082a575..00000000000
--- a/src/test/ui/macros/macro-at-most-once-rep-ambig.stderr
+++ /dev/null
@@ -1,80 +0,0 @@
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:40:11
-   |
-LL |     foo!(a?a?a); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:41:11
-   |
-LL |     foo!(a?a); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:42:11
-   |
-LL |     foo!(a?); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:43:11
-   |
-LL |     baz!(a?a?a); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:44:11
-   |
-LL |     baz!(a?a); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:45:11
-   |
-LL |     baz!(a?); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: unexpected end of macro invocation
-  --> $DIR/macro-at-most-once-rep-ambig.rs:46:11
-   |
-LL |     baz!(a,); //~ ERROR unexpected end of macro invocation
-   |           ^
-
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:47:11
-   |
-LL |     baz!(a?a?a,); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:48:11
-   |
-LL |     baz!(a?a,); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: no rules expected the token `?`
-  --> $DIR/macro-at-most-once-rep-ambig.rs:49:11
-   |
-LL |     baz!(a?,); //~ ERROR no rules expected the token `?`
-   |           ^
-
-error: unexpected end of macro invocation
-  --> $DIR/macro-at-most-once-rep-ambig.rs:50:5
-   |
-LL |     barplus!(); //~ ERROR unexpected end of macro invocation
-   |     ^^^^^^^^^^^
-
-error: unexpected end of macro invocation
-  --> $DIR/macro-at-most-once-rep-ambig.rs:51:15
-   |
-LL |     barplus!(a?); //~ ERROR unexpected end of macro invocation
-   |               ^
-
-error: unexpected end of macro invocation
-  --> $DIR/macro-at-most-once-rep-ambig.rs:52:15
-   |
-LL |     barstar!(a?); //~ ERROR unexpected end of macro invocation
-   |               ^
-
-error: aborting due to 13 previous errors
-