Skip to content

#[derive] suggestion should check for local struct #37522

Closed
@durka

Description

@durka

Consider this code:

struct Foo;

fn main() {
    println!("{:?} {:?}",
      /* 1 */ Foo,
      /* 2 */ std::fs::OpenOptions::new());
}

Both marked lines print the error that Debug is not satisfied and note that "if it is defined in your crate, add #[derive(Debug)] or manually implement it". The compiler should be able to check and issue the note only for (1), instead of printing the confusing "if it is defined in your crate".

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions