Does T and U having the same layout mean that Foo<T>
and Foo<U>
have the same layout?
#1019
Labels
A-type-layout
Area: type layout
Hey!
I'm not sure whether here is the right place to open this issue, but I've been in a discussion with @nox about the things that are allowed with
repr(transparent)
structs.In particular, suppose this code:
Is it correct? In other words, is
Foo<T>
guaranteed to have the same layout asFoo<U>
ifT
has the same layout asU
? (knowing thatFoo
isrepr(Rust)
)I'm thinking the answer to this question should be added to the
repr(transparent)
part of the reference, but I couldn't find the answer in the related RFC; so I couldn't find an answer to this question.Is the answer to the question known? (In practice it is to the best of my knowledge currently the same layout, but I don't know whether it is a guarantee given for the foreseeable future)
The text was updated successfully, but these errors were encountered: