mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			227 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			227 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ run-pass
 | |
| macro_rules! foo {
 | |
|     ($l:lifetime) => {
 | |
|         fn f(arg: &$l str) -> &$l str {
 | |
|             arg
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| pub fn main() {
 | |
|     foo!('static);
 | |
|     let x: &'static str = f("hi");
 | |
|     assert_eq!("hi", x);
 | |
| }
 | 
