Skip to content

Compilation error messages could be better #269

@ADD-SP

Description

@ADD-SP

For struct like

struct Unnamed(String);

The derive macro EncodeLabelSet emits

error: proc-macro derive panicked
 --> tests/build/friendly-compilation-error-msg.rs:7:49
  |
7 |     #[derive(Debug, Clone, PartialEq, Eq, Hash, EncodeLabelSet)]
  |                                                 ^^^^^^^^^^^^^^
  |
  = help: message: Can not derive Encode for struct with unnamed fields.

I think proc-macro derive panicked is a little bit confuse, and the end developer needs to continue reading down the error message to find the cause.

An usual practice is emit compile_error!, which show the causes more directly.

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