Skip to content

Editorial changes. #120

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 4 commits into from
May 8, 2019
Merged

Conversation

crlf0710
Copy link
Member

I'm not happy with several wordings within the text, so i did some small modifications.

Beyond this, i think &dyn Trait + <auto trait>s + <lifetime bounds> are actually guaranteed, but this text didn't cover it somehow. And i don't really know the correct way to write them out. Besides this, i'm still puzzled about things like the validity of &dyn Send + Sync and &dyn Sync + Send...

Copy link
Contributor

@gnzlbg gnzlbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -40,23 +39,23 @@ word and have therefore the same layout as C pointers.
> or, in the case of `&mut T`, aliasing.

We do not make any guarantees about the layout of
multi-trait objects `&(dyn T + U)` or references to other dynamically sized types,
multi-trait objects `&(dyn Tr + Ur)` or references to other dynamically sized types,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use Trait0 and Trait1 here ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Trait1 and Trait2.

@gnzlbg
Copy link
Contributor

gnzlbg commented Apr 19, 2019

Beyond this, i think &dyn Trait + s + are actually guaranteed, but this text didn't cover it somehow.

Where is this guaranteed ? (Can you point to an RFC, the reference, etc.?)

@crlf0710
Copy link
Member Author

Where is this guaranteed ?

Hmm, i never questioned this! No, i don't think i've seen any material explicitly said so.

I think it is important for this to become a guarantee, or i won't be able to transmute a &dyn Trait + Send + Sync to a std::raw::TraitObject...

@gnzlbg
Copy link
Contributor

gnzlbg commented Apr 19, 2019

@crlf0710

I think it is important for this to become a guarantee, or i won't be able to transmute a &dyn Trait + Send + Sync to a std::raw::TraitObject

I've opened #121 to track that we currently don't guarantee the layout of multi-trait objects, and provide a place to discuss how to solve that.

@crlf0710
Copy link
Member Author

@gnzlbg ok, would you like to merge this, or me to abandon this, or wait until #121 #122 be resolved somehow, and modify this PR?

@gnzlbg
Copy link
Contributor

gnzlbg commented Apr 22, 2019

We'll discuss it in the next meeting (next thursday), this will give time to more people to take a look at this.

@RalfJung
Copy link
Member

RalfJung commented May 5, 2019

I think it's fine to merge this as long as it doesn't make new guarantees -- and I don't think it does. :) See my one remaining open comment, though.

@RalfJung
Copy link
Member

RalfJung commented May 8, 2019

Thanks!

@RalfJung RalfJung merged commit fdcef75 into rust-lang:master May 8, 2019
@crlf0710 crlf0710 deleted the editorial_pointer_layout branch May 8, 2019 16:08
@Centril
Copy link
Contributor

Centril commented May 23, 2019

Beyond this, i think &dyn Trait + <auto trait>s + <lifetime bounds> are actually guaranteed

We do not guarantee the layout of trait objects in any shape or form on stable. As for raw::TraitObject, it is only a guarantee on nightly and only if you use that struct (making your own repr(C) type on stable does not count), which may go away at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants