- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
const-eval: fix and re-enable pointer fragment support #148259
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
base: master
Are you sure you want to change the base?
Conversation
| 
           
  | 
    
9058e28    to
    4cce5fe      
    Compare
  
    
          
 As I commented a moment ago on an unrelated matter in #145954 (comment): 
 In that light, we would FCP the restabilization here. It should be an easy call for us given the earlier decision.  | 
    
| 
           This seems right to me. I propose we restabilize this. @rfcbot fcp merge  | 
    
| 
           Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.  | 
    
        
          
                compiler/rustc_middle/src/mir/interpret/allocation/provenance_map.rs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      4e023d0    to
    739d035      
    Compare
  
    | fn get_alloc_id(self) -> Option<AllocId>; | ||
| 
               | 
          ||
| /// Defines the 'join' of provenance: what happens when doing a pointer load and different bytes have different provenance. | ||
| fn join(left: Self, right: Self) -> Option<Self>; | 
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'm getting rid of the join function because the code that used it anyway had to special-case wildcards, and then it became easier to just have the entire wildcard logic there rather than having some of it inside join.
739d035    to
    32b18d6      
    Compare
  
    | 
           Do we need tests for #147959?  | 
    
          
 Good point, I added that.  | 
    
32b18d6    to
    bfad332      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
bfad332    to
    cbe268a      
    Compare
  
    | pub struct PointerFrag<Prov> { | ||
| /// The position of this fragment inside the pointer (in `0..8`). | ||
| pub idx: u8, | ||
| /// The pointer this is a fragment of: provenance and the "real" raw bytes. | 
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.
the real raw bytes are in the next field, not in the prov field.
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.
True. I wasn't sure how to best write a comment that spans both fields.
The pointer fragment support from #144081 got disabled due to #146291. This brings it back. To fix the issue, the per-byte provenance fragment tracking tracks both the provenance and raw address of the full pointer, so we can ensure that only fragments that are truly part of the same pointer are being merged.
r? @oli-obk
Cc @theemathas
Fixes rust-lang/const-eval#72 again.
Also fixes #147959.
@traviscross I assume this won't need another t-lang FCP since it already got FCP'd in #144081?