Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion compiler/rustc_expand/src/mbe/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,12 @@ fn metavar_expr_concat<'tx>(
};
match &named_matches[*curr_idx] {
// FIXME(c410-f3r) Nested repetitions are unimplemented
MatchedSeq(_) => unimplemented!(),
MatchedSeq(_) => {
return Err(dcx.struct_span_err(
ident.span,
"nested repetitions with `${concat(...)}` metavariable expressions are not yet supported",
));
}
MatchedSingle(pnr) => extract_symbol_from_pnr(dcx, pnr, ident.span)?,
}
}
Expand Down
5 changes: 0 additions & 5 deletions tests/crashes/140479.rs

This file was deleted.

21 changes: 21 additions & 0 deletions tests/ui/macros/macro-metavar-expr-concat/in-repetition.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// issue: <https://github.com/rust-lang/rust/issues/140479>
// Ensure a proper compiler error, instead of an ICE occurs.
// FIXME(macro_metavar_expr_concat): this error message could be improved
#![feature(macro_metavar_expr_concat)]

macro_rules! InRepetition {
(
$(
$($arg:ident),+
)+
) => {
$(
$(
${concat(_, $arg)} //~ ERROR nested repetitions with `${concat(...)}` metavariable expressions are not yet supported
)*
)*
};
}
InRepetition!(other);

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: nested repetitions with `${concat(...)}` metavariable expressions are not yet supported
--> $DIR/in-repetition.rs:14:30
|
LL | ${concat(_, $arg)}
| ^^^

error: aborting due to 1 previous error

Loading