diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs
index c8ee40f3d2735..2f6d459f2e596 100644
--- a/src/liballoc/collections/vec_deque.rs
+++ b/src/liballoc/collections/vec_deque.rs
@@ -2423,7 +2423,7 @@ __impl_slice_eq1! { VecDeque, &'b [B] }
__impl_slice_eq1! { VecDeque, &'b mut [B] }
macro_rules! array_impls {
- ($($N: expr)+) => {
+ ($($N: expr),+) => {
$(
__impl_slice_eq1! { VecDeque, [B; $N] }
__impl_slice_eq1! { VecDeque, &'b [B; $N] }
@@ -2433,10 +2433,10 @@ macro_rules! array_impls {
}
array_impls! {
- 0 1 2 3 4 5 6 7 8 9
- 10 11 12 13 14 15 16 17 18 19
- 20 21 22 23 24 25 26 27 28 29
- 30 31 32
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32
}
#[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index ca7c766e41330..9d7210a93b63e 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -2065,7 +2065,7 @@ __impl_slice_eq1! { Cow<'a, [A]>, &'b mut [B], Clone }
__impl_slice_eq1! { Cow<'a, [A]>, Vec, Clone }
macro_rules! array_impls {
- ($($N: expr)+) => {
+ ($($N: expr),+) => {
$(
// NOTE: some less important impls are omitted to reduce code bloat
__impl_slice_eq1! { Vec, [B; $N] }
@@ -2079,10 +2079,10 @@ macro_rules! array_impls {
}
array_impls! {
- 0 1 2 3 4 5 6 7 8 9
- 10 11 12 13 14 15 16 17 18 19
- 20 21 22 23 24 25 26 27 28 29
- 30 31 32
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32
}
/// Implements comparison of vectors, lexicographically.
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index 26e7a79d35df6..a105d25a60aa3 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -116,7 +116,7 @@ macro_rules! __impl_slice_eq2 {
// macro for implementing n-element array functions and operations
macro_rules! array_impls {
- ($($N:expr)+) => {
+ ($($N:expr),+) => {
$(
#[stable(feature = "rust1", since = "1.0.0")]
impl AsRef<[T]> for [T; $N] {
@@ -266,10 +266,10 @@ macro_rules! array_impls {
}
array_impls! {
- 0 1 2 3 4 5 6 7 8 9
- 10 11 12 13 14 15 16 17 18 19
- 20 21 22 23 24 25 26 27 28 29
- 30 31 32
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32
}
// The Default impls cannot be generated using the array_impls! macro because
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs
index 46bb580dcddb1..e771ba451ef93 100644
--- a/src/libcore/clone.rs
+++ b/src/libcore/clone.rs
@@ -158,7 +158,7 @@ mod impls {
use super::Clone;
macro_rules! impl_clone {
- ($($t:ty)*) => {
+ ($($t:ty),*) => {
$(
#[stable(feature = "rust1", since = "1.0.0")]
impl Clone for $t {
@@ -172,10 +172,10 @@ mod impls {
}
impl_clone! {
- usize u8 u16 u32 u64 u128
- isize i8 i16 i32 i64 i128
- f32 f64
- bool char
+ usize, u8, u16, u32, u64, u128,
+ isize, i8, i16, i32, i64, i128,
+ f32, f64,
+ bool, char
}
#[unstable(feature = "never_type", issue = "35121")]
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 33881de30527e..02fc4979f723a 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -863,7 +863,7 @@ mod impls {
use cmp::Ordering::{self, Less, Greater, Equal};
macro_rules! partial_eq_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl PartialEq for $t {
#[inline]
@@ -883,20 +883,20 @@ mod impls {
}
partial_eq_impl! {
- bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64
+ bool, char, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64
}
macro_rules! eq_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Eq for $t {}
)*)
}
- eq_impl! { () bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+ eq_impl! { (), bool, char, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
macro_rules! partial_ord_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for $t {
#[inline]
@@ -936,10 +936,10 @@ mod impls {
}
}
- partial_ord_impl! { f32 f64 }
+ partial_ord_impl! { f32, f64 }
macro_rules! ord_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl PartialOrd for $t {
#[inline]
@@ -982,7 +982,7 @@ mod impls {
}
}
- ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+ ord_impl! { char, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
#[unstable(feature = "never_type", issue = "35121")]
impl PartialEq for ! {
diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs
index f0fd07b43cae0..7028d299520f8 100644
--- a/src/libcore/iter/range.rs
+++ b/src/libcore/iter/range.rs
@@ -72,7 +72,7 @@ macro_rules! step_identical_methods {
}
macro_rules! step_impl_unsigned {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "42168")]
@@ -145,7 +145,7 @@ macro_rules! step_impl_signed {
}
macro_rules! step_impl_no_between {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "42168")]
@@ -165,7 +165,7 @@ macro_rules! step_impl_no_between {
)*)
}
-step_impl_unsigned!(usize u8 u16);
+step_impl_unsigned!(usize, u8, u16);
#[cfg(not(target_pointer_width = "16"))]
step_impl_unsigned!(u32);
#[cfg(target_pointer_width = "16")]
@@ -182,32 +182,32 @@ step_impl_signed!([i64: u64]);
// If the target pointer width is not 64-bits, we
// assume here that it is less than 64-bits.
#[cfg(not(target_pointer_width = "64"))]
-step_impl_no_between!(u64 i64);
-step_impl_no_between!(u128 i128);
+step_impl_no_between!(u64, i64);
+step_impl_no_between!(u128, i128);
macro_rules! range_exact_iter_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl ExactSizeIterator for ops::Range<$t> { }
)*)
}
macro_rules! range_incl_exact_iter_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl ExactSizeIterator for ops::RangeInclusive<$t> { }
)*)
}
macro_rules! range_trusted_len_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[unstable(feature = "trusted_len", issue = "37572")]
unsafe impl TrustedLen for ops::Range<$t> { }
)*)
}
macro_rules! range_incl_trusted_len_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[unstable(feature = "trusted_len", issue = "37572")]
unsafe impl TrustedLen for ops::RangeInclusive<$t> { }
)*)
@@ -276,15 +276,15 @@ impl Iterator for ops::Range {
// Range<{u,i}64> and RangeInclusive<{u,i}{32,64,size}> are excluded
// because they cannot guarantee having a length <= usize::MAX, which is
// required by ExactSizeIterator.
-range_exact_iter_impl!(usize u8 u16 u32 isize i8 i16 i32);
-range_incl_exact_iter_impl!(u8 u16 i8 i16);
+range_exact_iter_impl!(usize, u8, u16, u32, isize, i8, i16, i32);
+range_incl_exact_iter_impl!(u8, u16, i8, i16);
// These macros generate `TrustedLen` impls.
//
// They need to guarantee that .size_hint() is either exact, or that
// the upper bound is None when it does not fit the type limits.
-range_trusted_len_impl!(usize isize u8 i8 u16 i16 u32 i32 i64 u64);
-range_incl_trusted_len_impl!(usize isize u8 i8 u16 i16 u32 i32 i64 u64);
+range_trusted_len_impl!(usize, isize, u8, i8, u16, i16, u32, i32, i64, u64);
+range_incl_trusted_len_impl!(usize, isize, u8, i8, u16, i16, u32, i32, i64, u64);
#[stable(feature = "rust1", since = "1.0.0")]
impl DoubleEndedIterator for ops::Range {
diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs
index d2c5a3bed2869..4beaf55e54848 100644
--- a/src/libcore/iter/traits.rs
+++ b/src/libcore/iter/traits.rs
@@ -772,7 +772,7 @@ pub trait Product: Sized {
// NB: explicitly use Add and Mul here to inherit overflow checks
macro_rules! integer_sum_product {
- (@impls $zero:expr, $one:expr, #[$attr:meta], $($a:ty)*) => ($(
+ (@impls $zero:expr, $one:expr, #[$attr:meta], $($a:ty),*) => ($(
#[$attr]
impl Sum for $a {
fn sum>(iter: I) -> $a {
@@ -801,13 +801,13 @@ macro_rules! integer_sum_product {
}
}
)*);
- ($($a:ty)*) => (
+ ($($a:ty),*) => (
integer_sum_product!(@impls 0, 1,
#[stable(feature = "iter_arith_traits", since = "1.12.0")],
- $($a)+);
+ $($a),+);
integer_sum_product!(@impls Wrapping(0), Wrapping(1),
#[stable(feature = "wrapping_iter_arith", since = "1.14.0")],
- $(Wrapping<$a>)+);
+ $(Wrapping<$a>),+);
);
}
@@ -843,7 +843,7 @@ macro_rules! float_sum_product {
)*)
}
-integer_sum_product! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize }
+integer_sum_product! { i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize }
float_sum_product! { f32 f64 }
/// An iterator adapter that produces output as long as the underlying
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index 23f07773f3f34..9a9e9f85a78e8 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -665,7 +665,7 @@ mod copy_impls {
use super::Copy;
macro_rules! impl_copy {
- ($($t:ty)*) => {
+ ($($t:ty),*) => {
$(
#[stable(feature = "rust1", since = "1.0.0")]
impl Copy for $t {}
@@ -674,10 +674,10 @@ mod copy_impls {
}
impl_copy! {
- usize u8 u16 u32 u64 u128
- isize i8 i16 i32 i64 i128
- f32 f64
- bool char
+ usize, u8, u16, u32, u64, u128,
+ isize, i8, i16, i32, i64, i128,
+ f32, f64,
+ bool, char
}
#[unstable(feature = "never_type", issue = "35121")]
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 7f5d596b220b9..42273bb6a21ff 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -4488,7 +4488,7 @@ pub enum FpCategory {
}
macro_rules! from_str_radix_int_impl {
- ($($t:ty)*) => {$(
+ ($($t:ty),*) => {$(
#[stable(feature = "rust1", since = "1.0.0")]
impl FromStr for $t {
type Err = ParseIntError;
@@ -4498,7 +4498,7 @@ macro_rules! from_str_radix_int_impl {
}
)*}
}
-from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }
+from_str_radix_int_impl! { isize, i8, i16, i32, i64, i128, usize, u8, u16, u32, u64, u128 }
/// The error type returned when a checked integral type conversion fails.
#[unstable(feature = "try_from", issue = "33417")]
@@ -4729,7 +4729,7 @@ trait FromStrRadixHelper: PartialOrd + Copy {
}
macro_rules! doit {
- ($($t:ty)*) => ($(impl FromStrRadixHelper for $t {
+ ($($t:ty),*) => ($(impl FromStrRadixHelper for $t {
#[inline]
fn min_value() -> Self { Self::min_value() }
#[inline]
@@ -4750,7 +4750,7 @@ macro_rules! doit {
}
})*)
}
-doit! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize }
+doit! { i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize }
fn from_str_radix(src: &str, radix: u32) -> Result {
use self::IntErrorKind::*;
diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs
index 00134a58d30f1..1b72614007295 100644
--- a/src/libcore/num/wrapping.rs
+++ b/src/libcore/num/wrapping.rs
@@ -128,7 +128,7 @@ sh_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
// FIXME(30524): impl Op for Wrapping, impl OpAssign for Wrapping
macro_rules! wrapping_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Add for Wrapping<$t> {
type Output = Wrapping<$t>;
@@ -323,10 +323,10 @@ macro_rules! wrapping_impl {
)*)
}
-wrapping_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+wrapping_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
macro_rules! wrapping_int_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
impl Wrapping<$t> {
doc_comment! {
concat!("Returns the smallest value that can be represented by this integer type.
@@ -685,10 +685,10 @@ assert_eq!(Wrapping(3i8).pow(6), Wrapping(-39));
)*)
}
-wrapping_int_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+wrapping_int_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
macro_rules! wrapping_int_impl_signed {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
impl Wrapping<$t> {
doc_comment! {
concat!("Returns the number of leading zeros in the binary representation of `self`.
@@ -814,10 +814,10 @@ assert!(!Wrapping(10", stringify!($t), ").is_negative());
)*)
}
-wrapping_int_impl_signed! { isize i8 i16 i32 i64 i128 }
+wrapping_int_impl_signed! { isize, i8, i16, i32, i64, i128 }
macro_rules! wrapping_int_impl_unsigned {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
impl Wrapping<$t> {
doc_comment! {
concat!("Returns the number of leading zeros in the binary representation of `self`.
@@ -891,7 +891,7 @@ assert_eq!(Wrapping(200_u8).next_power_of_two(), Wrapping(0));
)*)
}
-wrapping_int_impl_unsigned! { usize u8 u16 u32 u64 u128 }
+wrapping_int_impl_unsigned! { usize, u8, u16, u32, u64, u128 }
mod shift_max {
#![allow(non_upper_case_globals)]
diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs
index a1bc5463f7333..d0c5aead345a8 100644
--- a/src/libcore/ops/arith.rs
+++ b/src/libcore/ops/arith.rs
@@ -100,7 +100,7 @@ pub trait Add {
}
macro_rules! add_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty), *) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Add for $t {
type Output = $t;
@@ -114,7 +114,7 @@ macro_rules! add_impl {
)*)
}
-add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
+add_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64 }
/// The subtraction operator `-`.
///
@@ -198,7 +198,7 @@ pub trait Sub {
}
macro_rules! sub_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Sub for $t {
type Output = $t;
@@ -212,7 +212,7 @@ macro_rules! sub_impl {
)*)
}
-sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
+sub_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64 }
/// The multiplication operator `*`.
///
@@ -318,7 +318,7 @@ pub trait Mul {
}
macro_rules! mul_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Mul for $t {
type Output = $t;
@@ -332,7 +332,7 @@ macro_rules! mul_impl {
)*)
}
-mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
+mul_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64 }
/// The division operator `/`.
///
@@ -442,7 +442,7 @@ pub trait Div {
}
macro_rules! div_impl_integer {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
/// This operation rounds towards zero, truncating any
/// fractional part of the exact result.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -457,10 +457,10 @@ macro_rules! div_impl_integer {
)*)
}
-div_impl_integer! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+div_impl_integer! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
macro_rules! div_impl_float {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Div for $t {
type Output = $t;
@@ -473,7 +473,7 @@ macro_rules! div_impl_float {
)*)
}
-div_impl_float! { f32 f64 }
+div_impl_float! { f32, f64 }
/// The remainder operator `%`.
///
@@ -527,7 +527,7 @@ pub trait Rem {
}
macro_rules! rem_impl_integer {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
/// This operation satisfies `n % d == n - (n / d) * d`. The
/// result has the same sign as the left operand.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -542,11 +542,10 @@ macro_rules! rem_impl_integer {
)*)
}
-rem_impl_integer! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
-
+rem_impl_integer! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
macro_rules! rem_impl_float {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Rem for $t {
type Output = $t;
@@ -559,7 +558,7 @@ macro_rules! rem_impl_float {
)*)
}
-rem_impl_float! { f32 f64 }
+rem_impl_float! { f32, f64 }
/// The unary negation operator `-`.
///
@@ -614,7 +613,7 @@ pub trait Neg {
macro_rules! neg_impl_core {
- ($id:ident => $body:expr, $($t:ty)*) => ($(
+ ($id:ident => $body:expr, $($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Neg for $t {
type Output = $t;
@@ -629,19 +628,19 @@ macro_rules! neg_impl_core {
}
macro_rules! neg_impl_numeric {
- ($($t:ty)*) => { neg_impl_core!{ x => -x, $($t)*} }
+ ($($t:ty),*) => { neg_impl_core!{ x => -x, $($t),*} }
}
#[allow(unused_macros)]
macro_rules! neg_impl_unsigned {
- ($($t:ty)*) => {
+ ($($t:ty),*) => {
neg_impl_core!{ x => {
!x.wrapping_add(1)
- }, $($t)*} }
+ }, $($t),*} }
}
// neg_impl_unsigned! { usize u8 u16 u32 u64 }
-neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 }
+neg_impl_numeric! { isize, i8, i16, i32, i64, i128, f32, f64 }
/// The addition assignment operator `+=`.
///
@@ -685,7 +684,7 @@ pub trait AddAssign {
}
macro_rules! add_assign_impl {
- ($($t:ty)+) => ($(
+ ($($t:ty),+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl AddAssign for $t {
#[inline]
@@ -697,7 +696,7 @@ macro_rules! add_assign_impl {
)+)
}
-add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
+add_assign_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64 }
/// The subtraction assignment operator `-=`.
///
@@ -741,7 +740,7 @@ pub trait SubAssign {
}
macro_rules! sub_assign_impl {
- ($($t:ty)+) => ($(
+ ($($t:ty),+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl SubAssign for $t {
#[inline]
@@ -753,7 +752,7 @@ macro_rules! sub_assign_impl {
)+)
}
-sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
+sub_assign_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64 }
/// The multiplication assignment operator `*=`.
///
@@ -788,7 +787,7 @@ pub trait MulAssign {
}
macro_rules! mul_assign_impl {
- ($($t:ty)+) => ($(
+ ($($t:ty),+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl MulAssign for $t {
#[inline]
@@ -800,7 +799,7 @@ macro_rules! mul_assign_impl {
)+)
}
-mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
+mul_assign_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64 }
/// The division assignment operator `/=`.
///
@@ -835,7 +834,7 @@ pub trait DivAssign {
}
macro_rules! div_assign_impl {
- ($($t:ty)+) => ($(
+ ($($t:ty),+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl DivAssign for $t {
#[inline]
@@ -846,7 +845,7 @@ macro_rules! div_assign_impl {
)+)
}
-div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
+div_assign_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64 }
/// The remainder assignment operator `%=`.
///
@@ -885,7 +884,7 @@ pub trait RemAssign {
}
macro_rules! rem_assign_impl {
- ($($t:ty)+) => ($(
+ ($($t:ty),+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl RemAssign for $t {
#[inline]
@@ -896,4 +895,4 @@ macro_rules! rem_assign_impl {
)+)
}
-rem_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
+rem_assign_impl! { usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64 }
diff --git a/src/libcore/ops/bit.rs b/src/libcore/ops/bit.rs
index 3900f365b0ab1..eff561aea8bdf 100644
--- a/src/libcore/ops/bit.rs
+++ b/src/libcore/ops/bit.rs
@@ -52,7 +52,7 @@ pub trait Not {
}
macro_rules! not_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl Not for $t {
type Output = $t;
@@ -65,7 +65,7 @@ macro_rules! not_impl {
)*)
}
-not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+not_impl! { bool, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
/// The bitwise AND operator `&`.
///
@@ -136,7 +136,7 @@ pub trait BitAnd {
}
macro_rules! bitand_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl BitAnd for $t {
type Output = $t;
@@ -149,7 +149,7 @@ macro_rules! bitand_impl {
)*)
}
-bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+bitand_impl! { bool, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
/// The bitwise OR operator `|`.
///
@@ -220,7 +220,7 @@ pub trait BitOr {
}
macro_rules! bitor_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl BitOr for $t {
type Output = $t;
@@ -233,7 +233,7 @@ macro_rules! bitor_impl {
)*)
}
-bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+bitor_impl! { bool, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
/// The bitwise XOR operator `^`.
///
@@ -307,7 +307,7 @@ pub trait BitXor {
}
macro_rules! bitxor_impl {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl BitXor for $t {
type Output = $t;
@@ -320,7 +320,7 @@ macro_rules! bitxor_impl {
)*)
}
-bitxor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+bitxor_impl! { bool, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
/// The left shift operator `<<`. Note that because this trait is implemented
/// for all integer types with multiple right-hand-side types, Rust's type
@@ -412,7 +412,7 @@ macro_rules! shl_impl {
}
macro_rules! shl_impl_all {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
shl_impl! { $t, u8 }
shl_impl! { $t, u16 }
shl_impl! { $t, u32 }
@@ -429,7 +429,7 @@ macro_rules! shl_impl_all {
)*)
}
-shl_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
+shl_impl_all! { u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, isize, i128 }
/// The right shift operator `>>`. Note that because this trait is implemented
/// for all integer types with multiple right-hand-side types, Rust's type
@@ -521,7 +521,7 @@ macro_rules! shr_impl {
}
macro_rules! shr_impl_all {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
shr_impl! { $t, u8 }
shr_impl! { $t, u16 }
shr_impl! { $t, u32 }
@@ -538,7 +538,7 @@ macro_rules! shr_impl_all {
)*)
}
-shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
+shr_impl_all! { u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize }
/// The bitwise AND assignment operator `&=`.
///
@@ -615,7 +615,7 @@ pub trait BitAndAssign {
}
macro_rules! bitand_assign_impl {
- ($($t:ty)+) => ($(
+ ($($t:ty),+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl BitAndAssign for $t {
#[inline]
@@ -626,7 +626,7 @@ macro_rules! bitand_assign_impl {
)+)
}
-bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+bitand_assign_impl! { bool, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
/// The bitwise OR assignment operator `|=`.
///
@@ -664,7 +664,7 @@ pub trait BitOrAssign {
}
macro_rules! bitor_assign_impl {
- ($($t:ty)+) => ($(
+ ($($t:ty),+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl BitOrAssign for $t {
#[inline]
@@ -675,7 +675,7 @@ macro_rules! bitor_assign_impl {
)+)
}
-bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+bitor_assign_impl! { bool, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
/// The bitwise XOR assignment operator `^=`.
///
@@ -713,7 +713,7 @@ pub trait BitXorAssign {
}
macro_rules! bitxor_assign_impl {
- ($($t:ty)+) => ($(
+ ($($t:ty),+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
impl BitXorAssign for $t {
#[inline]
@@ -724,7 +724,7 @@ macro_rules! bitxor_assign_impl {
)+)
}
-bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
+bitxor_assign_impl! { bool, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128 }
/// The left shift assignment operator `<<=`.
///
@@ -775,7 +775,7 @@ macro_rules! shl_assign_impl {
}
macro_rules! shl_assign_impl_all {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
shl_assign_impl! { $t, u8 }
shl_assign_impl! { $t, u16 }
shl_assign_impl! { $t, u32 }
@@ -792,7 +792,7 @@ macro_rules! shl_assign_impl_all {
)*)
}
-shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
+shl_assign_impl_all! { u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize }
/// The right shift assignment operator `>>=`.
///
@@ -843,7 +843,7 @@ macro_rules! shr_assign_impl {
}
macro_rules! shr_assign_impl_all {
- ($($t:ty)*) => ($(
+ ($($t:ty),*) => ($(
shr_assign_impl! { $t, u8 }
shr_assign_impl! { $t, u16 }
shr_assign_impl! { $t, u32 }
@@ -860,4 +860,4 @@ macro_rules! shr_assign_impl_all {
)*)
}
-shr_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
+shr_assign_impl_all! { u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize }
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index 8c55a16f3c888..ef6deba343bfa 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -5031,7 +5031,7 @@ impl SliceOrd for [u8] {
trait BytewiseEquality { }
macro_rules! impl_marker_for {
- ($traitname:ident, $($ty:ty)*) => {
+ ($traitname:ident, $($ty:ty),*) => {
$(
impl $traitname for $ty { }
)*
@@ -5039,7 +5039,7 @@ macro_rules! impl_marker_for {
}
impl_marker_for!(BytewiseEquality,
- u8 i8 u16 i16 u32 i32 u64 i64 usize isize char bool);
+ u8, i8, u16, i16, u32, i32, u64, i64, usize, isize, char, bool);
#[doc(hidden)]
unsafe impl<'a, T> TrustedRandomAccess for Iter<'a, T> {
diff --git a/src/libcore/tests/array.rs b/src/libcore/tests/array.rs
index 6278d5e23e0d6..21f85ff963f4b 100644
--- a/src/libcore/tests/array.rs
+++ b/src/libcore/tests/array.rs
@@ -31,7 +31,7 @@ fn fixed_size_array() {
#[test]
fn array_try_from() {
macro_rules! test {
- ($($N:expr)+) => {
+ ($($N:expr),+) => {
$({
type Array = [u8; $N];
let array: Array = [0; $N];
@@ -43,9 +43,9 @@ fn array_try_from() {
}
}
test! {
- 0 1 2 3 4 5 6 7 8 9
- 10 11 12 13 14 15 16 17 18 19
- 20 21 22 23 24 25 26 27 28 29
- 30 31 32
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32
}
}
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 22f2023eefbd8..f1a9b31a8578c 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -363,6 +363,12 @@ pub mod parser {
Allow,
"detects the use of `?` as a macro separator"
}
+
+ declare_lint! {
+ pub INCORRECT_MACRO_FRAGMENT_REPETITION,
+ Allow,
+ "detects incorrect macro fragment follow due to repetition"
+ }
}
/// Does nothing as a lint pass, but registers some `Lint`s
@@ -427,6 +433,7 @@ impl LintPass for HardwiredLints {
MACRO_USE_EXTERN_CRATE,
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
parser::QUESTION_MARK_MACRO_SEP,
+ parser::INCORRECT_MACRO_FRAGMENT_REPETITION,
)
}
}
@@ -443,6 +450,13 @@ pub enum BuiltinLintDiagnostics {
MacroExpandedMacroExportsAccessedByAbsolutePaths(Span),
ElidedLifetimesInPaths(usize, Span, bool, Span, String),
UnknownCrateTypes(Span, String, String),
+ IncorrectMacroFragmentRepetition {
+ span: Span,
+ token_span: Span,
+ sugg_span: Span,
+ frag: String,
+ possible: Vec,
+ }
}
impl BuiltinLintDiagnostics {
@@ -529,6 +543,73 @@ impl BuiltinLintDiagnostics {
Applicability::MaybeIncorrect
);
}
+ BuiltinLintDiagnostics::IncorrectMacroFragmentRepetition {
+ span,
+ token_span,
+ sugg_span,
+ frag,
+ possible,
+ } => {
+ if span == token_span {
+ db.span_label(
+ span,
+ "this fragment is followed by itself without a valid separator",
+ );
+ } else {
+ db.span_label(
+ span,
+ "this fragment is followed by the first fragment in this repetition \
+ without a valid separator",
+ );
+ db.span_label(
+ token_span,
+ "this is the first fragment in the evaluated repetition",
+ );
+ }
+ let msg = "allowed there are: ";
+ let sugg_msg = "add a valid separator for the repetition to be unambiguous";
+ match &possible[..] {
+ &[] => {}
+ &[ref t] => {
+ db.note(&format!("only {} is allowed after `{}` fragments", t, frag));
+ if t.starts_with('`') && t.ends_with('`') {
+ db.span_suggestion_with_applicability(
+ sugg_span,
+ &format!("{}, for example", sugg_msg),
+ (&t[1..t.len()-1]).to_owned(),
+ Applicability::MaybeIncorrect,
+ );
+ } else {
+ db.note(sugg_msg);
+ }
+ }
+ _ => {
+ db.note(&format!(
+ "{}{} or {}",
+ msg,
+ possible[..possible.len() - 1].iter().map(|s| s.to_owned())
+ .collect::>().join(", "),
+ possible[possible.len() - 1],
+ ));
+ let mut note = true;
+ for t in &possible {
+ if t.starts_with('`') && t.ends_with('`') {
+ db.span_suggestion_with_applicability(
+ sugg_span,
+ &format!("{}, for example", sugg_msg),
+ (&t[1..t.len()-1]).to_owned(),
+ Applicability::MaybeIncorrect,
+ );
+ note = false;
+ break;
+ }
+ }
+ if note {
+ db.note(sugg_msg);
+ }
+ }
+ }
+ }
}
}
}
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 4b878b862526b..3d6d9b3745971 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -38,7 +38,7 @@ use hir::def_id::{CrateNum, LOCAL_CRATE};
use hir::intravisit;
use hir;
use lint::builtin::BuiltinLintDiagnostics;
-use lint::builtin::parser::QUESTION_MARK_MACRO_SEP;
+use lint::builtin::parser::{QUESTION_MARK_MACRO_SEP, INCORRECT_MACRO_FRAGMENT_REPETITION};
use session::{Session, DiagnosticMessageId};
use std::{hash, ptr};
use syntax::ast;
@@ -89,9 +89,12 @@ pub struct Lint {
impl Lint {
/// Returns the `rust::lint::Lint` for a `syntax::early_buffered_lints::BufferedEarlyLintId`.
- pub fn from_parser_lint_id(lint_id: BufferedEarlyLintId) -> &'static Self {
- match lint_id {
+ pub fn from_parser_lint_id(lint_id: &BufferedEarlyLintId) -> &'static Self {
+ match *lint_id {
BufferedEarlyLintId::QuestionMarkMacroSep => QUESTION_MARK_MACRO_SEP,
+ BufferedEarlyLintId::IncorrectMacroFragmentRepetition {
+ ..
+ } => INCORRECT_MACRO_FRAGMENT_REPETITION,
}
}
@@ -106,6 +109,25 @@ impl Lint {
.map(|(_, l)| l)
.unwrap_or(self.default_level)
}
+
+ pub fn builtin_diagnostic(lint_id: BufferedEarlyLintId) -> BuiltinLintDiagnostics {
+ match lint_id {
+ BufferedEarlyLintId::IncorrectMacroFragmentRepetition {
+ span,
+ token_span,
+ sugg_span,
+ frag,
+ possible,
+ } => BuiltinLintDiagnostics::IncorrectMacroFragmentRepetition {
+ span,
+ token_span,
+ sugg_span,
+ frag,
+ possible,
+ },
+ _ => BuiltinLintDiagnostics::Normal,
+ }
+ }
}
/// Declare a static item of type `&'static Lint`.
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index f1ddcda823ee7..3d343be2e600b 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -311,7 +311,7 @@ macro_rules! hash_option {
macro_rules! top_level_options {
(pub struct Options { $(
- $opt:ident : $t:ty [$dep_tracking_marker:ident $($warn_val:expr, $warn_text:expr)*],
+ $opt:ident : $t:ty [$dep_tracking_marker:ident $($warn_val:expr, $warn_text:expr),*],
)* } ) => (
#[derive(Clone)]
pub struct Options {
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index 48014a9e1192c..c92f5133b40d2 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -1092,9 +1092,10 @@ where
// Add all buffered lints from the `ParseSess` to the `Session`.
sess.parse_sess.buffered_lints.with_lock(|buffered_lints| {
info!("{} parse sess buffered_lints", buffered_lints.len());
- for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) {
- let lint = lint::Lint::from_parser_lint_id(lint_id);
- sess.buffer_lint(lint, id, span, &msg);
+ for BufferedEarlyLint {id, span, msg, lint_id} in buffered_lints.drain(..) {
+ let lint = lint::Lint::from_parser_lint_id(&lint_id);
+ let diag = lint::Lint::builtin_diagnostic(lint_id);
+ sess.buffer_lint_with_diagnostic(lint, id, span, &msg, diag);
}
});
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index 4d709d574c4f1..1ed2ead36568c 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -47,7 +47,8 @@ use rustc::lint::builtin::{
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
ELIDED_LIFETIMES_IN_PATHS,
EXPLICIT_OUTLIVES_REQUIREMENTS,
- parser::QUESTION_MARK_MACRO_SEP
+ parser::QUESTION_MARK_MACRO_SEP,
+ parser::INCORRECT_MACRO_FRAGMENT_REPETITION,
};
use rustc::session;
use rustc::util;
@@ -326,6 +327,11 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
reference: "issue #48075 ",
edition: Some(Edition::Edition2018),
},
+ FutureIncompatibleInfo {
+ id: LintId::of(INCORRECT_MACRO_FRAGMENT_REPETITION),
+ reference: "issue #56575 ",
+ edition: None,
+ },
FutureIncompatibleInfo {
id: LintId::of(MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS),
reference: "issue #52234 ",
diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs
index f9ce7b4319fac..e98e6f6002a06 100644
--- a/src/librustc_mir/interpret/snapshot.rs
+++ b/src/librustc_mir/interpret/snapshot.rs
@@ -103,7 +103,7 @@ macro_rules! __impl_snapshot_field {
macro_rules! impl_snapshot_for {
// FIXME(mark-i-m): Some of these should be `?` rather than `*`.
(enum $enum_name:ident {
- $( $variant:ident $( ( $($field:ident $(-> $delegate:expr)*),* ) )* ),* $(,)*
+ $( $variant:ident $( ( $($field:ident $(-> $delegate:expr);*),* ) )* ),* $(,)*
}) => {
impl<'a, Ctx> self::Snapshot<'a, Ctx> for $enum_name
@@ -126,7 +126,7 @@ macro_rules! impl_snapshot_for {
};
// FIXME(mark-i-m): same here.
- (struct $struct_name:ident { $($field:ident $(-> $delegate:expr)*),* $(,)* }) => {
+ (struct $struct_name:ident { $($field:ident $(-> $delegate:expr);*),* $(,)* }) => {
impl<'a, Ctx> self::Snapshot<'a, Ctx> for $struct_name
where Ctx: self::SnapshotContext<'a>,
{
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index f314d57acdd52..bc3e306f27681 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -3977,8 +3977,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
}
}
- let diag = lint::builtin::BuiltinLintDiagnostics
- ::AbsPathWithModule(diag_span);
+ let diag = lint::builtin::BuiltinLintDiagnostics::AbsPathWithModule(diag_span);
self.session.buffer_lint_with_diagnostic(
lint::builtin::ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
diag_id, diag_span,
diff --git a/src/libsyntax/early_buffered_lints.rs b/src/libsyntax/early_buffered_lints.rs
index a976af1435d23..9269eb9a28d00 100644
--- a/src/libsyntax/early_buffered_lints.rs
+++ b/src/libsyntax/early_buffered_lints.rs
@@ -14,13 +14,20 @@
//! redundant. Later, these types can be converted to types for use by the rest of the compiler.
use syntax::ast::NodeId;
-use syntax_pos::MultiSpan;
+use syntax_pos::{MultiSpan, Span};
/// Since we cannot import `LintId`s from `rustc::lint`, we define some Ids here which can later be
/// passed to `rustc::lint::Lint::from_parser_lint_id` to get a `rustc::lint::Lint`.
pub enum BufferedEarlyLintId {
/// Usage of `?` as a macro separator is deprecated.
QuestionMarkMacroSep,
+ IncorrectMacroFragmentRepetition {
+ span: Span,
+ token_span: Span,
+ sugg_span: Span,
+ frag: String,
+ possible: Vec,
+ }
}
/// Stores buffered lint info which can later be passed to `librustc`.
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index ff622b0c18fac..f2482970308d1 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -10,6 +10,7 @@
use {ast, attr};
use syntax_pos::{Span, DUMMY_SP};
+use early_buffered_lints::BufferedEarlyLintId;
use edition::Edition;
use errors::FatalError;
use ext::base::{DummyResult, ExtCtxt, MacResult, SyntaxExtension};
@@ -785,7 +786,7 @@ fn check_matcher_core(sess: &ParseSess,
// against SUFFIX
continue 'each_token;
}
- TokenTree::Sequence(sp, ref seq_rep) => {
+ TokenTree::Sequence(delim_sp, ref seq_rep) => {
suffix_first = build_suffix_first();
// The trick here: when we check the interior, we want
// to include the separator (if any) as a potential
@@ -800,9 +801,46 @@ fn check_matcher_core(sess: &ParseSess,
let mut new;
let my_suffix = if let Some(ref u) = seq_rep.separator {
new = suffix_first.clone();
- new.add_one_maybe(TokenTree::Token(sp.entire(), u.clone()));
+ new.add_one_maybe(TokenTree::Token(delim_sp.entire(), u.clone()));
&new
} else {
+ // Verify that a fragment isn't followed by an invalid fragment type through
+ // repetition.
+ if let (
+ Some(tok),
+ Some(TokenTree::MetaVarDecl(sp, name, frag_spec)),
+ ) = (seq_rep.tts.first(), seq_rep.tts.last()) {
+ match is_in_follow(tok, &frag_spec.as_str()) {
+ IsInFollow::Invalid(..) | IsInFollow::Yes => {} // handled elsewhere
+ IsInFollow::No(possible) => {
+ let token_span = tok.span();
+ let next = if *sp == token_span {
+ "itself".to_owned()
+ } else {
+ quoted_tt_to_string(tok)
+ };
+ let sugg_span = sess.source_map().next_point(delim_sp.close);
+ sess.buffer_lint(
+ BufferedEarlyLintId::IncorrectMacroFragmentRepetition {
+ span: *sp,
+ token_span: tok.span(),
+ sugg_span,
+ frag: frag_spec.to_string(),
+ possible: possible.into_iter().map(String::from).collect(),
+ },
+ *sp,
+ ast::CRATE_NODE_ID,
+ &format!(
+ "`${name}:{frag}` is followed (through repetition) by \
+ {next}, which is not allowed for `{frag}` fragments",
+ name=name,
+ frag=frag_spec,
+ next=next,
+ ),
+ );
+ }
+ }
+ }
&suffix_first
};
@@ -855,7 +893,7 @@ fn check_matcher_core(sess: &ParseSess,
let sp = next_token.span();
let mut err = sess.span_diagnostic.struct_span_err(
sp,
- &format!("`${name}:{frag}` {may_be} followed by `{next}`, which \
+ &format!("`${name}:{frag}` {may_be} followed by {next}, which \
is not allowed for `{frag}` fragments",
name=name,
frag=frag_spec,
@@ -963,7 +1001,7 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow {
IsInFollow::Yes
},
"stmt" | "expr" => {
- let tokens = vec!["`=>`", "`,`", "`;`"];
+ let tokens = vec!["`;`", "`=>`", "`,`"];
match *tok {
TokenTree::Token(_, ref tok) => match *tok {
FatArrow | Comma | Semi => IsInFollow::Yes,
@@ -985,7 +1023,7 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow {
},
"path" | "ty" => {
let tokens = vec![
- "`{`", "`[`", "`=>`", "`,`", "`>`","`=`", "`:`", "`;`", "`|`", "`as`",
+ "`,`", "`{`", "`[`", "`=>`", "`>`","`=`", "`:`", "`;`", "`|`", "`as`",
"`where`",
];
match *tok {
@@ -1076,10 +1114,13 @@ fn is_legal_fragment_specifier(_sess: &ParseSess,
fn quoted_tt_to_string(tt: "ed::TokenTree) -> String {
match *tt {
- quoted::TokenTree::Token(_, ref tok) => ::print::pprust::token_to_string(tok),
- quoted::TokenTree::MetaVar(_, name) => format!("${}", name),
- quoted::TokenTree::MetaVarDecl(_, name, kind) => format!("${}:{}", name, kind),
- _ => panic!("unexpected quoted::TokenTree::{{Sequence or Delimited}} \
- in follow set checker"),
+ quoted::TokenTree::Token(_, ref tok) => format!(
+ "`{}`",
+ ::print::pprust::token_to_string(tok),
+ ),
+ quoted::TokenTree::MetaVar(_, name) => format!("`${}`", name),
+ quoted::TokenTree::MetaVarDecl(_, name, kind) => format!("`${}:{}`", name, kind),
+ quoted::TokenTree::Delimited(..) => "a delimited token tree".to_owned(),
+ quoted::TokenTree::Sequence(..) => "a sequence".to_owned(),
}
}
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 866dba24dcb0a..f069b2bd36905 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -85,14 +85,15 @@ impl ParseSess {
&self.source_map
}
- pub fn buffer_lint>(&self,
+ pub fn buffer_lint>(
+ &self,
lint_id: BufferedEarlyLintId,
span: S,
id: NodeId,
msg: &str,
) {
self.buffered_lints.with_lock(|buffered_lints| {
- buffered_lints.push(BufferedEarlyLint{
+ buffered_lints.push(BufferedEarlyLint {
span: span.into(),
id,
msg: msg.into(),
diff --git a/src/test/run-pass/issues/issue-33185.rs b/src/test/run-pass/issues/issue-33185.rs
index 6268454658f63..30a64e612c55f 100644
--- a/src/test/run-pass/issues/issue-33185.rs
+++ b/src/test/run-pass/issues/issue-33185.rs
@@ -13,7 +13,7 @@
#[macro_export]
macro_rules! state {
- ( $( $name:ident : $field:ty )* ) => (
+ ( $( $name:ident : $field:ty ),* ) => (
#[derive(Default)]
struct State {
$($name : $field),*
diff --git a/src/test/run-pass/macros/macro-first-set.rs b/src/test/run-pass/macros/macro-first-set.rs
index c5f82ce5f0c06..3ab6df87c1478 100644
--- a/src/test/run-pass/macros/macro-first-set.rs
+++ b/src/test/run-pass/macros/macro-first-set.rs
@@ -40,11 +40,11 @@ fn test_26444() {
}
macro_rules! pat_26444 {
- ($fname:ident $($arg:pat)* =) => {}
+ ($fname:ident $($arg:pat),* =) => {}
}
-pat_26444!(foo 1 2 5...7 =);
-pat_26444!(bar Some(ref x) Ok(ref mut y) &(w, z) =);
+pat_26444!(foo 1, 2, 5...7 =);
+pat_26444!(bar Some(ref x), Ok(ref mut y), &(w, z) =);
//}}}
diff --git a/src/test/rustdoc/issue-53812.rs b/src/test/rustdoc/issue-53812.rs
index 60d19fbcd1a20..e06b9cf56fcd5 100644
--- a/src/test/rustdoc/issue-53812.rs
+++ b/src/test/rustdoc/issue-53812.rs
@@ -14,7 +14,7 @@ pub trait MyIterator {
pub struct MyStruct(T);
macro_rules! array_impls {
- ($($N:expr)+) => {
+ ($($N:expr),+) => {
$(
impl<'a, T> MyIterator for &'a MyStruct<[T; $N]> {
}
@@ -27,4 +27,4 @@ macro_rules! array_impls {
// @has - '//*[@id="implementors-list"]//h3[3]' 'MyStruct<[T; 2]>'
// @has - '//*[@id="implementors-list"]//h3[4]' 'MyStruct<[T; 3]>'
// @has - '//*[@id="implementors-list"]//h3[5]' 'MyStruct<[T; 10]>'
-array_impls! { 10 3 2 1 0 }
+array_impls! { 10, 3, 2, 1, 0 }
diff --git a/src/test/ui/issues/issue-42755.rs b/src/test/ui/issues/issue-42755.rs
index a8458ccacc3c0..e41200238a36f 100644
--- a/src/test/ui/issues/issue-42755.rs
+++ b/src/test/ui/issues/issue-42755.rs
@@ -1,16 +1,6 @@
-// Copyright 2017 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 or the MIT license
-// , at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
macro_rules! foo {
- ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
+ ($($p:vis)*) => {}
+ //~^ ERROR repetition matches empty token tree
}
foo!(a);
diff --git a/src/test/ui/issues/issue-42755.stderr b/src/test/ui/issues/issue-42755.stderr
index bdbb99de4608f..12047e22f1b02 100644
--- a/src/test/ui/issues/issue-42755.stderr
+++ b/src/test/ui/issues/issue-42755.stderr
@@ -1,7 +1,7 @@
error: repetition matches empty token tree
- --> $DIR/issue-42755.rs:13:7
+ --> $DIR/issue-42755.rs:2:7
|
-LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
+LL | ($($p:vis)*) => {}
| ^^^^^^^^
error: aborting due to previous error
diff --git a/src/test/ui/macros/incorrrect-repetition-2.rs b/src/test/ui/macros/incorrrect-repetition-2.rs
new file mode 100644
index 0000000000000..f781664821c27
--- /dev/null
+++ b/src/test/ui/macros/incorrrect-repetition-2.rs
@@ -0,0 +1,9 @@
+#![deny(incorrect_macro_fragment_repetition)]
+
+macro_rules! foo {
+ ($($a:expr)*) => {};
+ //~^ ERROR `$a:expr` is followed (through repetition) by itself, which is not allowed for
+ //~| WARN this was previously accepted by the compiler but is being phased out
+}
+
+fn main() {}
diff --git a/src/test/ui/macros/incorrrect-repetition-2.stderr b/src/test/ui/macros/incorrrect-repetition-2.stderr
new file mode 100644
index 0000000000000..cf4f8e7b787f3
--- /dev/null
+++ b/src/test/ui/macros/incorrrect-repetition-2.stderr
@@ -0,0 +1,21 @@
+error: `$a:expr` is followed (through repetition) by itself, which is not allowed for `expr` fragments
+ --> $DIR/incorrrect-repetition-2.rs:4:8
+ |
+LL | ($($a:expr)*) => {};
+ | ^^^^^^^ this fragment is followed by itself without a valid separator
+ |
+note: lint level defined here
+ --> $DIR/incorrrect-repetition-2.rs:1:9
+ |
+LL | #![deny(incorrect_macro_fragment_repetition)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #56575
+ = note: allowed there are: `;`, `=>` or `,`
+help: add a valid separator for the repetition to be unambiguous, for example
+ |
+LL | ($($a:expr);*) => {};
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/macros/incorrrect-repetition.rs b/src/test/ui/macros/incorrrect-repetition.rs
new file mode 100644
index 0000000000000..da648ef924bf4
--- /dev/null
+++ b/src/test/ui/macros/incorrrect-repetition.rs
@@ -0,0 +1,11 @@
+#![deny(incorrect_macro_fragment_repetition)]
+
+macro_rules! sneaky {
+ ($($i:ident $e:expr)*) => {}
+ //~^ ERROR `$e:expr` is followed (through repetition) by `$i:ident`, which is not allowed for
+ //~| WARN this was previously accepted by the compiler but is being phased out
+}
+
+fn main() {
+ sneaky!(a b c d);
+}
diff --git a/src/test/ui/macros/incorrrect-repetition.stderr b/src/test/ui/macros/incorrrect-repetition.stderr
new file mode 100644
index 0000000000000..e8e5deac589a1
--- /dev/null
+++ b/src/test/ui/macros/incorrrect-repetition.stderr
@@ -0,0 +1,23 @@
+error: `$e:expr` is followed (through repetition) by `$i:ident`, which is not allowed for `expr` fragments
+ --> $DIR/incorrrect-repetition.rs:4:17
+ |
+LL | ($($i:ident $e:expr)*) => {}
+ | -------- ^^^^^^^ this fragment is followed by the first fragment in this repetition without a valid separator
+ | |
+ | this is the first fragment in the evaluated repetition
+ |
+note: lint level defined here
+ --> $DIR/incorrrect-repetition.rs:1:9
+ |
+LL | #![deny(incorrect_macro_fragment_repetition)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #56575
+ = note: allowed there are: `;`, `=>` or `,`
+help: add a valid separator for the repetition to be unambiguous, for example
+ |
+LL | ($($i:ident $e:expr);*) => {}
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/macros/macro-follow.stderr b/src/test/ui/macros/macro-follow.stderr
index 8760f6eb572e3..16b690d6cb4d8 100644
--- a/src/test/ui/macros/macro-follow.stderr
+++ b/src/test/ui/macros/macro-follow.stderr
@@ -140,7 +140,7 @@ error: `$e:expr` is followed by `(`, which is not allowed for `expr` fragments
LL | ($e:expr ()) => {}; //~ERROR `$e:expr` is followed by `(`
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:38:15
@@ -148,7 +148,7 @@ error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments
LL | ($e:expr []) => {}; //~ERROR `$e:expr` is followed by `[`
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:39:15
@@ -156,7 +156,7 @@ error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments
LL | ($e:expr {}) => {}; //~ERROR `$e:expr` is followed by `{`
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `=`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:40:14
@@ -164,7 +164,7 @@ error: `$e:expr` is followed by `=`, which is not allowed for `expr` fragments
LL | ($e:expr =) => {}; //~ERROR `$e:expr` is followed by `=`
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `|`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:41:14
@@ -172,7 +172,7 @@ error: `$e:expr` is followed by `|`, which is not allowed for `expr` fragments
LL | ($e:expr |) => {}; //~ERROR `$e:expr` is followed by `|`
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `:`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:42:14
@@ -180,7 +180,7 @@ error: `$e:expr` is followed by `:`, which is not allowed for `expr` fragments
LL | ($e:expr :) => {}; //~ERROR `$e:expr` is followed by `:`
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `>`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:43:14
@@ -188,7 +188,7 @@ error: `$e:expr` is followed by `>`, which is not allowed for `expr` fragments
LL | ($e:expr >) => {}; //~ERROR `$e:expr` is followed by `>`
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:44:14
@@ -196,7 +196,7 @@ error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments
LL | ($e:expr +) => {}; //~ERROR `$e:expr` is followed by `+`
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `ident`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:45:14
@@ -204,7 +204,7 @@ error: `$e:expr` is followed by `ident`, which is not allowed for `expr` fragmen
LL | ($e:expr ident) => {}; //~ERROR `$e:expr` is followed by `ident`
| ^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `if`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:46:14
@@ -212,7 +212,7 @@ error: `$e:expr` is followed by `if`, which is not allowed for `expr` fragments
LL | ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if`
| ^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `in`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:47:14
@@ -220,7 +220,7 @@ error: `$e:expr` is followed by `in`, which is not allowed for `expr` fragments
LL | ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in`
| ^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$p:pat`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:48:14
@@ -228,7 +228,7 @@ error: `$e:expr` is followed by `$p:pat`, which is not allowed for `expr` fragme
LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat`
| ^^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$e:expr`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:49:14
@@ -236,7 +236,7 @@ error: `$e:expr` is followed by `$e:expr`, which is not allowed for `expr` fragm
LL | ($e:expr $e:expr) => {}; //~ERROR `$e:expr` is followed by `$e:expr`
| ^^^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$t:ty`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:50:14
@@ -244,7 +244,7 @@ error: `$e:expr` is followed by `$t:ty`, which is not allowed for `expr` fragmen
LL | ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty`
| ^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$s:stmt`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:51:14
@@ -252,7 +252,7 @@ error: `$e:expr` is followed by `$s:stmt`, which is not allowed for `expr` fragm
LL | ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt`
| ^^^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$p:path`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:52:14
@@ -260,7 +260,7 @@ error: `$e:expr` is followed by `$p:path`, which is not allowed for `expr` fragm
LL | ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path`
| ^^^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$b:block`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:53:14
@@ -268,7 +268,7 @@ error: `$e:expr` is followed by `$b:block`, which is not allowed for `expr` frag
LL | ($e:expr $b:block) => {}; //~ERROR `$e:expr` is followed by `$b:block`
| ^^^^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$i:ident`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:54:14
@@ -276,7 +276,7 @@ error: `$e:expr` is followed by `$i:ident`, which is not allowed for `expr` frag
LL | ($e:expr $i:ident) => {}; //~ERROR `$e:expr` is followed by `$i:ident`
| ^^^^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$t:tt`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:55:14
@@ -284,7 +284,7 @@ error: `$e:expr` is followed by `$t:tt`, which is not allowed for `expr` fragmen
LL | ($e:expr $t:tt) => {}; //~ERROR `$e:expr` is followed by `$t:tt`
| ^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$i:item`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:56:14
@@ -292,7 +292,7 @@ error: `$e:expr` is followed by `$i:item`, which is not allowed for `expr` fragm
LL | ($e:expr $i:item) => {}; //~ERROR `$e:expr` is followed by `$i:item`
| ^^^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$e:expr` is followed by `$m:meta`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:57:14
@@ -300,7 +300,7 @@ error: `$e:expr` is followed by `$m:meta`, which is not allowed for `expr` fragm
LL | ($e:expr $m:meta) => {}; //~ERROR `$e:expr` is followed by `$m:meta`
| ^^^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:62:13
@@ -308,7 +308,7 @@ error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments
LL | ($t:ty ()) => {}; //~ERROR `$t:ty` is followed by `(`
| ^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `+`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:64:12
@@ -316,7 +316,7 @@ error: `$t:ty` is followed by `+`, which is not allowed for `ty` fragments
LL | ($t:ty +) => {}; //~ERROR `$t:ty` is followed by `+`
| ^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `ident`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:65:12
@@ -324,7 +324,7 @@ error: `$t:ty` is followed by `ident`, which is not allowed for `ty` fragments
LL | ($t:ty ident) => {}; //~ERROR `$t:ty` is followed by `ident`
| ^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `if`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:66:12
@@ -332,7 +332,7 @@ error: `$t:ty` is followed by `if`, which is not allowed for `ty` fragments
LL | ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if`
| ^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$p:pat`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:67:12
@@ -340,7 +340,7 @@ error: `$t:ty` is followed by `$p:pat`, which is not allowed for `ty` fragments
LL | ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat`
| ^^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$e:expr`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:68:12
@@ -348,7 +348,7 @@ error: `$t:ty` is followed by `$e:expr`, which is not allowed for `ty` fragments
LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr`
| ^^^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$t:ty`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:69:12
@@ -356,7 +356,7 @@ error: `$t:ty` is followed by `$t:ty`, which is not allowed for `ty` fragments
LL | ($t:ty $t:ty) => {}; //~ERROR `$t:ty` is followed by `$t:ty`
| ^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$s:stmt`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:70:12
@@ -364,7 +364,7 @@ error: `$t:ty` is followed by `$s:stmt`, which is not allowed for `ty` fragments
LL | ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt`
| ^^^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$p:path`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:71:12
@@ -372,7 +372,7 @@ error: `$t:ty` is followed by `$p:path`, which is not allowed for `ty` fragments
LL | ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path`
| ^^^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$i:ident`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:73:12
@@ -380,7 +380,7 @@ error: `$t:ty` is followed by `$i:ident`, which is not allowed for `ty` fragment
LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident`
| ^^^^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$t:tt`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:74:12
@@ -388,7 +388,7 @@ error: `$t:ty` is followed by `$t:tt`, which is not allowed for `ty` fragments
LL | ($t:ty $t:tt) => {}; //~ERROR `$t:ty` is followed by `$t:tt`
| ^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$i:item`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:75:12
@@ -396,7 +396,7 @@ error: `$t:ty` is followed by `$i:item`, which is not allowed for `ty` fragments
LL | ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item`
| ^^^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$m:meta`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:76:12
@@ -404,7 +404,7 @@ error: `$t:ty` is followed by `$m:meta`, which is not allowed for `ty` fragments
LL | ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta`
| ^^^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:80:15
@@ -412,7 +412,7 @@ error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments
LL | ($s:stmt ()) => {}; //~ERROR `$s:stmt` is followed by `(`
| ^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:81:15
@@ -420,7 +420,7 @@ error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments
LL | ($s:stmt []) => {}; //~ERROR `$s:stmt` is followed by `[`
| ^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:82:15
@@ -428,7 +428,7 @@ error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments
LL | ($s:stmt {}) => {}; //~ERROR `$s:stmt` is followed by `{`
| ^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `=`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:83:14
@@ -436,7 +436,7 @@ error: `$s:stmt` is followed by `=`, which is not allowed for `stmt` fragments
LL | ($s:stmt =) => {}; //~ERROR `$s:stmt` is followed by `=`
| ^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `|`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:84:14
@@ -444,7 +444,7 @@ error: `$s:stmt` is followed by `|`, which is not allowed for `stmt` fragments
LL | ($s:stmt |) => {}; //~ERROR `$s:stmt` is followed by `|`
| ^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `:`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:85:14
@@ -452,7 +452,7 @@ error: `$s:stmt` is followed by `:`, which is not allowed for `stmt` fragments
LL | ($s:stmt :) => {}; //~ERROR `$s:stmt` is followed by `:`
| ^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `>`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:86:14
@@ -460,7 +460,7 @@ error: `$s:stmt` is followed by `>`, which is not allowed for `stmt` fragments
LL | ($s:stmt >) => {}; //~ERROR `$s:stmt` is followed by `>`
| ^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `+`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:87:14
@@ -468,7 +468,7 @@ error: `$s:stmt` is followed by `+`, which is not allowed for `stmt` fragments
LL | ($s:stmt +) => {}; //~ERROR `$s:stmt` is followed by `+`
| ^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `ident`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:88:14
@@ -476,7 +476,7 @@ error: `$s:stmt` is followed by `ident`, which is not allowed for `stmt` fragmen
LL | ($s:stmt ident) => {}; //~ERROR `$s:stmt` is followed by `ident`
| ^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `if`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:89:14
@@ -484,7 +484,7 @@ error: `$s:stmt` is followed by `if`, which is not allowed for `stmt` fragments
LL | ($s:stmt if) => {}; //~ERROR `$s:stmt` is followed by `if`
| ^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `in`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:90:14
@@ -492,7 +492,7 @@ error: `$s:stmt` is followed by `in`, which is not allowed for `stmt` fragments
LL | ($s:stmt in) => {}; //~ERROR `$s:stmt` is followed by `in`
| ^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$p:pat`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:91:14
@@ -500,7 +500,7 @@ error: `$s:stmt` is followed by `$p:pat`, which is not allowed for `stmt` fragme
LL | ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat`
| ^^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$e:expr`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:92:14
@@ -508,7 +508,7 @@ error: `$s:stmt` is followed by `$e:expr`, which is not allowed for `stmt` fragm
LL | ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr`
| ^^^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$t:ty`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:93:14
@@ -516,7 +516,7 @@ error: `$s:stmt` is followed by `$t:ty`, which is not allowed for `stmt` fragmen
LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty`
| ^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$s:stmt`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:94:14
@@ -524,7 +524,7 @@ error: `$s:stmt` is followed by `$s:stmt`, which is not allowed for `stmt` fragm
LL | ($s:stmt $s:stmt) => {}; //~ERROR `$s:stmt` is followed by `$s:stmt`
| ^^^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$p:path`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:95:14
@@ -532,7 +532,7 @@ error: `$s:stmt` is followed by `$p:path`, which is not allowed for `stmt` fragm
LL | ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path`
| ^^^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$b:block`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:96:14
@@ -540,7 +540,7 @@ error: `$s:stmt` is followed by `$b:block`, which is not allowed for `stmt` frag
LL | ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block`
| ^^^^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$i:ident`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:97:14
@@ -548,7 +548,7 @@ error: `$s:stmt` is followed by `$i:ident`, which is not allowed for `stmt` frag
LL | ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident`
| ^^^^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$t:tt`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:98:14
@@ -556,7 +556,7 @@ error: `$s:stmt` is followed by `$t:tt`, which is not allowed for `stmt` fragmen
LL | ($s:stmt $t:tt) => {}; //~ERROR `$s:stmt` is followed by `$t:tt`
| ^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$i:item`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:99:14
@@ -564,7 +564,7 @@ error: `$s:stmt` is followed by `$i:item`, which is not allowed for `stmt` fragm
LL | ($s:stmt $i:item) => {}; //~ERROR `$s:stmt` is followed by `$i:item`
| ^^^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$s:stmt` is followed by `$m:meta`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:100:14
@@ -572,7 +572,7 @@ error: `$s:stmt` is followed by `$m:meta`, which is not allowed for `stmt` fragm
LL | ($s:stmt $m:meta) => {}; //~ERROR `$s:stmt` is followed by `$m:meta`
| ^^^^^^^ not allowed after `stmt` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$p:path` is followed by `(`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:104:15
@@ -580,7 +580,7 @@ error: `$p:path` is followed by `(`, which is not allowed for `path` fragments
LL | ($p:path ()) => {}; //~ERROR `$p:path` is followed by `(`
| ^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `+`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:106:14
@@ -588,7 +588,7 @@ error: `$p:path` is followed by `+`, which is not allowed for `path` fragments
LL | ($p:path +) => {}; //~ERROR `$p:path` is followed by `+`
| ^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `ident`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:107:14
@@ -596,7 +596,7 @@ error: `$p:path` is followed by `ident`, which is not allowed for `path` fragmen
LL | ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident`
| ^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `if`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:108:14
@@ -604,7 +604,7 @@ error: `$p:path` is followed by `if`, which is not allowed for `path` fragments
LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if`
| ^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$p:pat`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:109:14
@@ -612,7 +612,7 @@ error: `$p:path` is followed by `$p:pat`, which is not allowed for `path` fragme
LL | ($p:path $p:pat) => {}; //~ERROR `$p:path` is followed by `$p:pat`
| ^^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$e:expr`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:110:14
@@ -620,7 +620,7 @@ error: `$p:path` is followed by `$e:expr`, which is not allowed for `path` fragm
LL | ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr`
| ^^^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$t:ty`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:111:14
@@ -628,7 +628,7 @@ error: `$p:path` is followed by `$t:ty`, which is not allowed for `path` fragmen
LL | ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty`
| ^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$s:stmt`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:112:14
@@ -636,7 +636,7 @@ error: `$p:path` is followed by `$s:stmt`, which is not allowed for `path` fragm
LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt`
| ^^^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$p:path`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:113:14
@@ -644,7 +644,7 @@ error: `$p:path` is followed by `$p:path`, which is not allowed for `path` fragm
LL | ($p:path $p:path) => {}; //~ERROR `$p:path` is followed by `$p:path`
| ^^^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$i:ident`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:115:14
@@ -652,7 +652,7 @@ error: `$p:path` is followed by `$i:ident`, which is not allowed for `path` frag
LL | ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident`
| ^^^^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$t:tt`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:116:14
@@ -660,7 +660,7 @@ error: `$p:path` is followed by `$t:tt`, which is not allowed for `path` fragmen
LL | ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt`
| ^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$i:item`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:117:14
@@ -668,7 +668,7 @@ error: `$p:path` is followed by `$i:item`, which is not allowed for `path` fragm
LL | ($p:path $i:item) => {}; //~ERROR `$p:path` is followed by `$i:item`
| ^^^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$m:meta`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:118:14
@@ -676,7 +676,7 @@ error: `$p:path` is followed by `$m:meta`, which is not allowed for `path` fragm
LL | ($p:path $m:meta) => {}; //~ERROR `$p:path` is followed by `$m:meta`
| ^^^^^^^ not allowed after `path` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: aborting due to 85 previous errors
diff --git a/src/test/ui/macros/macro-followed-by-seq-bad.stderr b/src/test/ui/macros/macro-followed-by-seq-bad.stderr
index 2ad8990e1156f..d694c4aceaf5d 100644
--- a/src/test/ui/macros/macro-followed-by-seq-bad.stderr
+++ b/src/test/ui/macros/macro-followed-by-seq-bad.stderr
@@ -4,7 +4,7 @@ error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragmen
LL | ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments
| ^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: `$a:ty` is followed by `$b:tt`, which is not allowed for `ty` fragments
--> $DIR/macro-followed-by-seq-bad.rs:18:13
@@ -12,7 +12,7 @@ error: `$a:ty` is followed by `$b:tt`, which is not allowed for `ty` fragments
LL | ( $a:ty $($b:tt)* ) => { }; //~ ERROR not allowed for `ty` fragments
| ^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/macros/macro-input-future-proofing.rs b/src/test/ui/macros/macro-input-future-proofing.rs
index e5fdba63b0f15..a9d60018a10d8 100644
--- a/src/test/ui/macros/macro-input-future-proofing.rs
+++ b/src/test/ui/macros/macro-input-future-proofing.rs
@@ -1,14 +1,5 @@
-// Copyright 2015 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 or the MIT license
-// , at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
#![allow(unused_macros)]
+#![warn(incorrect_macro_fragment_repetition)]
macro_rules! errors_everywhere {
($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty`
@@ -23,11 +14,17 @@ macro_rules! errors_everywhere {
($pa:pat $pb:pat $ty:ty ,) => ();
//~^ ERROR `$pa:pat` is followed by `$pb:pat`, which is not allowed
//~^^ ERROR `$pb:pat` is followed by `$ty:ty`, which is not allowed
- ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-`
- ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-`
+ ($ty:ty -) => (); //~ ERROR `$ty:ty` is followed by `-`
+ ($a:ty, $b:ty -) => (); //~ ERROR `$b:ty` is followed by `-`
($($ty:ty)-+) => (); //~ ERROR `$ty:ty` is followed by `-`, which is not allowed for `ty`
- ( $($a:expr)* $($b:tt)* ) => { };
+ ( $a:expr $($b:tt)* ) => { };
//~^ ERROR `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
+ ( $($a:expr)* $($b:tt)* ) => { };
+ //~^ WARN `$a:expr` is followed (through repetition) by itself, which is not allowed for
+ //~| ERROR `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
+ //~| WARN this was previously accepted by the compiler but is being phased out
+ ( $($a:expr),* $($b:tt)* ) => { };
+ //~^ ERROR `$a:expr` may be followed by `$b:tt`, which is not allowed for `expr` fragments
}
fn main() { }
diff --git a/src/test/ui/macros/macro-input-future-proofing.stderr b/src/test/ui/macros/macro-input-future-proofing.stderr
index 4bb46e39562cb..e21fe8a4a57dd 100644
--- a/src/test/ui/macros/macro-input-future-proofing.stderr
+++ b/src/test/ui/macros/macro-input-future-proofing.stderr
@@ -1,21 +1,21 @@
error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments
- --> $DIR/macro-input-future-proofing.rs:14:13
+ --> $DIR/macro-input-future-proofing.rs:5:13
|
LL | ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty`
| ^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments
- --> $DIR/macro-input-future-proofing.rs:15:13
+ --> $DIR/macro-input-future-proofing.rs:6:13
|
LL | ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty`
| ^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$pa:pat` is followed by `>`, which is not allowed for `pat` fragments
- --> $DIR/macro-input-future-proofing.rs:21:14
+ --> $DIR/macro-input-future-proofing.rs:12:14
|
LL | ($pa:pat >) => (); //~ ERROR `$pa:pat` is followed by `>`, which is not allowed for `pat`
| ^ not allowed after `pat` fragments
@@ -23,7 +23,7 @@ LL | ($pa:pat >) => (); //~ ERROR `$pa:pat` is followed by `>`, which is not
= note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in`
error: `$pa:pat` is followed by `$pb:pat`, which is not allowed for `pat` fragments
- --> $DIR/macro-input-future-proofing.rs:23:14
+ --> $DIR/macro-input-future-proofing.rs:14:14
|
LL | ($pa:pat $pb:pat $ty:ty ,) => ();
| ^^^^^^^ not allowed after `pat` fragments
@@ -31,7 +31,7 @@ LL | ($pa:pat $pb:pat $ty:ty ,) => ();
= note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in`
error: `$pb:pat` is followed by `$ty:ty`, which is not allowed for `pat` fragments
- --> $DIR/macro-input-future-proofing.rs:23:22
+ --> $DIR/macro-input-future-proofing.rs:14:22
|
LL | ($pa:pat $pb:pat $ty:ty ,) => ();
| ^^^^^^ not allowed after `pat` fragments
@@ -39,36 +39,71 @@ LL | ($pa:pat $pb:pat $ty:ty ,) => ();
= note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in`
error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments
- --> $DIR/macro-input-future-proofing.rs:26:17
+ --> $DIR/macro-input-future-proofing.rs:17:13
|
-LL | ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-`
- | ^ not allowed after `ty` fragments
+LL | ($ty:ty -) => (); //~ ERROR `$ty:ty` is followed by `-`
+ | ^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$b:ty` is followed by `-`, which is not allowed for `ty` fragments
- --> $DIR/macro-input-future-proofing.rs:27:23
+ --> $DIR/macro-input-future-proofing.rs:18:19
|
-LL | ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-`
- | ^ not allowed after `ty` fragments
+LL | ($a:ty, $b:ty -) => (); //~ ERROR `$b:ty` is followed by `-`
+ | ^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments
- --> $DIR/macro-input-future-proofing.rs:28:7
+ --> $DIR/macro-input-future-proofing.rs:19:7
|
LL | ($($ty:ty)-+) => (); //~ ERROR `$ty:ty` is followed by `-`, which is not allowed for `ty`
| ^^^^^^^^ not allowed after `ty` fragments
|
- = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+ = note: allowed there are: `,`, `{`, `[`, `=>`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
- --> $DIR/macro-input-future-proofing.rs:29:21
+ --> $DIR/macro-input-future-proofing.rs:20:17
+ |
+LL | ( $a:expr $($b:tt)* ) => { };
+ | ^^^^^ not allowed after `expr` fragments
+ |
+ = note: allowed there are: `;`, `=>` or `,`
+
+error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
+ --> $DIR/macro-input-future-proofing.rs:22:21
|
LL | ( $($a:expr)* $($b:tt)* ) => { };
| ^^^^^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
+
+error: `$a:expr` may be followed by `$b:tt`, which is not allowed for `expr` fragments
+ --> $DIR/macro-input-future-proofing.rs:26:22
+ |
+LL | ( $($a:expr),* $($b:tt)* ) => { };
+ | ^^^^^ not allowed after `expr` fragments
+ |
+ = note: allowed there are: `;`, `=>` or `,`
+
+warning: `$a:expr` is followed (through repetition) by itself, which is not allowed for `expr` fragments
+ --> $DIR/macro-input-future-proofing.rs:22:9
+ |
+LL | ( $($a:expr)* $($b:tt)* ) => { };
+ | ^^^^^^^ this fragment is followed by itself without a valid separator
+ |
+note: lint level defined here
+ --> $DIR/macro-input-future-proofing.rs:2:9
+ |
+LL | #![warn(incorrect_macro_fragment_repetition)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #56575
+ = note: allowed there are: `;`, `=>` or `,`
+help: add a valid separator for the repetition to be unambiguous, for example
+ |
+LL | ( $($a:expr);* $($b:tt)* ) => { };
+ | ^
-error: aborting due to 9 previous errors
+error: aborting due to 11 previous errors
diff --git a/src/test/ui/unused/unused-macro-with-follow-violation.stderr b/src/test/ui/unused/unused-macro-with-follow-violation.stderr
index 78362fcb05a8c..776cf36674b81 100644
--- a/src/test/ui/unused/unused-macro-with-follow-violation.stderr
+++ b/src/test/ui/unused/unused-macro-with-follow-violation.stderr
@@ -4,7 +4,7 @@ error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments
LL | ($e:expr +) => () //~ ERROR not allowed for `expr` fragments
| ^ not allowed after `expr` fragments
|
- = note: allowed there are: `=>`, `,` or `;`
+ = note: allowed there are: `;`, `=>` or `,`
error: aborting due to previous error