mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-03 22:49:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			244 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			244 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
// run-pass
 | 
						|
 | 
						|
#![feature(decl_macro)]
 | 
						|
 | 
						|
pub struct Foo {
 | 
						|
    bar: u32,
 | 
						|
}
 | 
						|
pub macro pattern($a:pat) {
 | 
						|
    Foo { bar: $a }
 | 
						|
}
 | 
						|
 | 
						|
fn main() {
 | 
						|
    match (Foo { bar: 3 }) {
 | 
						|
        pattern!(3) => println!("Test OK"),
 | 
						|
        _ => unreachable!(),
 | 
						|
    }
 | 
						|
}
 |