Skip to content

Built-in super-trait doesn't imply trait object implements that super-trait #15155

Closed
@huonw

Description

@huonw
trait Trait: Send {}

#[cfg(not(working))]
struct Struct { x: Box<Trait> }

#[cfg(working)]
struct Struct { x: Box<Trait + Send> }

impl Trait for Struct {}

fn main() {}

Compiling with --cfg working compiles fine, then without that --cfg gives:

send2.rs:9:16: 9:22 error: the type `Struct', which does not fulfill `Send`, cannot implement this trait
send2.rs:9 impl Trait for Struct {}
                          ^~~~~~
send2.rs:9:16: 9:22 note: types implementing this trait must fulfill `Send+Sized`
send2.rs:9 impl Trait for Struct {}
                          ^~~~~~
error: aborting due to previous error

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