Skip to content

Commit eb5e9ab

Browse files
committed
Deprecate TcpListener::set_only_v6
This was supposed to have been removed in #33124 but snuck through :(
1 parent 6f1ae66 commit eb5e9ab

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

src/libstd/net/tcp.rs

+6-32
Original file line numberDiff line numberDiff line change
@@ -613,44 +613,18 @@ impl TcpListener {
613613
self.0.ttl()
614614
}
615615

616-
/// Sets the value for the `IPV6_V6ONLY` option on this socket.
617-
///
618-
/// If this is set to `true` then the socket is restricted to sending and
619-
/// receiving IPv6 packets only. In this case two IPv4 and IPv6 applications
620-
/// can bind the same port at the same time.
621-
///
622-
/// If this is set to `false` then the socket can be used to send and
623-
/// receive packets from an IPv4-mapped IPv6 address.
624-
///
625-
/// # Examples
626-
///
627-
/// ```no_run
628-
/// use std::net::TcpListener;
629-
///
630-
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
631-
/// listener.set_only_v6(true).expect("Cannot set to IPv6");
632-
/// ```
633616
#[stable(feature = "net2_mutators", since = "1.9.0")]
617+
#[rustc_deprecated(since = "1.16.0",
618+
reason = "this option can only be set before the socket is bound")]
619+
#[allow(missing_docs)]
634620
pub fn set_only_v6(&self, only_v6: bool) -> io::Result<()> {
635621
self.0.set_only_v6(only_v6)
636622
}
637623

638-
/// Gets the value of the `IPV6_V6ONLY` option for this socket.
639-
///
640-
/// For more information about this option, see [`set_only_v6`][link].
641-
///
642-
/// [link]: #method.set_only_v6
643-
///
644-
/// # Examples
645-
///
646-
/// ```no_run
647-
/// use std::net::TcpListener;
648-
///
649-
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
650-
/// listener.set_only_v6(true).expect("Cannot set to IPv6");
651-
/// assert_eq!(listener.only_v6().unwrap_or(false), true);
652-
/// ```
653624
#[stable(feature = "net2_mutators", since = "1.9.0")]
625+
#[rustc_deprecated(since = "1.16.0",
626+
reason = "this option can only be set before the socket is bound")]
627+
#[allow(missing_docs)]
654628
pub fn only_v6(&self) -> io::Result<bool> {
655629
self.0.only_v6()
656630
}

0 commit comments

Comments
 (0)