From 25f8ed57d4e140074eaa599bd4869d1ecbe27402 Mon Sep 17 00:00:00 2001 From: yvt Date: Thu, 10 Mar 2022 12:48:02 +0900 Subject: [PATCH] refactor: remove `#![feature(const_fn_trait_bound)]` The `const_fn_trait_bound` feature was stabilized by . --- README.md | 1 - doc/toolchain_limitations.md | 9 --------- examples/basic/src/main.rs | 1 - examples/basic_gr_peach/src/main.rs | 1 - examples/basic_nucleo_f401re/src/main.rs | 1 - examples/basic_rp_pico/src/main.rs | 1 - examples/basic_wio_terminal/src/main.rs | 1 - examples/smp_rp_pico/src/main.rs | 1 - src/r3/src/lib.rs | 1 - src/r3/src/tests.rs | 1 - src/r3_core/src/bind.rs | 3 --- src/r3_core/src/kernel/mutex.rs | 1 - src/r3_core/src/kernel/timer.rs | 2 -- src/r3_core/src/lib.md | 1 - src/r3_core/src/lib.rs | 1 - src/r3_kernel/src/lib.rs | 1 - src/r3_port_arm/src/lib.rs | 1 - src/r3_port_arm_m/src/lib.rs | 1 - src/r3_port_arm_m_test_driver/src/main.rs | 1 - src/r3_port_arm_test_driver/src/main.rs | 1 - src/r3_port_riscv/src/lib.rs | 1 - src/r3_port_riscv_test_driver/src/main.rs | 1 - src/r3_port_std/benches/test_suite.rs | 1 - src/r3_port_std/src/lib.md | 1 - src/r3_port_std/src/lib.rs | 1 - src/r3_port_std/tests/test_suite.rs | 1 - src/r3_portkit/src/lib.rs | 1 - src/r3_support_rp2040/src/lib.rs | 1 - src/r3_support_rza1/src/lib.rs | 1 - src/r3_test_suite/src/lib.rs | 1 - 30 files changed, 41 deletions(-) diff --git a/README.md b/README.md index 84c29fb773..ed95df2cf7 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,6 @@ The R3 original kernel is provided as a separate package [`r3_kernel`][]. ```rust #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(naked_functions)] diff --git a/doc/toolchain_limitations.md b/doc/toolchain_limitations.md index 248ddc167e..04e4992a53 100644 --- a/doc/toolchain_limitations.md +++ b/doc/toolchain_limitations.md @@ -168,7 +168,6 @@ fn clone_projection(p: &T::Proj) -> T::Proj { ``` ```rust,compile_fail,E0277 -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] trait Trait { @@ -201,7 +200,6 @@ trait Trait: ~const Clone {} ### `[tag:impl_block_const_bounds]` The trait bounds of an `impl` block can't include `~const` ```rust,compile_fail -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] struct Cfg(C); trait CfgBase {} @@ -214,7 +212,6 @@ impl Cfg { A work-around is to move the trait bounds to the `const fn`s inside. ```rust -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] struct Cfg(C); trait CfgBase {} @@ -232,7 +229,6 @@ impl Cfg { The following code doesn't compile (which is okay) because `T` might not be `T: const Drop`. ```rust,compile_fail,E0493 -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] #![feature(const_option)] @@ -248,7 +244,6 @@ impl const Drop for Type { The obvious solution is to add `T: ~const Drop` to the `Drop` implementation as well as to the type definition. However, this doesn't work because `~const` is not allowed to appear in the type definition. ```rust,compile_fail,E0367 -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] #![feature(const_option)] @@ -266,7 +261,6 @@ impl const Drop for Type { According to [rust-lang/rust#93028](https://github.com/rust-lang/rust/pull/93028), we can actually remove `~const` from this type definition, and the compiler permits the `Drop` implementation to have an extra `~const`. Unfortunately, this leaves a `Drop` trait bound on the type, which actually cover different types than `~const Drop` does. That's because `T: ~const Drop` means that `T` can be dropped in a constant context (n.b. this is [a special case for `Drop`](https://internals.rust-lang.org/t/pre-rfc-revamped-const-trait-impl-aka-rfc-2632/15192#const-drop-in-generic-code-6) and doesn't apply to other traits), while `T: Drop` means that `T` has a user-defined `Drop` implementation. ```rust,compile_fail,E0277 -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] #![feature(const_option)] @@ -283,7 +277,6 @@ let _ = Type(Some(())); A work-around is to enclose `T` in a container that unconditionally implements `const Drop`. ```rust -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] #![feature(const_option)] @@ -308,7 +301,6 @@ const _: () = { let _ = Type(Some(())); }; ### `[tag:const_closures]` Closures can't be `impl const Fn` ```rust -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] const fn identity(x: C) -> C { x } const fn foo() {} @@ -317,7 +309,6 @@ identity(|| {}); ``` ```rust,compile_fail,E0277 -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] const fn identity(x: C) -> C { x } // error[E0277]: the trait bound `[closure@lib.rs:6:26: 6:31]: ~const Fn<()>` is not satisfied diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs index 7eca9b6ec7..3ae89bb08a 100644 --- a/examples/basic/src/main.rs +++ b/examples/basic/src/main.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] diff --git a/examples/basic_gr_peach/src/main.rs b/examples/basic_gr_peach/src/main.rs index ba028b03c8..7c4e705ecd 100644 --- a/examples/basic_gr_peach/src/main.rs +++ b/examples/basic_gr_peach/src/main.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] diff --git a/examples/basic_nucleo_f401re/src/main.rs b/examples/basic_nucleo_f401re/src/main.rs index 410babf971..e027d84cfa 100644 --- a/examples/basic_nucleo_f401re/src/main.rs +++ b/examples/basic_nucleo_f401re/src/main.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(naked_functions)] diff --git a/examples/basic_rp_pico/src/main.rs b/examples/basic_rp_pico/src/main.rs index 0ea862ff30..04bdc1d538 100644 --- a/examples/basic_rp_pico/src/main.rs +++ b/examples/basic_rp_pico/src/main.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(naked_functions)] diff --git a/examples/basic_wio_terminal/src/main.rs b/examples/basic_wio_terminal/src/main.rs index 59a855c29b..a18a2e3a4d 100644 --- a/examples/basic_wio_terminal/src/main.rs +++ b/examples/basic_wio_terminal/src/main.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(naked_functions)] diff --git a/examples/smp_rp_pico/src/main.rs b/examples/smp_rp_pico/src/main.rs index 282d873f18..b1940c9420 100644 --- a/examples/smp_rp_pico/src/main.rs +++ b/examples/smp_rp_pico/src/main.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(naked_functions)] diff --git a/src/r3/src/lib.rs b/src/r3/src/lib.rs index 4e8c122417..46e876a3f6 100644 --- a/src/r3/src/lib.rs +++ b/src/r3/src/lib.rs @@ -3,7 +3,6 @@ #![feature(const_precise_live_drops)] #![feature(const_fn_fn_ptr_basics)] #![feature(type_alias_impl_trait)] -#![feature(const_fn_trait_bound)] #![feature(const_impl_trait)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] diff --git a/src/r3/src/tests.rs b/src/r3/src/tests.rs index 543c2ba932..26815b629d 100644 --- a/src/r3/src/tests.rs +++ b/src/r3/src/tests.rs @@ -9,7 +9,6 @@ pub(crate) macro doc_test( ) {concat!( ignore_if_port_std_does_not_support_target!($head), "\n ", "# #![feature(const_fn_fn_ptr_basics)] - # #![feature(const_fn_trait_bound)] # #![feature(const_refs_to_cell)] # #![feature(const_impl_trait)] # #![feature(const_trait_impl)] diff --git a/src/r3_core/src/bind.rs b/src/r3_core/src/bind.rs index 997c1dd113..082513076f 100644 --- a/src/r3_core/src/bind.rs +++ b/src/r3_core/src/bind.rs @@ -693,7 +693,6 @@ impl<'pool, System, T> DivideBind<'pool, System, T> { /// /// ```rust /// #![feature(const_fn_fn_ptr_basics)] -/// #![feature(const_fn_trait_bound)] /// #![feature(const_trait_impl)] /// #![feature(const_mut_refs)] /// use r3_core::{bind::Bind, kernel::{Cfg, traits}, prelude::*}; @@ -823,7 +822,6 @@ impl<'pool, const LEN: usize, System, T> const UnzipBind for Bind<'pool, System, /// /// ```rust /// #![feature(const_fn_fn_ptr_basics)] -/// #![feature(const_fn_trait_bound)] /// #![feature(const_trait_impl)] /// #![feature(const_mut_refs)] /// use r3_core::{ @@ -1300,7 +1298,6 @@ where /// # Example /// /// ```rust -/// #![feature(const_fn_trait_bound)] /// #![feature(const_trait_impl)] /// #![feature(const_mut_refs)] /// use core::cell::UnsafeCell; diff --git a/src/r3_core/src/kernel/mutex.rs b/src/r3_core/src/kernel/mutex.rs index 1ad0af1ccb..2345975d5f 100644 --- a/src/r3_core/src/kernel/mutex.rs +++ b/src/r3_core/src/kernel/mutex.rs @@ -41,7 +41,6 @@ define_object! { /// # Examples /// /// ```rust -/// #![feature(const_fn_trait_bound)] /// #![feature(const_trait_impl)] /// #![feature(const_mut_refs)] /// use r3_core::kernel::{ diff --git a/src/r3_core/src/kernel/timer.rs b/src/r3_core/src/kernel/timer.rs index 591c55ebcb..a5ee26e501 100644 --- a/src/r3_core/src/kernel/timer.rs +++ b/src/r3_core/src/kernel/timer.rs @@ -273,7 +273,6 @@ define_object! { /// /// ```rust /// # #![feature(const_fn_fn_ptr_basics)] -/// # #![feature(const_fn_trait_bound)] /// # #![feature(const_trait_impl)] /// # #![feature(const_mut_refs)] /// use r3_core::{kernel::{Cfg, StaticTimer, traits}, time::Duration}; @@ -315,7 +314,6 @@ define_object! { /// /// ```rust /// # #![feature(const_fn_fn_ptr_basics)] -/// # #![feature(const_fn_trait_bound)] /// # #![feature(const_trait_impl)] /// # #![feature(const_mut_refs)] /// use r3_core::{kernel::{Cfg, StaticTimer, traits, prelude::*}, time::Duration}; diff --git a/src/r3_core/src/lib.md b/src/r3_core/src/lib.md index 841076b79c..dd41f56a7a 100644 --- a/src/r3_core/src/lib.md +++ b/src/r3_core/src/lib.md @@ -104,7 +104,6 @@ Configuration functions are highly composable as they can make nested calls to o ```rust # #![feature(const_fn_fn_ptr_basics)] -# #![feature(const_fn_trait_bound)] # #![feature(const_trait_impl)] # #![feature(const_mut_refs)] # use r3_core::kernel::{Cfg, traits}; diff --git a/src/r3_core/src/lib.rs b/src/r3_core/src/lib.rs index 6ce0dc0375..214b2ec047 100644 --- a/src/r3_core/src/lib.rs +++ b/src/r3_core/src/lib.rs @@ -16,7 +16,6 @@ #![feature(const_cell_into_inner)] #![feature(const_ptr_offset_from)] #![feature(type_alias_impl_trait)] -#![feature(const_fn_trait_bound)] #![feature(const_intrinsic_copy)] #![feature(const_slice_ptr_len)] #![feature(exhaustive_patterns)] // `let Ok(()) = Ok::<(), !>(())` diff --git a/src/r3_kernel/src/lib.rs b/src/r3_kernel/src/lib.rs index cc9909d2cb..3f4cf4e85b 100644 --- a/src/r3_kernel/src/lib.rs +++ b/src/r3_kernel/src/lib.rs @@ -5,7 +5,6 @@ #![feature(const_raw_ptr_comparison)] #![feature(const_fn_fn_ptr_basics)] #![feature(cfg_target_has_atomic)] // `#[cfg(target_has_atomic_load_store)]` -#![feature(const_fn_trait_bound)] #![feature(const_intrinsic_copy)] #![feature(exhaustive_patterns)] // `let Ok(()) = Ok::<(), !>(())` #![feature(generic_const_exprs)] diff --git a/src/r3_port_arm/src/lib.rs b/src/r3_port_arm/src/lib.rs index cb96606162..2b65a7c8ad 100644 --- a/src/r3_port_arm/src/lib.rs +++ b/src/r3_port_arm/src/lib.rs @@ -1,6 +1,5 @@ #![feature(const_fn_fn_ptr_basics)] #![feature(const_ptr_offset_from)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_ptr_offset)] #![feature(const_trait_impl)] diff --git a/src/r3_port_arm_m/src/lib.rs b/src/r3_port_arm_m/src/lib.rs index 52f2d49870..bc1f7ccdd0 100644 --- a/src/r3_port_arm_m/src/lib.rs +++ b/src/r3_port_arm_m/src/lib.rs @@ -1,6 +1,5 @@ #![feature(const_fn_fn_ptr_basics)] #![feature(const_ptr_offset_from)] -#![feature(const_fn_trait_bound)] #![feature(generic_const_exprs)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] diff --git a/src/r3_port_arm_m_test_driver/src/main.rs b/src/r3_port_arm_m_test_driver/src/main.rs index 433e91b4a7..c266c0e659 100644 --- a/src/r3_port_arm_m_test_driver/src/main.rs +++ b/src/r3_port_arm_m_test_driver/src/main.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(naked_functions)] diff --git a/src/r3_port_arm_test_driver/src/main.rs b/src/r3_port_arm_test_driver/src/main.rs index 3fe424361c..3283dc37cd 100644 --- a/src/r3_port_arm_test_driver/src/main.rs +++ b/src/r3_port_arm_test_driver/src/main.rs @@ -4,7 +4,6 @@ //! title="Screwdriver"> #![doc = include_str!("./common.md")] #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(naked_functions)] diff --git a/src/r3_port_riscv/src/lib.rs b/src/r3_port_riscv/src/lib.rs index d1e6909519..11607fbccb 100644 --- a/src/r3_port_riscv/src/lib.rs +++ b/src/r3_port_riscv/src/lib.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(generic_const_exprs)] #![feature(const_trait_impl)] #![feature(naked_functions)] diff --git a/src/r3_port_riscv_test_driver/src/main.rs b/src/r3_port_riscv_test_driver/src/main.rs index 80f99a703c..3aabdc670e 100644 --- a/src/r3_port_riscv_test_driver/src/main.rs +++ b/src/r3_port_riscv_test_driver/src/main.rs @@ -1,5 +1,4 @@ #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(const_ptr_offset)] diff --git a/src/r3_port_std/benches/test_suite.rs b/src/r3_port_std/benches/test_suite.rs index e08ce777ae..2ed74dc70f 100644 --- a/src/r3_port_std/benches/test_suite.rs +++ b/src/r3_port_std/benches/test_suite.rs @@ -1,5 +1,4 @@ //! Runs test cases defined in `r3_test_suite`. -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_mut_refs)] #![feature(slice_ptr_len)] diff --git a/src/r3_port_std/src/lib.md b/src/r3_port_std/src/lib.md index cc27c7ff0e..316fb7ad78 100644 --- a/src/r3_port_std/src/lib.md +++ b/src/r3_port_std/src/lib.md @@ -4,7 +4,6 @@ The port for running [`::r3_kernel`][] in a hosted environment ```rust #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] diff --git a/src/r3_port_std/src/lib.rs b/src/r3_port_std/src/lib.rs index 641b5cfceb..d9529d82a4 100644 --- a/src/r3_port_std/src/lib.rs +++ b/src/r3_port_std/src/lib.rs @@ -1,5 +1,4 @@ #![feature(cfg_target_has_atomic)] // `#[cfg(target_has_atomic_load_store)]` -#![feature(const_fn_trait_bound)] #![feature(atomic_mut_ptr)] #![feature(thread_local)] #![feature(deadline_api)] diff --git a/src/r3_port_std/tests/test_suite.rs b/src/r3_port_std/tests/test_suite.rs index 21babd2de8..659120cb34 100644 --- a/src/r3_port_std/tests/test_suite.rs +++ b/src/r3_port_std/tests/test_suite.rs @@ -1,6 +1,5 @@ //! Runs test cases defined in `r3_test_suite`. #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] diff --git a/src/r3_portkit/src/lib.rs b/src/r3_portkit/src/lib.rs index aa455a4af9..2fa6093d37 100644 --- a/src/r3_portkit/src/lib.rs +++ b/src/r3_portkit/src/lib.rs @@ -1,6 +1,5 @@ //! R3 PortKit #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(generic_const_exprs)] #![feature(adt_const_params)] #![feature(naked_functions)] diff --git a/src/r3_support_rp2040/src/lib.rs b/src/r3_support_rp2040/src/lib.rs index 318003c2d8..46c60059bd 100644 --- a/src/r3_support_rp2040/src/lib.rs +++ b/src/r3_support_rp2040/src/lib.rs @@ -4,7 +4,6 @@ //! [R3]: ::r3 //! [Raspberry Pi Pico]: https://pico.raspberrypi.org #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(exhaustive_patterns)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] diff --git a/src/r3_support_rza1/src/lib.rs b/src/r3_support_rza1/src/lib.rs index ec0585627a..2a2c77fa5f 100644 --- a/src/r3_support_rza1/src/lib.rs +++ b/src/r3_support_rza1/src/lib.rs @@ -5,7 +5,6 @@ //! [RZ/A1H]: https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz/rza/rza1h.html //! [GR-PEACH]: https://www.renesas.com/us/en/products/gadget-renesas/boards/gr-peach.html #![feature(const_fn_fn_ptr_basics)] -#![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] #![feature(const_mut_refs)] #![cfg_attr( diff --git a/src/r3_test_suite/src/lib.rs b/src/r3_test_suite/src/lib.rs index 51dba2daee..4d4c2b81f6 100644 --- a/src/r3_test_suite/src/lib.rs +++ b/src/r3_test_suite/src/lib.rs @@ -2,7 +2,6 @@ #![feature(const_fn_fn_ptr_basics)] #![feature(cfg_target_has_atomic)] #![feature(const_transmute_copy)] -#![feature(const_fn_trait_bound)] #![feature(const_refs_to_cell)] #![feature(const_trait_impl)] #![feature(const_mut_refs)]