diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index a11eca0b9c7..3b0b3ee1a74 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -5,7 +5,6 @@ #![doc(rust_logo)] #![feature(assert_matches)] #![feature(box_patterns)] -#![feature(control_flow_enum)] #![feature(file_buffered)] #![feature(let_chains)] #![feature(never_type)] diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 7d40a7746b9..71ee77f8f61 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -62,7 +62,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #![feature(if_let_guard)] #![feature(iter_intersperse)] #![feature(let_chains)] diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index f8352d9d44a..6b0a897faba 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -3,7 +3,6 @@ #![allow(rustc::untranslatable_diagnostic)] #![feature(array_windows)] #![feature(box_patterns)] -#![feature(control_flow_enum)] #![feature(if_let_guard)] #![feature(let_chains)] #![feature(never_type)] diff --git a/compiler/rustc_infer/src/lib.rs b/compiler/rustc_infer/src/lib.rs index 051bba58518..934484bf915 100644 --- a/compiler/rustc_infer/src/lib.rs +++ b/compiler/rustc_infer/src/lib.rs @@ -20,7 +20,6 @@ #![doc(rust_logo)] #![feature(assert_matches)] #![feature(box_patterns)] -#![feature(control_flow_enum)] #![feature(extend_one)] #![feature(if_let_guard)] #![feature(iter_intersperse)] diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index c74cb866f21..e58ad23f414 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -32,7 +32,6 @@ #![feature(array_windows)] #![feature(assert_matches)] #![feature(box_patterns)] -#![feature(control_flow_enum)] #![feature(extract_if)] #![feature(if_let_guard)] #![feature(iter_order_by)] diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs index f206dba6cf4..b817b4cb7b8 100644 --- a/compiler/rustc_metadata/src/lib.rs +++ b/compiler/rustc_metadata/src/lib.rs @@ -2,7 +2,6 @@ #![allow(internal_features)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] -#![feature(control_flow_enum)] #![feature(coroutines)] #![feature(decl_macro)] #![feature(error_iter)] diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index a17c007debd..11d72106b22 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -20,7 +20,6 @@ #![feature(associated_type_defaults)] #![feature(box_patterns)] #![feature(cfg_version)] -#![feature(control_flow_enum)] #![feature(extract_if)] #![feature(if_let_guard)] #![feature(iter_intersperse)] diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index ab73dc19fcc..7a8158b8231 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -171,14 +171,13 @@ pub fn is_continue(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(control_flow_enum)] /// use std::ops::ControlFlow; /// /// assert_eq!(ControlFlow::::Break(3).break_value(), Some(3)); /// assert_eq!(ControlFlow::::Continue(3).break_value(), None); /// ``` #[inline] - #[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] + #[stable(feature = "control_flow_enum", since = "CURRENT_RUSTC_VERSION")] pub fn break_value(self) -> Option { match self { ControlFlow::Continue(..) => None, @@ -189,11 +188,8 @@ pub fn break_value(self) -> Option { /// Maps `ControlFlow` to `ControlFlow` by applying a function /// to the break value in case it exists. #[inline] - #[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] - pub fn map_break(self, f: F) -> ControlFlow - where - F: FnOnce(B) -> T, - { + #[stable(feature = "control_flow_enum", since = "CURRENT_RUSTC_VERSION")] + pub fn map_break(self, f: impl FnOnce(B) -> T) -> ControlFlow { match self { ControlFlow::Continue(x) => ControlFlow::Continue(x), ControlFlow::Break(x) => ControlFlow::Break(f(x)), @@ -206,14 +202,13 @@ pub fn map_break(self, f: F) -> ControlFlow /// # Examples /// /// ``` - /// #![feature(control_flow_enum)] /// use std::ops::ControlFlow; /// /// assert_eq!(ControlFlow::::Break(3).continue_value(), None); /// assert_eq!(ControlFlow::::Continue(3).continue_value(), Some(3)); /// ``` #[inline] - #[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] + #[stable(feature = "control_flow_enum", since = "CURRENT_RUSTC_VERSION")] pub fn continue_value(self) -> Option { match self { ControlFlow::Continue(x) => Some(x), @@ -224,11 +219,8 @@ pub fn continue_value(self) -> Option { /// Maps `ControlFlow` to `ControlFlow` by applying a function /// to the continue value in case it exists. #[inline] - #[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] - pub fn map_continue(self, f: F) -> ControlFlow - where - F: FnOnce(C) -> T, - { + #[stable(feature = "control_flow_enum", since = "CURRENT_RUSTC_VERSION")] + pub fn map_continue(self, f: impl FnOnce(C) -> T) -> ControlFlow { match self { ControlFlow::Continue(x) => ControlFlow::Continue(f(x)), ControlFlow::Break(x) => ControlFlow::Break(x), diff --git a/library/core/src/ops/mod.rs b/library/core/src/ops/mod.rs index 25c4b87f4e7..5464bf645d9 100644 --- a/library/core/src/ops/mod.rs +++ b/library/core/src/ops/mod.rs @@ -162,7 +162,7 @@ pub use self::bit::{BitAnd, BitOr, BitXor, Not, Shl, Shr}; #[stable(feature = "op_assign_traits", since = "1.8.0")] pub use self::bit::{BitAndAssign, BitOrAssign, BitXorAssign, ShlAssign, ShrAssign}; -#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] +#[stable(feature = "control_flow_enum_type", since = "1.55.0")] pub use self::control_flow::ControlFlow; #[unstable(feature = "coroutine_trait", issue = "43122")] pub use self::coroutine::{Coroutine, CoroutineState}; diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 2eb6d99b761..012aa689d4b 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -1,7 +1,6 @@ #![feature(array_windows)] #![feature(binary_heap_into_iter_sorted)] #![feature(box_patterns)] -#![feature(control_flow_enum)] #![feature(f128)] #![feature(f16)] #![feature(if_let_guard)] diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 514ec70a40b..10e258444a6 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -1,6 +1,5 @@ #![feature(array_chunks)] #![feature(box_patterns)] -#![feature(control_flow_enum)] #![feature(f128)] #![feature(f16)] #![feature(if_let_guard)] diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index 4094dec0cbf..743ee8e728b 100644 --- a/tests/mir-opt/jump_threading.rs +++ b/tests/mir-opt/jump_threading.rs @@ -2,7 +2,6 @@ //@ compile-flags: -Zmir-enable-passes=+Inline // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -#![feature(control_flow_enum)] #![feature(try_trait_v2)] #![feature(custom_mir, core_intrinsics, rustc_attrs)] diff --git a/tests/mir-opt/separate_const_switch.rs b/tests/mir-opt/separate_const_switch.rs index 5e8371b3e49..05835942980 100644 --- a/tests/mir-opt/separate_const_switch.rs +++ b/tests/mir-opt/separate_const_switch.rs @@ -1,5 +1,4 @@ // skip-filecheck -#![feature(control_flow_enum)] #![feature(try_trait_v2)] //@ compile-flags: -Zunsound-mir-opts diff --git a/tests/ui-fulldeps/stable-mir/check_abi.rs b/tests/ui-fulldeps/stable-mir/check_abi.rs index 7518ea902ec..5b7da7bb129 100644 --- a/tests/ui-fulldeps/stable-mir/check_abi.rs +++ b/tests/ui-fulldeps/stable-mir/check_abi.rs @@ -8,7 +8,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #![feature(ascii_char, ascii_char_variants)] extern crate rustc_hir; diff --git a/tests/ui-fulldeps/stable-mir/check_allocation.rs b/tests/ui-fulldeps/stable-mir/check_allocation.rs index 7752ff51ac8..1e2f640f39f 100644 --- a/tests/ui-fulldeps/stable-mir/check_allocation.rs +++ b/tests/ui-fulldeps/stable-mir/check_allocation.rs @@ -10,7 +10,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #![feature(ascii_char, ascii_char_variants)] extern crate rustc_hir; diff --git a/tests/ui-fulldeps/stable-mir/check_attribute.rs b/tests/ui-fulldeps/stable-mir/check_attribute.rs index be52853a479..131fd99ebaa 100644 --- a/tests/ui-fulldeps/stable-mir/check_attribute.rs +++ b/tests/ui-fulldeps/stable-mir/check_attribute.rs @@ -7,7 +7,6 @@ //@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 #![feature(rustc_private)] -#![feature(control_flow_enum)] extern crate rustc_hir; #[macro_use] diff --git a/tests/ui-fulldeps/stable-mir/check_def_ty.rs b/tests/ui-fulldeps/stable-mir/check_def_ty.rs index 9f45b62d343..ec3cf1753e2 100644 --- a/tests/ui-fulldeps/stable-mir/check_def_ty.rs +++ b/tests/ui-fulldeps/stable-mir/check_def_ty.rs @@ -10,7 +10,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/check_defs.rs b/tests/ui-fulldeps/stable-mir/check_defs.rs index 5bb1053f187..3402b345818 100644 --- a/tests/ui-fulldeps/stable-mir/check_defs.rs +++ b/tests/ui-fulldeps/stable-mir/check_defs.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/check_foreign.rs b/tests/ui-fulldeps/stable-mir/check_foreign.rs index 06d2af4ac8a..4acbabbb6be 100644 --- a/tests/ui-fulldeps/stable-mir/check_foreign.rs +++ b/tests/ui-fulldeps/stable-mir/check_foreign.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] extern crate rustc_middle; #[macro_use] diff --git a/tests/ui-fulldeps/stable-mir/check_instance.rs b/tests/ui-fulldeps/stable-mir/check_instance.rs index 68eb3c54593..7d63e202fa6 100644 --- a/tests/ui-fulldeps/stable-mir/check_instance.rs +++ b/tests/ui-fulldeps/stable-mir/check_instance.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/check_item_kind.rs b/tests/ui-fulldeps/stable-mir/check_item_kind.rs index 1d5b19304c1..91baa074c10 100644 --- a/tests/ui-fulldeps/stable-mir/check_item_kind.rs +++ b/tests/ui-fulldeps/stable-mir/check_item_kind.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs index 5098547c2c8..8721f243587 100644 --- a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs +++ b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/check_transform.rs b/tests/ui-fulldeps/stable-mir/check_transform.rs index 1d3e4c6845b..40217b9aa95 100644 --- a/tests/ui-fulldeps/stable-mir/check_transform.rs +++ b/tests/ui-fulldeps/stable-mir/check_transform.rs @@ -8,7 +8,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #![feature(ascii_char, ascii_char_variants)] extern crate rustc_hir; diff --git a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs index 0b8cfcf27fd..0715e0cfc52 100644 --- a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs +++ b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs @@ -10,7 +10,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index 4c9a8a665b8..6b458c5d923 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] extern crate rustc_hir; #[macro_use] diff --git a/tests/ui-fulldeps/stable-mir/projections.rs b/tests/ui-fulldeps/stable-mir/projections.rs index d68e7d37950..a8bf4c1d399 100644 --- a/tests/ui-fulldeps/stable-mir/projections.rs +++ b/tests/ui-fulldeps/stable-mir/projections.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] extern crate rustc_hir; #[macro_use] diff --git a/tests/ui-fulldeps/stable-mir/smir_internal.rs b/tests/ui-fulldeps/stable-mir/smir_internal.rs index 07f404fd471..6f5478c08bf 100644 --- a/tests/ui-fulldeps/stable-mir/smir_internal.rs +++ b/tests/ui-fulldeps/stable-mir/smir_internal.rs @@ -10,7 +10,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/smir_serde.rs b/tests/ui-fulldeps/stable-mir/smir_serde.rs index 957d840f7a2..7dbf892f9e4 100644 --- a/tests/ui-fulldeps/stable-mir/smir_serde.rs +++ b/tests/ui-fulldeps/stable-mir/smir_serde.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs index ac428c80e0f..f1bc03781b9 100644 --- a/tests/ui-fulldeps/stable-mir/smir_visitor.rs +++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs @@ -9,7 +9,6 @@ #![feature(rustc_private)] #![feature(assert_matches)] -#![feature(control_flow_enum)] #[macro_use] extern crate rustc_smir; diff --git a/tests/ui/try-trait/bad-interconversion.rs b/tests/ui/try-trait/bad-interconversion.rs index 385f5510fb4..9c45bde8898 100644 --- a/tests/ui/try-trait/bad-interconversion.rs +++ b/tests/ui/try-trait/bad-interconversion.rs @@ -1,5 +1,3 @@ -#![feature(control_flow_enum)] - use std::ops::ControlFlow; fn result_to_result() -> Result { diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr index 9aab2cf6ab8..82877baef3e 100644 --- a/tests/ui/try-trait/bad-interconversion.stderr +++ b/tests/ui/try-trait/bad-interconversion.stderr @@ -1,5 +1,5 @@ error[E0277]: `?` couldn't convert the error to `u8` - --> $DIR/bad-interconversion.rs:6:20 + --> $DIR/bad-interconversion.rs:4:20 | LL | fn result_to_result() -> Result { | --------------- expected `u8` because of this @@ -15,7 +15,7 @@ LL | Ok(Err(123_i32)?) = note: required for `Result` to implement `FromResidual>` error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result` - --> $DIR/bad-interconversion.rs:11:12 + --> $DIR/bad-interconversion.rs:9:12 | LL | fn option_to_result() -> Result { | -------------------------------------------- this function returns a `Result` @@ -26,7 +26,7 @@ LL | Some(3)?; = help: the trait `FromResidual>` is implemented for `Result` error[E0277]: the `?` operator can only be used on `Result`s in a function that returns `Result` - --> $DIR/bad-interconversion.rs:17:31 + --> $DIR/bad-interconversion.rs:15:31 | LL | fn control_flow_to_result() -> Result { | -------------------------------------------------- this function returns a `Result` @@ -37,7 +37,7 @@ LL | Ok(ControlFlow::Break(123)?) = help: the trait `FromResidual>` is implemented for `Result` error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option` - --> $DIR/bad-interconversion.rs:22:22 + --> $DIR/bad-interconversion.rs:20:22 | LL | fn result_to_option() -> Option { | ------------------------------------ this function returns an `Option` @@ -48,7 +48,7 @@ LL | Some(Err("hello")?) = help: the trait `FromResidual>` is implemented for `Option` error[E0277]: the `?` operator can only be used on `Option`s in a function that returns `Option` - --> $DIR/bad-interconversion.rs:27:33 + --> $DIR/bad-interconversion.rs:25:33 | LL | fn control_flow_to_option() -> Option { | ------------------------------------------ this function returns an `Option` @@ -59,7 +59,7 @@ LL | Some(ControlFlow::Break(123)?) = help: the trait `FromResidual>` is implemented for `Option` error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` - --> $DIR/bad-interconversion.rs:32:39 + --> $DIR/bad-interconversion.rs:30:39 | LL | fn result_to_control_flow() -> ControlFlow { | -------------------------------------------------- this function returns a `ControlFlow` @@ -71,7 +71,7 @@ LL | ControlFlow::Continue(Err("hello")?) = help: for that trait implementation, expected `ControlFlow`, found `Result` error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` - --> $DIR/bad-interconversion.rs:37:12 + --> $DIR/bad-interconversion.rs:35:12 | LL | fn option_to_control_flow() -> ControlFlow { | ----------------------------------------------- this function returns a `ControlFlow` @@ -83,7 +83,7 @@ LL | Some(3)?; = help: for that trait implementation, expected `ControlFlow`, found `Option` error[E0277]: the `?` operator in a function that returns `ControlFlow` can only be used on other `ControlFlow`s (with the same Break type) - --> $DIR/bad-interconversion.rs:43:29 + --> $DIR/bad-interconversion.rs:41:29 | LL | fn control_flow_to_control_flow() -> ControlFlow { | ----------------------------------------------------- this function returns a `ControlFlow` diff --git a/tests/ui/try-trait/try-operator-custom.rs b/tests/ui/try-trait/try-operator-custom.rs index 936c0b0689a..ebeb0869f98 100644 --- a/tests/ui/try-trait/try-operator-custom.rs +++ b/tests/ui/try-trait/try-operator-custom.rs @@ -1,6 +1,5 @@ //@ run-pass -#![feature(control_flow_enum)] #![feature(try_trait_v2)] use std::ops::{ControlFlow, FromResidual, Try};