- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
          For async closures, cap closure kind, get rid of by_mut_body
          #120717
        
          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
Conversation
| 
           Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt  | 
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
           ☔ The latest upstream changes (presumably #120712) made this pull request unmergeable. Please resolve the merge conflicts.  | 
    
b40b710    to
    62cf533      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
62cf533    to
    7e78369      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
           ☔ The latest upstream changes (presumably #121356) made this pull request unmergeable. Please resolve the merge conflicts.  | 
    
7e78369    to
    a6570ec      
    Compare
  
    | 
           ☔ The latest upstream changes (presumably #121800) made this pull request unmergeable. Please resolve the merge conflicts.  | 
    
a6570ec    to
    5df00fc      
    Compare
  
    | 
           r? oli-obk This is almost certainly not commented enough; please let me know where I should go into more detail.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk if it's a good time to start documenting how async closures work in the unstable-book, but may be good to have a single central thing to link to
| 
           ☔ The latest upstream changes (presumably #122241) made this pull request unmergeable. Please resolve the merge conflicts.  | 
    
5df00fc    to
    89fa3e9      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
89fa3e9    to
    9f03a2b      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
9f03a2b    to
    541858e      
    Compare
  
    by_mut_bodyby_mut_body
      | 
           @bors r+  | 
    
| 
           ☀️ Test successful - checks-actions  | 
    
| 
           Finished benchmarking commit (c86f3ac): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment. 
 Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment. 
 CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 670.215s -> 668.111s (-0.31%)  | 
    
…losure, r=bjorn3 Add `async-closures/once.rs` back to cranelift tests This was fixed afaict by rust-lang#120717 r? `@bjorn3`
Rollup merge of rust-lang#123022 - compiler-errors:clif-tests-async-closure, r=bjorn3 Add `async-closures/once.rs` back to cranelift tests This was fixed afaict by rust-lang#120717 r? `@bjorn3`
Right now we have three
AsyncFn*traits, and three corresponding futures that are returned by thecall_*functions for them. This is fine, but it is a bit excessive, since the future returned byAsyncFnandAsyncFnMutare identical. Really, the only distinction we need to make with these bodies is "by ref" and "by move".This PR removes
AsyncFn::CallFutureand renamesAsyncFnMut::CallMutFuturetoAsyncFnMut::CallRefFuture. This simplifies MIR building for async closures, since we don't need to build an extra "by mut" body, but just a "by move" body which is materially different.We need to do a bit of delicate handling of the ClosureKind for async closures, since we need to "cap" it to
AsyncFnMutin some cases when we only care about what body we're looking for.This also fixes a bug where
<{async closure} as Fn>::callwas returning a body that takes the async-closure receiver by move.This also helps align the
AsyncFntraits to theLendingFntraits' eventual designs.