Add test of qpath interpolations

This commit is contained in:
David Tolnay 2021-11-22 19:57:08 -08:00
parent dd549dcab4
commit 01800caddf
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -14,8 +14,15 @@ macro_rules! overly_complicated {
} }
macro_rules! qpath {
(<$type:ty as $trait:path>::$name:ident) => {
<$type as $trait>::$name
};
}
pub fn main() { pub fn main() {
let _: qpath!(<str as ToOwned>::Owned);
assert!(overly_complicated!(f, x, Option<usize>, { return Some(x); }, assert!(overly_complicated!(f, x, Option<usize>, { return Some(x); },
Some(8), Some(y), y) == 8) Some(8), Some(y), y) == 8)
} }