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

Rollup of 10 pull requests #120121

Merged
merged 41 commits into from
Jan 19, 2024
Merged

Rollup of 10 pull requests #120121

merged 41 commits into from
Jan 19, 2024

Commits on Dec 10, 2023

  1. Configuration menu
    Copy the full SHA
    17edbe7 View commit details
    Browse the repository at this point in the history

Commits on Dec 19, 2023

  1. Docs: Use non-SeqCst in module example of atomics

    I done this for this reasons:
    1. The example now shows that there is more Orderings than just SeqCst.
    2. People who would copy from example would now have more suitable orderings for the job.
    3. SeqCst is both much harder to reason about and not needed in most situations.
    
    IMHO, we should encourage people to think and use memory orderings that is suitable to task instead of blindly defaulting to SeqCst.
    AngelicosPhosphoros committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    1c5b2ce View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2024

  1. Configuration menu
    Copy the full SHA
    46ad131 View commit details
    Browse the repository at this point in the history

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

Commits on Jan 17, 2024

  1. Configuration menu
    Copy the full SHA
    c1c7707 View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2024

  1. Configuration menu
    Copy the full SHA
    ec263df View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0373ce6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d95d6ce View commit details
    Browse the repository at this point in the history
  4. Remove no-longer-needed allow(dead_code) from the standard library

    `repr(transparent)` now silences the lint.
    shepmaster committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    fb7762b View commit details
    Browse the repository at this point in the history
  5. Remove no-longer-needed allow(dead_code) from the tests

    `repr(transparent)` now silences the lint.
    shepmaster committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    92cc57b View commit details
    Browse the repository at this point in the history
  6. Remove no-longer-needed allow(dead_code) from Miri tests

    `repr(transparent)` now silences the lint.
    shepmaster committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    aeeaed9 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7fead95 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    35a9fc3 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2024

  1. Configuration menu
    Copy the full SHA
    1a34342 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#118665 - dtolnay:signedness, r=Nilstrieb

    Consolidate all associated items on the NonZero integer types into a single impl block per type
    
    **Before:**
    
    ```rust
    #[repr(transparent)]
    #[rustc_layout_scalar_valid_range_start(1)]
    pub struct NonZeroI8(i8);
    
    impl NonZeroI8 {
        pub const fn new(n: i8) -> Option<Self> ...
        pub const fn get(self) -> i8 ...
    }
    
    impl NonZeroI8 {
        pub const fn leading_zeros(self) -> u32 ...
        pub const fn trailing_zeros(self) -> u32 ...
    }
    
    impl NonZeroI8 {
        pub const fn abs(self) -> NonZeroI8 ...
    }
    ...
    ```
    
    **After:**
    
    ```rust
    #[repr(transparent)]
    #[rustc_layout_scalar_valid_range_start(1)]
    pub struct NonZeroI8(i8);
    
    impl NonZeroI8 {
        pub const fn new(n: i8) -> Option<Self> ...
        pub const fn get(self) -> i8 ...
        pub const fn leading_zeros(self) -> u32 ...
        pub const fn trailing_zeros(self) -> u32 ...
        pub const fn abs(self) -> NonZeroI8 ...
        ...
    }
    ```
    
    Having 6-7 different impl blocks per type is not such a problem in today's implementation, but becomes awful upon the switch to a generic `NonZero<T>` type (context: rust-lang#82363 (comment)).
    
    In the implementation from rust-lang#100428, there end up being **67** impl blocks on that type.
    
    <img src="https://github.com/rust-lang/rust/assets/1940490/5b68bd6f-8a36-4922-baa3-348e30dbfcc1" width="200"><img src="https://github.com/rust-lang/rust/assets/1940490/2cfec71e-c2cd-4361-a542-487f13f435d9" width="200"><img src="https://github.com/rust-lang/rust/assets/1940490/2fe00337-7307-405d-9036-6fe1e58b2627" width="200">
    
    Without the refactor to a single impl block first, introducing `NonZero<T>` would be a usability regression compared to today's separate pages per type. With all those blocks expanded, Ctrl+F is obnoxious because you need to skip 12&times; past every match you don't care about. With all the blocks collapsed, Ctrl+F is useless. Getting to a state in which exactly one type's (e.g. `NonZero<u32>`) impl blocks are expanded while the rest are collapsed is annoying.
    
    After this refactor to a single impl block, we can move forward with making `NonZero<T>` a generic struct whose docs all go on the same rustdoc page. The rustdoc will have 12 impl blocks, one per choice of `T` supported by the standard library. The reader can expand a single one of those impl blocks e.g. `NonZero<u32>` to understand the entire API of that type.
    
    Note that moving the API into a generic `impl<T> NonZero<T> { ... }` is not going to be an option until after `NonZero<T>` has been stabilized, which may be months or years after its introduction. During the period while generic `NonZero` is unstable, it will be extra important to offer good documentation on all methods demonstrating the API being used through the stable aliases such as `NonZeroI8`.
    
    This PR follows a `key = $value` syntax for the macros which is similar to the macros we already use for producing a single large impl block on the integer primitives.
    
    https://github.com/rust-lang/rust/blob/1dd4db50620fb38a6382c22456a96ed7cddeff83/library/core/src/num/mod.rs#L288-L309
    
    Best reviewed one commit at a time.
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    122b3f9 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#118798 - GnomedDev:use-atomicu8-backtrace, …

    …r=Nilstrieb
    
    Use AtomicU8 instead of AtomicUsize in backtrace.rs
    
    Just a small inefficiency I saw when looking at std sources.
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    2d828cd View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#119062 - compiler-errors:asm-in-let-else, r…

    …=davidtwco,est31
    
    Deny braced macro invocations in let-else
    
    Fixes rust-lang#119057
    
    Pending T-lang decision
    
    cc `@dtolnay`
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    2e4c6fc View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#119138 - AngelicosPhosphoros:use_proper_ato…

    …mics_in_spinlock_example, r=Nilstrieb
    
    Docs: Use non-SeqCst in module example of atomics
    
    I done this for this reasons:
    1. The example now shows that there is more Orderings than just SeqCst.
    2. People who would copy from example would now have more suitable orderings for the job.
    3. SeqCst is both much harder to reason about and not needed in most situations.
    
    IMHO, we should encourage people to think and use memory orderings that is suitable to task instead of blindly defaulting to SeqCst.
    
    r? `@m-ou-se`
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    f9076bb View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#119907 - asquared31415:fn_trait_docs, r=Nil…

    …strieb
    
    Update `fn()` trait implementation docs
    
    Fixes rust-lang#119903
    
    This was FCP'd and approved for the 1.70.0 release, this is just a docs update to match that change.
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    48ba721 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#120083 - Zalathar:no-profiler, r=wesleywiser

    Warn when not having a profiler runtime means that coverage tests won't be run/blessed
    
    On a few occasions (e.g. rust-lang#118036, rust-lang#119984) people have been tripped up by the fact that half of the coverage test suite is skipped by default, because it `// needs-profiler-support` and the profiler runtime is not actually built in any of the default config profiles.
    
    (This is made worse by the fact that it isn't enabled in any of the PR CI jobs either. So people think that they've successfully blessed the test suite, and then get a rude surprise when their merge only fails in the full CI job suite.)
    
    This PR adds a simple warning to compiletest that should alert the user in some cases. It's not foolproof, but it should increase the chances of catching this problem earlier in the PR process.
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    987445c View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#120107 - shepmaster:dead-code-repr-transpar…

    …ent, r=Nilstrieb
    
    dead_code treats #[repr(transparent)] the same as #[repr(C)]
    
    In rust-lang#92972 we enabled linting on unused fields in tuple structs. In rust-lang#118297 that lint was enabled by default. That exposed issues like rust-lang#119659, where the fields of a struct marked `#[repr(transparent)]` were reported by the `dead_code` lint. The language team [decided](rust-lang#119659 (comment)) that the lint should treat `repr(transparent)` the same as `#[repr(C)]`.
    
    Fixes rust-lang#119659
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    332f8f7 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#120110 - invpt:patch-1, r=the8472

    Update documentation for Vec::into_boxed_slice to be more clear about excess capacity
    
    Currently, the documentation for Vec::into_boxed_slice says that "if the vector has excess capacity, its items will be moved into a newly-allocated buffer with exactly the right capacity." This is misleading, as copies do not necessarily occur, depending on if the allocator supports in-place shrinking. I copied some of the wording from shrink_to_fit, though it could potentially still be worded better than this.
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    7219bd2 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#120113 - WaffleLapkin:🔥-1, r=compiler-errors

    Remove myself from review rotation
    
    r? `@wesleywiser`
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    e35dfed View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#120118 - kapilsinha:patch-1, r=Nilstrieb

    Fix typo in documentation in base.rs
    matthiaskrgr authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    b4616f5 View commit details
    Browse the repository at this point in the history