-
Notifications
You must be signed in to change notification settings - Fork 210
Const generics port #198
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
Merged
Const generics port #198
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
e4580da
x86_64: "practically" thread-safe Pool
japaric 596a1f0
fix warnings
japaric b9d7128
x86: put Sync impl behind a Cargo feature
japaric b0129f5
1.36.0 compatibility
japaric 357a312
Preparing for v0.5.5
korken89 87917e0
Make Producer<..., SingleCore> Send, like Consumer
BryanKadzban 1790c4f
indexmap: expose PowerOfTwo, Bucket and Pos
willem66745 0ab806d
readme: add instructions for tests
andresv 26dcfa3
histbuf: replace slow modulo operatins
andresv 9e08514
histbuf: fix style
andresv 0364e05
Vec: add set_len
samlich 6ba462e
String: add as_mut_vec
samlich f962e3a
Initial conversion to const generics
perlindgren 6dcedb8
Fixes for min const generics
korken89 8ba71d4
Merge branch 'master' into const_generics
korken89 305de71
Fixed warnings
korken89 3de878b
Cleanup
korken89 f7cb3e5
Fix fmt
kpp a3f4d8f
Update minimal Rust version from 1.31 to 1.51
kpp 92cc062
Fix cargo test without cargo features enabled
kpp 7fb276f
Fix warnings in src/indexmap.rs
kpp 5bde47c
Fix cfail tests
kpp aee0817
Merge pull request #199 from kpp/const_generics
korken89 1444990
Cleanup and HistoryBuffer is now const and using MaybeUninit
korken89 73d209a
Merge branch 'master' into const_generics
korken89 12682bd
Removed unnecessary String interface, already covered by `core`
korken89 870a925
Removed SingeCore and MultiCore, relies on atomics now
korken89 e0b3b3a
remove as_slice dependency
burrbull 622eba9
Merge pull request #200 from burrbull/const_generics
korken89 618eebf
AsRef, AsMut for pool
burrbull fbf8c4d
Merge pull request #201 from burrbull/const_generics
korken89 a507b8e
Fix cfail tests in const generics
kpp 5d294a7
Merge pull request #202 from kpp/fix_cfail
korken89 6bee0f8
Simplify code in histbuf
kpp e21c402
Merge pull request #203 from kpp/simplify_histbuf
korken89 2bfe3fe
Restore tests for SPSC as close as we can
korken89 1fac593
Added unsafe and docs to Queue::{u8(), u16()}
korken89 2c248a3
Fixed so pool and MPMC works on thumbv6
korken89 0ffef8f
Cleanup of comments
korken89 dfa5d50
Updated changelog
korken89 6fdcc4f
New SPSC queue, now safe and much simpler
korken89 58cb279
IndexMap::new() is now a const-fn
korken89 bf6728e
Clarification in changelog
korken89 8754c3d
Added missing `{enqueue, dequeue}_unchecked` interfaces
korken89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
authors = [ | ||
"Jorge Aparicio <[email protected]>", | ||
"Per Lindgren <[email protected]>", | ||
"Emil Fresk <[email protected]>", | ||
] | ||
categories = [ | ||
"data-structures", | ||
|
@@ -31,10 +32,11 @@ __trybuild = [] | |
[target.x86_64-unknown-linux-gnu.dev-dependencies] | ||
scoped_threadpool = "0.1.8" | ||
|
||
[target.thumbv6m-none-eabi.dependencies] | ||
atomic-polyfill = "0.1.2" | ||
|
||
[dependencies] | ||
as-slice = "0.1.5" | ||
generic-array = "0.14.4" | ||
hash32 = "0.1.0" | ||
hash32 = "0.2.1" | ||
|
||
[dependencies.serde] | ||
version = "1" | ||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,89 @@ | ||
error[E0277]: `*const ()` cannot be sent between threads safely | ||
--> $DIR/not-send.rs:19:5 | ||
| | ||
19 | is_send::<Consumer<NotSend, consts::U4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
12 | fn is_send<T>() | ||
| ------- required by a bound in this | ||
13 | where | ||
14 | T: Send, | ||
| ---- required by this bound in `is_send` | ||
... | ||
19 | is_send::<Consumer<NotSend, 4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
| | ||
= help: within `std::marker::PhantomData<*const ()>`, the trait `std::marker::Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `std::marker::PhantomData<*const ()>` | ||
= note: required because of the requirements on the impl of `std::marker::Send` for `heapless::spsc::split::Consumer<'_, std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>` | ||
note: required by `is_send` | ||
--> $DIR/not-send.rs:12:1 | ||
| | ||
12 | / fn is_send<T>() | ||
13 | | where | ||
14 | | T: Send, | ||
15 | | { | ||
16 | | } | ||
| |_^ | ||
= help: within `PhantomData<*const ()>`, the trait `Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `PhantomData<*const ()>` | ||
= note: required because of the requirements on the impl of `Send` for `Consumer<'_, PhantomData<*const ()>, 4_usize>` | ||
|
||
error[E0277]: `*const ()` cannot be sent between threads safely | ||
--> $DIR/not-send.rs:20:5 | ||
| | ||
20 | is_send::<Producer<NotSend, consts::U4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
| | ||
= help: within `std::marker::PhantomData<*const ()>`, the trait `std::marker::Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `std::marker::PhantomData<*const ()>` | ||
= note: required because of the requirements on the impl of `std::marker::Send` for `heapless::spsc::split::Producer<'_, std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>` | ||
note: required by `is_send` | ||
--> $DIR/not-send.rs:12:1 | ||
12 | fn is_send<T>() | ||
| ------- required by a bound in this | ||
13 | where | ||
14 | T: Send, | ||
| ---- required by this bound in `is_send` | ||
... | ||
20 | is_send::<Producer<NotSend, 4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
| | ||
12 | / fn is_send<T>() | ||
13 | | where | ||
14 | | T: Send, | ||
15 | | { | ||
16 | | } | ||
| |_^ | ||
= help: within `PhantomData<*const ()>`, the trait `Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `PhantomData<*const ()>` | ||
= note: required because of the requirements on the impl of `Send` for `Producer<'_, PhantomData<*const ()>, 4_usize>` | ||
|
||
error[E0277]: `*const ()` cannot be sent between threads safely | ||
--> $DIR/not-send.rs:21:5 | ||
| | ||
21 | is_send::<Queue<NotSend, consts::U4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
| | ||
= help: within `std::marker::PhantomData<*const ()>`, the trait `std::marker::Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `std::marker::PhantomData<*const ()>` | ||
= note: required because of the requirements on the impl of `std::marker::Send` for `generic_array::GenericArray<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>` | ||
= note: required because it appears within the type `std::mem::ManuallyDrop<generic_array::GenericArray<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>>` | ||
= note: required because it appears within the type `std::mem::MaybeUninit<generic_array::GenericArray<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>>` | ||
= note: required because it appears within the type `heapless::i::Queue<generic_array::GenericArray<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>>` | ||
= note: required because it appears within the type `heapless::spsc::Queue<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>` | ||
note: required by `is_send` | ||
--> $DIR/not-send.rs:12:1 | ||
12 | fn is_send<T>() | ||
| ------- required by a bound in this | ||
13 | where | ||
14 | T: Send, | ||
| ---- required by this bound in `is_send` | ||
... | ||
21 | is_send::<Queue<NotSend, 4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
| | ||
12 | / fn is_send<T>() | ||
13 | | where | ||
14 | | T: Send, | ||
15 | | { | ||
16 | | } | ||
| |_^ | ||
= help: within `Queue<PhantomData<*const ()>, 4_usize>`, the trait `Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `PhantomData<*const ()>` | ||
= note: required because it appears within the type `ManuallyDrop<PhantomData<*const ()>>` | ||
= note: required because it appears within the type `MaybeUninit<PhantomData<*const ()>>` | ||
= note: required because it appears within the type `UnsafeCell<MaybeUninit<PhantomData<*const ()>>>` | ||
= note: required because it appears within the type `[UnsafeCell<MaybeUninit<PhantomData<*const ()>>>; 4]` | ||
= note: required because it appears within the type `Queue<PhantomData<*const ()>, 4_usize>` | ||
|
||
error[E0277]: `*const ()` cannot be sent between threads safely | ||
--> $DIR/not-send.rs:22:5 | ||
| | ||
22 | is_send::<heapless::Vec<NotSend, consts::U4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
12 | fn is_send<T>() | ||
| ------- required by a bound in this | ||
13 | where | ||
14 | T: Send, | ||
| ---- required by this bound in `is_send` | ||
... | ||
22 | is_send::<Vec<NotSend, 4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
| | ||
= help: within `heapless::Vec<PhantomData<*const ()>, 4_usize>`, the trait `Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `PhantomData<*const ()>` | ||
= note: required because it appears within the type `[PhantomData<*const ()>; 4]` | ||
= note: required because it appears within the type `ManuallyDrop<[PhantomData<*const ()>; 4]>` | ||
= note: required because it appears within the type `MaybeUninit<[PhantomData<*const ()>; 4]>` | ||
= note: required because it appears within the type `heapless::Vec<PhantomData<*const ()>, 4_usize>` | ||
|
||
error[E0277]: `*const ()` cannot be sent between threads safely | ||
--> $DIR/not-send.rs:23:5 | ||
| | ||
= help: within `std::marker::PhantomData<*const ()>`, the trait `std::marker::Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `std::marker::PhantomData<*const ()>` | ||
= note: required because of the requirements on the impl of `std::marker::Send` for `generic_array::GenericArray<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>` | ||
= note: required because it appears within the type `std::mem::ManuallyDrop<generic_array::GenericArray<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>>` | ||
= note: required because it appears within the type `std::mem::MaybeUninit<generic_array::GenericArray<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>>` | ||
= note: required because it appears within the type `heapless::i::Vec<generic_array::GenericArray<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>>` | ||
= note: required because it appears within the type `heapless::vec::Vec<std::marker::PhantomData<*const ()>, typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UInt<typenum::uint::UTerm, typenum::bit::B1>, typenum::bit::B0>, typenum::bit::B0>>` | ||
note: required by `is_send` | ||
--> $DIR/not-send.rs:12:1 | ||
12 | fn is_send<T>() | ||
| ------- required by a bound in this | ||
13 | where | ||
14 | T: Send, | ||
| ---- required by this bound in `is_send` | ||
... | ||
23 | is_send::<HistoryBuffer<NotSend, 4>>(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | ||
| | ||
12 | / fn is_send<T>() | ||
13 | | where | ||
14 | | T: Send, | ||
15 | | { | ||
16 | | } | ||
| |_^ | ||
= help: within `HistoryBuffer<PhantomData<*const ()>, 4_usize>`, the trait `Send` is not implemented for `*const ()` | ||
= note: required because it appears within the type `PhantomData<*const ()>` | ||
= note: required because it appears within the type `ManuallyDrop<PhantomData<*const ()>>` | ||
= note: required because it appears within the type `MaybeUninit<PhantomData<*const ()>>` | ||
= note: required because it appears within the type `[MaybeUninit<PhantomData<*const ()>>; 4]` | ||
= note: required because it appears within the type `HistoryBuffer<PhantomData<*const ()>, 4_usize>` |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.