Skip to content
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

Tracking Issue for const_sockaddr_setters #131714

Closed
1 of 3 tasks
tgross35 opened this issue Oct 14, 2024 · 5 comments · Fixed by #138129
Closed
1 of 3 tasks

Tracking Issue for const_sockaddr_setters #131714

tgross35 opened this issue Oct 14, 2024 · 5 comments · Fixed by #138129
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Comments

@tgross35
Copy link
Contributor

tgross35 commented Oct 14, 2024

Feature gate: #![feature(const_sockaddr_setters)]

This is a tracking issue using the set_ip and set_port methods on SocketAddr types in const contexts.

Public API

// core::net

impl SocketAddr {
    pub const fn set_ip(&mut self, new_ip: IpAddr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV4 {
    pub const fn set_ip(&mut self, new_ip: Ipv4Addr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV6 {
    pub const fn set_ip(&mut self, new_ip: Ipv6Addr);
    pub const fn set_port(&mut self, new_port: u16);
    pub const fn set_flowinfo(&mut self, new_flowinfo: u32);
    pub const fn set_scope_id(&mut self, new_scope_id: u32);
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@tgross35 tgross35 added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 14, 2024
tgross35 added a commit to tgross35/rust that referenced this issue Oct 14, 2024
Unstably add `const` to the `sockaddr_setters` methods. Included API:

    // core::net

    impl SocketAddr {
        pub const fn set_ip(&mut self, new_ip: IpAddr);
        pub const fn set_port(&mut self, new_port: u16);
    }

    impl SocketAddrV4 {
        pub const fn set_ip(&mut self, new_ip: Ipv4Addr);
        pub const fn set_port(&mut self, new_port: u16);
    }

    impl SocketAddrV6 {
        pub const fn set_ip(&mut self, new_ip: Ipv6Addr);
        pub const fn set_port(&mut self, new_port: u16);
    }

Tracking issue: <rust-lang#131714>
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 26, 2024
… r=Amanieu

Add an unstable `const_sockaddr_setters` feature

Unstably add `const` to the `sockaddr_setters` methods. Included API:

```rust
// core::net

impl SocketAddr {
    pub const fn set_ip(&mut self, new_ip: IpAddr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV4 {
    pub const fn set_ip(&mut self, new_ip: Ipv4Addr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV6 {
    pub const fn set_ip(&mut self, new_ip: Ipv6Addr);
    pub const fn set_port(&mut self, new_port: u16);
}
```

Tracking issue: <rust-lang#131714>
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Oct 29, 2024
Add an unstable `const_sockaddr_setters` feature

Unstably add `const` to the `sockaddr_setters` methods. Included API:

```rust
// core::net

impl SocketAddr {
    pub const fn set_ip(&mut self, new_ip: IpAddr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV4 {
    pub const fn set_ip(&mut self, new_ip: Ipv4Addr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV6 {
    pub const fn set_ip(&mut self, new_ip: Ipv6Addr);
    pub const fn set_port(&mut self, new_port: u16);
}
```

Tracking issue: <rust-lang/rust#131714>
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Oct 30, 2024
Add an unstable `const_sockaddr_setters` feature

Unstably add `const` to the `sockaddr_setters` methods. Included API:

```rust
// core::net

impl SocketAddr {
    pub const fn set_ip(&mut self, new_ip: IpAddr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV4 {
    pub const fn set_ip(&mut self, new_ip: Ipv4Addr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV6 {
    pub const fn set_ip(&mut self, new_ip: Ipv6Addr);
    pub const fn set_port(&mut self, new_port: u16);
}
```

Tracking issue: <rust-lang/rust#131714>
@RalfJung
Copy link
Member

@rust-lang/libs-api @rust-lang/wg-const-eval these are all fairly simple methods that have long been stable (since Rust 1.9), and I think are ready to be made const-stable.

// core::net

impl SocketAddr {
    pub const fn set_ip(&mut self, new_ip: IpAddr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV4 {
    pub const fn set_ip(&mut self, new_ip: Ipv4Addr);
    pub const fn set_port(&mut self, new_port: u16);
}

impl SocketAddrV6 {
    pub const fn set_ip(&mut self, new_ip: Ipv6Addr);
    pub const fn set_port(&mut self, new_port: u16);
    pub const fn set_flowinfo(&mut self, new_flowinfo: u32);
    pub const fn set_scope_id(&mut self, new_scope_id: u32);
}

@RalfJung RalfJung added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Feb 24, 2025
@dtolnay
Copy link
Member

dtolnay commented Feb 24, 2025

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Feb 24, 2025

Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Feb 24, 2025
@dtolnay dtolnay removed the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Feb 24, 2025
@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Feb 24, 2025
@rfcbot
Copy link

rfcbot commented Feb 24, 2025

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Mar 6, 2025
@rfcbot
Copy link

rfcbot commented Mar 6, 2025

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

workingjubilee added a commit to workingjubilee/rustc that referenced this issue Mar 7, 2025
…=tgross35

Stabilize const_char_classify, const_sockaddr_setters

FCP for const_char_classify: rust-lang#132241
FCP for const_sockaddr_setters: rust-lang#131714

Fixes rust-lang#132241
Fixes rust-lang#131714

Cc `@rust-lang/wg-const-eval`
jhpratt added a commit to jhpratt/rust that referenced this issue Mar 7, 2025
…=tgross35

Stabilize const_char_classify, const_sockaddr_setters

FCP for const_char_classify: rust-lang#132241
FCP for const_sockaddr_setters: rust-lang#131714

Fixes rust-lang#132241
Fixes rust-lang#131714

Cc ```@rust-lang/wg-const-eval```
@bors bors closed this as completed in c33e9d6 Mar 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 7, 2025
Rollup merge of rust-lang#138129 - RalfJung:stabilize-const-things, r=tgross35

Stabilize const_char_classify, const_sockaddr_setters

FCP for const_char_classify: rust-lang#132241
FCP for const_sockaddr_setters: rust-lang#131714

Fixes rust-lang#132241
Fixes rust-lang#131714

Cc ``@rust-lang/wg-const-eval``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants