-
-
Notifications
You must be signed in to change notification settings - Fork 44
Sync algorithm from rust-lang/rust master #65
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
Merged
+303
−209
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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);
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.