Skip to content

#[derive(Debug)] fails when used with a raw pointer to DST #36870

Closed
@whitequark

Description

@whitequark

... with the following error message:

error[E0277]: the trait bound `core::ops::Fn() -> bool + 'static: core::marker::Sized` is not satisfied
   --> /home/whitequark/Work/artiq-dev/artiq/artiq/runtime/../runtime.rs/src/sched.rs:109:16
    |
109 |     Completion(*const (Fn() -> bool + 'static)),
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/whitequark/Work/artiq-dev/artiq/artiq/runtime/../runtime.rs/src/sched.rs:107:10: 107:15 note: in this expansion of #[derive(Debug)] (defined in /home/whitequark/Work/artiq-dev/artiq/artiq/runtime/../runtime.rs/src/sched.rs)
    |
    = note: `core::ops::Fn() -> bool + 'static` does not have a constant size known at compile-time
    = note: required because of the requirements on the impl of `core::fmt::Debug` for `*const core::ops::Fn() -> bool + 'static`
    = note: required because of the requirements on the impl of `core::fmt::Debug` for `&*const core::ops::Fn() -> bool + 'static`
    = note: required for the cast to the object type `core::fmt::Debug`

since the Debug impl for raw pointers just prints the actual pointer, I don't see why it should require the pointee to be Sized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions