Skip to content
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

Bump to 1.6.0 #30

Merged
merged 4 commits into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ sudo: false
language: rust

matrix:
include:
allow_failures:
- name: "Miri"
include:
- rust: stable
- rust: beta
- rust: nightly

- rust: nightly
os: linux
env: DESCRIPTION="Miri"
name: "Miri"
script:
- sh ci/miri.sh

Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Released YYYY/MM/DD.

### Added

* Implement `Default` for `Arena<T>`.
* TODO (or remove section if none)

### Changed

Expand All @@ -28,6 +28,18 @@ Released YYYY/MM/DD.

--------------------------------------------------------------------------------

## 1.6.0

Released 2019/09/09.

### Added

* Added the `Arena::iter_mut` method for mutably iterating over an arena's
contents. [See #29 for
details.](https://github.com/SimonSapin/rust-typed-arena/pull/29)

--------------------------------------------------------------------------------

## 1.5.0

Released 2019/08/02.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "typed-arena"
version = "1.5.0"
version = "1.6.0"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
license = "MIT"
description = "The arena, a fast but limited type of allocator"
Expand Down
1 change: 1 addition & 0 deletions ci/miri.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-his
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
rustup default "$MIRI_NIGHTLY"

cargo clean
rustup component add miri
cargo miri setup

Expand Down
46 changes: 24 additions & 22 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,32 +444,34 @@ pub struct IterMut<'a, T: 'a> {
impl<'a, T> Iterator for IterMut<'a, T> {
type Item = &'a mut T;
fn next(&mut self) -> Option<&'a mut T> {
match self.state {
IterMutState::ChunkListRest {
mut index,
ref mut inner_iter,
} => {
match inner_iter.next() {
Some(item) => Some(item),
None => {
index += 1;
if index < self.chunks.rest.len() {
let inner_iter = self.chunks.rest[index].iter_mut();
// Extend the lifetime of the individual elements to that of the arena.
let inner_iter = unsafe { mem::transmute(inner_iter) };
self.state = IterMutState::ChunkListRest { index, inner_iter };
self.next()
} else {
let iter = self.chunks.current.iter_mut();
// Extend the lifetime of the individual elements to that of the arena.
let iter = unsafe { mem::transmute(iter) };
self.state = IterMutState::ChunkListCurrent { iter };
self.next()
loop {
match self.state {
IterMutState::ChunkListRest {
mut index,
ref mut inner_iter,
} => {
match inner_iter.next() {
Some(item) => return Some(item),
None => {
index += 1;
if index < self.chunks.rest.len() {
let inner_iter = self.chunks.rest[index].iter_mut();
// Extend the lifetime of the individual elements to that of the arena.
let inner_iter = unsafe { mem::transmute(inner_iter) };
self.state = IterMutState::ChunkListRest { index, inner_iter };
continue;
} else {
let iter = self.chunks.current.iter_mut();
// Extend the lifetime of the individual elements to that of the arena.
let iter = unsafe { mem::transmute(iter) };
self.state = IterMutState::ChunkListCurrent { iter };
continue;
}
}
}
}
IterMutState::ChunkListCurrent { ref mut iter } => return iter.next(),
}
IterMutState::ChunkListCurrent { ref mut iter } => iter.next(),
}
}

Expand Down