Skip to content

Commit 09b0186

Browse files
committed
Remove dependency on proc-macro-hack
1 parent eeae634 commit 09b0186

File tree

8 files changed

+7
-80
lines changed

8 files changed

+7
-80
lines changed

futures-macro/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ proc-macro = true
1515

1616
[features]
1717

18-
[build-dependencies]
19-
autocfg = "1"
20-
2118
[dependencies]
2219
proc-macro2 = "1.0"
23-
proc-macro-hack = "0.5.19"
2420
quote = "1.0"
2521
syn = { version = "1.0.56", features = ["full"] }

futures-macro/build.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

futures-macro/src/lib.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,38 @@ mod select;
2222
mod stream_select;
2323

2424
/// The `join!` macro.
25-
#[cfg_attr(fn_like_proc_macro, proc_macro)]
26-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack)]
25+
#[proc_macro]
2726
pub fn join_internal(input: TokenStream) -> TokenStream {
2827
crate::join::join(input)
2928
}
3029

3130
/// The `try_join!` macro.
32-
#[cfg_attr(fn_like_proc_macro, proc_macro)]
33-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack)]
31+
#[proc_macro]
3432
pub fn try_join_internal(input: TokenStream) -> TokenStream {
3533
crate::join::try_join(input)
3634
}
3735

3836
/// The `select!` macro.
39-
#[cfg_attr(fn_like_proc_macro, proc_macro)]
40-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack)]
37+
#[proc_macro]
4138
pub fn select_internal(input: TokenStream) -> TokenStream {
4239
crate::select::select(input)
4340
}
4441

4542
/// The `select_biased!` macro.
46-
#[cfg_attr(fn_like_proc_macro, proc_macro)]
47-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack)]
43+
#[proc_macro]
4844
pub fn select_biased_internal(input: TokenStream) -> TokenStream {
4945
crate::select::select_biased(input)
5046
}
5147

52-
// TODO: Change this to doc comment once rustdoc bug fixed.
48+
// TODO: Change this to doc comment once rustdoc bug fixed: https://github.com/rust-lang/futures-rs/pull/2435
5349
// The `test` attribute.
5450
#[proc_macro_attribute]
5551
pub fn test_internal(input: TokenStream, item: TokenStream) -> TokenStream {
5652
crate::executor::test(input, item)
5753
}
5854

5955
/// The `stream_select!` macro.
60-
#[cfg_attr(fn_like_proc_macro, proc_macro)]
61-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack)]
56+
#[proc_macro]
6257
pub fn stream_select_internal(input: TokenStream) -> TokenStream {
6358
crate::stream_select::stream_select(input.into())
6459
.unwrap_or_else(syn::Error::into_compile_error)

futures-util/Cargo.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ default = ["std", "async-await", "async-await-macro"]
1515
std = ["alloc", "futures-core/std", "futures-task/std", "slab"]
1616
alloc = ["futures-core/alloc", "futures-task/alloc"]
1717
async-await = []
18-
async-await-macro = ["async-await", "futures-macro", "proc-macro-hack", "proc-macro-nested"]
18+
async-await-macro = ["async-await", "futures-macro"]
1919
compat = ["std", "futures_01"]
2020
io-compat = ["io", "compat", "tokio-io"]
2121
sink = ["futures-sink"]
@@ -34,18 +34,13 @@ write-all-vectored = ["io"]
3434
# TODO: remove in the next major version.
3535
cfg-target-has-atomic = []
3636

37-
[build-dependencies]
38-
autocfg = "1"
39-
4037
[dependencies]
4138
futures-core = { path = "../futures-core", version = "0.3.17", default-features = false }
4239
futures-task = { path = "../futures-task", version = "0.3.17", default-features = false }
4340
futures-channel = { path = "../futures-channel", version = "0.3.17", default-features = false, features = ["std"], optional = true }
4441
futures-io = { path = "../futures-io", version = "0.3.17", default-features = false, features = ["std"], optional = true }
4542
futures-sink = { path = "../futures-sink", version = "0.3.17", default-features = false, optional = true }
4643
futures-macro = { path = "../futures-macro", version = "=0.3.17", default-features = false, optional = true }
47-
proc-macro-hack = { version = "0.5.19", optional = true }
48-
proc-macro-nested = { version = "0.1.2", optional = true }
4944
slab = { version = "0.4.2", optional = true }
5045
memchr = { version = "2.2", optional = true }
5146
futures_01 = { version = "0.1.25", optional = true, package = "futures" }

futures-util/build.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![warn(rust_2018_idioms, single_use_lifetimes)]
22

3-
use autocfg::AutoCfg;
43
use std::env;
54

65
include!("no_atomic_cas.rs");
@@ -39,23 +38,5 @@ fn main() {
3938
println!("cargo:rustc-cfg=futures_no_atomic_cas");
4039
}
4140

42-
let cfg = match AutoCfg::new() {
43-
Ok(cfg) => cfg,
44-
Err(e) => {
45-
println!(
46-
"cargo:warning={}: unable to determine rustc version: {}",
47-
env!("CARGO_PKG_NAME"),
48-
e
49-
);
50-
return;
51-
}
52-
};
53-
54-
// Function like procedural macros in expressions patterns statements stabilized in Rust 1.45:
55-
// https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html#stabilizing-function-like-procedural-macros-in-expressions-patterns-and-statements
56-
if cfg.probe_rustc_version(1, 45) {
57-
println!("cargo:rustc-cfg=fn_like_proc_macro");
58-
}
59-
6041
println!("cargo:rerun-if-changed=no_atomic_cas.rs");
6142
}

