1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-24 04:52:58 +01:00

update all crates msrv to 1.57 (#464)

This commit is contained in:
Rob Ede 2022-07-23 01:51:12 +02:00 committed by GitHub
parent 126ed4c2e3
commit 66756bc448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 34 additions and 91 deletions

View File

@ -14,18 +14,10 @@ ci-check = "hack --workspace --feature-powerset --exclude-features=io-uring chec
ci-check-linux = "hack --workspace --feature-powerset check --tests --examples" ci-check-linux = "hack --workspace --feature-powerset check --tests --examples"
# tests avoiding io-uring feature # tests avoiding io-uring feature
ci-test = " hack --feature-powerset --exclude=actix-rt --exclude=actix-server --exclude-features=io-uring test --workspace --lib --tests --no-fail-fast -- --nocapture" ci-test = "hack --feature-powerset --exclude-features=io-uring test --lib --tests --no-fail-fast -- --nocapture"
ci-test-rt = " hack --feature-powerset --exclude-features=io-uring test --package=actix-rt --lib --tests --no-fail-fast -- --nocapture"
ci-test-server = "hack --feature-powerset --exclude-features=io-uring test --package=actix-server --lib --tests --no-fail-fast -- --nocapture"
# tests avoiding io-uring feature on Windows # tests avoiding io-uring feature on Windows
ci-test-win = " hack --feature-powerset --depth 2 --exclude=actix-rt --exclude=actix-server --exclude-features=io-uring test --workspace --lib --tests --no-fail-fast -- --nocapture" ci-test-win = "hack --feature-powerset --depth 2 --exclude-features=io-uring test --lib --tests --no-fail-fast -- --nocapture"
ci-test-rt-win = " hack --feature-powerset --depth 2 --exclude-features=io-uring test --package=actix-rt --lib --tests --no-fail-fast -- --nocapture"
ci-test-server-win = "hack --feature-powerset --depth 2 --exclude-features=io-uring test --package=actix-server --lib --tests --no-fail-fast -- --nocapture"
# test with io-uring feature # test with io-uring feature
ci-test-rt-linux = " hack --feature-powerset test --package=actix-rt --lib --tests --no-fail-fast -- --nocapture" ci-test-linux = " hack --feature-powerset test --lib --tests --no-fail-fast -- --nocapture"
ci-test-server-linux = "hack --feature-powerset test --package=actix-server --lib --tests --no-fail-fast -- --nocapture"
# test lower msrv
ci-test-lower-msrv = "hack --workspace --exclude=actix-server --exclude=actix-tls --feature-powerset test --lib --tests --no-fail-fast -- --nocapture"

View File

@ -101,14 +101,11 @@ jobs:
if: > if: >
matrix.target.os != 'ubuntu-latest' matrix.target.os != 'ubuntu-latest'
&& matrix.target.triple != 'x86_64-pc-windows-gnu' && matrix.target.triple != 'x86_64-pc-windows-gnu'
run: | run: cargo ci-test
cargo ci-test
cargo ci-test-rt
cargo ci-test-server
- name: tests - name: tests
if: matrix.target.os == 'ubuntu-latest' if: matrix.target.os == 'ubuntu-latest'
run: | run: |
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-rt-linux && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-server-linux" sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-linux"
- name: Clear the cargo caches - name: Clear the cargo caches
run: | run: |

View File

@ -18,7 +18,7 @@ jobs:
- { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu } - { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu }
- { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc } - { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc }
version: version:
- 1.52.0 # MSRV for -server and -tls - 1.57.0
- stable - stable
name: ${{ matrix.target.name }} / ${{ matrix.version }} name: ${{ matrix.target.name }} / ${{ matrix.version }}
@ -77,10 +77,6 @@ jobs:
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: { command: generate-lockfile } with: { command: generate-lockfile }
- name: Tweak lockfile
run: |
cargo update -p=native-tls --precise=0.2.8
- name: check lib - name: check lib
if: > if: >
matrix.target.os != 'ubuntu-latest' matrix.target.os != 'ubuntu-latest'
@ -110,59 +106,16 @@ jobs:
- name: tests - name: tests
if: matrix.target.os == 'macos-latest' if: matrix.target.os == 'macos-latest'
run: | run: cargo ci-test
cargo ci-test
cargo ci-test-rt
cargo ci-test-server
- name: tests - name: tests
if: > if: >
matrix.target.os == 'windows-latest' matrix.target.os == 'windows-latest'
&& matrix.target.triple != 'x86_64-pc-windows-gnu' && matrix.target.triple != 'x86_64-pc-windows-gnu'
run: | run: cargo ci-test-win
cargo ci-test-win
cargo ci-test-rt-win
cargo ci-test-server-win
- name: tests - name: tests
if: matrix.target.os == 'ubuntu-latest' if: matrix.target.os == 'ubuntu-latest'
run: | run: |
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-rt-linux && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-server-linux" sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-linux"
- name: Clear the cargo caches
run: |
cargo install cargo-cache --version 0.6.2 --no-default-features --features ci-autoclean
cargo-cache
build_and_test_lower_msrv:
name: Linux / 1.49 (lower MSRV)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install 1.49.0 # MSRV for all but -server and -tls
uses: actions-rs/toolchain@v1
with:
toolchain: 1.49.0-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Install cargo-hack
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-hack
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with: { command: generate-lockfile }
- name: Tweak lockfile
run: |
cargo update -p=rustls --precise=0.20.2
cargo update -p=native-tls --precise=0.2.8
- name: tests
run: |
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=1.49 cargo ci-test-lower-msrv"
- name: Clear the cargo caches - name: Clear the cargo caches
run: | run: |

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.57.
## 0.5.1 - 2022-03-15 ## 0.5.1 - 2022-03-15

View File

@ -1,7 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.49. - Minimum supported Rust version (MSRV) is now 1.57.
## 0.2.3 - 2021-10-19 ## 0.2.3 - 2021-10-19

View File

@ -2,6 +2,7 @@
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Add `#[track_caller]` attribute to `spawn` functions and methods. [#454] - Add `#[track_caller]` attribute to `spawn` functions and methods. [#454]
- Minimum supported Rust version (MSRV) is now 1.57.
[#454]: https://github.com/actix/actix-net/pull/454 [#454]: https://github.com/actix/actix-net/pull/454

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.57.
## 2.1.1 - 2022-03-09 ## 2.1.1 - 2022-03-09

View File

@ -24,7 +24,7 @@ struct ServerSocketInfo {
timeout: Option<actix_rt::time::Instant>, timeout: Option<actix_rt::time::Instant>,
} }
/// poll instance of the server. /// Poll instance of the server.
pub(crate) struct Accept { pub(crate) struct Accept {
poll: Poll, poll: Poll,
waker_queue: WakerQueue, waker_queue: WakerQueue,
@ -161,11 +161,13 @@ impl Accept {
// a loop that would try to drain the command channel. It's yet unknown // a loop that would try to drain the command channel. It's yet unknown
// if it's necessary/good practice to actively drain the waker queue. // if it's necessary/good practice to actively drain the waker queue.
loop { loop {
// take guard with every iteration so no new interest can be added // Take guard with every iteration so no new interests can be added until the current
// until the current task is done. // task is done. Take care not to take the guard again inside this loop.
let mut guard = self.waker_queue.guard(); let mut guard = self.waker_queue.guard();
#[allow(clippy::significant_drop_in_scrutinee)]
match guard.pop_front() { match guard.pop_front() {
// worker notify it becomes available. // Worker notified it became available.
Some(WakerInterest::WorkerAvailable(idx)) => { Some(WakerInterest::WorkerAvailable(idx)) => {
drop(guard); drop(guard);
@ -176,7 +178,7 @@ impl Accept {
} }
} }
// a new worker thread is made and it's handle would be added to Accept // A new worker thread has been created so store its handle.
Some(WakerInterest::Worker(handle)) => { Some(WakerInterest::Worker(handle)) => {
drop(guard); drop(guard);

View File

@ -1,7 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.49. - Minimum supported Rust version (MSRV) is now 1.57.
## 2.0.2 - 2021-12-18 ## 2.0.2 - 2021-12-18

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.57.
## 3.0.4 - 2022-03-15 ## 3.0.4 - 2022-03-15

View File

@ -27,25 +27,25 @@ pub trait Host: Unpin + 'static {
impl Host for String { impl Host for String {
fn hostname(&self) -> &str { fn hostname(&self) -> &str {
str_split_once(self, ':') self.split_once(':')
.map(|(hostname, _)| hostname) .map(|(hostname, _)| hostname)
.unwrap_or(self) .unwrap_or(self)
} }
fn port(&self) -> Option<u16> { fn port(&self) -> Option<u16> {
str_split_once(self, ':').and_then(|(_, port)| port.parse().ok()) self.split_once(':').and_then(|(_, port)| port.parse().ok())
} }
} }
impl Host for &'static str { impl Host for &'static str {
fn hostname(&self) -> &str { fn hostname(&self) -> &str {
str_split_once(self, ':') self.split_once(':')
.map(|(hostname, _)| hostname) .map(|(hostname, _)| hostname)
.unwrap_or(self) .unwrap_or(self)
} }
fn port(&self) -> Option<u16> { fn port(&self) -> Option<u16> {
str_split_once(self, ':').and_then(|(_, port)| port.parse().ok()) self.split_once(':').and_then(|(_, port)| port.parse().ok())
} }
} }
@ -69,11 +69,3 @@ mod tests {
assert_connection_info_eq!("example.com:false:false", "example.com", None); assert_connection_info_eq!("example.com:false:false", "example.com", None);
} }
} }
// `str::split_once` is stabilized in 1.52.0
fn str_split_once(str: &str, delimiter: char) -> Option<(&str, &str)> {
let mut splitn = str.splitn(2, delimiter);
let prefix = splitn.next()?;
let suffix = splitn.next()?;
Some((prefix, suffix))
}

View File

@ -1,7 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.49. - Minimum supported Rust version (MSRV) is now 1.57.
## 0.1.0 - 2020-01-15 ## 0.1.0 - 2020-01-15

View File

@ -1,7 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.49. - Minimum supported Rust version (MSRV) is now 1.57.
## 3.0.0 - 2021-04-16 ## 3.0.0 - 2021-04-16

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.57.
## 1.1.0 - 2022-06-11 ## 1.1.0 - 2022-06-11

View File

@ -72,7 +72,7 @@ impl AsRef<[u8]> for ByteString {
impl AsRef<str> for ByteString { impl AsRef<str> for ByteString {
fn as_ref(&self) -> &str { fn as_ref(&self) -> &str {
&*self self
} }
} }
@ -96,7 +96,7 @@ impl ops::Deref for ByteString {
impl borrow::Borrow<str> for ByteString { impl borrow::Borrow<str> for ByteString {
fn borrow(&self) -> &str { fn borrow(&self) -> &str {
&*self self
} }
} }

View File

@ -1 +1 @@
msrv = "1.48" msrv = "1.57"

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.57.
## 0.1.3 - 2022-05-03 ## 0.1.3 - 2022-05-03

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2022-xx-xx ## Unreleased - 2022-xx-xx
- Minimum supported Rust version (MSRV) is now 1.57.
## 0.1.3 - 2022-05-03 ## 0.1.3 - 2022-05-03