diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-06-12 16:17:09 -0400 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-06-15 15:44:59 +0000 |
commit | 7671253eda836193313586013e92dde3d14f5ebe (patch) | |
tree | 095de95237928b67486755f6ba2420774f50744e | |
parent | b028c7ece2ad67236e55a38b776c0bf70408a53e (diff) | |
download | gcc-7671253eda836193313586013e92dde3d14f5ebe.zip gcc-7671253eda836193313586013e92dde3d14f5ebe.tar.gz gcc-7671253eda836193313586013e92dde3d14f5ebe.tar.bz2 |
Remove direct error on macro rule count-related match failure
gcc/rust/ChangeLog:
* expand/rust-macro-expand.cc
(MacroExpander::match_repetition): Remove redundant rust_error_at call.
gcc/testsuite/ChangeLog:
* rust/compile/macro6.rs: Remove check for direct error.
* rust/compile/macro7.rs: Likewise.
* rust/compile/macro-issue2229.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 7 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/macro-issue2229.rs | 6 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/macro6.rs | 2 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/macro7.rs | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index 00a0a5f..9858049 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -694,13 +694,6 @@ MacroExpander::match_repetition (Parser<MacroInvocLexer> &parser, gcc_unreachable (); } - if (!res) - rust_error_at (rep.get_match_locus (), - "invalid amount of matches for macro invocation. Expected " - "between %s and %s, got %lu", - lo_str.c_str (), hi_str.c_str (), - (unsigned long) match_amount); - rust_debug_loc (rep.get_match_locus (), "%s matched %lu times", res ? "successfully" : "unsuccessfully", (unsigned long) match_amount); diff --git a/gcc/testsuite/rust/compile/macro-issue2229.rs b/gcc/testsuite/rust/compile/macro-issue2229.rs new file mode 100644 index 0000000..c148ff5 --- /dev/null +++ b/gcc/testsuite/rust/compile/macro-issue2229.rs @@ -0,0 +1,6 @@ +macro_rules! foo { + ($(+)+) => {e}; + () => {} +} + +foo!(); diff --git a/gcc/testsuite/rust/compile/macro6.rs b/gcc/testsuite/rust/compile/macro6.rs index 0ca35ba..9c54a67 100644 --- a/gcc/testsuite/rust/compile/macro6.rs +++ b/gcc/testsuite/rust/compile/macro6.rs @@ -1,5 +1,5 @@ macro_rules! zero_or_one { - ($($a:literal)?) => { // { dg-error "invalid amount of matches for macro invocation. Expected between 0 and 1, got 2" } + ($($a:literal)?) => { f(); } } diff --git a/gcc/testsuite/rust/compile/macro7.rs b/gcc/testsuite/rust/compile/macro7.rs index abc4805..563acdd 100644 --- a/gcc/testsuite/rust/compile/macro7.rs +++ b/gcc/testsuite/rust/compile/macro7.rs @@ -1,7 +1,7 @@ fn f() {} macro_rules! one_or_more { - ($($a:literal)+) => { // { dg-error "invalid amount of matches for macro invocation" } + ($($a:literal)+) => { f(); }; } |