Skip to content

Conversation

CDirkx
Copy link
Contributor

@CDirkx CDirkx commented Aug 31, 2020

Constify the following methods of alloc::borrow::Cow:

  • is_borrowed
  • is_owned

Analogous to the const methods is_some and is_none for Option, and is_ok and is_err for Result.

These methods are still unstable under cow_is_borrowed.
Possible because of #49146 (Allow if and match in constants).

Tracking issue: #65143

Constify the following methods of `alloc::borrow::Cow`:
 - `is_borrowed`
 - `is_owned`

These methods are still unstable under `cow_is_borrowed`.
Possible because of rust-lang#49146 (Allow if and match in constants).

Tracking issue: rust-lang#65143
@ecstatic-morse
Copy link
Contributor

r? @KodrAus (Needs FCP)

@ecstatic-morse
Copy link
Contributor

Oh, actually these methods are unstable, and thus (I think) don't require an FCP to become const. Is this correct @rust-lang/libs?

r? @ecstatic-morse

You do need a test for these in a const context however.

Similar to the tests for Option and Result.
@ecstatic-morse
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 1, 2020

📌 Commit d591829 has been approved by ecstatic-morse

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 1, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 1, 2020
Rollup of 12 pull requests

Successful merges:

 - rust-lang#75945 (Use `env::func()`, not 'the function env::func' in docs for std::env)
 - rust-lang#76002 (Fix `-Z instrument-coverage` on MSVC)
 - rust-lang#76003 (Adds two source span utility functions used in source-based coverage)
 - rust-lang#76059 (Clean up E0764)
 - rust-lang#76103 (Clean up E0769)
 - rust-lang#76139 (Make `cow_is_borrowed` methods const)
 - rust-lang#76154 (Fix rustdoc strings indentation)
 - rust-lang#76161 (Remove notrust in rustc_middle)
 - rust-lang#76163 (README: Adjust Linux and macOS support platform and architecture)
 - rust-lang#76166 (Make `StringReader` private)
 - rust-lang#76172 (Revert rust-lang#75463)
 - rust-lang#76178 (Update expect-test to 1.0)

Failed merges:

r? @ghost
@bors bors merged commit c307e90 into rust-lang:master Sep 1, 2020
@CDirkx CDirkx deleted the cow-is-borrowed branch September 1, 2020 13:55
@cuviper cuviper added this to the 1.48.0 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants