571 Commits

Author SHA1 Message Date
Jorge Aparicio
0484efb5bf update changelog 2022-05-09 16:58:51 +02:00
Jorge Aparicio
1735e6e58c rustfmt 2022-05-09 16:58:01 +02:00
gramar
b6f4bc03d2 Add changelog entry for Indexmap entry api 2022-05-09 16:57:47 +02:00
gramar
9b03b5940d Drive-by fix insert on full map 2022-05-09 16:57:03 +02:00
gramar
b6b3438f21 Add entry API 2022-05-09 16:55:35 +02:00
gramar
d2c85a18e0 Add entry API 2022-05-09 16:55:32 +02:00
Jorge Aparicio
fa1e92dacd rustfmt 2022-05-09 16:53:10 +02:00
Jorge Aparicio
b36367a28e
Merge pull request #275 from MarcusGrass/indexmap_into_iter
Add intoiter for Indexmap
2022-05-09 14:52:55 +00:00
bors[bot]
4ad6060f31
Merge #274
274: Implement FromIterator for String r=japaric a=VersBinarii

Implements FromIterator trait on String.

It also addresses issue: https://github.com/japaric/heapless/issues/245

Co-authored-by: VersBinarii <versbinarii@gmail.com>
2022-05-09 13:54:37 +00:00
Jorge Aparicio
0cb35c7170 v0.7.11 v0.7.11 2022-05-09 15:25:16 +02:00
Jorge Aparicio
56d2a37f76
Merge pull request #288 from japaric/safe-droppable
remove unsafe from Droppable test helper
2022-05-09 13:23:30 +00:00
Jorge Aparicio
433e4a3cdb remove unsafe from Droppable test helper 2022-05-09 15:14:34 +02:00
Jorge Aparicio
44fb37d168
Merge pull request #287 from japaric/binary-heap-double-drop
fix: BinaryHeap elements are dropped twice
2022-05-09 13:13:38 +00:00
Jorge Aparicio
5c39f5c7ee fix: BinaryHeap elements are dropped twice 2022-05-09 15:07:03 +02:00
bors[bot]
6877eedfd4
Merge #280
280: Fix undefined behavior identified by Miri r=japaric a=jgallagher

Hi! We ran into an exception triggered by new undefined behavior checks inserted into the nightly compiler (https://github.com/rust-lang/rust/pull/92686/files#diff-54110dcedc5a4d976321aa5d2a6767ac0744a3ef1363b75ffc62faf81cf14c30R230-L229). Running `heapless`'s test suite under Miri didn't flag anything at first, but it did once we added `MIRIFLAGS="-Zmiri-tag-raw-pointers"`. All three of the fixes in this PR were identified via

```
MIRIFLAGS="-Zmiri-tag-raw-pointers -Zmiri-ignore-leaks" cargo +nightly miri test -- --skip pool::
```

and the fixes came from copying the implementations from the equivalent methods in `std`. Note that I skipped the `pool::` tests; there is at least one miri failure in them, but it wasn't immediately obvious how to fix it so I skipped it for now. It's probably worth adding the flag above to the CI miri run, but I didn't do that either (since it would immediately cause failures given I didn't fix the problem in `pool`).

The specific output for `pool` is

```
test pool::singleton::tests::sanity ... error: Undefined Behavior: trying to reborrow <untagged> for SharedReadWrite permission at alloc36[0x1], but that tag does not exist in the borrow stack for this location
   --> /home/john/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:380:18
    |
380 |         unsafe { &*self.as_ptr() }
    |                  ^^^^^^^^^^^^^^^
    |                  |
    |                  trying to reborrow <untagged> for SharedReadWrite permission at alloc36[0x1], but that tag does not exist in the borrow stack for this location
    |                  this error occurs as part of a reborrow at alloc36[0x1..0x9]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information

    = note: inside `std::ptr::NonNull::<pool::stack::Node<u8>>::as_ref` at /home/john/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:380:18
note: inside `pool::stack::Stack::<u8>::push` at src/pool/cas.rs:43:17
   --> src/pool/cas.rs:43:17
    |
43  | /                 new_head
44  | |                     .as_raw()
45  | |                     .as_ref()
    | |_____________________________^
note: inside `pool::Pool::<u8>::grow` at src/pool/mod.rs:390:25
   --> src/pool/mod.rs:390:25
    |
390 |                         self.stack.push(p);
    |                         ^^^^^^^^^^^^^^^^^^
note: inside `<pool::singleton::tests::sanity::A as pool::singleton::Pool>::grow` at src/pool/singleton.rs:78:9
   --> src/pool/singleton.rs:78:9
    |
78  |         Self::ptr().grow(memory)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `pool::singleton::tests::sanity` at src/pool/singleton.rs:362:9
   --> src/pool/singleton.rs:362:9
    |
362 |         A::grow(unsafe { &mut MEMORY });
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure at src/pool/singleton.rs:353:5
   --> src/pool/singleton.rs:353:5
    |
352 |       #[test]
    |       ------- in this procedural macro expansion
353 | /     fn sanity() {
354 | |         const SZ: usize = 2 * mem::size_of::<Node<u8>>() - 1;
355 | |         static mut MEMORY: [u8; SZ] = [0; SZ];
356 | |
...   |
373 | |         assert_eq!(*A::alloc().unwrap().init(1), 1);
374 | |     }
    | |_____^
    = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
```

