637 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
0eea6da5bc
Merge pull request #423 from MabezDev/new-0.7-release
Backport xtensa cas polyfil and bump to 0.7.17
v0.7.17
2023-12-04 14:50:49 +01:00
Scott Mabin
bb436a004d Backport xtensa cas polyfil and bump to 0.7.17 2023-12-04 13:37:21 +00:00
Dario Nieuwenhuis
0a35fbfa7f Add CI config from main branch, fix build. 2023-12-04 13:45:29 +01:00
bors[bot]
06bd308da4
Merge #309
309: build docs as part of CI r=japaric a=japaric



Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-08-10 13:36:42 +00:00
Jorge Aparicio
eaebcdc654 build docs as part of CI 2022-08-10 15:32:19 +02:00
bors[bot]
5e93d0f415
Merge #308
308: update CI to use new branch name r=japaric a=japaric



Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-08-09 13:59:53 +00:00
Jorge Aparicio
9025e7d770 update CI to use new branch name 2022-08-09 15:59:23 +02:00
Jorge Aparicio
8a98b2650d v0.7.16 v0.7.16 2022-08-09 15:47:24 +02:00
bors[bot]
ca2dd9687f
Merge #307
307: update changelog after #303 r=japaric a=japaric



Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-08-09 11:42:04 +00:00
Jorge Aparicio
33152e3619 update changelog after #303 2022-08-09 13:38:05 +02:00
bors[bot]
3a59006b99
Merge #304
304: Make the docs build r=japaric a=falk-h

Turns out there were some broken links and `#![deny(warnings)]` in the crate root.

Co-authored-by: Falk Höppner <falk@technocreatives.com>
2022-08-09 11:34:11 +00:00
bors[bot]
c333a6c3b6
Merge #303
303: Vec - PartialEq where Rhs is the Vec r=japaric a=elpiel

I was using the Vec for tests and initially, I was confused because I saw the impl for PartialEq but then I realized that PartialEq with Rhs of Vec was not implemented.

These impls are not mandatory but might help other people when using Vec on Rhs.

PS: Amazing crate btw, thanks you for the awesome work!

Co-authored-by: Lachezar Lechev <elpiel93@gmail.com>
Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-08-09 09:55:21 +00:00
Jorge Aparicio
e3e3bd42fd
applease rustfmt 2022-08-09 11:31:33 +02:00
Falk Höppner
5c99525b02 Add doc fix to changelog 2022-07-19 15:36:48 +02:00
Falk Höppner
a7a807a6c2 Make the docs build
Turns out there were some broken links.
2022-07-18 23:03:02 +02:00
Lachezar Lechev
5dc13b35c1
Vec - PartialEq where Rhs is the Vec 2022-07-17 11:18:07 +02:00
bors[bot]
1463915689
Merge #302
302: Add clarification in String r=japaric a=mriise

Needed to look into implementation to be sure String was allocating bytes not chars.

Co-authored-by: Melanie Riise <me@mriise.net>
2022-07-06 09:19:05 +00:00
Melanie Riise
4eed6ad9d7
Add clarification in String 2022-07-05 09:17:46 -07:00
Jorge Aparicio
610bf51238 v0.7.15 v0.7.15 2022-07-05 12:19:33 +02:00
bors[bot]
8c329c3292
Merge #301
301: Add some more Vec methods. r=japaric a=Dirbaio

Added

- `Vec::insert(index, element)`
- `Vec::remove(index)`
- `Vec::retain(f)`
- `Vec::retain_mut(f)`

Behavior matches `std` except `insert` which is now fallible and returns back the element when full. Implementation and docs taken from `std`.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-07-05 10:08:35 +00:00
Dario Nieuwenhuis
1d4c333ab6 Add changelog. 2022-07-04 19:13:02 +02:00
Dario Nieuwenhuis
2d953ef95a Vec: add retain, retain_mut. 2022-07-04 19:07:25 +02:00
Dario Nieuwenhuis
f32d5d9daa Vec: add remove. 2022-07-04 19:07:20 +02:00
Dario Nieuwenhuis
fedce67b58 Vec: add insert. 2022-07-04 19:07:10 +02:00
bors[bot]
344629e9ed
Merge #300
300: Fix OOB get_unchecked, shadow Vec::as_ptr methods r=japaric a=saethlin

