Skip to content

Commit e103585

Browse files
committed
Change from $(,)? to $(,)* for ctest
`ctest` sometimes reports a parsing failure but it isn't consistent (I do not know why). Just use a less ideal older syntax for now, this is an internal macro. (backport <rust-lang#4120>) (cherry picked from commit 27ad994)
1 parent ae052d3 commit e103585

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/macros.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,14 @@ macro_rules! e {
197197

198198
// FIXME(ctest): ctest can't handle `const extern` functions, we should be able to remove this
199199
// cfg completely.
200+
// FIXME(ctest): ctest can't handle `$(,)?` so we use `$(,)*` which isn't quite correct.
200201
cfg_if! {
201202
if #[cfg(feature = "const-extern-fn")] {
202203
/// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled.
203204
macro_rules! f {
204205
($(
205206
$(#[$attr:meta])*
206-
pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty
207+
pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty
207208
$body:block
208209
)*) => ($(
209210
#[inline]
@@ -217,7 +218,7 @@ cfg_if! {
217218
macro_rules! safe_f {
218219
($(
219220
$(#[$attr:meta])*
220-
pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty
221+
pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty
221222
$body:block
222223
)*) => ($(
223224
#[inline]
@@ -231,7 +232,7 @@ cfg_if! {
231232
macro_rules! const_fn {
232233
($(
233234
$(#[$attr:meta])*
234-
$({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty
235+
$({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty
235236
$body:block
236237
)*) => ($(
237238
#[inline]
@@ -245,7 +246,7 @@ cfg_if! {
245246
macro_rules! f {
246247
($(
247248
$(#[$attr:meta])*
248-
pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty
249+
pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty
249250
$body:block
250251
)*) => ($(
251252
#[inline]
@@ -259,7 +260,7 @@ cfg_if! {
259260
macro_rules! safe_f {
260261
($(
261262
$(#[$attr:meta])*
262-
pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty
263+
pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty
263264
$body:block
264265
)*) => ($(
265266
#[inline]
@@ -273,7 +274,7 @@ cfg_if! {
273274
macro_rules! const_fn {
274275
($(
275276
$(#[$attr:meta])*
276-
$({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)?) -> $ret:ty
277+
$({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty
277278
$body:block
278279
)*) => ($(
279280
#[inline]

0 commit comments

Comments
 (0)