Skip to content

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

Closed
@Havvy

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.

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