Skip to content

Commit 7adbb7f

Browse files
authored
refactor: remove direct actix-rt support (launchbadge#1679)
actix- runtime feature flags are now aliases for tokio- flags
1 parent 9a6d07f commit 7adbb7f

File tree

16 files changed

+34
-157
lines changed

16 files changed

+34
-157
lines changed

Cargo.lock

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ runtime-async-std = []
7575
runtime-tokio = []
7676

7777
# actual runtimes
78-
runtime-actix-native-tls = [
79-
"sqlx-core/runtime-actix-native-tls",
80-
"sqlx-macros/runtime-actix-native-tls",
81-
"_rt-actix",
82-
]
78+
runtime-actix-native-tls = ["runtime-tokio-native-tls"]
8379
runtime-async-std-native-tls = [
8480
"sqlx-core/runtime-async-std-native-tls",
8581
"sqlx-macros/runtime-async-std-native-tls",
@@ -91,11 +87,7 @@ runtime-tokio-native-tls = [
9187
"_rt-tokio",
9288
]
9389

94-
runtime-actix-rustls = [
95-
"sqlx-core/runtime-actix-rustls",
96-
"sqlx-macros/runtime-actix-rustls",
97-
"_rt-actix",
98-
]
90+
runtime-actix-rustls = ["runtime-tokio-rustls"]
9991
runtime-async-std-rustls = [
10092
"sqlx-core/runtime-async-std-rustls",
10193
"sqlx-macros/runtime-async-std-rustls",
@@ -108,7 +100,6 @@ runtime-tokio-rustls = [
108100
]
109101

110102
# for conditional compilation
111-
_rt-actix = []
112103
_rt-async-std = []
113104
_rt-tokio = []
114105

sqlx-bench/Cargo.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ edition = "2021"
66
publish = false
77

88
[features]
9-
runtime-actix-native-tls = [
10-
"sqlx/runtime-actix-native-tls",
11-
"sqlx-rt/runtime-actix-native-tls",
12-
]
9+
runtime-actix-native-tls = ["runtime-tokio-native-tls"]
1310
runtime-async-std-native-tls = [
1411
"sqlx/runtime-async-std-native-tls",
1512
"sqlx-rt/runtime-async-std-native-tls",
@@ -19,10 +16,7 @@ runtime-tokio-native-tls = [
1916
"sqlx-rt/runtime-tokio-native-tls",
2017
]
2118

22-
runtime-actix-rustls = [
23-
"sqlx/runtime-actix-rustls",
24-
"sqlx-rt/runtime-actix-rustls",
25-
]
19+
runtime-actix-rustls = ["runtime-tokio-rustls"]
2620
runtime-async-std-rustls = [
2721
"sqlx/runtime-async-std-rustls",
2822
"sqlx-rt/runtime-async-std-rustls",

sqlx-core/Cargo.toml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ decimal = ["rust_decimal", "num-bigint"]
6565
json = ["serde", "serde_json"]
6666

6767
# runtimes
68-
runtime-actix-native-tls = [
69-
"sqlx-rt/runtime-actix-native-tls",
70-
"sqlx/runtime-actix-native-tls",
71-
"_tls-native-tls",
72-
"_rt-actix",
73-
]
68+
runtime-actix-native-tls = ["runtime-tokio-native-tls"]
7469
runtime-async-std-native-tls = [
7570
"sqlx-rt/runtime-async-std-native-tls",
7671
"sqlx/runtime-async-std-native-tls",
@@ -84,12 +79,7 @@ runtime-tokio-native-tls = [
8479
"_rt-tokio",
8580
]
8681

87-
runtime-actix-rustls = [
88-
"sqlx-rt/runtime-actix-rustls",
89-
"sqlx/runtime-actix-rustls",
90-
"_tls-rustls",
91-
"_rt-actix"
92-
]
82+
runtime-actix-rustls = ['runtime-tokio-rustls']
9383
runtime-async-std-rustls = [
9484
"sqlx-rt/runtime-async-std-rustls",
9585
"sqlx/runtime-async-std-rustls",
@@ -104,7 +94,6 @@ runtime-tokio-rustls = [
10494
]
10595

10696
# for conditional compilation
107-
_rt-actix = ["tokio-stream"]
10897
_rt-async-std = []
10998
_rt-tokio = ["tokio-stream"]
11099
_tls-native-tls = []

sqlx-core/src/migrate/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'s> MigrationSource<'s> for &'s Path {
2424
let mut s = fs::read_dir(self.canonicalize()?).await?;
2525
let mut migrations = Vec::new();
2626

27-
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
27+
#[cfg(feature = "_rt-tokio")]
2828
let mut s = tokio_stream::wrappers::ReadDirStream::new(s);
2929

3030
while let Some(entry) = s.try_next().await? {

sqlx-core/src/mssql/connection/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl Connection for MssqlConnection {
4545
ready(self.stream.shutdown(Shutdown::Both).map_err(Into::into)).boxed()
4646
}
4747

48-
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
48+
#[cfg(feature = "_rt-tokio")]
4949
{
5050
use sqlx_rt::AsyncWriteExt;
5151

sqlx-core/src/net/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ pub use tls::{CertificateInput, MaybeTlsStream};
77
#[cfg(feature = "_rt-async-std")]
88
type PollReadBuf<'a> = [u8];
99

10-
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
10+
#[cfg(feature = "_rt-tokio")]
1111
type PollReadBuf<'a> = sqlx_rt::ReadBuf<'a>;
1212

1313
#[cfg(feature = "_rt-async-std")]
1414
type PollReadOut = usize;
1515

16-
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
16+
#[cfg(feature = "_rt-tokio")]
1717
type PollReadOut = ();

sqlx-core/src/net/socket.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl Socket {
5151
}
5252
}
5353

54-
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
54+
#[cfg(feature = "_rt-tokio")]
5555
{
5656
use sqlx_rt::AsyncWriteExt;
5757

@@ -103,7 +103,7 @@ impl AsyncWrite for Socket {
103103
}
104104
}
105105

106-
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
106+
#[cfg(feature = "_rt-tokio")]
107107
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
108108
match &mut *self {
109109
Socket::Tcp(s) => Pin::new(s).poll_shutdown(cx),

sqlx-core/src/net/tls/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ where
190190
}
191191
}
192192

193-
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
193+
#[cfg(feature = "_rt-tokio")]
194194
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
195195
match &mut *self {
196196
MaybeTlsStream::Raw(s) => Pin::new(s).poll_shutdown(cx),

sqlx-core/src/postgres/copy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl<C: DerefMut<Target = PgConnection>> PgCopyIn<C> {
203203
loop {
204204
let read = match () {
205205
// Tokio lets us read into the buffer without zeroing first
206-
#[cfg(any(feature = "runtime-tokio", feature = "runtime-actix"))]
206+
#[cfg(feature = "runtime-tokio")]
207207
_ if buf.len() != buf.capacity() => {
208208
// in case we have some data in the buffer, which can occur
209209
// if the previous write did not fill the buffer

sqlx-macros/Cargo.toml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ default = ["runtime-tokio-native-tls", "migrate"]
2020
migrate = ["sha2", "sqlx-core/migrate"]
2121

2222
# runtimes
23-
runtime-actix-native-tls = [
24-
"sqlx-core/runtime-actix-native-tls",
25-
"sqlx-rt/runtime-actix-native-tls",
26-
"_rt-actix",
27-
]
23+
runtime-actix-native-tls = ["runtime-tokio-native-tls"]
2824
runtime-async-std-native-tls = [
2925
"sqlx-core/runtime-async-std-native-tls",
3026
"sqlx-rt/runtime-async-std-native-tls",
@@ -36,11 +32,7 @@ runtime-tokio-native-tls = [
3632
"_rt-tokio",
3733
]
3834

39-
runtime-actix-rustls = [
40-
"sqlx-core/runtime-actix-rustls",
41-
"sqlx-rt/runtime-actix-rustls",
42-
"_rt-actix",
43-
]
35+
runtime-actix-rustls = ["runtime-tokio-rustls"]
4436
runtime-async-std-rustls = [
4537
"sqlx-core/runtime-async-std-rustls",
4638
"sqlx-rt/runtime-async-std-rustls",
@@ -53,7 +45,6 @@ runtime-tokio-rustls = [
5345
]
5446

5547
# for conditional compilation
56-
_rt-actix = []
5748
_rt-async-std = []
5849
_rt-tokio = []
5950

sqlx-macros/src/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,6 @@ pub fn test(_attr: TokenStream, input: TokenStream) -> TokenStream {
128128
::sqlx_rt::async_std::task::block_on(async { #body })
129129
}
130130
}
131-
} else if cfg!(feature = "_rt-actix") {
132-
quote! {
133-
#[test]
134-
#(#attrs)*
135-
fn #name() #ret {
136-
::sqlx_rt::actix_rt::System::new()
137-
.block_on(async { #body })
138-
}
139-
}
140131
} else {
141132
panic!("one of 'runtime-actix', 'runtime-async-std' or 'runtime-tokio' features must be enabled");
142133
};

sqlx-rt/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@ authors = [
1111
]
1212

1313
[features]
14-
runtime-actix-native-tls = ["_rt-actix", "_tls-native-tls", "tokio-native-tls"]
14+
runtime-actix-native-tls = ["runtime-tokio-native-tls"]
1515
runtime-async-std-native-tls = [
1616
"_rt-async-std",
1717
"_tls-native-tls",
1818
"async-native-tls",
1919
]
2020
runtime-tokio-native-tls = ["_rt-tokio", "_tls-native-tls", "tokio-native-tls"]
2121

22-
runtime-actix-rustls = ["_rt-actix", "_tls-rustls", "tokio-rustls"]
22+
runtime-actix-rustls = ["runtime-tokio-rustls"]
2323
runtime-async-std-rustls = ["_rt-async-std", "_tls-rustls", "futures-rustls"]
2424
runtime-tokio-rustls = ["_rt-tokio", "_tls-rustls", "tokio-rustls"]
2525

2626
# Not used directly and not re-exported from sqlx
27-
_rt-actix = ["actix-rt", "tokio", "once_cell"]
2827
_rt-async-std = ["async-std"]
2928
_rt-tokio = ["tokio", "once_cell"]
3029
_tls-native-tls = ["native-tls"]
@@ -33,7 +32,6 @@ _tls-rustls = []
3332
[dependencies]
3433
async-native-tls = { version = "0.4.0", optional = true }
3534
futures-rustls = { version = "0.22.0", optional = true }
36-
actix-rt = { version = "2.0.0", default-features = false, optional = true }
3735
async-std = { version = "1.7.0", features = ["unstable"], optional = true }
3836
tokio-native-tls = { version = "0.3.0", optional = true }
3937
tokio-rustls = { version = "0.23.0", optional = true }

0 commit comments

Comments
 (0)