Skip to content

Commit

Permalink
refactor: remove #![feature(const_fn_trait_bound)]
Browse files Browse the repository at this point in the history
The `const_fn_trait_bound` feature was stabilized by
<rust-lang/rust#93827>.
  • Loading branch information
yvt committed Mar 10, 2022
1 parent 2bf7208 commit 25f8ed5
Show file tree
Hide file tree
Showing 30 changed files with 0 additions and 41 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
9 changes: 0 additions & 9 deletions doc/toolchain_limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ fn clone_projection<T: Trait>(p: &T::Proj) -> T::Proj {
```

```rust,compile_fail,E0277
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]
trait Trait {
Expand Down Expand Up @@ -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>(C);
trait CfgBase {}
Expand All @@ -214,7 +212,6 @@ impl<C: ~const CfgBase> Cfg<C> {
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>(C);
trait CfgBase {}
Expand All @@ -232,7 +229,6 @@ impl<C> Cfg<C> {
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)]
Expand All @@ -248,7 +244,6 @@ impl<T> const Drop for Type<T> {
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)]
Expand All @@ -266,7 +261,6 @@ impl<T: ~const Drop> const Drop for Type<T> {
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)]
Expand All @@ -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)]
Expand All @@ -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<C: ~const Fn()>(x: C) -> C { x }
const fn foo() {}
Expand All @@ -317,7 +309,6 @@ identity(|| {});
```

```rust,compile_fail,E0277
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]
const fn identity<C: ~const Fn()>(x: C) -> C { x }
// error[E0277]: the trait bound `[[email protected]:6:26: 6:31]: ~const Fn<()>` is not satisfied
Expand Down
1 change: 0 additions & 1 deletion examples/basic/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion examples/basic_gr_peach/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion examples/basic_nucleo_f401re/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion examples/basic_rp_pico/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion examples/basic_wio_terminal/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion examples/smp_rp_pico/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 0 additions & 3 deletions src/r3_core/src/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*};
Expand Down Expand Up @@ -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::{
Expand Down Expand Up @@ -1300,7 +1298,6 @@ where
/// # Example
///
/// ```rust
/// #![feature(const_fn_trait_bound)]
/// #![feature(const_trait_impl)]
/// #![feature(const_mut_refs)]
/// use core::cell::UnsafeCell;
Expand Down
1 change: 0 additions & 1 deletion src/r3_core/src/kernel/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 0 additions & 2 deletions src/r3_core/src/kernel/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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};
Expand Down
1 change: 0 additions & 1 deletion src/r3_core/src/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 0 additions & 1 deletion src/r3_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<(), !>(())`
Expand Down
1 change: 0 additions & 1 deletion src/r3_kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_arm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_arm_m/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_arm_m_test_driver/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_arm_test_driver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//! title="Screwdriver"></a></div>
#![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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_riscv/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_riscv_test_driver/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_std/benches/test_suite.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_std/src/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_std/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_port_std/tests/test_suite.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_portkit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_support_rp2040/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/r3_support_rza1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion src/r3_test_suite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 25f8ed5

Please sign in to comment.