- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
resolve: disallow labelled breaks/continues through closures/async blocks #73726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            bors
  merged 1 commit into
  rust-lang:master
from
davidtwco:issue-73541-labelled-break-through-closure-async
  
      
      
   
  Jul 3, 2020 
      
    
                
     Merged
            
            resolve: disallow labelled breaks/continues through closures/async blocks #73726
                    bors
  merged 1 commit into
  rust-lang:master
from
davidtwco:issue-73541-labelled-break-through-closure-async
  
      
      
   
  Jul 3, 2020 
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
              
                    estebank
  
              
              reviewed
              
                  
                    Jun 25, 2020 
                  
              
              
            
            
e284e61    to
    701df52      
    Compare
  
    | (I'm no longer on remote work, so I'll review with delays now.) | 
              
                    petrochenkov
  
              
              reviewed
              
                  
                    Jul 2, 2020 
                  
              
              
            
            
| Also the commits need squashing. | 
This commit modifies resolve to disallow `break`/`continue` to labels through closures or async blocks. This doesn't make sense and should have been prohibited anyway. Signed-off-by: David Wood <david@davidtw.co>
701df52    to
    cb541dc      
    Compare
  
    | 
 Fixed! | 
| @bors r+ | 
| 📌 Commit cb541dc has been approved by  | 
    
  Manishearth 
      added a commit
        to Manishearth/rust
      that referenced
      this pull request
    
      Jul 2, 2020 
    
    
      
  
    
      
    
  
…k-through-closure-async, r=petrochenkov resolve: disallow labelled breaks/continues through closures/async blocks Fixes rust-lang#73541. This PR modifies name resolution to prohibit labelled breaks/continues through closures or async blocks, fixing an ICE. In addition, it improves the diagnostics surrounding labelled breaks/continues through closures or async blocks by informing the user if the label exists in an parent scope and telling them that won't work. r? @petrochenkov (resolve) cc @estebank (diagnostic changes) @tmandry (issue is from `wg-async-foundations`)
    
  bors 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Jul 2, 2020 
    
    
      
  
    
      
    
  
…arth Rollup of 8 pull requests Successful merges: - rust-lang#73454 (Move contributing.md to rustc-dev-guide and point at getting started) - rust-lang#73724 (Use WASM's saturating casts if they are available) - rust-lang#73726 (resolve: disallow labelled breaks/continues through closures/async blocks) - rust-lang#73753 (Use 'tcx for references to AccessLevels wherever possible.) - rust-lang#73781 (Update psm version) - rust-lang#73952 (Add option for local docker testing.) - rust-lang#73957 (disable BTree min_max test in Miri for now) - rust-lang#73975 (Document rustc_ast::ast::Pat) Failed merges: r? @ghost
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    S-waiting-on-bors
  Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Fixes #73541.
This PR modifies name resolution to prohibit labelled breaks/continues through closures or async blocks, fixing an ICE. In addition, it improves the diagnostics surrounding labelled breaks/continues through closures or async blocks by informing the user if the label exists in an parent scope and telling them that won't work.
r? @petrochenkov (resolve)
cc @estebank (diagnostic changes) @tmandry (issue is from
wg-async-foundations)