Constify std:馃:IpAddr, Ipv4Addr, and Ipv6Addr 路 Issue #76205 路 rust-lang/rust (original) (raw)

Due to recent stabilizations of const integer arithmetic and const control flow, all methods of types std:馃:IpAddr, Ipv4Addr, and Ipv6Addr can be made const. This issue provides an overview of all methods and steps that need to be taken:

Ipv4Addr

Methods already stable const:

Methods unstable const by PR#76142 (const_ipv4):

None of these methods depends on an unstable feature, and could all thus be made stable const.

Ipv6Addr

Methods already stable const:

Ipv6Addr::segments has been made unstable const in PR#76206 (const_ipv6), together with all dependent methods:

All of these methods depend on segments, and thus upon the unstable feature const_fn_transmute, however the transmute is only used for better code generation, the operations could be rewritten equivalently using stable const code.

IpAddr

The following methods are stable const:

Implemented in PR#76226.

With the relevant methods of Ipv4Addr and Ipv6Addr made const, the following were also made unstable const in PR#76304: