update tests
This commit is contained in:
parent
32aafb2203
commit
e97edad935
6 changed files with 16 additions and 189 deletions
|
@ -1,28 +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.
|
|
||||||
|
|
||||||
// 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
|
|
||||||
// edition:2015
|
|
||||||
|
|
||||||
#![feature(macro_at_most_once_rep)]
|
|
||||||
|
|
||||||
macro_rules! bar {
|
|
||||||
($(a)?) => {} //~ERROR expected `*` or `+`
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! baz {
|
|
||||||
($(a),?) => {} //~ERROR expected `*` or `+`
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {}
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
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
|
|
||||||
|
|
|
@ -1,45 +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.
|
|
||||||
|
|
||||||
// Feature gate test for macro_at_most_once_rep under 2018 edition.
|
|
||||||
|
|
||||||
// gate-test-macro_at_most_once_rep
|
|
||||||
// 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 `?`
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
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 | macro_rules! foo {
|
|
||||||
| ---------------- when calling this macro
|
|
||||||
...
|
|
||||||
LL | foo!(a?); //~ ERROR no rules expected the token `?`
|
|
||||||
| ^ no rules expected this token in macro call
|
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
|
||||||
--> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:42:11
|
|
||||||
|
|
|
||||||
LL | macro_rules! foo {
|
|
||||||
| ---------------- when calling this macro
|
|
||||||
...
|
|
||||||
LL | foo!(a?a); //~ ERROR no rules expected the token `?`
|
|
||||||
| ^ no rules expected this token in macro call
|
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
|
||||||
--> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:43:11
|
|
||||||
|
|
|
||||||
LL | macro_rules! foo {
|
|
||||||
| ---------------- when calling this macro
|
|
||||||
...
|
|
||||||
LL | foo!(a?a?a); //~ ERROR no rules expected the token `?`
|
|
||||||
| ^ no rules expected this token in macro call
|
|
||||||
|
|
||||||
error: aborting due to 10 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
|
@ -12,22 +12,20 @@
|
||||||
|
|
||||||
// edition:2018
|
// edition:2018
|
||||||
|
|
||||||
#![feature(macro_at_most_once_rep)]
|
|
||||||
|
|
||||||
macro_rules! foo {
|
macro_rules! foo {
|
||||||
($(a)?) => {}
|
($(a)?) => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! baz {
|
macro_rules! baz {
|
||||||
($(a),?) => {} //~ERROR the `?` macro repetition operator
|
($(a),?) => {}; //~ERROR the `?` macro repetition operator
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! barplus {
|
macro_rules! barplus {
|
||||||
($(a)?+) => {} // ok. matches "a+" and "+"
|
($(a)?+) => {}; // ok. matches "a+" and "+"
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! barstar {
|
macro_rules! barstar {
|
||||||
($(a)?*) => {} // ok. matches "a*" and "*"
|
($(a)?*) => {}; // ok. matches "a*" and "*"
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
@ -41,7 +39,7 @@ pub fn main() {
|
||||||
barplus!(a); //~ERROR unexpected end of macro invocation
|
barplus!(a); //~ERROR unexpected end of macro invocation
|
||||||
barplus!(a?); //~ ERROR no rules expected the token `?`
|
barplus!(a?); //~ ERROR no rules expected the token `?`
|
||||||
barplus!(a?a); //~ ERROR no rules expected the token `?`
|
barplus!(a?a); //~ ERROR no rules expected the token `?`
|
||||||
barplus!(a+);
|
barplus!(a);
|
||||||
barplus!(+);
|
barplus!(+);
|
||||||
|
|
||||||
barstar!(); //~ERROR unexpected end of macro invocation
|
barstar!(); //~ERROR unexpected end of macro invocation
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: the `?` macro repetition operator does not take a separator
|
error: the `?` macro repetition operator does not take a separator
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:22:10
|
--> $DIR/macro-at-most-once-rep-2018.rs:20:10
|
||||||
|
|
|
|
||||||
LL | ($(a),?) => {} //~ERROR the `?` macro repetition operator
|
LL | ($(a),?) => {} //~ERROR the `?` macro repetition operator
|
||||||
| ^
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
error: no rules expected the token `?`
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:36:11
|
--> $DIR/macro-at-most-once-rep-2018.rs:34:11
|
||||||
|
|
|
|
||||||
LL | macro_rules! foo {
|
LL | macro_rules! foo {
|
||||||
| ---------------- when calling this macro
|
| ---------------- when calling this macro
|
||||||
|
@ -14,7 +14,7 @@ LL | foo!(a?); //~ ERROR no rules expected the token `?`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
error: no rules expected the token `?`
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:37:11
|
--> $DIR/macro-at-most-once-rep-2018.rs:35:11
|
||||||
|
|
|
|
||||||
LL | macro_rules! foo {
|
LL | macro_rules! foo {
|
||||||
| ---------------- when calling this macro
|
| ---------------- when calling this macro
|
||||||
|
@ -23,7 +23,7 @@ LL | foo!(a?a); //~ ERROR no rules expected the token `?`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
error: no rules expected the token `?`
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:38:11
|
--> $DIR/macro-at-most-once-rep-2018.rs:36:11
|
||||||
|
|
|
|
||||||
LL | macro_rules! foo {
|
LL | macro_rules! foo {
|
||||||
| ---------------- when calling this macro
|
| ---------------- when calling this macro
|
||||||
|
@ -32,7 +32,7 @@ LL | foo!(a?a?a); //~ ERROR no rules expected the token `?`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
||||||
error: unexpected end of macro invocation
|
error: unexpected end of macro invocation
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:40:5
|
--> $DIR/macro-at-most-once-rep-2018.rs:38:5
|
||||||
|
|
|
|
||||||
LL | macro_rules! barplus {
|
LL | macro_rules! barplus {
|
||||||
| -------------------- when calling this macro
|
| -------------------- when calling this macro
|
||||||
|
@ -50,7 +50,7 @@ LL | barplus!(a); //~ERROR unexpected end of macro invocation
|
||||||
| ^ missing tokens in macro arguments
|
| ^ missing tokens in macro arguments
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
error: no rules expected the token `?`
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:42:15
|
--> $DIR/macro-at-most-once-rep-2018.rs:40:15
|
||||||
|
|
|
|
||||||
LL | macro_rules! barplus {
|
LL | macro_rules! barplus {
|
||||||
| -------------------- when calling this macro
|
| -------------------- when calling this macro
|
||||||
|
@ -59,7 +59,7 @@ LL | barplus!(a?); //~ ERROR no rules expected the token `?`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
error: no rules expected the token `?`
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:43:15
|
--> $DIR/macro-at-most-once-rep-2018.rs:41:15
|
||||||
|
|
|
|
||||||
LL | macro_rules! barplus {
|
LL | macro_rules! barplus {
|
||||||
| -------------------- when calling this macro
|
| -------------------- when calling this macro
|
||||||
|
@ -68,7 +68,7 @@ LL | barplus!(a?a); //~ ERROR no rules expected the token `?`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
||||||
error: unexpected end of macro invocation
|
error: unexpected end of macro invocation
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:47:5
|
--> $DIR/macro-at-most-once-rep-2018.rs:45:5
|
||||||
|
|
|
|
||||||
LL | macro_rules! barstar {
|
LL | macro_rules! barstar {
|
||||||
| -------------------- when calling this macro
|
| -------------------- when calling this macro
|
||||||
|
@ -77,7 +77,7 @@ LL | barstar!(); //~ERROR unexpected end of macro invocation
|
||||||
| ^^^^^^^^^^^ missing tokens in macro arguments
|
| ^^^^^^^^^^^ missing tokens in macro arguments
|
||||||
|
|
||||||
error: unexpected end of macro invocation
|
error: unexpected end of macro invocation
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:48:15
|
--> $DIR/macro-at-most-once-rep-2018.rs:46:14
|
||||||
|
|
|
|
||||||
LL | macro_rules! barstar {
|
LL | macro_rules! barstar {
|
||||||
| -------------------- when calling this macro
|
| -------------------- when calling this macro
|
||||||
|
@ -86,7 +86,7 @@ LL | barstar!(a); //~ERROR unexpected end of macro invocation
|
||||||
| ^ missing tokens in macro arguments
|
| ^ missing tokens in macro arguments
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
error: no rules expected the token `?`
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:49:15
|
--> $DIR/macro-at-most-once-rep-2018.rs:47:15
|
||||||
|
|
|
|
||||||
LL | macro_rules! barstar {
|
LL | macro_rules! barstar {
|
||||||
| -------------------- when calling this macro
|
| -------------------- when calling this macro
|
||||||
|
@ -95,7 +95,7 @@ LL | barstar!(a?); //~ ERROR no rules expected the token `?`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
||||||
error: no rules expected the token `?`
|
error: no rules expected the token `?`
|
||||||
--> $DIR/macro-at-most-once-rep-2018.rs:50:15
|
--> $DIR/macro-at-most-once-rep-2018.rs:48:15
|
||||||
|
|
|
|
||||||
LL | macro_rules! barstar {
|
LL | macro_rules! barstar {
|
||||||
| -------------------- when calling this macro
|
| -------------------- when calling this macro
|
||||||
|
|
Loading…
Add table
Reference in a new issue