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

Make delegation methods of std::net::IpAddr unstably const #76304

Merged
merged 1 commit into from
Sep 25, 2020

Conversation

CDirkx
Copy link
Contributor

@CDirkx CDirkx commented Sep 3, 2020

Make the following methods of std::net::IpAddr unstable const under the const_ip feature:

  • is_unspecified
  • is_loopback
  • is_global
  • is_multicast

Also adds a test for these methods in a const context.

Possible because these methods delegate to the inner Ipv4Addr or Ipv6Addr, which were made const (PR#76205 and PR#76206), and the recent stabilization of const control flow.

Part of #76205

r? @ecstatic-morse

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 3, 2020
@jyn514 jyn514 added A-const-fn T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Sep 4, 2020
@jyn514 jyn514 changed the title Make delegation methods of std::net::IpAddr const Make delegation methods of std::net::IpAddr unstably const Sep 4, 2020
@ecstatic-morse
Copy link
Contributor

LGTM! Any reason not to do is_ipv{4,6} as part of this PR as well?

@bors delegate+

@bors
Copy link
Contributor

bors commented Sep 4, 2020

✌️ @CDirkx can now approve this pull request

@CDirkx
Copy link
Contributor Author

CDirkx commented Sep 4, 2020

I had already opened up PR#76226 to directly stabilize those as const, although I could include them here as unstable const, and when this gets merged rebase the stabilization PR.

@ecstatic-morse
Copy link
Contributor

No need.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 4, 2020

📌 Commit 0c339b5bf283bfc839c06018190b2ab849be9270 has been approved by ecstatic-morse

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 4, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 7, 2020
Rollup of 18 pull requests

Successful merges:

 - rust-lang#76273 (Move some Vec UI tests into alloc unit tests)
 - rust-lang#76274 (Allow try blocks as the argument to return expressions)
 - rust-lang#76287 (Remove an unnecessary allowed lint)
 - rust-lang#76293 (Implementation of incompatible features error)
 - rust-lang#76299 (Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`)
 - rust-lang#76302 (Address review comments on `Peekable::next_if`)
 - rust-lang#76303 (Link to `#capacity-and-reallocation` when using with_capacity)
 - rust-lang#76305 (Move various ui const tests to `library`)
 - rust-lang#76309 (Indent a note to make folding work nicer)
 - rust-lang#76312 (time.rs: Make spelling of "Darwin" consistent)
 - rust-lang#76318 (Use ops::ControlFlow in rustc_data_structures::graph::iterate)
 - rust-lang#76324 (Move Vec slice UI tests in library)
 - rust-lang#76338 (add some intra-doc links to `Iterator`)
 - rust-lang#76340 (Remove unused duplicated `trivial_dropck_outlives`)
 - rust-lang#76344 (Improve docs for `std::env::args()`)
 - rust-lang#76346 (Docs: nlink example typo)
 - rust-lang#76358 (Minor grammar fix in doc comment for soft-deprecated methods)
 - rust-lang#76364 (Disable atomics on avr target.)

Failed merges:

 - rust-lang#76304 (Make delegation methods of `std::net::IpAddr` unstably const)

r? @ghost
@bors
Copy link
Contributor

bors commented Sep 7, 2020

☔ The latest upstream changes (presumably #76422) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 7, 2020
@CDirkx CDirkx force-pushed the const-ip branch 2 times, most recently from ba84081 to ac28f1f Compare September 7, 2020 15:44
@CDirkx
Copy link
Contributor Author

CDirkx commented Sep 7, 2020

Rebased onto master.

@CDirkx
Copy link
Contributor Author

CDirkx commented Sep 8, 2020

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 8, 2020
@bors
Copy link
Contributor

bors commented Sep 23, 2020

☔ The latest upstream changes (presumably #76850) made this pull request unmergeable. Please resolve the merge conflicts.

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 23, 2020
@ecstatic-morse
Copy link
Contributor

ecstatic-morse commented Sep 23, 2020

Huh, this seems to have never gotten added to the queue. bors retry can sometimes be finicky. Sorry @CDirkx. I'll make sure it gets in after a rebase.

Make the following methods of `std::net::IpAddr` unstable const under the `const_ip` feature:
- `is_unspecified`
- `is_loopback`
- `is_global`
- `is_multicast`

Also adds a test for these methods in a const context.

Possible because these methods delegate to the inner `Ipv4Addr` or `Ipv6Addr`, which were made const, and the recent stabilization of const control flow.

Part of rust-lang#76205
@CDirkx
Copy link
Contributor Author

CDirkx commented Sep 23, 2020

Ah, I thought I used the wrong command. Rebased, so @bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 23, 2020
@ecstatic-morse
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Sep 23, 2020

📌 Commit 947536f has been approved by ecstatic-morse

@ecstatic-morse
Copy link
Contributor

(I would use r={reviewer} when delegated to, retry seems to fail sometimes)

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 24, 2020
Make delegation methods of `std::net::IpAddr` unstably const

Make the following methods of `std::net::IpAddr` unstable const under the `const_ip` feature:
 - `is_unspecified`
 - `is_loopback`
 - `is_global`
 - `is_multicast`

Also adds a test for these methods in a const context.

Possible because these methods delegate to the inner `Ipv4Addr` or `Ipv6Addr`, which were made const ([PR#76205](rust-lang#76142) and [PR#76206](rust-lang#76206)), and the recent stabilization of const control flow.

Part of rust-lang#76205

r? @ecstatic-morse
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 25, 2020
…as-schievink

Rollup of 15 pull requests

Successful merges:

 - rust-lang#75438 (Use adaptive SVG favicon for rustdoc like other rust sites)
 - rust-lang#76304 (Make delegation methods of `std::net::IpAddr` unstably const)
 - rust-lang#76724 (Allow a unique name to be assigned to dataflow graphviz output)
 - rust-lang#76978 (Documented From impls in std/sync/mpsc/mod.rs)
 - rust-lang#77044 (Liballoc bench vec use mem take not replace)
 - rust-lang#77050 (Typo fix: "satsify" -> "satisfy")
 - rust-lang#77074 (add array::from_ref)
 - rust-lang#77078 (Don't use an if guard to check equality with a constant)
 - rust-lang#77079 (Use `Self` in docs when possible)
 - rust-lang#77081 (Merge two almost identical match arms)
 - rust-lang#77121 (Updated html_root_url for compiler crates)
 - rust-lang#77136 (Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn`)
 - rust-lang#77160 (Suggest `const_fn_transmute`, not `const_fn`)
 - rust-lang#77164 (Remove workaround for deref issue that no longer exists.)
 - rust-lang#77165 (Followup to rust-lang#76673)

Failed merges:

r? `@ghost`
@bors bors merged commit 88e3693 into rust-lang:master Sep 25, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 25, 2020
@CDirkx CDirkx deleted the const-ip branch October 17, 2020 13:41
@RalfJung RalfJung added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants