- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Support ZSTs in DispatchFromDyn #60369
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
      
      
    
                
     Merged
            
            
          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
    
  
  
    
    | r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) | 
| This possibly needs an FCP or some discussion so I've marked it as such tentatively. | 
| Please ensure that the ZST has alignment ≤ a pointer, because we should not DispatchFromDyn those: #[repr(align(64))]
struct A;
struct P<'a, T: ?Sized + 'a> {
    p: &'a T,
    a: A,
}
fn main() {
    use std::mem::size_of;
    dbg!(size_of::<(P<'static, u8>, *const (/*vtable*/))>());
    dbg!(size_of::<P<'static, dyn Sync>>());
} | 
| @kennytm I'd prefer we check alignment to be  | 
              
                    eddyb
  
              
              approved these changes
              
                  
                    Apr 30, 2019 
                  
              
              
            
            
| @bors r+ | 
| 📌 Commit 1b679e7 has been approved by  | 
    
  Centril 
      added a commit
        to Centril/rust
      that referenced
      this pull request
    
      Apr 30, 2019 
    
    
      
  
    
      
    
  
Support ZSTs in DispatchFromDyn Allows to use ZSTs with 1 byte alignment in `DispatchFromDyn` implementation. This is required for `Box<T, A: Alloc>` cc rust-lang#58457
    
  Centril 
      added a commit
        to Centril/rust
      that referenced
      this pull request
    
      May 1, 2019 
    
    
      
  
    
      
    
  
Support ZSTs in DispatchFromDyn Allows to use ZSTs with 1 byte alignment in `DispatchFromDyn` implementation. This is required for `Box<T, A: Alloc>` cc rust-lang#58457
    
  Centril 
      added a commit
        to Centril/rust
      that referenced
      this pull request
    
      May 1, 2019 
    
    
      
  
    
      
    
  
Support ZSTs in DispatchFromDyn Allows to use ZSTs with 1 byte alignment in `DispatchFromDyn` implementation. This is required for `Box<T, A: Alloc>` cc rust-lang#58457
    
  bors 
      added a commit
      that referenced
      this pull request
    
      May 1, 2019 
    
    
      
  
    
      
    
  
Rollup of 7 pull requests Successful merges: - #60327 (Search for incompatible universes in borrow errors) - #60330 (Suggest using an inclusive range instead of an exclusive range when the endpoint overflows by 1) - #60366 (build-gcc: Create missing cc symlink) - #60369 (Support ZSTs in DispatchFromDyn) - #60404 (Implement `BorrowMut<str>` for `String`) - #60417 (Rename hir::ExprKind::Use to ::DropTemps and improve docs.) - #60432 (Update clippy) Failed merges: r? @ghost
    
  Centril 
      added a commit
        to Centril/rust
      that referenced
      this pull request
    
      May 1, 2019 
    
    
      
  
    
      
    
  
Support ZSTs in DispatchFromDyn Allows to use ZSTs with 1 byte alignment in `DispatchFromDyn` implementation. This is required for `Box<T, A: Alloc>` cc rust-lang#58457
    
  bors 
      added a commit
      that referenced
      this pull request
    
      May 1, 2019 
    
    
      
  
    
      
    
  
Rollup of 7 pull requests Successful merges: - #60287 (Use references for variances_of) - #60327 (Search for incompatible universes in borrow errors) - #60330 (Suggest using an inclusive range instead of an exclusive range when the endpoint overflows by 1) - #60366 (build-gcc: Create missing cc symlink) - #60369 (Support ZSTs in DispatchFromDyn) - #60404 (Implement `BorrowMut<str>` for `String`) - #60417 (Rename hir::ExprKind::Use to ::DropTemps and improve docs.) Failed merges: r? @ghost
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    needs-fcp
  This change is insta-stable, or significant enough to need a team FCP to proceed. 
  
    S-waiting-on-bors
  Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 
  
    T-lang
  Relevant to the language team 
  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.
  
    
  
    
Allows to use ZSTs with 1 byte alignment in
DispatchFromDynimplementation. This is required forBox<T, A: Alloc>cc #58457