Skip to content

Failed on trait with generic arguments. #2

@najamelan

Description

@najamelan

I wanted to give blanket a try because, well, boilerplate. But:

#[ blanket(derive( Ref, Mut, Box, Rc )) ]
//
pub trait SpawnHandle<Out: 'static + Send>
{
   ...
}

gave me:

error[E0658]: associated type bounds are unstable
  --> src/iface/spawn_handle.rs:57:23
   |
57 | pub trait SpawnHandle<Out: 'static + Send>
   |                       ^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

and

error[E0107]: missing generics for trait `spawn_handle::SpawnHandle`
  --> src/iface/spawn_handle.rs:57:11
   |
57 | pub trait SpawnHandle<Out: 'static + Send>
   |           ^^^^^^^^^^^ expected 1 type argument
   |
note: trait defined here, with 1 type parameter: `Out`
  --> src/iface/spawn_handle.rs:57:11
   |
57 | pub trait SpawnHandle<Out: 'static + Send>
   |           ^^^^^^^^^^^ ---
help: use angle brackets to add missing type argument
   |
57 | pub trait SpawnHandle<Out><Out: 'static + Send>

It generates:

impl<Out: 'static + Send, SH: SpawnHandle<Out: 'static + Send>>
            SpawnHandle<Out: 'static + Send> for Box<SH>

Where the manual implementation would do:

impl<T, Out> SpawnHandle<Out> for Box<T> 

   where T  : SpawnHandle<Out> + ?Sized, 
         Out: 'static + Send

So it seems the issue is that the trait bounds on the generic type are repeated and they shouldn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions