From 558ddee2cea3063a487393ea292126259702fe97 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 22 Nov 2021 19:58:18 -0800 Subject: [PATCH] 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, ::Owned); | ----------------------------------- | | | this macro call doesn't expand to a type | in this macro invocation --- src/test/ui/macros/macro-interpolation.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/ui/macros/macro-interpolation.rs b/src/test/ui/macros/macro-interpolation.rs index 2dee804fb31..35003a79ad7 100644 --- a/src/test/ui/macros/macro-interpolation.rs +++ b/src/test/ui/macros/macro-interpolation.rs @@ -15,13 +15,18 @@ fn $fnname($arg: $ty) -> Option<$ty> $body } macro_rules! qpath { - (<$type:ty as $trait:path>::$name:ident) => { + (path, <$type:ty as $trait:path>::$name:ident) => { + <$type as $trait>::$name + }; + + (ty, <$type:ty as $trait:ty>::$name:ident) => { <$type as $trait>::$name }; } pub fn main() { - let _: qpath!(::Owned); + let _: qpath!(path, ::Owned); + let _: qpath!(ty, ::Owned); assert!(overly_complicated!(f, x, Option, { return Some(x); }, Some(8), Some(y), y) == 8)