futures-util/src/async_await/join_mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,10 @@ macro_rules! document_join_macro {
8181

8282
#[allow(unreachable_pub)]
8383
#[doc(hidden)]
84-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack(support_nested))]
8584
pub use futures_macro::join_internal;
8685

8786
#[allow(unreachable_pub)]
8887
#[doc(hidden)]
89-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack(support_nested))]
9088
pub use futures_macro::try_join_internal;
9189

9290
document_join_macro! {

futures-util/src/async_await/select_mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ macro_rules! document_select_macro {
2929
/// It is also gated behind the `async-await` feature of this library, which is
3030
/// activated by default.
3131
///
32-
/// Note that `select!` relies on `proc-macro-hack`, and may require to set the
33-
/// compiler's recursion limit very high, e.g. `#![recursion_limit="1024"]`.
34-
///
3532
/// # Examples
3633
///
3734
/// ```
@@ -309,12 +306,10 @@ macro_rules! document_select_macro {
309306
#[cfg(feature = "std")]
310307
#[allow(unreachable_pub)]
311308
#[doc(hidden)]
312-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack(support_nested))]
313309
pub use futures_macro::select_internal;
314310

315311
#[allow(unreachable_pub)]
316312
#[doc(hidden)]
317-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack(support_nested))]
318313
pub use futures_macro::select_biased_internal;
319314

320315
document_select_macro! {

futures-util/src/async_await/stream_select_mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#[cfg(feature = "std")]
44
#[allow(unreachable_pub)]
55
#[doc(hidden)]
6-
#[cfg_attr(not(fn_like_proc_macro), proc_macro_hack::proc_macro_hack(support_nested))]
76
pub use futures_macro::stream_select_internal;
87

98
/// Combines several streams, all producing the same `Item` type, into one stream.
@@ -13,10 +12,6 @@ pub use futures_macro::stream_select_internal;
1312
///
1413
/// If multiple streams are ready, one will be pseudo randomly selected at runtime.
1514
///
16-
/// This macro is gated behind the `async-await` feature of this library, which is activated by default.
17-
/// Note that `stream_select!` relies on `proc-macro-hack`, and may require to set the compiler's recursion
18-
/// limit very high, e.g. `#![recursion_limit="1024"]`.
19-
///
2015
/// # Examples
2116
///
2217
/// ```

0 commit comments

Comments
 (0)