Skip to content

Trait inheritance isn't considered in trait bounds checking #13155

Closed
@alexcrichton

Description

@alexcrichton
trait A: Send {}

fn is_send<T: Send>(){}

fn main() {
    is_send::<~A:>();
}
$ rustc foo.rs
foo.rs:6:5: 6:19 error: instantiating a type parameter with an incompatible type `~A<no-bounds>`, which does not fulfill `Send`                                             
foo.rs:6     is_send::<~A:>();                                                        
             ^~~~~~~~~~~~~~                                                           
error: aborting due to previous error                                                 

I would expect this code to compile because any instance of trait A must already ascribe to Send. This caused some excessive verbosity in #13050.

cc @nikomatsakis
cc @pnkfelix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions