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

Cfg target has atomic v1.6.0 #4

Open
wants to merge 110 commits into
base: cfg_target_has_atomic_v1.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
fa9cbf1
Clarify BufPut::put_int behavior (#486)
stepancheg Aug 8, 2021
2697fa7
BufMut::put_bytes(self, val, cnt) (#487)
stepancheg Aug 8, 2021
ee24be7
ci: fetch cargo hack from github release (#507)
Darksonn Aug 24, 2021
0e9fa0b
impl From<Box<[u8]>> for Bytes (#504)
ijackson Aug 24, 2021
55e2968
Clarifying actions of clear and truncate. (#508)
chotchki Aug 24, 2021
ebc61e5
chore: prepare bytes v1.1.0 (#509)
Darksonn Aug 25, 2021
ba5c5c9
Appease miri (#515)
Noah-Kennedy Nov 7, 2021
d946ef2
`const`-ify `Bytes::len` and `Bytes::is_empty` (#514)
Cyborus04 Nov 9, 2021
68afb40
Add `BytesMut::zeroed` (#517)
ldm0 Nov 24, 2021
0e3b246
Address various clippy warnings (#528)
robjtede Jan 24, 2022
131dae1
Implement `Extend<Bytes>` for `BytesMut` (#527)
robjtede Jan 24, 2022
88f5e12
update Miri CI config (#534)
RalfJung Mar 9, 2022
d4f5023
Optimize BytesMut::reserve: Reuse vec if possible (#529)
NobodyXu Mar 16, 2022
e4c7236
docs: redraw layout diagram with box drawing characters. (#539)
adeschamps Mar 25, 2022
9e6edd1
Clarify `BytesMut::unsplit` docs (#535)
leshow Apr 6, 2022
7244769
Fix aliasing in Clone by using a raw pointer (#523)
saethlin Apr 6, 2022
547a320
Add TSAN support (#541)
Darksonn Apr 15, 2022
8198f9e
Make strict provenance compatible (#542)
Darksonn Apr 15, 2022
0a2c43a
Fix bugs in `BytesMut::reserve_inner` (#544)
NobodyXu Apr 28, 2022
89061c3
Only avoid pointer casts when using miri
Darksonn Apr 29, 2022
b4b2c18
Revert accidental push directly to master
Darksonn Apr 29, 2022
716a0b1
Only avoid pointer casts when using miri (#545)
Darksonn Apr 29, 2022
0ce4fe3
Update actions/checkout action to v3 (#546)
taiki-e May 1, 2022
b8d27c0
Add `UninitSlice::as_uninit_slice_mut()` (#548)
erickt May 10, 2022
3536017
Fix chain remaining_mut(), allowing to chain growing buffer (#488)
Zettroke Jun 11, 2022
28a1eab
chore: Fix unused warnings (#551)
LucioFranco Jun 23, 2022
f514bd3
miri: don't use int2ptr casts for invalid pointers (#553)
Darksonn Jul 9, 2022
068ed41
Add conversion from BytesMut to Vec<u8> (#543)
NobodyXu Jul 10, 2022
10d1f6e
Fix: `From<BytesMut> fo Vec<u8>` implementation (#554)
NobodyXu Jul 13, 2022
cd188cb
Add conversion from Bytes to Vec<u8> (#547)
NobodyXu Jul 13, 2022
7553a67
Fix amortized asymptotics of `BytesMut` (#555)
NobodyXu Jul 19, 2022
38fd42a
chore: prepare bytes v1.2.0 (#556)
Darksonn Jul 19, 2022
d6e1999
Fix reserve over allocating underlying buffer (#560)
schultetwin1 Jul 30, 2022
b724914
chore: prepare bytes v1.2.1 (#561)
Darksonn Jul 30, 2022
d1b5d4c
Don't have important data in unused capacity when calling reserve (#563)
Darksonn Aug 12, 2022
a36f661
docs: Bytes::new etc should return Self not Bytes (#568)
adamchalmers Aug 24, 2022
6e4b1f2
Rename and expose `BytesMut::spare_capacity_mut` (#572)
yotamofek Oct 4, 2022
5c7b431
Update nightly snapshot to the current one (#577)
Phantomical Nov 14, 2022
8a8c41f
Implement native-endian get and put functions for Buf and BufMut (#576)
Phantomical Nov 14, 2022
9b22722
chore: prepare bytes v1.3.0 (#579)
Phantomical Nov 21, 2022
050d65b
make IntoIter constructor public (#581)
matko Nov 25, 2022
c93a94b
Fix duplicate "the the" typos (#585)
xpromache Dec 20, 2022
f15bba3
Document which functions require `std` (#591)
MrGunflame Jan 31, 2023
39e2586
Support non-atomic targets
taiki-e Jan 20, 2021
996f472
Remove uses of unstable feature(cfg_target_has_atomic)
taiki-e May 23, 2021
c6b431a
fix
taiki-e May 23, 2021
d74afcb
setup codegen ci
taiki-e May 23, 2021
968b268
add comment
taiki-e May 23, 2021
7167040
update list
taiki-e Jun 18, 2021
5c2e7c3
Integrated portable atomics crate
marius-meissner Mar 18, 2022
05de2cd
Added patch note to README
marius-meissner Mar 18, 2022
4ba0531
Removed obsolete fence import
marius-meissner Jan 31, 2023
05e9d5c
Avoid large reallocations when freezing BytesMut (#592)
bk2204 Jan 31, 2023
21ed332
chore: prepare bytes v1.4.0 (#593)
Darksonn Jan 31, 2023
74b04c7
Mark BytesMut::extend_from_slice as inline (#595)
samanpa Feb 4, 2023
99a2754
Add a safe way to create UninitSlice from slices (#598)
mina86 Feb 9, 2023
b29112c
Implement BufMut for `&mut [MaybeUninit<u8>]` (#597)
mina86 Feb 10, 2023
c7756c3
Fix CI failure (#616)
taiki-e Jun 4, 2023
64c4fa2
Rename UninitSlice constructors for consistency with ReadBuf (#599)
mina86 Jun 20, 2023
74e6e20
chore: prepare bytes v1.5.0 (#627)
Darksonn Sep 7, 2023
bd9c164
doc: fix changelog typo (#628)
Darksonn Sep 7, 2023
a14ef46
Move comment to correct constant (#629)
rukai Sep 11, 2023
a4e16a5
docs: fix some spelling mistakes (#633)
mxsm Sep 25, 2023
fd9243f
Various cleanup (#635)
Darksonn Oct 2, 2023
bde8c50
docs: typo fix (#637)
DanielBauman88 Oct 19, 2023
72cbb92
docs: fix broken links (#639)
kaffarell Nov 16, 2023
f73c6c8
Simplify UninitSlice::as_uninit_slice_mut() logic (#644)
lucab Dec 28, 2023
dbbdb63
Use `self.` instead of `Self::` (#642)
braddunbar Dec 28, 2023
3bf6583
readme: add security policy (#649)
Darksonn Jan 3, 2024
fbc64bc
Update loom to 0.7 (#651)
taiki-e Jan 7, 2024
09214ba
Update CI config (#650)
taiki-e Jan 7, 2024
abb4a2e
BytesMut: Assert alignment of Shared (#652)
braddunbar Jan 19, 2024
0864aea
add `Bytes::is_unique` (#643)
Cyborus04 Jan 19, 2024
0ba3b4c
Remove unnecessary namespace qualifier (#660)
braddunbar Jan 28, 2024
9257a6e
Remove an unnecessary else branch (#662)
braddunbar Jan 28, 2024
e24587d
Remove unreachable else branch (#661)
braddunbar Jan 28, 2024
d2e7abd
refactor: make parameter mut in From<Vec> (#667)
braddunbar Jan 31, 2024
8bcac21
Restore commented tests (#665)
braddunbar Feb 6, 2024
47e8305
Use sub instead of offset (#668)
braddunbar Feb 6, 2024
c6972d6
Calculate original capacity only if necessary (#666)
braddunbar Feb 6, 2024
f586ffc
set_vec_pos does not need a second parameter (#672)
braddunbar Feb 6, 2024
1bcd212
get_vec_pos: use &self instead of &mut self (#670)
braddunbar Feb 6, 2024
4628927
Refactor split_at/split_to (#663)
braddunbar Feb 23, 2024
99584cc
Use Iterator from the prelude (#673)
braddunbar Mar 2, 2024
c5fae00
copy_to_bytes: Add panic section to docs (#676)
braddunbar Mar 3, 2024
7968f6f
Remove redundant reserve call (#674)
braddunbar Mar 4, 2024
ca00411
Remove commented tests for Bytes::unsplit (#677)
braddunbar Mar 4, 2024
536db06
Use ManuallyDrop instead of mem::forget (#675)
braddunbar Mar 14, 2024
ce8d8a0
chore: prepare bytes v1.6.0 (#681)
braddunbar Mar 22, 2024
0d4cc7f
Bytes: Use ManuallyDrop instead of mem::forget (#678)
braddunbar Apr 8, 2024
e4af486
Don't set `len` in `BytesMut::reserve` (#682)
braddunbar Apr 9, 2024
4eb62b9
Bytes::split_to - check fast path first (#689)
braddunbar Apr 10, 2024
b5fbfc3
perf: improve Bytes::copy_to_bytes (#688)
tisonkun Apr 10, 2024
327615e
test(benches): encloses bytes into `test::black_box` for clone benche…
wyfo Apr 11, 2024
4e2c9c0
Truncate tweaks (#694)
braddunbar Apr 17, 2024
9d3ec1c
Resize refactor (#696)
braddunbar Apr 24, 2024
ce09d7d
Bytes::split_off - check fast path first (#693)
braddunbar Apr 24, 2024
baa5053
Reuse capacity when possible in <BytesMut as Buf>::advance impl (#698)
paolobarbolini Apr 25, 2024
a8806c2
Improve BytesMut::split suggestion (#699)
paolobarbolini Apr 25, 2024
cb7f844
Tweak clear and truncate length modifications (#700)
Darksonn Apr 26, 2024
0c17e99
ci: silence unexpected-cfgs warnings due to `#[cfg(loom)]` (#703)
Darksonn May 5, 2024
86694b0
Add zero-copy make_mut (#695)
Sytten May 5, 2024
4950c50
Offset from (#705)
braddunbar May 11, 2024
caf520a
Fix iter tests to use the actual bytes IntoIter instead of std (#707)
paolobarbolini May 19, 2024
fa1daac
Change Bytes::make_mut to impl From<Bytes> for BytesMut (closes #709)…
nox May 28, 2024
4b3bd43
#3 merge with bytes/master v1.6.0
HusseinAbdelhamid Jun 7, 2024
cbaf2bf
#3 update README.m to specify using the correct branch
HusseinAbdelhamid Jun 18, 2024
94507b2
#3 add unsafe-assume-single-core feature for portable-atomic crate
HusseinAbdelhamid Jun 18, 2024
3074751
#3 update README.m for branch v1.6.0
HusseinAbdelhamid Jun 18, 2024
1548e56
Removed feature unsafe-assume-single-core, as it's unsound to be used…
marius-meissner Sep 23, 2024
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
82 changes: 60 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
nightly: nightly-2021-04-13
nightly: nightly-2022-11-12

defaults:
run:
Expand All @@ -23,19 +23,19 @@ jobs:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable
run: rustup update stable
- name: Check formatting
run: cargo fmt --all -- --check
run: cargo fmt --all --check

# TODO
# # Apply clippy lints
# clippy:
# name: clippy
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/checkout@v4
# - name: Apply clippy lints
# run: cargo clippy --all-features

Expand All @@ -48,11 +48,11 @@ jobs:
name: minrust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update 1.39.0 && rustup default 1.39.0
- uses: actions/checkout@v4
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check
run: . ci/test-stable.sh check
run: ci/test-stable.sh check

# Stable
stable:
Expand All @@ -65,23 +65,23 @@ jobs:
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update stable --no-self-update && rustup default stable
run: rustup update stable --no-self-update
- name: Test
run: . ci/test-stable.sh test
run: ci/test-stable.sh test

# Nightly
nightly:
name: nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update $nightly && rustup default $nightly
- name: Test
run: . ci/test-stable.sh test
run: ci/test-stable.sh test

# Run tests on some extra platforms
cross:
Expand All @@ -96,9 +96,9 @@ jobs:
- wasm32-unknown-unknown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable
run: rustup update stable
- name: cross build --target ${{ matrix.target }}
run: |
cargo install cross
Expand All @@ -111,23 +111,61 @@ jobs:
cargo build --target ${{ matrix.target }}
if: matrix.target == 'wasm32-unknown-unknown'

# Build for no_std environment.
no-std:
strategy:
fail-fast: false
matrix:
# thumbv7m-none-eabi supports atomic CAS.
# thumbv6m-none-eabi supports atomic, but not atomic CAS.
# riscv32i-unknown-none-elf does not support atomic at all.
target:
- thumbv7m-none-eabi
- thumbv6m-none-eabi
- riscv32i-unknown-none-elf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update stable
- name: Install cargo-hack
run: cargo install cargo-hack
- run: rustup target add ${{ matrix.target }}
# * --optional-deps is needed for serde feature
# * --no-dev-deps is needed to avoid https://github.com/rust-lang/cargo/issues/4866
- run: cargo hack build --target ${{ matrix.target }} --feature-powerset --skip std,default --optional-deps --no-dev-deps

# When this job failed, run ci/no_atomic_cas.sh and commit result changes.
# TODO(taiki-e): Ideally, this should be automated using a bot that creates
# PR when failed, but there is no bandwidth to implement it
# right now...
codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update nightly && rustup default nightly
- run: ci/no_atomic_cas.sh
- run: git diff --exit-code

# Sanitizers
tsan:
name: tsan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update $nightly && rustup default $nightly
- name: Install rust-src
run: rustup component add rust-src
- name: ASAN / TSAN
run: . ci/tsan.sh
run: ci/tsan.sh

miri:
name: miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Miri
run: ci/miri.sh

Expand All @@ -136,7 +174,7 @@ jobs:
name: loom
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update $nightly && rustup default $nightly
- name: Loom tests
Expand All @@ -155,9 +193,9 @@ jobs:
- loom
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable
run: rustup update $nightly && rustup default $nightly
- name: Build documentation
run: cargo doc --no-deps --all-features
env:
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/rt-bytes.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 132 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,135 @@
# 1.6.0 (March 22, 2024)

### Added

- Add `Bytes::is_unique` (#643)

### Documented

- Fix changelog typo (#628)
- Fix some spelling mistakes (#633)
- Typo fix (#637)
- Fix broken links (#639)
- Add security policy (#649)

### Internal changes

- Move comment to correct constant (#629)
- Various cleanup (#635)
- Simplify `UninitSlice::as_uninit_slice_mut()` logic (#644)
- Use `self.` instead of `Self::` (#642)
- `BytesMut`: Assert alignment of `Shared` (#652)
- Remove unnecessary namespace qualifier (#660)
- Remove an unnecessary else branch (#662)
- Remove unreachable else branch (#661)
- make parameter mut in `From<Vec>` (#667)
- Restore commented tests (#665)
- Use `sub` instead of `offset` (#668)
- Calculate original capacity only if necessary (#666)
- `set_vec_pos` does not need a second parameter (#672)
- `get_vec_pos`: use `&self` instead of `&mut self` (#670)
- Refactor `split_at`/`split_to` (#663)
- Use `Iterator` from the prelude (#673)
- `copy_to_bytes`: Add panic section to docs (#676)
- Remove redundant reserve call (#674)
- Use `ManuallyDrop` instead of `mem::forget` (#675)


# 1.5.0 (September 7, 2023)

### Added

- Add `UninitSlice::{new,uninit}` (#598, #599)
- Implement `BufMut` for `&mut [MaybeUninit<u8>]` (#597)

### Changed

- Mark `BytesMut::extend_from_slice` as inline (#595)

# 1.4.0 (January 31, 2023)

### Added

- Make `IntoIter` constructor public (#581)

### Fixed

- Avoid large reallocations when freezing `BytesMut` (#592)

### Documented

- Document which functions require `std` (#591)
- Fix duplicate "the the" typos (#585)

# 1.3.0 (November 20, 2022)

### Added

- Rename and expose `BytesMut::spare_capacity_mut` (#572)
- Implement native-endian get and put functions for `Buf` and `BufMut` (#576)

### Fixed

- Don't have important data in unused capacity when calling reserve (#563)

### Documented

- `Bytes::new` etc should return `Self` not `Bytes` (#568)

# 1.2.1 (July 30, 2022)

### Fixed

- Fix unbounded memory growth when using `reserve` (#560)

# 1.2.0 (July 19, 2022)

### Added

- Add `BytesMut::zeroed` (#517)
- Implement `Extend<Bytes>` for `BytesMut` (#527)
- Add conversion from `BytesMut` to `Vec<u8>` (#543, #554)
- Add conversion from `Bytes` to `Vec<u8>` (#547)
- Add `UninitSlice::as_uninit_slice_mut()` (#548)
- Add const to `Bytes::{len,is_empty}` (#514)

### Changed

- Reuse vector in `BytesMut::reserve` (#539, #544)

### Fixed

- Make miri happy (#515, #523, #542, #545, #553)
- Make tsan happy (#541)
- Fix `remaining_mut()` on chain (#488)
- Fix amortized asymptotics of `BytesMut` (#555)

### Documented

- Redraw layout diagram with box drawing characters (#539)
- Clarify `BytesMut::unsplit` docs (#535)

# 1.1.0 (August 25, 2021)

### Added

- `BufMut::put_bytes(self, val, cnt)` (#487)
- Implement `From<Box<[u8]>>` for `Bytes` (#504)

### Changed

- Override `put_slice` for `&mut [u8]` (#483)
- Panic on integer overflow in `Chain::remaining` (#482)
- Add inline tags to `UninitSlice` methods (#443)
- Override `copy_to_bytes` for Chain and Take (#481)
- Keep capacity when unsplit on empty other buf (#502)

### Documented

- Clarify `BufMut` allocation guarantees (#501)
- Clarify `BufMut::put_int` behavior (#486)
- Clarify actions of `clear` and `truncate`. (#508)

# 1.0.1 (January 11, 2021)

### Changed
Expand Down
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
name = "bytes"
# When releasing to crates.io:
# - Update CHANGELOG.md.
# - Create "v1.0.x" git tag.
version = "1.0.1"
# - Create "v1.x.y" git tag.
version = "1.6.0"
edition = "2018"
rust-version = "1.39"
license = "MIT"
authors = [
"Carl Lerche <[email protected]>",
Expand All @@ -15,20 +17,20 @@ repository = "https://github.com/tokio-rs/bytes"
readme = "README.md"
keywords = ["buffers", "zero-copy", "io"]
categories = ["network-programming", "data-structures"]
edition = "2018"

[features]
default = ["std"]
std = []

[dependencies]
serde = { version = "1.0.60", optional = true, default-features = false, features = ["alloc"] }
portable-atomic = { version = "1.6.0", default-features = false }

[dev-dependencies]
serde_test = "1.0"

[target.'cfg(loom)'.dev-dependencies]
loom = "0.5"
loom = "0.7"

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
Loading