Skip to content

Better error message using byte string where only regular strings are allowed in attributes #54926

Description

@Havvy

The error message shows the code that matters.

error: literal in `cfg` predicate value must be a string
 --> src/lib.rs:L:11
  |
L | #[cfg(X = b"a")]
  |    

It should probably suggest removing the b. Likewise if using single quotes, it should suggest using double quotes. Both should also be machine applicable. Raw strings are allowed, so nothing needs to be done with them.

Activity

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

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions