Skip to content

Commit

Permalink
Merge branch '1.21.2' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
MediosZ committed Sep 28, 2022
2 parents 4f2e423 + 47b6e19 commit 05d4b34
Show file tree
Hide file tree
Showing 81 changed files with 2,120 additions and 2,154 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
workflows:
ci:
jobs:
- test-arm
- test-arm
3 changes: 3 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
# the system's binaries, so the environment shouldn't matter.
task:
name: FreeBSD 64-bit
auto_cancellation: $CIRRUS_BRANCH != 'master' && $CIRRUS_BRANCH !=~ 'tokio-.*'
setup_script:
- pkg install -y bash curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
Expand All @@ -25,6 +26,7 @@ task:

task:
name: FreeBSD docs
auto_cancellation: $CIRRUS_BRANCH != 'master' && $CIRRUS_BRANCH !=~ 'tokio-.*'
env:
RUSTFLAGS: --cfg docsrs --cfg tokio_unstable
RUSTDOCFLAGS: --cfg docsrs --cfg tokio_unstable -Dwarnings
Expand All @@ -42,6 +44,7 @@ task:

task:
name: FreeBSD 32-bit
auto_cancellation: $CIRRUS_BRANCH != 'master' && $CIRRUS_BRANCH !=~ 'tokio-.*'
setup_script:
- pkg install -y bash curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
Expand Down
48 changes: 32 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
# Change to specific Rust release to pin
rust_stable: stable
rust_nightly: nightly-2022-07-26
rust_clippy: 1.52.0
rust_clippy: 1.56.0
# When updating this, also update:
# - README.md
# - tokio/README.md
Expand Down Expand Up @@ -49,6 +49,7 @@ jobs:
- loom-compile
- check-readme
- test-hyper
- x86_64-fortanix-unknown-sgx
- wasm32-unknown-unknown
- wasm32-wasi
- check-external-types
Expand All @@ -75,7 +76,7 @@ jobs:
run: rustup update stable
- uses: Swatinem/rust-cache@v1
- name: Install cargo-hack
run: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack

# Run `tokio` with `full` features. This excludes testing utilities which
# can alter the runtime behavior of Tokio.
Expand Down Expand Up @@ -141,9 +142,7 @@ jobs:
- uses: Swatinem/rust-cache@v1

- name: Install Valgrind
run: |
sudo apt-get update -y
sudo apt-get install -y valgrind
uses: taiki-e/install-action@valgrind

# Compile tests
- name: cargo build test-mem
Expand Down Expand Up @@ -278,12 +277,12 @@ jobs:
override: true
- uses: Swatinem/rust-cache@v1
- name: Install cargo-hack
run: cargo install cargo-hack
- name: check --each-feature
run: cargo hack check --all --each-feature -Z avoid-dev-deps
uses: taiki-e/install-action@cargo-hack
- name: check --feature-powerset
run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going
# Try with unstable feature flags
- name: check --each-feature --unstable
run: cargo hack check --all --each-feature -Z avoid-dev-deps
- name: check --feature-powerset --unstable
run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going
env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings

Expand All @@ -298,8 +297,9 @@ jobs:
toolchain: ${{ env.rust_min }}
override: true
- uses: Swatinem/rust-cache@v1
- name: "test --workspace --all-features"
run: cargo check --workspace --all-features
- name: "test --all-features"
run: cargo check --all-features
working-directory: tokio

minimal-versions:
name: minimal-versions
Expand All @@ -313,7 +313,7 @@ jobs:
override: true
- uses: Swatinem/rust-cache@v1
- name: Install cargo-hack
run: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: "check --all-features -Z minimal-versions"
run: |
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
Expand Down Expand Up @@ -450,6 +450,23 @@ jobs:
git diff
cargo test --features full
x86_64-fortanix-unknown-sgx:
name: build tokio for x86_64-fortanix-unknown-sgx
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rust_nightly }}
target: x86_64-fortanix-unknown-sgx
override: true
- uses: Swatinem/rust-cache@v1
# NOTE: Currently the only test we can run is to build tokio with rt and sync features.
- name: build tokio
run: cargo build --target x86_64-fortanix-unknown-sgx --features rt,sync
working-directory: tokio

wasm32-unknown-unknown:
name: test tokio for wasm32-unknown-unknown
runs-on: ubuntu-latest
Expand Down Expand Up @@ -481,13 +498,13 @@ jobs:

# Install dependencies
- name: Install cargo-hack
run: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack

- name: Install wasm32-wasi target
run: rustup target add wasm32-wasi

- name: Install wasmtime
run: cargo install wasmtime-cli
uses: taiki-e/install-action@wasmtime

- name: Install cargo-wasi
run: cargo install cargo-wasi
Expand Down Expand Up @@ -537,4 +554,3 @@ jobs:
cargo install cargo-check-external-types --locked --version 0.1.3
cargo check-external-types --all-features --config external-types.toml
working-directory: tokio

