Skip to content

Commit b02b594

Browse files
committed
Merge remote-tracking branch 'upstream/master' into cfg_target_has_atomic
2 parents dc925c8 + b29112c commit b02b594

24 files changed

+2003
-210
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
env:
1212
RUSTFLAGS: -Dwarnings
1313
RUST_BACKTRACE: 1
14-
nightly: nightly-2021-04-13
14+
nightly: nightly-2022-11-12
1515

1616
defaults:
1717
run:
@@ -23,7 +23,7 @@ jobs:
2323
name: rustfmt
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
2727
- name: Install Rust
2828
run: rustup update stable
2929
- name: Check formatting
@@ -35,7 +35,7 @@ jobs:
3535
# name: clippy
3636
# runs-on: ubuntu-latest
3737
# steps:
38-
# - uses: actions/checkout@v2
38+
# - uses: actions/checkout@v3
3939
# - name: Apply clippy lints
4040
# run: cargo clippy --all-features
4141

@@ -48,7 +48,7 @@ jobs:
4848
name: minrust
4949
runs-on: ubuntu-latest
5050
steps:
51-
- uses: actions/checkout@v2
51+
- uses: actions/checkout@v3
5252
- name: Install Rust
5353
run: rustup update 1.39.0 && rustup default 1.39.0
5454
- name: Check
@@ -65,7 +65,7 @@ jobs:
6565
- windows-latest
6666
runs-on: ${{ matrix.os }}
6767
steps:
68-
- uses: actions/checkout@v2
68+
- uses: actions/checkout@v3
6969
- name: Install Rust
7070
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
7171
run: rustup update stable --no-self-update
@@ -77,7 +77,7 @@ jobs:
7777
name: nightly
7878
runs-on: ubuntu-latest
7979
steps:
80-
- uses: actions/checkout@v2
80+
- uses: actions/checkout@v3
8181
- name: Install Rust
8282
run: rustup update $nightly && rustup default $nightly
8383
- name: Test
@@ -96,7 +96,7 @@ jobs:
9696
- wasm32-unknown-unknown
9797
runs-on: ubuntu-latest
9898
steps:
99-
- uses: actions/checkout@v2
99+
- uses: actions/checkout@v3
100100
- name: Install Rust
101101
run: rustup update stable
102102
- name: cross build --target ${{ matrix.target }}
@@ -153,7 +153,7 @@ jobs:
153153
name: tsan
154154
runs-on: ubuntu-latest
155155
steps:
156-
- uses: actions/checkout@v2
156+
- uses: actions/checkout@v3
157157
- name: Install Rust
158158
run: rustup update $nightly && rustup default $nightly
159159
- name: Install rust-src
@@ -164,7 +164,7 @@ jobs:
164164
name: miri
165165
runs-on: ubuntu-latest
166166
steps:
167-
- uses: actions/checkout@v2
167+
- uses: actions/checkout@v3
168168
- name: Miri
169169
run: ci/miri.sh
170170

@@ -173,7 +173,7 @@ jobs:
173173
name: loom
174174
runs-on: ubuntu-latest
175175
steps:
176-
- uses: actions/checkout@v2
176+
- uses: actions/checkout@v3
177177
- name: Install Rust
178178
run: rustup update $nightly && rustup default $nightly
179179
- name: Loom tests
@@ -192,9 +192,9 @@ jobs:
192192
- loom
193193
runs-on: ubuntu-latest
194194
steps:
195-
- uses: actions/checkout@v2
195+
- uses: actions/checkout@v3
196196
- name: Install Rust
197-
run: rustup update stable
197+
run: rustup update $nightly && rustup default $nightly
198198
- name: Build documentation
199199
run: cargo doc --no-deps --all-features
200200
env:

