Skip to content

proc-macros should not automatically error on token groups that are "locally" syntactically correct #108385

Open
@AaronKutch

Description

@AaronKutch

My limited understanding is that TokenStreams inputs and outputs for proc-macros have to abide to some minimal level of syntax (e.x. can't have mismatched delimiters outside of string literals), but everything else should be fair game for the proc-macro to handle (please edit the title if there is a better term for what I am describing). However, I found a case where the proc-macro system will forcibly error just because Rust doesn't support it, and it doesn't involve any special delimiters.
I am adding hexadecimal, binary, etc floating point support to my awint crate and encountered this problem:

proc_macro_ex!(0x123.456_i256f128); // error: hexadecimal float literal is not supported

this is frustrating because it works if I chose some other closely related convention like 0j123.456_i256f128.

I am titling this issue more generally because I want to make sure there are not other cases like it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-langRelevant to the language team, which will review and decide on the PR/issue.needs-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions