Skip to content

Misleading "not found in this scope" error #923

Closed
@emk

Description

@emk

I'm loving the new serde!

This is a bit of an unfortunate error message, and it's probably rustc's fault, but I thought I would report it:

/// A parsed version of our configuration file.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Config {
    /// Configuration for each notifier.
    notifiers: HashMap<String, NotifierConfig>,
}

# No definition of NotifierConfig.

Here, the error[E0412]: is correct, but the brightly colored "not found in this scope" below it points to the wrong thing.

error[E0412]: cannot find type `NotifierConfig` in this scope
 --> src/config.rs:6:35
  |
6 | #[derive(Clone, Debug, Serialize, Deserialize)]
  |                                   ^^^^^^^^^^^ not found in this scope

The fix, of course, is to implement NotifierConfig. I know you can't do much about this error, but I thought you might like to know that there was a minor ergonomic issue.

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