Skip to content

Compilation error messages could be better #269

Closed

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.

Activity

  1. changed the title [-]compilation error msgs could be better[/-] [+]Compilation error messages could be better[/+] on Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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