Skip to content

Commit ba31a9b

Browse files
authored
Rollup merge of #100604 - dtolnay:okorerr, r=m-ou-se
Remove unstable Result::into_ok_or_err Pending FCP: #82223 (comment) ```@rustbot``` label +waiting-on-fcp
2 parents e193f46 + 39809c5 commit ba31a9b

File tree

6 files changed

+11
-61
lines changed

6 files changed

+11
-61
lines changed

Diff for: compiler/rustc_codegen_gcc/patches/0024-core-Disable-portable-simd-test.patch

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ index 06c7be0..359e2e7 100644
1414
@@ -75,7 +75,6 @@
1515
#![feature(never_type)]
1616
#![feature(unwrap_infallible)]
17-
#![feature(result_into_ok_or_err)]
1817
-#![feature(portable_simd)]
1918
#![feature(ptr_metadata)]
2019
#![feature(once_cell)]

Diff for: compiler/rustc_transmute/src/layout/tree.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use super::{Byte, Def, Ref};
2+
use std::ops::ControlFlow;
23

34
#[cfg(test)]
45
mod tests;
@@ -86,17 +87,18 @@ where
8687
F: Fn(D) -> bool,
8788
{
8889
match self {
89-
Self::Seq(elts) => elts
90-
.into_iter()
91-
.map(|elt| elt.prune(f))
92-
.try_fold(Tree::unit(), |elts, elt| {
90+
Self::Seq(elts) => match elts.into_iter().map(|elt| elt.prune(f)).try_fold(
91+
Tree::unit(),
92+
|elts, elt| {
9393
if elt == Tree::uninhabited() {
94-
Err(Tree::uninhabited())
94+
ControlFlow::Break(Tree::uninhabited())
9595
} else {
96-
Ok(elts.then(elt))
96+
ControlFlow::Continue(elts.then(elt))
9797
}
98-
})
99-
.into_ok_or_err(),
98+
},
99+
) {
100+
ControlFlow::Break(node) | ControlFlow::Continue(node) => node,
101+
},
100102
Self::Alt(alts) => alts
101103
.into_iter()
102104
.map(|alt| alt.prune(f))

Diff for: compiler/rustc_transmute/src/lib.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
#![feature(
2-
alloc_layout_extra,
3-
control_flow_enum,
4-
decl_macro,
5-
iterator_try_reduce,
6-
never_type,
7-
result_into_ok_or_err
8-
)]
1+
#![feature(alloc_layout_extra, control_flow_enum, decl_macro, iterator_try_reduce, never_type)]
92
#![allow(dead_code, unused_variables)]
103
#![deny(rustc::untranslatable_diagnostic)]
114
#![deny(rustc::diagnostic_outside_of_impl)]

Diff for: library/core/src/result.rs

-34
Original file line numberDiff line numberDiff line change
@@ -1776,40 +1776,6 @@ impl<T, E> Result<Result<T, E>, E> {
17761776
}
17771777
}
17781778

1779-
impl<T> Result<T, T> {
1780-
/// Returns the [`Ok`] value if `self` is `Ok`, and the [`Err`] value if
1781-
/// `self` is `Err`.
1782-
///
1783-
/// In other words, this function returns the value (the `T`) of a
1784-
/// `Result<T, T>`, regardless of whether or not that result is `Ok` or
1785-
/// `Err`.
1786-
///
1787-
/// This can be useful in conjunction with APIs such as
1788-
/// [`Atomic*::compare_exchange`], or [`slice::binary_search`], but only in
1789-
/// cases where you don't care if the result was `Ok` or not.
1790-
///
1791-
/// [`Atomic*::compare_exchange`]: crate::sync::atomic::AtomicBool::compare_exchange
1792-
///
1793-
/// # Examples
1794-
///
1795-
/// ```
1796-
/// #![feature(result_into_ok_or_err)]
1797-
/// let ok: Result<u32, u32> = Ok(3);
1798-
/// let err: Result<u32, u32> = Err(4);
1799-
///
1800-
/// assert_eq!(ok.into_ok_or_err(), 3);
1801-
/// assert_eq!(err.into_ok_or_err(), 4);
1802-
/// ```
1803-
#[inline]
1804-
#[unstable(feature = "result_into_ok_or_err", reason = "newly added", issue = "82223")]
1805-
pub const fn into_ok_or_err(self) -> T {
1806-
match self {
1807-
Ok(v) => v,
1808-
Err(v) => v,
1809-
}
1810-
}
1811-
}
1812-
18131779
// This is a separate function to reduce the code size of the methods
18141780
#[cfg(not(feature = "panic_immediate_abort"))]
18151781
#[inline(never)]

Diff for: library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
#![feature(const_pin)]
7676
#![feature(never_type)]
7777
#![feature(unwrap_infallible)]
78-
#![feature(result_into_ok_or_err)]
7978
#![feature(pointer_byte_offsets)]
8079
#![feature(portable_simd)]
8180
#![feature(ptr_metadata)]

Diff for: library/core/tests/result.rs

-9
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,6 @@ fn test_unwrap_or() {
9595
assert_eq!(ok_err.unwrap_or(50), 50);
9696
}
9797

98-
#[test]
99-
fn test_ok_or_err() {
100-
let ok: Result<isize, isize> = Ok(100);
101-
let err: Result<isize, isize> = Err(200);
102-
103-
assert_eq!(ok.into_ok_or_err(), 100);
104-
assert_eq!(err.into_ok_or_err(), 200);
105-
}
106-
10798
#[test]
10899
fn test_unwrap_or_else() {
109100
fn handler(msg: &'static str) -> isize {

0 commit comments

Comments
 (0)