Skip to content

Commit ca77d8d

Browse files
authored
split -server and -tls msrv and raise to 1.52 (#398)
1 parent 0077588 commit ca77d8d

File tree

13 files changed

+106
-33
lines changed

13 files changed

+106
-33
lines changed

.cargo/config.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@ ci-doctest = "test --workspace --all-features --doc --no-fail-fast -- --nocaptur
55

66
# just check the library (without dev deps)
77
ci-check-min = "hack --workspace check --no-default-features"
8-
ci-check-lib = "hack --workspace --feature-powerset --exclude-features io-uring check"
8+
ci-check-lib = "hack --workspace --feature-powerset --exclude-features=io-uring check"
99
ci-check-lib-linux = "hack --workspace --feature-powerset check"
1010

1111
# check everything
12-
ci-check = "hack --workspace --feature-powerset --exclude-features io-uring check --tests --examples"
12+
ci-check = "hack --workspace --feature-powerset --exclude-features=io-uring check --tests --examples"
1313
ci-check-linux = "hack --workspace --feature-powerset check --tests --examples"
1414

1515
# tests avoiding io-uring feature
1616
ci-test = "hack test --workspace --exclude=actix-rt --exclude=actix-server --all-features --lib --tests --no-fail-fast -- --nocapture"
17-
ci-test-rt = " hack --feature-powerset --exclude-features io-uring test --package=actix-rt --lib --tests --no-fail-fast -- --nocapture"
18-
ci-test-server = "hack --feature-powerset --exclude-features io-uring test --package=actix-server --lib --tests --no-fail-fast -- --nocapture"
17+
ci-test-rt = " hack --feature-powerset --exclude-features=io-uring test --package=actix-rt --lib --tests --no-fail-fast -- --nocapture"
18+
ci-test-server = "hack --feature-powerset --exclude-features=io-uring test --package=actix-server --lib --tests --no-fail-fast -- --nocapture"
1919

2020
# test with io-uring feature
2121
ci-test-rt-linux = " hack --feature-powerset test --package=actix-rt --lib --tests --no-fail-fast -- --nocapture"
2222
ci-test-server-linux = "hack --feature-powerset test --package=actix-server --lib --tests --no-fail-fast -- --nocapture"
23+
24+
# test lower msrv
25+
ci-test-lower-msrv = "hack --workspace --feature-powerset test --lib --tests --no-fail-fast -- --nocapture"

.github/workflows/ci.yml

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu }
1919
- { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc }
2020
version:
21-
- 1.46.0 # MSRV
21+
- 1.52.0 # MSRV for -server and -tls
2222
- stable
2323
- nightly
2424

@@ -64,8 +64,7 @@ jobs:
6464

6565
# - name: Generate Cargo.lock
6666
# uses: actions-rs/cargo@v1
67-
# with:
68-
# command: generate-lockfile
67+
# with: { command: generate-lockfile }
6968
# - name: Cache Dependencies
7069
# uses: Swatinem/rust-cache@v1.2.0
7170

@@ -117,27 +116,67 @@ jobs:
117116
cargo ci-test-rt-linux
118117
cargo ci-test-server-linux
119118
119+
- name: Clear the cargo caches
120+
run: |
121+
cargo install cargo-cache --version 0.6.2 --no-default-features --features ci-autoclean
122+
cargo-cache
123+
124+
build_and_test_lower_msrv:
125+
name: Linux / 1.46 (lower MSRV)
126+
runs-on: ubuntu-latest
127+
steps:
128+
- uses: actions/checkout@v2
129+
130+
- name: Install 1.46.0 # MSRV for all but -server and -tls
131+
uses: actions-rs/toolchain@v1
132+
with:
133+
toolchain: 1.46.0-x86_64-unknown-linux-gnu
134+
profile: minimal
135+
override: true
136+
137+
- name: Install cargo-hack
138+
uses: actions-rs/cargo@v1
139+
with:
140+
command: install
141+
args: cargo-hack
142+
143+
- name: tests
144+
run: cargo ci-test-lower-msrv
145+
146+
- name: Clear the cargo caches
147+
run: |
148+
cargo install cargo-cache --version 0.6.2 --no-default-features --features ci-autoclean
149+
cargo-cache
150+
151+
coverage:
152+
name: coverage
153+
runs-on: ubuntu-latest
154+
steps:
155+
- uses: actions/checkout@v2
156+
157+
- name: Install Rust (nightly)
158+
uses: actions-rs/toolchain@v1
159+
with:
160+
toolchain: stable-x86_64-unknown-linux-gnu
161+
profile: minimal
162+
override: true
163+
164+
- name: Generate Cargo.lock
165+
uses: actions-rs/cargo@v1
166+
with: { command: generate-lockfile }
167+
- name: Cache Dependencies
168+
uses: Swatinem/rust-cache@v1.3.0
169+
120170
- name: Generate coverage file
121-
if: >
122-
matrix.target.os == 'ubuntu-latest'
123-
&& matrix.version == 'stable'
124-
&& github.ref == 'refs/heads/master'
171+
if: github.ref == 'refs/heads/master'
125172
run: |
126173
cargo install cargo-tarpaulin
127174
cargo tarpaulin --out Xml --verbose
128175
- name: Upload to Codecov
129-
if: >
130-
matrix.target.os == 'ubuntu-latest'
131-
&& matrix.version == 'stable'
132-
&& github.ref == 'refs/heads/master'
176+
if: github.ref == 'refs/heads/master'
133177
uses: codecov/codecov-action@v1
134178
with: { file: cobertura.xml }
135179