Co-authored-by: John Gallagher <john@oxidecomputer.com>
2022-05-02 08:55:31 +00:00
Emil Fresk
1c56672469
Merge pull request #283 from japaric/rm-scoped_threadpool
use std:🧵:scope instead of scoped_threadpool
2022-05-01 09:39:06 +02:00
John Gallagher
8fd2907115 Add note to CHANGELOG 2022-04-29 12:42:52 -04:00
Jorge Aparicio
57ac20eeb7 ubuntu-specific(?) suppressions 2022-04-29 16:16:24 +02:00
Jorge Aparicio
1e1d801b07 fix typo 2022-04-29 15:29:15 +02:00
Jorge Aparicio
3d3277f6d3 only build tests that require thread::scope on nightly 2022-04-29 15:21:58 +02:00
Jorge Aparicio
477c53b25d use std:🧵:scope instead of scoped_threadpool
as it's easier to deal with TSAN false positives in the former API

as surfaced in PR 280 the current supression rules don't handle newer versions of the
scoped_threadpool crate

trying to update the supression rules related to scoped_threadpool in PR #282 revealed that the
supression rules are masking (hiding) real data races:
https://github.com/japaric/heapless/pull/282#issuecomment-1113173358

std:🧵:scope requires less supression rules and does not mask real data races -- for instance,
the data race in the linked issue comment is not masked when using std:🧵:scope

tradeoffs:
- pro: one less dev dependency
- pro: supressions file is simpler
- cons: std:🧵:scope is only available on recent nightlies
2022-04-29 15:20:55 +02:00
John Gallagher
713abb8bd6 Fix undefined behavior in Vec::swap_remove_unchecked() 2022-04-28 17:42:30 -04:00
John Gallagher
f7eb54477c Fix undefined behavior in Vec::truncate() 2022-04-28 17:29:20 -04:00
John Gallagher
d304960424 Fix undefined behavior in Hole::move_to() 2022-04-28 17:26:02 -04:00
gramar
8b3c7f238a Add intoiter for Indexmap 2022-03-23 13:38:15 +01:00
VersBinarii
c7bc3c8166 Implement FromIterator for String 2022-03-15 15:36:10 +01:00
Emil Fresk
9fb9cd7045
Merge pull request #269 from quartiq/fix-pool-example
pool: fix example
2022-02-14 16:43:38 +01:00
Robert Jördens
668033f991 add changelog entry 2022-02-14 14:19:15 +01:00
Robert Jördens
6ffbcb84f1 pool: fix example
* Pool trait and exception use missing
2022-02-11 10:28:40 +01:00
Emil Fresk
3b2bc421a0 Remove deploy CI, docs.rs works well 2022-01-21 12:04:30 +01:00
Emil Fresk
98b7dd41f8 Release 0.7.10 v0.7.10 2022-01-21 12:03:14 +01:00
Emil Fresk
4a204da35d
Merge pull request #267 from TDHolmes/allow-non-x86-hosts
assume native compilation if target_os is not "none" to allow non-x86 hosts to run tests
2022-01-21 11:46:23 +01:00
Tyler Holmes
5cf74504da
Merge branch 'master' into allow-non-x86-hosts 2022-01-20 09:59:22 -08:00
Tyler Holmes
db3e2b98ed
Update CHANGELOG.md 2022-01-20 09:58:43 -08:00
Emil Fresk
70cecc4147
Merge pull request #265 from TDHolmes/cas-fixup
Add cas support for risc-v via atomic-polyfill and fix mpmc/pool documentation
2022-01-19 14:59:12 +01:00
Tyler Holmes
bc9e208089 differentiate full vs CAS polyfill 2022-01-17 11:32:13 -08:00
Tyler Holmes
a68ce63fbe changelog 2022-01-17 11:32:12 -08:00
Tyler Holmes
58e020a287 have docs.rs document the optional features 2022-01-17 11:31:40 -08:00
Tyler Holmes
a469645439 fix documentation 2022-01-17 11:31:40 -08:00
Tyler Holmes
63c0370d69 add riscv cas atomic support and cleanup the #cfg's for it 2022-01-17 11:31:40 -08:00
Emil Fresk
7546c64e79
Merge pull request #266 from finnbear/feature/historybuf_ordered_iterator
Feature/historybuf `OldestOrdered` iterator
2022-01-17 08:11:52 +01:00
Tyler Holmes
2bee731ed1 assume native compilation if target_os is not "none" to allow non-x86 hosts to run tests 2022-01-16 14:56:00 -08:00
Finn Bear
4d0a160638
Merge branch 'master' into feature/historybuf_ordered_iterator 2022-01-15 23:34:01 -08:00
Finn Bear
60da0951f3 Changelog. 2022-01-15 23:32:03 -08:00
Finn Bear
55a1ec9ea3 Cleanup tests. 2022-01-15 16:58:10 -08:00
Finn Bear
4132b5115c Fix termination behavior and add comprehensive test cases. 2022-01-15 16:41:33 -08:00
Finn Bear
77adbab007 Fix panic if buffer was empty. 2022-01-15 15:48:05 -08:00
Emil Fresk
e33646c189 Add changelog enforcer 2022-01-10 08:27:52 +01:00
Emil Fresk
0eff6364fb
Merge pull request #254 from eivindbergem/master
Implemented sealed traits according to Rust API Guidelines
2022-01-10 08:27:02 +01:00
Emil Fresk
180db255c7
Merge pull request #261 from haata/zero_capacity_vec
Relax Vec bounds to allow for zero-length Vecs
2022-01-10 08:26:03 +01:00