Skip to content

Commit 4ab3e9d

Browse files
committed
Add a failing case to tests/ui/macros/macro-interpolation.
This test currently tests the successful paths for the `Interpolated`/`NtTy`/`Path` case in `parse_path_inner`, but it doesn't test the failure path.
1 parent e8f7333 commit 4ab3e9d

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

tests/ui/macros/macro-interpolation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// run-pass
2-
31
macro_rules! overly_complicated {
42
($fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path) =>
53
({
@@ -21,12 +19,14 @@ macro_rules! qpath {
2119

2220
(ty, <$type:ty as $trait:ty>::$name:ident) => {
2321
<$type as $trait>::$name
22+
//~^ ERROR expected identifier, found `!`
2423
};
2524
}
2625

2726
pub fn main() {
2827
let _: qpath!(path, <str as ToOwned>::Owned);
2928
let _: qpath!(ty, <str as ToOwned>::Owned);
29+
let _: qpath!(ty, <str as !>::Owned);
3030

3131
assert!(overly_complicated!(f, x, Option<usize>, { return Some(x); },
3232
Some(8), Some(y), y) == 8)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: expected identifier, found `!`
2+
--> $DIR/macro-interpolation.rs:21:19
3+
|
4+
LL | <$type as $trait>::$name
5+
| ^^^^^^ expected identifier
6+
...
7+
LL | let _: qpath!(ty, <str as !>::Owned);
8+
| -----------------------------
9+
| |
10+
| this macro call doesn't expand to a type
11+
| in this macro invocation
12+
|
13+
= note: this error originates in the macro `qpath` (in Nightly builds, run with -Z macro-backtrace for more info)
14+
15+
error: aborting due to previous error
16+

0 commit comments

Comments
 (0)