Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to syn 2 #1862

Merged
merged 5 commits into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions axum-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"] }
Expand Down
1 change: 0 additions & 1 deletion axum-extra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
6 changes: 3 additions & 3 deletions axum-extra/src/json_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<serde_json::Value>) {
/// while let Some(value) = stream.next().await {
Expand All @@ -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<Item = Result<serde_json::Value, BoxError>> {
/// # futures::stream::empty()
/// # futures_util::stream::empty()
/// }
///
/// async fn handler() -> Response {
Expand Down
4 changes: 3 additions & 1 deletion axum-macros/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 3 additions & 2 deletions axum-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
] }
Expand All @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion axum-macros/src/attr_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where
{
attrs
.iter()
.filter(|attr| attr.path.is_ident(ident))
.filter(|attr| attr.meta.path().is_ident(ident))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having just upgraded another project to syn 2, I realized you used a more verbose solution than necessary here. Attribute also has a path method, so this can be attr.path().

.map(|attr| attr.parse_args::<T>())
.try_fold(T::default(), |out, next| out.combine(next?))
}
Expand Down
3 changes: 1 addition & 2 deletions axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion axum/src/body/stream_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<impl Stream<Item = io::Result<&'static str>>> {
Expand Down
2 changes: 1 addition & 1 deletion axum/src/docs/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion axum/src/extract/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion axum/src/extract/raw_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::convert::Infallible;
/// routing::get,
/// Router,
/// };
/// use futures::StreamExt;
/// use futures_util::StreamExt;
///
/// async fn handler(RawQuery(query): RawQuery) {
/// // ...
Expand Down
4 changes: 2 additions & 2 deletions axum/src/extract/request_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -192,7 +192,7 @@ fn body_stream_traits() {
/// routing::get,
/// Router,
/// };
/// use futures::StreamExt;
/// use futures_util::StreamExt;
///
/// async fn handler(RawBody(body): RawBody) {
/// // ...
Expand Down
2 changes: 1 addition & 1 deletion axum/src/extract/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions axum/src/response/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
//!
Expand Down Expand Up @@ -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 _;

Expand Down
2 changes: 1 addition & 1 deletion axum/src/routing/tests/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to remove duplicate syn versions but still lots of crates that need to be updated. I'm gonna submit some patches but don't it should block us from updating.

]

[sources]
Expand Down
2 changes: 1 addition & 1 deletion examples/low-level-openssl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/low-level-rustls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down