about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-11 10:43:20 +0000
committerbors <bors@rust-lang.org>2018-06-11 10:43:20 +0000
commit13f8d073fe5c87638d9ebe849c5fdd80e87da95a (patch)
tree0d0471bcb122e2d35c2ad951a2555c6f08e3da20 /src/test/compile-fail
parent18a00bd9855421a74f40a29fcb4dd2e0c8bea59f (diff)
parent987020846ce40ce479df3d62adc47ca4609a5317 (diff)
Auto merge of #51480 - dtolnay:lifetime, r=kennytm
Enable fall through past $:lifetime matcher

```rust
macro_rules! is_lifetime {
    ($lifetime:lifetime) => { true };
    ($other:tt) => { false };
}

fn main() {
    println!("{}", is_lifetime!('lifetime));
    println!("{}", is_lifetime!(@));
}
```

Before this fix, the `is_lifetime!` invocation would fail to compile with:

```
error: expected a lifetime, found `@`
 --> src/main.rs:8:33
  |
8 |     println!("{}", is_lifetime!(@));
  |                                 ^
```

Fixes #50903.
Fixes #51477.

r? @kennytm
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/macro-non-lifetime.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/compile-fail/macro-non-lifetime.rs b/src/test/compile-fail/macro-non-lifetime.rs
index a2706e83229..647d7aaa759 100644
--- a/src/test/compile-fail/macro-non-lifetime.rs
+++ b/src/test/compile-fail/macro-non-lifetime.rs
@@ -16,5 +16,5 @@ macro_rules! m { ($x:lifetime) => { } }
 
 fn main() {
     m!(a);
-    //~^ ERROR expected a lifetime, found `a`
+    //~^ ERROR no rules expected the token `a`
 }