Skip to content

Commit 558ddee

Browse files
committed
Add test of NtTy in a qpath
Currently fails: error: expected identifier, found `ToOwned` --> src/test/ui/macros/macro-interpolation.rs:23:19 | LL | <$type as $trait>::$name | ^^^^^^ expected identifier ... LL | let _: qpath!(ty, <str as ToOwned>::Owned); | ----------------------------------- | | | this macro call doesn't expand to a type | in this macro invocation
1 parent 01800ca commit 558ddee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/ui/macros/macro-interpolation.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ macro_rules! overly_complicated {
1515
}
1616

1717
macro_rules! qpath {
18-
(<$type:ty as $trait:path>::$name:ident) => {
18+
(path, <$type:ty as $trait:path>::$name:ident) => {
19+
<$type as $trait>::$name
20+
};
21+
22+
(ty, <$type:ty as $trait:ty>::$name:ident) => {
1923
<$type as $trait>::$name
2024
};
2125
}
2226

2327
pub fn main() {
24-
let _: qpath!(<str as ToOwned>::Owned);
28+
let _: qpath!(path, <str as ToOwned>::Owned);
29+
let _: qpath!(ty, <str as ToOwned>::Owned);
2530

2631
assert!(overly_complicated!(f, x, Option<usize>, { return Some(x); },
2732
Some(8), Some(y), y) == 8)

0 commit comments

Comments
 (0)