mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-30 20:44:34 +00:00 
			
		
		
		
	 e80a3e2232
			
		
	
	
		e80a3e2232
		
	
	
	
	
		
			
			This test is intended to demonstrate that a particular macro-argument span doesn't get lost during span-refinement, but it turns out that span-extraction currently doesn't yield any MIR spans for this position. This patch therefore tweaks the test to add a function call in that position, so that it still remains relevant to span refinement.
		
			
				
	
	
		
			23 lines
		
	
	
		
			497 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			497 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ edition: 2021
 | |
| 
 | |
| use core::hint::black_box;
 | |
| 
 | |
| #[derive(Debug, PartialEq)]
 | |
| struct Foo(u32);
 | |
| 
 | |
| fn main() {
 | |
|     assert_ne!(
 | |
|         black_box(Foo(5)), // Make sure this expression's span isn't lost.
 | |
|         if black_box(false) {
 | |
|             Foo(0) //
 | |
|         } else {
 | |
|             Foo(1) //
 | |
|         }
 | |
|     );
 | |
|     ()
 | |
| }
 | |
| 
 | |
| // This test is a short fragment extracted from `issue-84561.rs`, highlighting
 | |
| // a particular span of code that can easily be lost if overlapping spans are
 | |
| // processed incorrectly.
 |