@@ -57,7 +57,8 @@ pub enum SocketAddr {
57
57
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
58
58
///
59
59
/// The size of a `SocketAddrV4` struct may vary depending on the target operating
60
- /// system.
60
+ /// system. Do not assume that this type has the same memory layout as the underlying
61
+ /// system representation.
61
62
///
62
63
/// [IETF RFC 793]: https://tools.ietf.org/html/rfc793
63
64
/// [`IPv4` address]: Ipv4Addr
@@ -76,6 +77,8 @@ pub enum SocketAddr {
76
77
#[ derive( Copy ) ]
77
78
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
78
79
pub struct SocketAddrV4 {
80
+ // Do not assume that this struct is implemented as the underlying system representation.
81
+ // The memory layout is not part of the stable interface that std exposes.
79
82
inner : c:: sockaddr_in ,
80
83
}
81
84
@@ -88,7 +91,8 @@ pub struct SocketAddrV4 {
88
91
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
89
92
///
90
93
/// The size of a `SocketAddrV6` struct may vary depending on the target operating
91
- /// system.
94
+ /// system. Do not assume that this type has the same memory layout as the underlying
95
+ /// system representation.
92
96
///
93
97
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
94
98
/// [`IPv6` address]: Ipv6Addr
@@ -107,6 +111,8 @@ pub struct SocketAddrV4 {
107
111
#[ derive( Copy ) ]
108
112
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
109
113
pub struct SocketAddrV6 {
114
+ // Do not assume that this struct is implemented as the underlying system representation.
115
+ // The memory layout is not part of the stable interface that std exposes.
110
116
inner : c:: sockaddr_in6 ,
111
117
}
112
118
0 commit comments