-
Notifications
You must be signed in to change notification settings - Fork 59
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
How transitive is repr(transparent)? #486
Comments
No.
I think that s the intention; I don't know if it actually follows from anything we document. I also don't know what |
Probably worth documenting somewhere. I suspect |
That would make randomize-layout unsound though, which is clearly a bug. So I don't think it's "fine". |
I don't think we promise that |
The question (as I understood it) was for this specific type, which doesn't use associated types. Obviously there are limits to this. |
We definitely don't promise this, and |
Oh sure I meant that I wouldn't be surprised and I wouldn't treat it as a strong expectation of what the semantics should be. |
I read through the linked document and could not find anything that states that the answer is no. What am I missing? |
The answer is always "no" except when the linked document states otherwise. So the fact that none of the cases there says they are compatible implies that they are not compatible. |
The document does not seem to discuss ABI compatibility of structs at all. Does that mean that two different structs are never ABI compatible? |
It mentions repr(transparent). But structs without that attribute are indeed not ABI compatible with anything else.
|
Context: hyperium/hyper#3500
repr(transparent)
makes types have the same representation/ABI. Does it have the same effect on generic types containing it?For example, in the following case:
is it safe to transmute between
Generic<T>
andGeneric<Wrapper<T>>
? Do they have the same ABI? I'm thinking about things like-Zrandomize-layout
.The text was updated successfully, but these errors were encountered: