Skip to content

Support ZSTs in DispatchFromDyn #60369

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
May 1, 2019
Merged

Support ZSTs in DispatchFromDyn #60369

merged 2 commits into from
May 1, 2019

Conversation

TimDiekmann
Copy link
Member

@TimDiekmann TimDiekmann commented Apr 29, 2019

Allows to use ZSTs with 1 byte alignment in DispatchFromDyn implementation. This is required for Box<T, A: Alloc>

cc #58457

@rust-highfive
Copy link
Contributor

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 29, 2019
@Centril Centril added T-lang Relevant to the language team needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Apr 30, 2019
@Centril
Copy link
Contributor

Centril commented Apr 30, 2019

This possibly needs an FCP or some discussion so I've marked it as such tentatively.

@kennytm
Copy link
Member

kennytm commented Apr 30, 2019

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>>());
}

@eddyb
Copy link
Member

eddyb commented Apr 30, 2019

@kennytm I'd prefer we check alignment to be 1, to be more conservative.

@eddyb
Copy link
Member

eddyb commented Apr 30, 2019

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 30, 2019

📌 Commit 1b679e7 has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 30, 2019
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
@bors bors merged commit 1b679e7 into rust-lang:master May 1, 2019
@TimDiekmann TimDiekmann deleted the dispatch-zst branch May 3, 2019 07:31
# for free to join this conversation on GitHub. Already have an account? # 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants