diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-22 08:16:39 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-24 00:59:38 +0100 |
| commit | a05c83b2ebc4e85e32f723e708a40dbd3f165cd0 (patch) | |
| tree | 8a5fe4fb32c7968db725c058c3991bcd4a3cdfd0 /src/test/ui/parser/macro | |
| parent | a63f35daeefc4ae89ba5b6bd0323d97bb0d050e6 (diff) | |
| download | rust-a05c83b2ebc4e85e32f723e708a40dbd3f165cd0.tar.gz rust-a05c83b2ebc4e85e32f723e708a40dbd3f165cd0.zip | |
parse: use `parse_item_common` in `parse_assoc_item_`.
Diffstat (limited to 'src/test/ui/parser/macro')
| -rw-r--r-- | src/test/ui/parser/macro/trait-non-item-macros.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/parser/macro/trait-non-item-macros.stderr | 23 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/test/ui/parser/macro/trait-non-item-macros.rs b/src/test/ui/parser/macro/trait-non-item-macros.rs index 5021886bf98..97fb564bf64 100644 --- a/src/test/ui/parser/macro/trait-non-item-macros.rs +++ b/src/test/ui/parser/macro/trait-non-item-macros.rs @@ -1,10 +1,13 @@ macro_rules! bah { - ($a:expr) => ($a) - //~^ ERROR expected one of `async` + ($a:expr) => { + $a + }; //~^ ERROR macro expansion ignores token `2` and any following } -trait bar { +trait Bar { bah!(2); } -fn main() {} +fn main() { + let _recovery_witness: () = 0; //~ ERROR mismatched types +} diff --git a/src/test/ui/parser/macro/trait-non-item-macros.stderr b/src/test/ui/parser/macro/trait-non-item-macros.stderr index c76b096a1eb..35e5bfe62f5 100644 --- a/src/test/ui/parser/macro/trait-non-item-macros.stderr +++ b/src/test/ui/parser/macro/trait-non-item-macros.stderr @@ -1,13 +1,22 @@ -error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `static`, `type`, `unsafe`, or identifier, found `2` - --> $DIR/trait-non-item-macros.rs:2:19 +error: macro expansion ignores token `2` and any following + --> $DIR/trait-non-item-macros.rs:3:9 | -LL | ($a:expr) => ($a) - | ^^ expected one of 11 possible tokens +LL | $a + | ^^ ... LL | bah!(2); - | -------- in this macro invocation + | -------- caused by the macro expansion here | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: the usage of `bah!` is likely invalid in trait item context -error: aborting due to previous error +error[E0308]: mismatched types + --> $DIR/trait-non-item-macros.rs:12:33 + | +LL | let _recovery_witness: () = 0; + | -- ^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. |
