Skip to content

format_static! #3021

Open
Open
@SoniEx2

Description

Between rust-lang/rust#78837 and rust-lang/rust#79150, we feel like a format_static!() macro would be useful. This would allow one to, for example:

#[doc = format_static!(include!("docs_for_foo.md"), $arg1, $arg2)]

or even just for replacing these occurrences of concat! with something more human-readable: https://github.com/rust-lang/rust/pull/79150/files#diff-28f62e401cacbc5959e8762c79a4e0417d52ab64b2cd4e19cafa0d9f7e1bbaeeR30

such that

#[doc = concat!("For example, `Option<", stringify!($Ty), ">` is the same size as `", stringify!($Int), "`:")]

becomes

#[doc = format_static!("For example, `Option<{}>` is the same size as `{}`:", stringify!($Ty), stringify!($Int))]

which doesn't require whoever is maintaining the thing to parse the stringify!() parts before being able to continue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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