File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ // 
2+ // popped up in in #94012, where an alternative desugaring was 
3+ // causing unreachable code errors 
4+ 
5+ #![ feature( let_else) ]  
6+ #![ deny( unused_variables) ]  
7+ #![ deny( unreachable_code) ]  
8+ 
9+ fn  let_else_diverge ( )  -> bool  { 
10+     let  Some ( _)  = Some ( "test" )  else  { 
11+         let  x = 5 ;  //~ ERROR unused variable: `x` 
12+         return  false ; 
13+     } ; 
14+     return  true ; 
15+ } 
16+ 
17+ fn  main ( )  { 
18+     let_else_diverge ( ) ; 
19+ } 
Original file line number Diff line number Diff line change 1+ error: unused variable: `x`
2+   --> $DIR/let-else-then-diverge.rs:11:13
3+    |
4+ LL |         let x = 5;
5+    |             ^ help: if this is intentional, prefix it with an underscore: `_x`
6+    |
7+ note: the lint level is defined here
8+   --> $DIR/let-else-then-diverge.rs:6:9
9+    |
10+ LL | #![deny(unused_variables)]
11+    |         ^^^^^^^^^^^^^^^^
12+ 
13+ error: aborting due to previous error
14+ 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments