diff options
Diffstat (limited to 'tests/ui/macros/macro-lifetime.rs')
-rw-r--r-- | tests/ui/macros/macro-lifetime.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/macros/macro-lifetime.rs b/tests/ui/macros/macro-lifetime.rs new file mode 100644 index 000000000..5931fe009 --- /dev/null +++ b/tests/ui/macros/macro-lifetime.rs @@ -0,0 +1,14 @@ +// run-pass +macro_rules! foo { + ($l:lifetime) => { + fn f<$l>(arg: &$l str) -> &$l str { + arg + } + } +} + +pub fn main() { + foo!('a); + let x: &'static str = f("hi"); + assert_eq!("hi", x); +} |