Skip to content

libfmt_macros should be renamed to have a rustc_ prefix or moved into librustc_builtin_macros. #71177

@eddyb

Description

@eddyb
Member

For historical reasons we have a crate that looks like it would be part of the standard library, but it's really just a parser for the implementation of format_args!.

cc @petrochenkov

Activity

added
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Apr 15, 2020
Mark-Simulacrum

Mark-Simulacrum commented on Apr 15, 2020

@Mark-Simulacrum
Member

❤️ I would also deeply appreciate the removal/merge of this crate. It's what I always hit when trying to find the "real" formatting piece of the compiler, and it's essentially never what I want.

petrochenkov

petrochenkov commented on Apr 16, 2020

@petrochenkov
Contributor

or moved into librustc_builtin_macros

Unfortunately, fmt_macros is also used from rustc_trait_selection due to implementation of the #[on_unimplemented] attribute, and it's undesirable to introduce the dependency rustc_builtin_macros -> rustc_trait_selection.

Possible solutions:

  • Keep it as a separate crate, rename to rustc_parse_format.
  • Merge it into rustc_parse if it doesn't add extra dependencies (need to check).
  • Turn #[rustc_on_unimplemented] into an built-in attribute macro so it does formatting during expansion and trait selection works with some lowered form of it, #[rustc_on_unimplemented_impl] or whatever. Then the crate can be merged into rustc_builtin_macros.
eddyb

eddyb commented on May 31, 2020

@eddyb
MemberAuthor
  • Keep it as a separate crate, rename to rustc_parse_format.
  • Merge it into rustc_parse if it doesn't add extra dependencies (need to check).

Either of these seem fine with me, anything else would be overkill, IMO.

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

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @eddyb@Mark-Simulacrum@petrochenkov

      Issue actions

        libfmt_macros should be renamed to have a rustc_ prefix or moved into librustc_builtin_macros. · Issue #71177 · rust-lang/rust