Skip to content

Commit

Permalink
fix(core): add missing bounds to type-alias-impl-traits
Browse files Browse the repository at this point in the history
It seems that [rust-lang/rust#96736][1] introduced checks for these
missing bounds, resulting in the following compilation error:

     error[E0277]: expected a `FnOnce<(Output,)>` closure, found `Mapper`
         --> src/r3_core/src/bind.rs:1360:5
          |
     1360 |     move || (mapper)(inner_bound_fn())
          |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(Output,)>` closure, found `Mapper`
          |
     note: required by a bound in `map_bind_inner`
         --> src/r3_core/src/bind.rs:1358:13
          |
     1352 | const fn map_bind_inner<InnerBoundFn, Output, Mapper, NewOutput>(
          |          -------------- required by a bound in this
     ...
     1358 |     Mapper: FnOnce(Output) -> NewOutput + Copy + Send + 'static,
          |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map_bind_inner`
     help: consider further restricting this bound
          |
     1349 |     Mapper: Copy + Send + 'static + core::ops::FnOnce<(Output,)>,
          |                                   ++++++++++++++++++++++++++++++

[1]: rust-lang/rust#96736
  • Loading branch information
yvt committed May 14, 2022
1 parent a6331be commit 0a738d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/r3_core/src/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,8 @@ macro_rules! impl_fn_bind {
type BoundFn<T, Output, $( $RuntimeBinderI, )*>
where
$( $RuntimeBinderI: RuntimeBinder, )*
T: Copy + Send + 'static,
T: for<'call> FnOnce($( $RuntimeBinderI::Target<'call>, )*)
-> Output + Copy + Send + 'static,
= impl FnOnce() -> Output + Copy + Send + 'static;

const fn bind_inner<
Expand Down Expand Up @@ -1345,8 +1346,8 @@ where

type MappedBoundFn<InnerBoundFn, Output, Mapper, NewOutput>
where
InnerBoundFn: Copy + Send + 'static,
Mapper: Copy + Send + 'static,
InnerBoundFn: FnOnce() -> Output + Copy + Send + 'static,
Mapper: FnOnce(Output) -> NewOutput + Copy + Send + 'static,
= impl FnOnce() -> NewOutput + Copy + Send + 'static;

const fn map_bind_inner<InnerBoundFn, Output, Mapper, NewOutput>(
Expand Down

0 comments on commit 0a738d3

Please sign in to comment.