6 changes: 2 additions & 4 deletions .github/workflows/stress-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ jobs:
override: true
- uses: Swatinem/rust-cache@v1
- name: Install Valgrind
run: |
sudo apt-get update -y
sudo apt-get install -y valgrind
uses: taiki-e/install-action@valgrind

# Compiles each of the stress test examples.
- name: Compile stress test examples
run: cargo build -p stress-test --release --example ${{ matrix.stress-test }}

# Runs each of the examples using Valgrind. Detects leaks and displays them.
- name: Run valgrind
run: valgrind --leak-check=full --show-leak-kinds=all ./target/release/examples/${{ matrix.stress-test }}
run: valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./target/release/examples/${{ matrix.stress-test }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Make sure you activated the full features of the tokio crate on Cargo.toml:

```toml
[dependencies]
tokio = { version = "1.21.0", features = ["full"] }
tokio = { version = "1.21.2", features = ["full"] }
```
Then, on your main.rs:

Expand Down
6 changes: 0 additions & 6 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ serde_derive = "1.0"
serde_json = "1.0"
httparse = "1.0"
httpdate = "1.0"
once_cell = "1.5.2"
rand = "0.8.3"

[target.'cfg(windows)'.dev-dependencies.winapi]
Expand Down Expand Up @@ -71,11 +70,6 @@ path = "udp-codec.rs"
name = "tinyhttp"
path = "tinyhttp.rs"

[[example]]
name = "custom-executor"
path = "custom-executor.rs"


[[example]]
name = "custom-executor-tokio-context"
path = "custom-executor-tokio-context.rs"
Expand Down
8 changes: 8 additions & 0 deletions tokio-stream/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.1.10 (Sept 18, 2022)

- time: add `StreamExt::chunks_timeout` ([#4695])
- stream: add track_caller to public APIs ([#4786])

[#4695]: https://github.com/tokio-rs/tokio/pull/4695
[#4786]: https://github.com/tokio-rs/tokio/pull/4786

# 0.1.9 (June 4, 2022)

- deps: upgrade `tokio-util` dependency to `0.7.x` ([#3762])
Expand Down
2 changes: 1 addition & 1 deletion tokio-stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "tokio-stream"
# - Remove path dependencies
# - Update CHANGELOG.md.
# - Create "tokio-stream-0.1.x" git tag.
version = "0.1.9"
version = "0.1.10"
edition = "2018"
rust-version = "1.49"
authors = ["Tokio Contributors <[email protected]>"]
Expand Down
22 changes: 22 additions & 0 deletions tokio-util/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# 0.7.4 (September 8, 2022)

### Added

- io: add `SyncIoBridge::shutdown()` ([#4938])
- task: improve `LocalPoolHandle` ([#4680])

### Fixed

- util: add `track_caller` to public APIs ([#4785])

### Unstable

- task: fix compilation errors in `JoinMap` with Tokio v1.21.0 ([#4755])
- task: remove the unstable, deprecated `JoinMap::join_one` ([#4920])

[#4680]: https://github.com/tokio-rs/tokio/pull/4680
[#4755]: https://github.com/tokio-rs/tokio/pull/4755
[#4785]: https://github.com/tokio-rs/tokio/pull/4785
[#4920]: https://github.com/tokio-rs/tokio/pull/4920
[#4938]: https://github.com/tokio-rs/tokio/pull/4938

# 0.7.3 (June 4, 2022)

### Changed
Expand Down
4 changes: 2 additions & 2 deletions tokio-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "tokio-util"
# - Remove path dependencies
# - Update CHANGELOG.md.
# - Create "tokio-util-0.7.x" git tag.
version = "0.7.3"
version = "0.7.4"
edition = "2018"
rust-version = "1.49"
authors = ["Tokio Contributors <[email protected]>"]
Expand Down Expand Up @@ -34,7 +34,7 @@ rt = ["tokio/rt", "tokio/sync", "futures-util", "hashbrown"]
__docs_rs = ["futures-util"]

[dependencies]
tokio = { version = "1.19.0", path = "../tokio", features = ["sync"] }
tokio = { version = "1.21.0", path = "../tokio", features = ["sync"] }
bytes = "1.0.0"
futures-core = "0.3.0"
futures-sink = "0.3.0"
Expand Down
10 changes: 3 additions & 7 deletions tokio-util/src/codec/length_delimited.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,15 +522,11 @@ impl LengthDelimitedCodec {
}
};

let num_skip = self.builder.get_num_skip();

if num_skip > 0 {
src.advance(num_skip);
}
src.advance(self.builder.get_num_skip());

// Ensure that the buffer has enough space to read the incoming
// payload
src.reserve(n);
src.reserve(n.saturating_sub(src.len()));

Ok(Some(n))
}
Expand Down Expand Up @@ -568,7 +564,7 @@ impl Decoder for LengthDelimitedCodec {
self.state = DecodeState::Head;

// Make sure the buffer has enough space to read the next head
src.reserve(self.builder.num_head_bytes());
src.reserve(self.builder.num_head_bytes().saturating_sub(src.len()));

Ok(Some(data))
}
Expand Down
49 changes: 49 additions & 0 deletions tokio-util/src/io/stream_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,58 @@ pin_project! {
/// # }
/// ```
///
/// If the stream produces errors which are not [std::io::Error],
/// the errors can be converted using [`StreamExt`] to map each
/// element.
///
/// ```
/// use bytes::Bytes;
/// use tokio::io::AsyncReadExt;
/// use tokio_util::io::StreamReader;
/// use tokio_stream::StreamExt;
/// # #[tokio::main]
/// # async fn main() -> std::io::Result<()> {
///
/// // Create a stream from an iterator, including an error.
/// let stream = tokio_stream::iter(vec![
/// Result::Ok(Bytes::from_static(&[0, 1, 2, 3])),
/// Result::Ok(Bytes::from_static(&[4, 5, 6, 7])),
/// Result::Err("Something bad happened!")
/// ]);
///
/// // Use StreamExt to map the stream and error to a std::io::Error
/// let stream = stream.map(|result| result.map_err(|err| {
/// std::io::Error::new(std::io::ErrorKind::Other, err)
/// }));
///
/// // Convert it to an AsyncRead.
/// let mut read = StreamReader::new(stream);
///
/// // Read five bytes from the stream.
/// let mut buf = [0; 5];
/// read.read_exact(&mut buf).await?;
/// assert_eq!(buf, [0, 1, 2, 3, 4]);
///
/// // Read the rest of the current chunk.
/// assert_eq!(read.read(&mut buf).await?, 3);
/// assert_eq!(&buf[..3], [5, 6, 7]);
///
/// // Reading the next chunk will produce an error
/// let error = read.read(&mut buf).await.unwrap_err();
/// assert_eq!(error.kind(), std::io::ErrorKind::Other);
/// assert_eq!(error.into_inner().unwrap().to_string(), "Something bad happened!");
///
/// // We have now reached the end.
/// assert_eq!(read.read(&mut buf).await?, 0);
///
/// # Ok(())
/// # }
/// ```
///
/// [`AsyncRead`]: tokio::io::AsyncRead
/// [`Stream`]: futures_core::Stream
/// [`ReaderStream`]: crate::io::ReaderStream
/// [`StreamExt`]: tokio_stream::StreamExt
#[derive(Debug)]
pub struct StreamReader<S, B> {
#[pin]
Expand Down
31 changes: 31 additions & 0 deletions tokio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# 1.21.2 (September 27, 2022)

This release removes the dependency on the `once_cell` crate to restore the MSRV
of 1.21.x, which is the latest minor version at the time of release. ([#5048])

[#5048]: https://github.com/tokio-rs/tokio/pull/5048

# 1.21.1 (September 13, 2022)

### Fixed

- net: fix dependency resolution for socket2 ([#5000])
- task: ignore failure to set TLS in `LocalSet` Drop ([#4976])

[#4976]: https://github.com/tokio-rs/tokio/pull/4976
[#5000]: https://github.com/tokio-rs/tokio/pull/5000

# 1.21.0 (September 2, 2022)

This release is the first release of Tokio to intentionally support WASM. The
Expand Down Expand Up @@ -93,6 +110,13 @@ wasm32-wasi target is given unstable support for the `net` feature.
[#4956]: https://github.com/tokio-rs/tokio/pull/4956
[#4959]: https://github.com/tokio-rs/tokio/pull/4959

# 1.20.2 (September 27, 2022)

This release removes the dependency on the `once_cell` crate to restore the MSRV
of the 1.20.x LTS release. ([#5048])

[#5048]: https://github.com/tokio-rs/tokio/pull/5048

# 1.20.1 (July 25, 2022)

### Fixed
Expand Down Expand Up @@ -211,6 +235,13 @@ This release fixes a bug in `Notified::enable`. ([#4747])
[#4729]: https://github.com/tokio-rs/tokio/pull/4729
[#4739]: https://github.com/tokio-rs/tokio/pull/4739

# 1.18.3 (September 27, 2022)

This release removes the dependency on the `once_cell` crate to restore the MSRV
of the 1.18.x LTS release. ([#5048])

[#5048]: https://github.com/tokio-rs/tokio/pull/5048

# 1.18.2 (May 5, 2022)

Add missing features for the `winapi` dependency. ([#4663])
Expand Down
Loading

0 comments on commit 05d4b34

Please sign in to comment.