The fixes in #280 missed one instance of UB. The get_unchecked_mut
inside VacantEntry::Insert can be out of bounds of the initialized
region of the backing Vec. When that happens, the call is UB. This is
detected both by the standard library's debug assertions which can be
enabled with -Zbuild-std and with Miri but only with
-Zmiri-tag-raw-pointers.

This also adds inherent as_ptr and as_mut_ptr methods to Vec which
shadow those provided by the Deref to a slice. Without this shadowing,
the change from get_unchecked_mut to as_mut_ptr.add wouldn't actually
fix the problem identified by the debug assertions or Miri, it just
hides it from the debug assertions. The core problem is that references
narrow provenance, so if we want to access outside of the initialized
region of a Vec we need to get a pointer to the array without passing
through a reference to the initialized region first. The pointers from
these shadowing methods can be used to access anywhere in the allocation,
whereas vec.as_slice().as_ptr() would be UB to use for access into the
uninitialized region.

Co-authored-by: Ben Kimock <kimockb@gmail.com>
2022-06-20 12:28:51 +00:00
Ben Kimock
270db441f7 Fix OOB get_unchecked, shadow Vec::as_ptr methods
The fixes in #280 missed one instance of UB. The get_unchecked_mut
inside VacantEntry::Insert can be out of bounds of the initialized
region of the backing Vec. When that happens, the call is UB. This is
detected both by the standard library's debug assertions which can be
enabled with -Zbuild-std and with Miri but only with
-Zmiri-tag-raw-pointers.

This also adds inherent as_ptr and as_mut_ptr methods to Vec which
shadow those provided by the Deref to a slice. Without this shadowing,
the change from get_unchecked_mut to as_mut_ptr.add wouldn't actually
fix the problem identified by the debug assertions or Miri, it just
hides it from the debug assertions. The core problem is that references
narrow provenance, so if we want to access outside of the initialized
region of a Vec we need to get a pointer to the array without passing
through a reference to the initialized region first. The pointers from
these shadowing methods can be used to access anywhere in the allocation,
whereas vec.as_slice().as_ptr() would be UB to use for access into the
uninitialized region.
2022-06-18 19:37:26 -04:00
Jorge Aparicio
309f150ca0 v0.6.14 v0.7.14 2022-06-15 15:11:11 +02:00
bors[bot]
84cedfd3d2
Merge #277
277: Add support for Arduino Uno and 2560 r=japaric a=mutantbob

This patch includes changes I needed to build my Arduino Uno sketches.  I incorporated the work from https://github.com/japaric/heapless/pull/264 to reduce the chance of conflicts.

Now that atomic-polyfill 0.1.8 supports AVR, things are a bit easier.


Co-authored-by: Robert Forsman <git@thoth.purplefrog.com>
2022-06-15 11:41:55 +00:00
bors[bot]
0a844a0204
Merge #298
298: compile-time check power of two invariant in Index{Set,Map}'s default method r=korken89 a=japaric

closes #295

I tested this manually with both `FnvIndexSet` and `FnvIndexMap`. I tried to add a compile fail test but discovered (the hard way) that all the const assert trickery in `sealed` is checked when the code is built with `cargo build` but *not* when the code is built with `cargo check`. As `trybuild` uses `cargo check` under the hood it's not possible to compile fail test any of those const asserts.

r? `@korken89` 

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-06-15 11:28:46 +00:00
Jorge Aparicio
d58b8dbbb7 update changelog 2022-06-15 13:14:15 +02:00
bors[bot]
6dc013b7f9
Merge #299
299: remove the scoped_threads feature gate r=japaric a=japaric