CHANGELOG.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,87 @@
1+
# 1.4.0 (January 31, 2023)
2+
3+
### Added
4+
5+
- Make `IntoIter` constructor public (#581)
6+
7+
### Fixed
8+
9+
- Avoid large reallocations when freezing `BytesMut` (#592)
10+
11+
### Documented
12+
13+
- Document which functions require `std` (#591)
14+
- Fix duplicate "the the" typos (#585)
15+
16+
# 1.3.0 (November 20, 2022)
17+
18+
### Added
19+
20+
- Rename and expose `BytesMut::spare_capacity_mut` (#572)
21+
- Implement native-endian get and put functions for `Buf` and `BufMut` (#576)
22+
23+
### Fixed
24+
25+
- Don't have important data in unused capacity when calling reserve (#563)
26+
27+
### Documented
28+
29+
- `Bytes::new` etc should return `Self` not `Bytes` (#568)
30+
31+
# 1.2.1 (July 30, 2022)
32+
33+
### Fixed
34+
35+
- Fix unbounded memory growth when using `reserve` (#560)
36+
37+
# 1.2.0 (July 19, 2022)
38+
39+
### Added
40+
41+
- Add `BytesMut::zeroed` (#517)
42+
- Implement `Extend<Bytes>` for `BytesMut` (#527)
43+
- Add conversion from `BytesMut` to `Vec<u8>` (#543, #554)
44+
- Add conversion from `Bytes` to `Vec<u8>` (#547)
45+
- Add `UninitSlice::as_uninit_slice_mut()` (#548)
46+
- Add const to `Bytes::{len,is_empty}` (#514)
47+
48+
### Changed
49+
50+
- Reuse vector in `BytesMut::reserve` (#539, #544)
51+
52+
### Fixed
53+
54+
- Make miri happy (#515, #523, #542, #545, #553)
55+
- Make tsan happy (#541)
56+
- Fix `remaining_mut()` on chain (#488)
57+
- Fix amortized asymptotics of `BytesMut` (#555)
58+
59+
### Documented
60+
61+
- Redraw layout diagram with box drawing characters (#539)
62+
- Clarify `BytesMut::unsplit` docs (#535)
63+
64+
# 1.1.0 (August 25, 2021)
65+
66+
### Added
67+
68+
- `BufMut::put_bytes(self, val, cnt)` (#487)
69+
- Implement `From<Box<[u8]>>` for `Bytes` (#504)
70+
71+
### Changed
72+
73+
- Override `put_slice` for `&mut [u8]` (#483)
74+
- Panic on integer overflow in `Chain::remaining` (#482)
75+
- Add inline tags to `UninitSlice` methods (#443)
76+
- Override `copy_to_bytes` for Chain and Take (#481)
77+
- Keep capacity when unsplit on empty other buf (#502)
78+
79+
### Documented
80+
81+
- Clarify `BufMut` allocation guarantees (#501)
82+
- Clarify `BufMut::put_int` behavior (#486)
83+
- Clarify actions of `clear` and `truncate`. (#508)
84+
185
# 1.0.1 (January 11, 2021)
286

387
### Changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
name = "bytes"
44
# When releasing to crates.io:
55
# - Update CHANGELOG.md.
6-
# - Create "v1.0.x" git tag.
7-
version = "1.0.1"
6+
# - Create "v1.x.y" git tag.
7+
version = "1.4.0"
88
license = "MIT"
99
authors = [
1010
"Carl Lerche <me@carllerche.com>",

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ Serde support is optional and disabled by default. To enable use the feature `se
3636
bytes = { version = "1", features = ["serde"] }
3737
```
3838

39+
## Building documentation
40+
41+
When building the `bytes` documentation the `docsrs` option should be used, otherwise
42+
feature gates will not be shown. This requires a nightly toolchain:
43+
44+
```
45+
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc
46+
```
47+
3948
## License
4049

4150
This project is licensed under the [MIT license](LICENSE).

benches/buf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl TestBuf {
4646
}
4747
impl Buf for TestBuf {
4848
fn remaining(&self) -> usize {
49-
return self.buf.len() - self.pos;
49+
self.buf.len() - self.pos
5050
}
5151
fn advance(&mut self, cnt: usize) {
5252
self.pos += cnt;

benches/bytes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ fn from_long_slice(b: &mut Bencher) {
8888
#[bench]
8989
fn slice_empty(b: &mut Bencher) {
9090
b.iter(|| {
91+
// `clone` is to convert to ARC
9192
let b = Bytes::from(vec![17; 1024]).clone();
9293
for i in 0..1000 {
9394
test::black_box(b.slice(i % 100..i % 100));

ci/miri.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/bash
22
set -e
33

4-
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
5-
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
6-
rustup set profile minimal
7-
rustup default "$MIRI_NIGHTLY"
8-
rustup component add miri
4+
rustup toolchain install nightly --component miri
5+
rustup override set nightly
6+
cargo miri setup
7+
8+
export MIRIFLAGS="-Zmiri-strict-provenance"
99

1010
cargo miri test
1111
cargo miri test --target mips64-unknown-linux-gnuabi64

ci/test-stable.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ set -ex
55
cmd="${1:-test}"
66

77
# Install cargo-hack for feature flag test
8-
cargo install cargo-hack
8+
host=$(rustc -Vv | grep host | sed 's/host: //')
9+
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-$host.tar.gz | tar xzf - -C ~/.cargo/bin
910

1011
# Run with each feature
1112
# * --each-feature includes both default/no-default features

clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
msrv = "1.39"

0 commit comments

Comments
 (0)