-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Stabilize some Result methods as const #76136
Conversation
Stabilize the following methods of `Result` as const: - `is_ok` - `is_err` - `as_ref` Possible because of stabilization of rust-lang#49146 (Allow if and match in constants).
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
r? @KodrAus (Needs FCP) |
Created an issue for similar stabilizations: #76225 |
@rfcbot fcp merge |
Team member @KodrAus 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. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
EDIT: Nevermind, these all require |
⌛ Testing commit 787b270 with merge a51855f645eb6b86d1c6eb5656ae3394c9949a05... |
💔 Test failed - checks-actions |
@CDirkx Test failures are legit. Clippy has a lint that suggests |
Update the test `redundant_pattern_matching`: check if `is_ok` and `is_err` are suggested within const contexts. Also removes the `redundant_pattern_matching_const_result` test, as it is no longer needed.
I updated the testcases, when this get's merged I'll update the testcases using |
How can it be enough to update the testcases, doesn't the clippy code emitting these lints also need to be updated? |
Clippy is checking if the suggested methods are But once the |
That's what I thought as well (#76135 (comment)), but the implementation of I removed the |
`is_ok` and `is_err` are stabilized as const and can thus always be suggested.
Co-authored-by: Ralf Jung <post@ralfj.de>
@bors r=dtolnay |
📌 Commit bf70e21 has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Stabilize some Result methods as const Stabilize the following methods of Result as const: - `is_ok` - `is_err` - `as_ref` A test is also included, analogous to the test for `const_option`. These methods are currently const under the unstable feature `const_result` (tracking issue: rust-lang#67520). I believe these methods to be eligible for stabilization because of the stabilization of rust-lang#49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](rust-lang#75463) and [PR#76135](rust-lang#76135). Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature. Related: rust-lang#76225
Stabilize the following methods of Result as const:
is_ok
is_err
as_ref
A test is also included, analogous to the test for
const_option
.These methods are currently const under the unstable feature
const_result
(tracking issue: #67520).I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: PR#75463 and PR#76135.
Note: these methods are the only methods currently under the
const_result
feature, thus this PR results in the removal of the feature.Related: #76225