136-
- name: Clear the cargo caches
137-
run: |
138-
cargo install cargo-cache --version 0.6.2 --no-default-features --features ci-autoclean
139-
cargo-cache
140-
141180
rustdoc:
142181
name: rustdoc
143182
runs-on: ubuntu-latest

actix-codec/src/framed.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@ impl<T, U> Framed<T, U> {
178178
U: Decoder,
179179
{
180180
loop {
181-
let mut this = self.as_mut().project();
181+
let this = self.as_mut().project();
182182
// Repeatedly call `decode` or `decode_eof` as long as it is "readable". Readable is
183183
// defined as not having returned `None`. If the upstream has returned EOF, and the
184184
// decoder is no longer readable, it can be assumed that the decoder will never become
185185
// readable again, at which point the stream is terminated.
186186

187187
if this.flags.contains(Flags::READABLE) {
188188
if this.flags.contains(Flags::EOF) {
189-
match this.codec.decode_eof(&mut this.read_buf) {
189+
match this.codec.decode_eof(this.read_buf) {
190190
Ok(Some(frame)) => return Poll::Ready(Some(Ok(frame))),
191191
Ok(None) => return Poll::Ready(None),
192192
Err(e) => return Poll::Ready(Some(Err(e))),
@@ -195,7 +195,7 @@ impl<T, U> Framed<T, U> {
195195

196196
log::trace!("attempting to decode a frame");
197197

198-
match this.codec.decode(&mut this.read_buf) {
198+
match this.codec.decode(this.read_buf) {
199199
Ok(Some(frame)) => {
200200
log::trace!("frame decoded from buffer");
201201
return Poll::Ready(Some(Ok(frame)));

actix-macros/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ syn = { version = "^1", features = ["full"] }
2222
actix-rt = "2.0.0"
2323

2424
futures-util = { version = "0.3.7", default-features = false }
25+
rustversion = "1"
2526
trybuild = "1"

actix-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,5 @@ pub fn test(args: TokenStream, item: TokenStream) -> TokenStream {
198198
fn input_and_compile_error(mut item: TokenStream, err: syn::Error) -> TokenStream {
199199
let compile_err = TokenStream::from(err.to_compile_error());
200200
item.extend(compile_err);
201-
return item;
201+
item
202202
}

actix-macros/tests/trybuild.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[rustversion::stable(1.46)] // MSRV
12
#[test]
23
fn compile_macros() {
34
let t = trybuild::TestCases::new();

actix-rt/src/system.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ impl System {
155155
pub struct SystemRunner {
156156
rt: Runtime,
157157
stop_rx: oneshot::Receiver<i32>,
158+
#[allow(dead_code)]
158159
system: System,
159160
}
160161

actix-server/src/accept.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,9 @@ struct Accept {
8181
}
8282

8383
/// Array of u128 with every bit as marker for a worker handle's availability.
84+
#[derive(Debug, Default)]
8485
struct Availability([u128; 4]);
8586

86-
impl Default for Availability {
87-
fn default() -> Self {
88-
Self([0; 4])
89-
}
90-
}
91-
9287
impl Availability {
9388
/// Check if any worker handle is available
9489
#[inline(always)]

actix-server/src/worker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ impl WorkerHandleAccept {
181181
/// Held by [ServerBuilder](crate::builder::ServerBuilder).
182182
#[derive(Debug)]
183183
pub(crate) struct WorkerHandleServer {
184+
#[allow(dead_code)]
184185
idx: usize,
185186
tx: UnboundedSender<Stop>,
186187
}

actix-service/examples/clone.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
use std::{future::Future, sync::mpsc, time::Duration};
2+
3+
async fn oracle<F, Fut>(f: F) -> (u32, u32)
4+
where
5+
F: FnOnce() -> Fut + Clone + Send + 'static,
6+
Fut: Future<Output = u32> + 'static,
7+
{
8+
let f1 = actix_rt::spawn(f.clone()());
9+
let f2 = actix_rt::spawn(f());
10+
11+
(f1.await.unwrap(), f2.await.unwrap())
12+
}
13+
14+
#[actix_rt::main]
15+
async fn main() {
16+
let (tx, rx) = mpsc::channel();
17+
18+
let (r1, r2) = oracle({
19+
let tx = tx.clone();
20+
21+
|| async move {
22+
tx.send(()).unwrap();
23+
4 * 4
24+
}
25+
})
26+
.await;
27+
assert_eq!(r1, r2);
28+
29+
tx.send(()).unwrap();
30+
31+
rx.recv_timeout(Duration::from_millis(100)).unwrap();
32+
rx.recv_timeout(Duration::from_millis(100)).unwrap();
33+
}

0 commit comments

Comments
 (0)