diff --git a/.circleci/config.yml b/.circleci/config.yml index 6f901a95e93..604ff46861d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: resource_class: arm.medium environment: # Change to pin rust version - RUST_STABLE: stable + RUST_STABLE: 1.67.1 steps: - checkout - run: diff --git a/.cirrus.yml b/.cirrus.yml index bdc44e0c93c..135c9dd18fc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,7 +1,9 @@ +only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'master' || $CIRRUS_BRANCH =~ 'tokio-.*') +auto_cancellation: $CIRRUS_BRANCH != 'master' && $CIRRUS_BRANCH !=~ 'tokio-.*' freebsd_instance: - image: freebsd-12-4-release-amd64 + image_family: freebsd-13-1 env: - RUST_STABLE: stable + RUST_STABLE: 1.67.1 RUST_NIGHTLY: nightly-2022-10-25 RUSTFLAGS: -D warnings @@ -11,9 +13,8 @@ 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 + - pkg install -y bash - curl https://sh.rustup.rs -sSf --output rustup.sh - sh rustup.sh -y --profile minimal --default-toolchain $RUST_STABLE - . $HOME/.cargo/env @@ -26,12 +27,11 @@ 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 setup_script: - - pkg install -y bash curl + - pkg install -y bash - curl https://sh.rustup.rs -sSf --output rustup.sh - sh rustup.sh -y --profile minimal --default-toolchain $RUST_NIGHTLY - . $HOME/.cargo/env @@ -44,9 +44,8 @@ task: task: name: FreeBSD 32-bit - auto_cancellation: $CIRRUS_BRANCH != 'master' && $CIRRUS_BRANCH !=~ 'tokio-.*' setup_script: - - pkg install -y bash curl + - pkg install -y bash - curl https://sh.rustup.rs -sSf --output rustup.sh - sh rustup.sh -y --profile minimal --default-toolchain $RUST_STABLE - . $HOME/.cargo/env diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2813ede8a86..1bdfb7320a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ env: RUSTFLAGS: -Dwarnings RUST_BACKTRACE: 1 # Change to specific Rust release to pin - rust_stable: stable + rust_stable: 1.67.1 rust_nightly: nightly-2022-11-03 rust_clippy: 1.65.0 # When updating this, also update: @@ -349,19 +349,6 @@ jobs: with: toolchain: ${{ env.rust_min }} - uses: Swatinem/rust-cache@v2 - # First compile just the main tokio crate with minrust and newest version - # of all dependencies, then pin once_cell and compile the rest of the - # crates with the pinned once_cell version. - # - # This is necessary because tokio-util transitively depends on once_cell, - # which is not compatible with the current minrust after the 1.15.0 - # release. - - name: "check -p tokio --all-features" - run: cargo check -p tokio --all-features - env: - RUSTFLAGS: "" # remove -Dwarnings - - name: "pin once_cell version" - run: cargo update -p once_cell --precise 1.14.0 - name: "check --workspace --all-features" run: cargo check --workspace --all-features env: diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000000..ae78f634e71 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,291 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. + +# This file was manually edited to only fix the versions that are necessary +# to compile with minrust. +version = 3 + +[[package]] +name = "async-stream" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "futures" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" + +[[package]] +name = "futures-executor" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1997dd9df74cdac935c76252744c1ed5794fac083242ea4fe77ef3ed60ba0f83" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" + +[[package]] +name = "futures-macro" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "futures-sink" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" + +[[package]] +name = "futures-task" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" + +[[package]] +name = "futures-test" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6a770d3eb0d13372658eec78213b849e0530cf58b4fbc7bf0320e5e4632716" +dependencies = [ + "futures-core", + "futures-executor", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "futures-util", + "pin-project", + "pin-utils", +] + +[[package]] +name = "futures-util" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "predicates" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc3d91237f5de3bcd9d927e24d03b495adb6135097b001cea7403e2d573d00a9" +dependencies = [ + "difflib", + "float-cmp", + "itertools", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" + +[[package]] +name = "predicates-tree" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "regex" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "serde" +version = "1.0.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71f2b4817415c6d4210bfe1c7bfcf4801b2d904cb4d0e1a8fdb651013c9e86b8" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "once_cell" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" + +[[package]] +name = "tokio" +version = "1.25.0" +dependencies = [ + "async-stream", + "autocfg", + "bytes", + "futures", + "libc", + "loom", + "memchr", + "mio", + "mio-aio", + "mockall", + "nix 0.26.2", + "ntapi", + "num_cpus", + "parking_lot", + "pin-project-lite", + "proptest", + "rand", + "signal-hook-registry", + "socket2", + "tempfile", + "tokio-macros", + "tokio-stream", + "tokio-test", + "tracing", + "wasm-bindgen-test", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.11" +dependencies = [ + "async-stream", + "futures", + "futures-core", + "parking_lot", + "pin-project-lite", + "proptest", + "tokio", + "tokio-test", + "tokio-util", +] + +[[package]] +name = "tokio-test" +version = "0.4.2" +dependencies = [ + "async-stream", + "bytes", + "futures-core", + "futures-util", + "tokio", + "tokio-stream", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +dependencies = [ + "async-stream", + "bytes", + "futures", + "futures-core", + "futures-io", + "futures-sink", + "futures-test", + "futures-util", + "hashbrown", + "parking_lot", + "pin-project-lite", + "slab", + "tokio", + "tokio-stream", + "tokio-test", + "tracing", +] diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index 0f6d30a687d..dfbef149884 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -135,9 +135,6 @@ features = [ "Win32_Security_Authorization", ] -[target.'cfg(windows)'.dev-dependencies.ntapi] -version = "0.3.6" - [dev-dependencies] tokio-test = { version = "0.4.0", path = "../tokio-test" } tokio-stream = { version = "0.1", path = "../tokio-stream" } diff --git a/tokio/tests/net_named_pipe.rs b/tokio/tests/net_named_pipe.rs index c42122465c0..22037361c6c 100644 --- a/tokio/tests/net_named_pipe.rs +++ b/tokio/tests/net_named_pipe.rs @@ -2,13 +2,11 @@ #![cfg(all(windows))] use std::io; -use std::mem; -use std::os::windows::io::AsRawHandle; use std::time::Duration; use tokio::io::AsyncWriteExt; use tokio::net::windows::named_pipe::{ClientOptions, PipeMode, ServerOptions}; use tokio::time; -use windows_sys::Win32::Foundation::{ERROR_NO_DATA, ERROR_PIPE_BUSY, NO_ERROR, UNICODE_STRING}; +use windows_sys::Win32::Foundation::{ERROR_NO_DATA, ERROR_PIPE_BUSY}; #[tokio::test] async fn test_named_pipe_client_drop() -> io::Result<()> { @@ -16,8 +14,6 @@ async fn test_named_pipe_client_drop() -> io::Result<()> { let mut server = ServerOptions::new().create(PIPE_NAME)?; - assert_eq!(num_instances("test-named-pipe-client-drop")?, 1); - let client = ClientOptions::new().open(PIPE_NAME)?; server.connect().await?; @@ -367,53 +363,3 @@ async fn test_named_pipe_access() -> io::Result<()> { } Ok(()) } - -fn num_instances(pipe_name: impl AsRef) -> io::Result { - use ntapi::ntioapi; - - let mut name = pipe_name.as_ref().encode_utf16().collect::>(); - let mut name = UNICODE_STRING { - Length: (name.len() * mem::size_of::()) as u16, - MaximumLength: (name.len() * mem::size_of::()) as u16, - Buffer: name.as_mut_ptr(), - }; - let root = std::fs::File::open(r"\\.\Pipe\")?; - let mut io_status_block = unsafe { mem::zeroed() }; - let mut file_directory_information = [0_u8; 1024]; - - let status = unsafe { - ntioapi::NtQueryDirectoryFile( - root.as_raw_handle(), - std::ptr::null_mut(), - None, - std::ptr::null_mut(), - &mut io_status_block, - &mut file_directory_information as *mut _ as *mut _, - 1024, - ntioapi::FileDirectoryInformation, - 0, - &mut name as *mut _ as _, - 0, - ) - }; - - if status as u32 != NO_ERROR { - return Err(io::Error::last_os_error()); - } - - let info = unsafe { - mem::transmute::<_, &ntioapi::FILE_DIRECTORY_INFORMATION>(&file_directory_information) - }; - let raw_name = unsafe { - std::slice::from_raw_parts( - info.FileName.as_ptr(), - info.FileNameLength as usize / mem::size_of::(), - ) - }; - let name = String::from_utf16(raw_name).unwrap(); - let num_instances = unsafe { *info.EndOfFile.QuadPart() }; - - assert_eq!(name, pipe_name.as_ref()); - - Ok(num_instances as u32) -}