Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate all associated items on the NonZero integer types into a single impl block per type #118665

Merged
merged 18 commits into from
Jan 19, 2024

Commits on Jan 14, 2024

  1. Move nonzero_integers macro call to bottom of module

    This way all the other macros defined in this module, such as
    nonzero_leading_trailing_zeros, are available to call within the expansion of
    nonzero_integers.
    
    (Macros defined by macro_rules cannot be called from the same module above the
    location of the macro_rules.)
    
    In this commit the ability to call things like nonzero_leading_trailing_zeros is
    not immediately used, but later commits in this stack will be consolidating the
    entire API of NonZeroT to be generated through nonzero_integers, and will need
    to make use of some of the other macros to do that.
    dtolnay committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    56df3bb View commit details
    Browse the repository at this point in the history
  2. Define only a single NonZero type per macro call

    Later in this stack, as the nonzero_integers macro is going to be
    responsible for producing a larger fraction of the API for the NonZero
    integer types, it will need to receive a number of additional arguments
    beyond the ones currently seen here.
    
    Additional arguments, especially named arguments across multiple lines,
    will turn out clearer if everything in one macro call is for the same
    NonZero type.
    
    This commit adopts a similar arrangement to what we do for generating
    the API of the integer primitives (`impl u8` etc), which also generate a
    single type's API per top-level macro call, rather than generating all
    12 impl blocks for the 12 types from one macro call.
    dtolnay committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    54cb822 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9196d2a View commit details
    Browse the repository at this point in the history
  4. Format nonzero_integer macro calls same way we do the primitive int i…

    …mpls
    
    The `key = $value` style will be beneficial as we introduce some more
    macro arguments here in later commits.
    dtolnay committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    a6152cd View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3de0af1 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    81e1a7c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a78d9a6 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f846ed5 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    757ed25 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    4291b3f View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    b21b9cc View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    c6d776e View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    63256af View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    4419136 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    7f7c5af View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    66cda3b View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    c537132 View commit details
    Browse the repository at this point in the history
  18. Unbreak tidy's feature parser

        tidy error: /git/rust/library/core/src/num/nonzero.rs:67: malformed stability attribute: missing `feature` key
        tidy error: /git/rust/library/core/src/num/nonzero.rs:82: malformed stability attribute: missing `feature` key
        tidy error: /git/rust/library/core/src/num/nonzero.rs:98: malformed stability attribute: missing the `since` key
        tidy error: /git/rust/library/core/src/num/nonzero.rs:112: malformed stability attribute: missing `feature` key
        tidy error: /git/rust/library/core/src/num/nonzero.rs:450: malformed stability attribute: missing `feature` key
        some tidy checks failed
    dtolnay committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    cdee1fe View commit details
    Browse the repository at this point in the history