Skip to content

[pull] master from dtolnay:master#5

Open
pull[bot] wants to merge 240 commits intomesalock-linux:masterfrom
dtolnay:master
Open

[pull] master from dtolnay:master#5
pull[bot] wants to merge 240 commits intomesalock-linux:masterfrom
dtolnay:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull bot commented Mar 17, 2020

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added ⤵️ pull merge-conflict Resolve conflicts manually labels Mar 17, 2020
We run our test suite as far back as rustc 1.20, which does not support
the modern tool attribute syntax.

    warning: lint name `cast_lossless` is deprecated and may not have an effect in the future.
     --> tests/test.rs:3:11
      |
    3 |     allow(cast_lossless, string_lit_as_bytes, unseparated_literal_suffix)
      |           ^^^^^^^^^^^^^ help: change it to: `clippy::cast_lossless`
      |
      = note: `#[warn(renamed_and_removed_lints)]` on by default

    warning: lint name `string_lit_as_bytes` is deprecated and may not have an effect in the future.
     --> tests/test.rs:3:26
      |
    3 |     allow(cast_lossless, string_lit_as_bytes, unseparated_literal_suffix)
      |                          ^^^^^^^^^^^^^^^^^^^ help: change it to: `clippy::string_lit_as_bytes`

    warning: lint name `unseparated_literal_suffix` is deprecated and may not have an effect in the future.
     --> tests/test.rs:3:47
      |
    3 |     allow(cast_lossless, string_lit_as_bytes, unseparated_literal_suffix)
      |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change it to: `clippy::unseparated_literal_suffix`
    error[E0658]: use of unstable library feature `maybe_uninit_slice`
       --> src/lib.rs:227:47
        |
    227 |     unsafe { str::from_utf8_unchecked(written.assume_init_ref()) }
        |                                               ^^^^^^^^^^^^^^^
    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:254:30
        |
    254 |                     unsafe { core::hint::assert_unchecked(offset >= 4) }
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    313 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = note: this error originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:257:30
        |
    257 |                     unsafe { core::hint::assert_unchecked(offset <= buf.len()) }
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    313 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = note: this error originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:278:30
        |
    278 |                     unsafe { core::hint::assert_unchecked(offset >= 2) }
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    313 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = note: this error originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:281:30
        |
    281 |                     unsafe { core::hint::assert_unchecked(offset <= buf.len()) }
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    313 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = note: this error originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:294:30
        |
    294 |                     unsafe { core::hint::assert_unchecked(offset >= 1) }
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    313 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = note: this error originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:297:30
        |
    297 |                     unsafe { core::hint::assert_unchecked(offset <= buf.len()) }
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    313 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = note: this error originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:352:22
        |
    352 |             unsafe { core::hint::assert_unchecked(offset >= 4) }
        |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:355:22
        |
    355 |             unsafe { core::hint::assert_unchecked(offset <= buf.len()) }
        |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:373:22
        |
    373 |             unsafe { core::hint::assert_unchecked(offset >= 2) }
        |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:376:22
        |
    376 |             unsafe { core::hint::assert_unchecked(offset <= buf.len()) }
        |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:389:22
        |
    389 |             unsafe { core::hint::assert_unchecked(offset >= 1) }
        |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    error[E0658]: use of unstable library feature 'hint_assert_unchecked'
       --> src/lib.rs:392:22
        |
    392 |             unsafe { core::hint::assert_unchecked(offset <= buf.len()) }
        |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    error[E0425]: cannot find function `size_of` in this scope
       --> src/lib.rs:246:23
        |
    246 |                 while size_of::<Self>() > 1
        |                       ^^^^^^^ not found in this scope
    ...
    325 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = note: this error originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: consider importing this function
        |
    45  + use core::mem::size_of;
        |
    error[E0658]: use of unstable library feature 'slice_first_last_chunk'
       --> src/lib.rs:160:46
        |
    160 |                 let (prefix, unsigned) = buf.split_last_chunk_mut().unwrap();
        |                                              ^^^^^^^^^^^^^^^^^^^^
    ...
    173 | impl_Integer!(i8, u8);
        | --------------------- in this macro invocation
        |
        = note: see issue #111774 <rust-lang/rust#111774> for more information
        = note: this error originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)

    error[E0308]: mismatched types
       --> src/lib.rs:161:84
        |
    161 |                 let mut offset = prefix.len() + Unsigned::fmt(self.unsigned_abs(), unsigned);
        |                                                 -------------                      ^^^^^^^^ expected `&mut [MaybeUninit<u8>; 3]`, found `&mut [MaybeUninit<u8>]`
        |                                                 |
        |                                                 arguments to this function are incorrect
    ...
    173 | impl_Integer!(i8, u8);
        | --------------------- in this macro invocation
        |
        = note: expected mutable reference `&mut [MaybeUninit<u8>; 3]`
                   found mutable reference `&mut [MaybeUninit<u8>]`
    note: method defined here
       --> src/lib.rs:231:8
        |
    231 |     fn fmt(self, buf: &mut Self::Buffer) -> usize;
        |        ^^^
        = note: this error originates in the macro `impl_Integer` (in Nightly builds, run with -Z macro-backtrace for more info)
    warning: this operation has no effect
       --> src/lib.rs:382:17
        |
    382 |             buf[offset + 0].write(DECIMAL_PAIRS[pair1 * 2 + 0]);
        |                 ^^^^^^^^^^ help: consider reducing it to: `offset`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op
        = note: `-W clippy::identity-op` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::identity_op)]`

    warning: this operation has no effect
       --> src/lib.rs:382:49
        |
    382 |             buf[offset + 0].write(DECIMAL_PAIRS[pair1 * 2 + 0]);
        |                                                 ^^^^^^^^^^^^^ help: consider reducing it to: `(pair1 * 2)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

    warning: this operation has no effect
       --> src/lib.rs:384:49
        |
    384 |             buf[offset + 2].write(DECIMAL_PAIRS[pair2 * 2 + 0]);
        |                                                 ^^^^^^^^^^^^^ help: consider reducing it to: `(pair2 * 2)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

    warning: this operation has no effect
       --> src/lib.rs:404:17
        |
    404 |             buf[offset + 0].write(DECIMAL_PAIRS[pair * 2 + 0]);
        |                 ^^^^^^^^^^ help: consider reducing it to: `offset`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

    warning: this operation has no effect
       --> src/lib.rs:404:49
        |
    404 |             buf[offset + 0].write(DECIMAL_PAIRS[pair * 2 + 0]);
        |                                                 ^^^^^^^^^^^^ help: consider reducing it to: `(pair * 2)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

    warning: this operation has no effect
       --> src/lib.rs:445:13
        |
    445 |         buf[quad_index * 4 + OFFSET + 0].write(DECIMAL_PAIRS[pair1 * 2 + 0]);
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(quad_index * 4 + OFFSET)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

    warning: this operation has no effect
       --> src/lib.rs:445:62
        |
    445 |         buf[quad_index * 4 + OFFSET + 0].write(DECIMAL_PAIRS[pair1 * 2 + 0]);
        |                                                              ^^^^^^^^^^^^^ help: consider reducing it to: `(pair1 * 2)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

    warning: this operation has no effect
       --> src/lib.rs:447:62
        |
    447 |         buf[quad_index * 4 + OFFSET + 2].write(DECIMAL_PAIRS[pair2 * 2 + 0]);
        |                                                              ^^^^^^^^^^^^^ help: consider reducing it to: `(pair2 * 2)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op
    warning: adding items after statements is confusing, since items exist from the start of the scope
       --> src/lib.rs:472:5
        |
    472 |     const M_HIGH: u128 = 76624777043294442917917351357515459181;
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
        = note: `-W clippy::items-after-statements` implied by `-W clippy::pedantic`
        = help: to override `-W clippy::pedantic` add `#[allow(clippy::items_after_statements)]`

    warning: adding items after statements is confusing, since items exist from the start of the scope
       --> src/lib.rs:473:5
        |
    473 |     const SH_POST: u8 = 51;
        |     ^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
