mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	 87c2f9a5be
			
		
	
	
		87c2f9a5be
		
	
	
	
	
		
			
			This reverts commit 1d35638dc38dbfbf1cc2a9823135dfcf3c650169, reversing changes made to f23a80a4c2fbca593b64e70f5970368824b4c5e9.
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|    LL|       |#![feature(coverage_attribute)]
 | |
|    LL|       |//@ edition: 2021
 | |
|    LL|       |
 | |
|    LL|       |// Regression test for <https://github.com/rust-lang/rust/issues/122738>.
 | |
|    LL|       |// These code patterns should not trigger an ICE when allocating a physical
 | |
|    LL|       |// counter to a node and also one of its in-edges, because that is allowed
 | |
|    LL|       |// when the node contains a tight loop to itself.
 | |
|    LL|       |
 | |
|    LL|      1|fn loopy(cond: bool) {
 | |
|    LL|      1|    let true = cond else { loop {} };
 | |
|                                          ^0
 | |
|    LL|      1|}
 | |
|    LL|       |
 | |
|    LL|       |// Variant that also has `loop {}` on the success path.
 | |
|    LL|       |// This isn't needed to catch the original ICE, but might help detect regressions.
 | |
|    LL|      0|fn _loop_either_way(cond: bool) {
 | |
|    LL|      0|    let true = cond else { loop {} };
 | |
|    LL|      0|    loop {}
 | |
|    LL|       |}
 | |
|    LL|       |
 | |
|    LL|       |// Variant using regular `if` instead of let-else.
 | |
|    LL|       |// This doesn't trigger the original ICE, but might help detect regressions.
 | |
|    LL|      0|fn _if(cond: bool) {
 | |
|    LL|      0|    if cond { loop {} } else { loop {} }
 | |
|    LL|       |}
 | |
|    LL|       |
 | |
|    LL|       |#[coverage(off)]
 | |
|    LL|       |fn main() {
 | |
|    LL|       |    loopy(true);
 | |
|    LL|       |}
 | |
| 
 |