Skip to content

Commit a336f8d

Browse files
authored
Rollup merge of rust-lang#141072 - Rynibami:stabilize-const-result-flatten, r=jhpratt
Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: rust-lang#70140 - [x] Implementation `const` `Result::flatten`: rust-lang#130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](rust-lang#70142 (comment)) by ``@RalfJung`` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue rust-lang#70142
2 parents 999a8cc + 195806b commit a336f8d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

core/src/result.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,6 @@ impl<T, E> Result<Result<T, E>, E> {
17221722
/// # Examples
17231723
///
17241724
/// ```
1725-
/// #![feature(result_flattening)]
17261725
/// let x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello"));
17271726
/// assert_eq!(Ok("hello"), x.flatten());
17281727
///
@@ -1736,14 +1735,14 @@ impl<T, E> Result<Result<T, E>, E> {
17361735
/// Flattening only removes one level of nesting at a time:
17371736
///
17381737
/// ```
1739-
/// #![feature(result_flattening)]
17401738
/// let x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok("hello")));
17411739
/// assert_eq!(Ok(Ok("hello")), x.flatten());
17421740
/// assert_eq!(Ok("hello"), x.flatten().flatten());
17431741
/// ```
17441742
#[inline]
1745-
#[unstable(feature = "result_flattening", issue = "70142")]
1746-
#[rustc_const_unstable(feature = "result_flattening", issue = "70142")]
1743+
#[stable(feature = "result_flattening", since = "CURRENT_RUSTC_VERSION")]
1744+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
1745+
#[rustc_const_stable(feature = "result_flattening", since = "CURRENT_RUSTC_VERSION")]
17471746
pub const fn flatten(self) -> Result<T, E> {
17481747
// FIXME(const-hack): could be written with `and_then`
17491748
match self {

0 commit comments

Comments
 (0)