On my machine, benchmarks are 15% faster without these...
    warning: casts from `u8` to `u32` can be expressed infallibly using `From`
       --> src/lib.rs:278:52
        |
    278 |                     let (pair1, pair2) = divmod100(quad as u32);
        |                                                    ^^^^^^^^^^^
    ...
    322 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = help: an `as` cast can become silently lossy if the types change in the future
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
        = note: `-W clippy::cast-lossless` implied by `-W clippy::pedantic`
        = help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_lossless)]`
        = note: this warning originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: use `u32::from` instead
        |
    278 -                     let (pair1, pair2) = divmod100(quad as u32);
    278 +                     let (pair1, pair2) = divmod100(u32::from(quad));
        |

        Checking itertools v0.13.0
    warning: casts from `u8` to `u32` can be expressed infallibly using `From`
       --> src/lib.rs:295:50
        |
    295 |                     let (last, pair) = divmod100(remain as u32);
        |                                                  ^^^^^^^^^^^^^
    ...
    322 | impl_Unsigned!(u8);
        | ------------------ in this macro invocation
        |
        = help: an `as` cast can become silently lossy if the types change in the future
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
        = note: this warning originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: use `u32::from` instead
        |
    295 -                     let (last, pair) = divmod100(remain as u32);
    295 +                     let (last, pair) = divmod100(u32::from(remain));
        |

    warning: casts from `u16` to `u32` can be expressed infallibly using `From`
       --> src/lib.rs:278:52
        |
    278 |                     let (pair1, pair2) = divmod100(quad as u32);
        |                                                    ^^^^^^^^^^^
    ...
    323 | impl_Unsigned!(u16);
        | ------------------- in this macro invocation
        |
        = help: an `as` cast can become silently lossy if the types change in the future
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
        = note: this warning originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: use `u32::from` instead
        |
    278 -                     let (pair1, pair2) = divmod100(quad as u32);
    278 +                     let (pair1, pair2) = divmod100(u32::from(quad));
        |

    warning: casts from `u16` to `u32` can be expressed infallibly using `From`
       --> src/lib.rs:295:50
        |
    295 |                     let (last, pair) = divmod100(remain as u32);
        |                                                  ^^^^^^^^^^^^^
    ...
    323 | impl_Unsigned!(u16);
        | ------------------- in this macro invocation
        |
        = help: an `as` cast can become silently lossy if the types change in the future
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
        = note: this warning originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: use `u32::from` instead
        |
    295 -                     let (last, pair) = divmod100(remain as u32);
    295 +                     let (last, pair) = divmod100(u32::from(remain));
        |

    warning: casts from `u32` to `u64` can be expressed infallibly using `From`
       --> src/lib.rs:296:30
        |
    296 |                     remain = last as Self;
        |                              ^^^^^^^^^^^^
    ...
    325 | impl_Unsigned!(u64);
        | ------------------- in this macro invocation
        |
        = help: an `as` cast can become silently lossy if the types change in the future
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
        = note: this warning originates in the macro `impl_Unsigned` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: use `Self::from` instead
        |
    296 -                     remain = last as Self;
    296 +                     remain = Self::from(last);
        |

    warning: casts from `u32` to `u64` can be expressed infallibly using `From`
       --> src/lib.rs:378:22
        |
    378 |             remain = last as u64;
        |                      ^^^^^^^^^^^
        |
        = help: an `as` cast can become silently lossy if the types change in the future
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
    help: use `u64::from` instead
        |
    378 -             remain = last as u64;
    378 +             remain = u64::from(last);
        |
Sync algorithm from rust-lang/rust master
dtolnay and others added 9 commits December 26, 2025 22:56
Simplify pointer usage in Buffer::format method
The compiler is unaware of the restricted range of the input, so it is
unable to optimize out the final division and modulus. By doing this
manually, we get a nontrivial performance gain.
Optimize 128-bit integer formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⤵️ pull merge-conflict Resolve conflicts manually

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants