From 8e1eb8979f58552dc5fefe3b09aa7da21ed48b8b Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sat, 18 Mar 2023 20:23:27 +0100 Subject: [PATCH] Update to syn 2 (#1862) --- axum-core/Cargo.toml | 4 ++-- axum-extra/Cargo.toml | 1 - axum-extra/src/json_lines.rs | 6 +++--- axum-macros/CHANGELOG.md | 4 +++- axum-macros/Cargo.toml | 5 +++-- axum-macros/src/attr_parsing.rs | 2 +- axum/Cargo.toml | 3 +-- axum/src/body/stream_body.rs | 2 +- axum/src/docs/middleware.md | 2 +- axum/src/extract/multipart.rs | 2 +- axum/src/extract/raw_query.rs | 2 +- axum/src/extract/request_parts.rs | 4 ++-- axum/src/extract/ws.rs | 2 +- axum/src/response/sse.rs | 4 ++-- axum/src/routing/tests/merge.rs | 2 +- deny.toml | 2 ++ examples/low-level-openssl/Cargo.toml | 2 +- examples/low-level-rustls/Cargo.toml | 2 +- examples/validator/Cargo.toml | 2 +- 19 files changed, 28 insertions(+), 25 deletions(-) diff --git a/axum-core/Cargo.toml b/axum-core/Cargo.toml index 4c4904c7..5fb23124 100644 --- a/axum-core/Cargo.toml +++ b/axum-core/Cargo.toml @@ -15,7 +15,7 @@ version = "0.3.3" # remember to also bump the version that axum depends on __private_docs = ["dep:tower-http"] [dependencies] -async-trait = "0.1" +async-trait = "0.1.67" bytes = "1.0" futures-util = { version = "0.3", default-features = false, features = ["alloc"] } http = "0.2.7" @@ -32,7 +32,7 @@ rustversion = "1.0.9" [dev-dependencies] axum = { path = "../axum", version = "0.6.0", features = ["headers"] } -futures-util = "0.3" +futures-util = { version = "0.3", default-features = false, features = ["alloc"] } hyper = "0.14.24" tokio = { version = "1.25.0", features = ["macros"] } tower-http = { version = "0.4", features = ["limit"] } diff --git a/axum-extra/Cargo.toml b/axum-extra/Cargo.toml index faf6bd34..7b57a6e2 100644 --- a/axum-extra/Cargo.toml +++ b/axum-extra/Cargo.toml @@ -62,7 +62,6 @@ tokio-util = { version = "0.7", optional = true } [dev-dependencies] axum = { path = "../axum", version = "0.6.0", features = ["headers"] } -futures = "0.3" http-body = "0.4.4" hyper = "0.14" reqwest = { version = "0.11", default-features = false, features = ["json", "stream", "multipart"] } diff --git a/axum-extra/src/json_lines.rs b/axum-extra/src/json_lines.rs index 99244287..8b04825f 100644 --- a/axum-extra/src/json_lines.rs +++ b/axum-extra/src/json_lines.rs @@ -32,7 +32,7 @@ pin_project! { /// /// ```rust /// use axum_extra::json_lines::JsonLines; - /// use futures::stream::StreamExt; + /// use futures_util::stream::StreamExt; /// /// async fn handler(mut stream: JsonLines) { /// while let Some(value) = stream.next().await { @@ -46,10 +46,10 @@ pin_project! { /// ```rust /// use axum::{BoxError, response::{IntoResponse, Response}}; /// use axum_extra::json_lines::JsonLines; - /// use futures::stream::Stream; + /// use futures_util::stream::Stream; /// /// fn stream_of_values() -> impl Stream> { - /// # futures::stream::empty() + /// # futures_util::stream::empty() /// } /// /// async fn handler() -> Response { diff --git a/axum-macros/CHANGELOG.md b/axum-macros/CHANGELOG.md index f6e56d2a..4bb7e6e7 100644 --- a/axum-macros/CHANGELOG.md +++ b/axum-macros/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased -- None. +- **change:** Update to syn 2.0 ([#1862]) + +[#1862]: https://github.com/tokio-rs/axum/pull/1862 # 0.3.6 (13. March, 2023) diff --git a/axum-macros/Cargo.toml b/axum-macros/Cargo.toml index adae9702..a560009b 100644 --- a/axum-macros/Cargo.toml +++ b/axum-macros/Cargo.toml @@ -22,8 +22,9 @@ proc-macro = true heck = "0.4" proc-macro2 = "1.0" quote = "1.0" -syn = { version = "1.0", features = [ +syn = { version = "2.0", features = [ "full", + "parsing", # needed for `Hash` impls "extra-traits", ] } @@ -34,7 +35,7 @@ axum-extra = { path = "../axum-extra", version = "0.7.0", features = ["typed-rou rustversion = "1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -syn = { version = "1.0", features = ["full", "extra-traits"] } +syn = { version = "2.0", features = ["full", "extra-traits"] } tokio = { version = "1.25.0", features = ["full"] } trybuild = "1.0.63" diff --git a/axum-macros/src/attr_parsing.rs b/axum-macros/src/attr_parsing.rs index a6eff772..67da01eb 100644 --- a/axum-macros/src/attr_parsing.rs +++ b/axum-macros/src/attr_parsing.rs @@ -62,7 +62,7 @@ where { attrs .iter() - .filter(|attr| attr.path.is_ident(ident)) + .filter(|attr| attr.meta.path().is_ident(ident)) .map(|attr| attr.parse_args::()) .try_fold(T::default(), |out, next| out.combine(next?)) } diff --git a/axum/Cargo.toml b/axum/Cargo.toml index 8fd9ddfc..cf1ac2f9 100644 --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -30,7 +30,7 @@ ws = ["tokio", "dep:tokio-tungstenite", "dep:sha1", "dep:base64"] __private_docs = ["tower/full", "dep:tower-http"] [dependencies] -async-trait = "0.1.43" +async-trait = "0.1.67" axum-core = { path = "../axum-core", version = "0.3.3" } bitflags = "1.0" bytes = "1.0" @@ -103,7 +103,6 @@ rustversion = "1.0.9" [dev-dependencies] anyhow = "1.0" axum-macros = { path = "../axum-macros", version = "0.3.4", features = ["__private"] } -futures = "0.3" quickcheck = "1.0" quickcheck_macros = "1.0" reqwest = { version = "0.11.14", default-features = false, features = ["json", "stream", "multipart"] } diff --git a/axum/src/body/stream_body.rs b/axum/src/body/stream_body.rs index 6ad2f695..1c2955ea 100644 --- a/axum/src/body/stream_body.rs +++ b/axum/src/body/stream_body.rs @@ -32,7 +32,7 @@ pin_project! { /// body::StreamBody, /// response::IntoResponse, /// }; - /// use futures::stream::{self, Stream}; + /// use futures_util::stream::{self, Stream}; /// use std::io; /// /// async fn handler() -> StreamBody>> { diff --git a/axum/src/docs/middleware.md b/axum/src/docs/middleware.md index 0d1245ec..fe77cc5b 100644 --- a/axum/src/docs/middleware.md +++ b/axum/src/docs/middleware.md @@ -225,7 +225,7 @@ use axum::{ body::Body, http::Request, }; -use futures::future::BoxFuture; +use futures_util::future::BoxFuture; use tower::{Service, Layer}; use std::task::{Context, Poll}; diff --git a/axum/src/extract/multipart.rs b/axum/src/extract/multipart.rs index 2561b5ce..7bccc183 100644 --- a/axum/src/extract/multipart.rs +++ b/axum/src/extract/multipart.rs @@ -32,7 +32,7 @@ use std::{ /// routing::post, /// Router, /// }; -/// use futures::stream::StreamExt; +/// use futures_util::stream::StreamExt; /// /// async fn upload(mut multipart: Multipart) { /// while let Some(mut field) = multipart.next_field().await.unwrap() { diff --git a/axum/src/extract/raw_query.rs b/axum/src/extract/raw_query.rs index 0e507cfc..98a60b09 100644 --- a/axum/src/extract/raw_query.rs +++ b/axum/src/extract/raw_query.rs @@ -13,7 +13,7 @@ use std::convert::Infallible; /// routing::get, /// Router, /// }; -/// use futures::StreamExt; +/// use futures_util::StreamExt; /// /// async fn handler(RawQuery(query): RawQuery) { /// // ... diff --git a/axum/src/extract/request_parts.rs b/axum/src/extract/request_parts.rs index 981e88f0..b3a28bc4 100644 --- a/axum/src/extract/request_parts.rs +++ b/axum/src/extract/request_parts.rs @@ -117,7 +117,7 @@ where /// routing::get, /// Router, /// }; -/// use futures::StreamExt; +/// use futures_util::StreamExt; /// /// async fn handler(mut stream: BodyStream) { /// while let Some(chunk) = stream.next().await { @@ -192,7 +192,7 @@ fn body_stream_traits() { /// routing::get, /// Router, /// }; -/// use futures::StreamExt; +/// use futures_util::StreamExt; /// /// async fn handler(RawBody(body): RawBody) { /// // ... diff --git a/axum/src/extract/ws.rs b/axum/src/extract/ws.rs index 5c1167c4..8965bd73 100644 --- a/axum/src/extract/ws.rs +++ b/axum/src/extract/ws.rs @@ -74,7 +74,7 @@ //! //! ```rust,no_run //! use axum::{Error, extract::ws::{WebSocket, Message}}; -//! use futures::{sink::SinkExt, stream::{StreamExt, SplitSink, SplitStream}}; +//! use futures_util::{sink::SinkExt, stream::{StreamExt, SplitSink, SplitStream}}; //! //! async fn handle_socket(mut socket: WebSocket) { //! let (mut sender, mut receiver) = socket.split(); diff --git a/axum/src/response/sse.rs b/axum/src/response/sse.rs index bbe2c5f2..2e9e2853 100644 --- a/axum/src/response/sse.rs +++ b/axum/src/response/sse.rs @@ -10,7 +10,7 @@ //! }; //! use std::{time::Duration, convert::Infallible}; //! use tokio_stream::StreamExt as _ ; -//! use futures::stream::{self, Stream}; +//! use futures_util::stream::{self, Stream}; //! //! let app = Router::new().route("/sse", get(sse_handler)); //! @@ -509,7 +509,7 @@ impl<'a> Iterator for MemchrSplit<'a> { mod tests { use super::*; use crate::{routing::get, test_helpers::*, Router}; - use futures::stream; + use futures_util::stream; use std::{collections::HashMap, convert::Infallible}; use tokio_stream::StreamExt as _; diff --git a/axum/src/routing/tests/merge.rs b/axum/src/routing/tests/merge.rs index 29aaf15c..0344a879 100644 --- a/axum/src/routing/tests/merge.rs +++ b/axum/src/routing/tests/merge.rs @@ -126,7 +126,7 @@ async fn layer() { async fn layer_and_handle_error() { let one = Router::new().route("/foo", get(|| async {})); let two = Router::new() - .route("/timeout", get(futures::future::pending::<()>)) + .route("/timeout", get(std::future::pending::<()>)) .layer( ServiceBuilder::new() .layer(HandleErrorLayer::new(|_| async { diff --git a/deny.toml b/deny.toml index a53b047b..c543455c 100644 --- a/deny.toml +++ b/deny.toml @@ -23,6 +23,8 @@ skip-tree = [ { name = "windows-sys" }, # old version pulled in by rustls via ring { name = "spin" }, + # lots still pulls in syn 1.x + { name = "syn" }, ] [sources] diff --git a/examples/low-level-openssl/Cargo.toml b/examples/low-level-openssl/Cargo.toml index 5ba8ba55..d0e1a46d 100644 --- a/examples/low-level-openssl/Cargo.toml +++ b/examples/low-level-openssl/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] axum = { path = "../../axum" } -futures-util = "0.3" +futures-util = { version = "0.3", default-features = false, features = ["alloc"] } hyper = { version = "0.14", features = ["full"] } openssl = "0.10" tokio = { version = "1", features = ["full"] } diff --git a/examples/low-level-rustls/Cargo.toml b/examples/low-level-rustls/Cargo.toml index b5e9c152..91069128 100644 --- a/examples/low-level-rustls/Cargo.toml +++ b/examples/low-level-rustls/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] axum = { path = "../../axum" } -futures-util = "0.3" +futures-util = { version = "0.3", default-features = false, features = ["alloc"] } hyper = { version = "0.14", features = ["full"] } rustls-pemfile = "0.3" tokio = { version = "1", features = ["full"] } diff --git a/examples/validator/Cargo.toml b/examples/validator/Cargo.toml index 8c35019f..b164a30a 100644 --- a/examples/validator/Cargo.toml +++ b/examples/validator/Cargo.toml @@ -5,7 +5,7 @@ publish = false version = "0.1.0" [dependencies] -async-trait = "0.1" +async-trait = "0.1.67" axum = { path = "../../axum" } http-body = "0.4.3" serde = { version = "1.0", features = ["derive"] }