mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-03 22:49:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			411 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			411 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
// https://github.com/rust-lang/rust/issues/5718
 | 
						|
//@ run-pass
 | 
						|
 | 
						|
struct Element;
 | 
						|
 | 
						|
macro_rules! foo {
 | 
						|
    ($tag: expr, $string: expr) => {
 | 
						|
        if $tag == $string {
 | 
						|
            let element: Box<_> = Box::new(Element);
 | 
						|
            unsafe {
 | 
						|
                return std::mem::transmute::<_, usize>(element);
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
fn bar() -> usize {
 | 
						|
    foo!("a", "b");
 | 
						|
    0
 | 
						|
}
 | 
						|
 | 
						|
fn main() {
 | 
						|
    bar();
 | 
						|
}
 |