the feature has been stabilized in a recent nightly

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-06-15 11:12:58 +00:00
Jorge Aparicio
d9e620036b remove the scoped_threads feature gate
the feature has been stabilized in a recent nightly
2022-06-15 13:11:48 +02:00
Robert Forsman
178d44cc4f that cast was unnecessary 2022-06-14 13:50:34 -04:00
Robert Forsman
c8e6dcc3da act on japaric's requests using techniques from Rahix to more generically support AVR 2022-06-14 13:47:05 -04:00
Jorge Aparicio
1379a9859c compile-time check power of two invariant in Index{Set,Map}'s default method
closes #295
2022-06-14 12:30:52 +02:00
Robert Forsman
2150effc73 it seems that I do not need to emit cargo:rustc-cfg=has_atomics for avr-atmega* 2022-06-03 12:32:23 -04:00
Robert Forsman
3b9b9f7548 Merge remote-tracking branch 'upstream/master' 2022-05-28 18:38:23 -04:00
Jorge Aparicio
39273893de v0.7.13 v0.7.13 2022-05-16 12:14:22 +02:00
bors[bot]
511252b348
Merge #294
294: test BinaryHeap::into_vec r=japaric a=japaric



Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-05-16 10:03:46 +00:00
Jorge Aparicio
0917bcc7b3 test BinaryHeap::into_vec 2022-05-16 12:01:57 +02:00
bors[bot]
f07235e88e
Merge #262
262: add BinaryHeap::into_vec r=japaric a=Lambda-Logan

std::collections::BinaryHeap provides an into_vec method https://doc.rust-lang.org/std/collections/struct.BinaryHeap.html#method.into_vec

My use case is I want a sorted iterator  similar to BinaryHeap.into_sorted_iter. I found my self creating a new heapless:Vec from heapless::BinaryHeap::into_iter and then sorting it. It seemed better to return the underlying vec and sort that.

But the functionality seemed generally useful and helps the API jive a little better with std::collections::BinaryHeap.

Do you see any issues with this implementation? Also, apologies for anything weird... This is my first PR :) 



Co-authored-by: Logan Dimond <Lambda.Dimond@gmail.com>
Co-authored-by: Logan Dimond <lambda.dimond@gmail.com>
2022-05-16 09:19:30 +00:00
Logan Dimond
472a839f41 make 'into_vec' just using 'self.data' 2022-05-14 15:47:44 -04:00
Logan Dimond
338323b7f9
Merge branch 'japaric:master' into bheap_into_vec 2022-05-14 15:38:23 -04:00
Jorge Aparicio
4431ae1e25 v0.7.12 v0.7.12 2022-05-12 15:27:32 +02:00
bors[bot]
02773a5b07
Merge #293
293: unconditionally depend on atomic-polyfill for riscv32i target r=japaric a=japaric

due to a limitation in the llvm backend [1] the `riscv32i-unknown-none-elf` target lacks the `core::sync::atomic` API even though the actual hardware is capable of atomic loads and stores (`fence` instruction). thus, at this point in time, this target needs `atomic-polyfill` for a working SPSC implementation

[1]: https://github.com/knurling-rs/defmt/issues/597#issuecomment-934467023

fixes #271 
closes #272 
closes #273 

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-05-12 13:06:27 +00:00
Jorge Aparicio
50c0930e1b update changelog 2022-05-12 15:04:06 +02:00
Jorge Aparicio
a94c1d0f59 riscv32imc needs the same treatment 2022-05-12 15:02:58 +02:00
Jorge Aparicio
34b05be696 add changelog entry 2022-05-12 14:58:29 +02:00
Jorge Aparicio
5d9e4b6268 unconditionally depend on atomic-polyfill for riscv32i target 2022-05-12 14:35:37 +02:00
Jorge Aparicio
3129e290a6 GHA: cargo check --no-default-features 2022-05-12 14:35:18 +02:00