- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
don't clone types that are copy, round two. #68459
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
b1bfc3b    to
    7841664      
    Compare
  
    | ☔ The latest upstream changes (presumably #68474) made this pull request unmergeable. Please resolve the merge conflicts. | 
7841664    to
    28f1d62      
    Compare
  
    | Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact  | 
28f1d62    to
    5627a3f      
    Compare
  
    5627a3f    to
    09f9701      
    Compare
  
            
          
                src/librustc_errors/emitter.rs
              
                Outdated
          
        
      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.
You might want to leave it for another PR but level should probably be Level, not &Level.
@petrochenkov and/or @estebank might know more about what's happening in this code though.
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.
I think at some point Level wasn't Copy, this is probably just a leftover from that.
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.
cc @matthewjasper Why is there a reference to a Local here - is it a mutable reference perhaps?
        
          
                src/librustc_mir/borrow_check/mod.rs
              
                Outdated
          
        
      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.
@oli-obk @spastorino Maybe we need to consider passing Place by value more often?
(it's a pair of an integer and a pointer, so it should be really compact)
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.
That doesn't work if there are subslices of the projection involved. We do have a PlaceRef type for exactly that use case though
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.
Yeah, except in the cases @oli-obk mentions I'd change most of the uses to take Place by value. I need to do a bunch of cleanups still :).
4dac326    to
    8cc79ab      
    Compare
  
            
          
                src/librustc/mir/mod.rs
              
                Outdated
          
        
      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.
This entire .map(|elem| ...) feels like .copied().
So really, projs is just self.projs.clone().
Or better, self.projs.fold_with(folder) (and derive/impl TypeFoldable on ProjectionElem if it doesn't already have that - it should, though).
        
          
                src/librustc/mir/mod.rs
              
                Outdated
          
        
      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.
Actually, the way this is structured is probably a bad idea and should be exhaustive, hmpf.
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.
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -2466,7 +2466,13 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
                 Deref => Deref,
                 Field(f, ()) => Field(*f, ()),
                 Index(()) => Index(()),
-                elem => *elem,
+                Downcast(symbol, variantidx) => Downcast(*symbol, *variantidx),
+                ConstantIndex { offset, min_length, from_end } => {
+                    ConstantIndex { offset: *offset, min_length: *min_length, from_end: *from_end }
+                }
+                Subslice { from, to, from_end } => {
+                    Subslice { from: *from, to: *to, from_end: *from_end }
+                }
             })
             .collect();
8cc79ab    to
    c3d79c0      
    Compare
  
    c3d79c0    to
    6a722ac      
    Compare
  
    | @bors r+ Thanks! | 
| 📌 Commit 6a722acfa9700993dabea1ae4f766cc208cbf94c has been approved by  | 
| ☔ The latest upstream changes (presumably #68407) made this pull request unmergeable. Please resolve the merge conflicts. | 
6a722ac    to
    f7dcdcc      
    Compare
  
    | @bors r+ | 
| 📌 Commit f7dcdcc has been approved by  | 
| ⌛ Testing commit f7dcdcc with merge fa4004a3d536df6cda05dd0a48c9d65eb5b40172... | 
| @bors retry Yielding priority to the stable release. | 
don't clone types that are copy, round two. Apparently fixing some of these issues makes clippy find even more so I did a couple of rounds now. r? @eddyb
Apparently fixing some of these issues makes clippy find even more so I did a couple of rounds now.
r? @eddyb