Skip to content

Commit

Permalink
Fix min dependency versions. Update MSRV to 1.64.
Browse files Browse the repository at this point in the history
Also includes a work-around for a buggy `format_args!` macro found in
rustc 1.67 and 1.68.

Resolves #2670.
  • Loading branch information
SergioBenitez committed Dec 14, 2023
1 parent 92a2559 commit a59f3c4
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion contrib/db_pools/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "../README.md"
keywords = ["rocket", "framework", "database", "pools"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[lib]
proc-macro = true
Expand Down
2 changes: 1 addition & 1 deletion contrib/db_pools/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "../README.md"
keywords = ["rocket", "framework", "database", "pools"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion contrib/dyn_templates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
keywords = ["rocket", "framework", "templates", "templating", "engine"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[features]
tera = ["tera_"]
Expand Down
2 changes: 1 addition & 1 deletion contrib/sync_db_pools/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "../README.md"
keywords = ["rocket", "framework", "database", "pools"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[lib]
proc-macro = true
Expand Down
4 changes: 2 additions & 2 deletions contrib/sync_db_pools/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "../README.md"
keywords = ["rocket", "framework", "database", "pools"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[features]
diesel_sqlite_pool = ["diesel/sqlite", "diesel/r2d2"]
Expand All @@ -31,7 +31,7 @@ r2d2_postgres = { version = "0.18", optional = true }
rusqlite = { version = "0.29.0", optional = true }
r2d2_sqlite = { version = "0.22.0", optional = true }

memcache = { version = "0.15", optional = true }
memcache = { version = "0.15.2", optional = true }
r2d2-memcache = { version = "0.6", optional = true }

[dependencies.rocket_sync_db_pools_codegen]
Expand Down
2 changes: 1 addition & 1 deletion contrib/ws/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
keywords = ["rocket", "web", "framework", "websocket"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[features]
default = ["tungstenite"]
Expand Down
4 changes: 2 additions & 2 deletions contrib/ws/src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ impl<'r, S> IoHandler for MessageStream<'r, S>
{
async fn io(self: Pin<Box<Self>>, io: IoStream) -> io::Result<()> {
let (mut sink, source) = DuplexStream::new(io, self.ws.config).await.split();
let handler = Pin::into_inner(self).handler;
let mut stream = std::pin::pin!((handler)(source));
let stream = (Pin::into_inner(self).handler)(source);
rocket::tokio::pin!(stream);
while let Some(msg) = stream.next().await {
let result = match msg {
Ok(msg) => sink.send(msg).await,
Expand Down
4 changes: 2 additions & 2 deletions core/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "../../README.md"
keywords = ["rocket", "web", "framework", "code", "generation"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[lib]
proc-macro = true
Expand All @@ -19,7 +19,7 @@ proc-macro = true
indexmap = "2"
quote = "1.0"
syn = { version = "2.0", features = ["full", "visit", "visit-mut", "extra-traits"] }
proc-macro2 = "1.0.27"
proc-macro2 = "1.0.60"
devise = "0.4"
rocket_http = { version = "0.6.0-dev", path = "../http/" }
unicode-xid = "0.2"
Expand Down
4 changes: 2 additions & 2 deletions core/http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["rocket", "web", "framework", "http"]
license = "MIT OR Apache-2.0"
categories = ["web-programming"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[features]
default = []
Expand All @@ -38,7 +38,7 @@ log = "0.4"
ref-cast = "1.0"
uncased = "0.9.6"
either = "1"
pear = "0.2.3"
pear = "0.2.8"
pin-project-lite = "0.2"
memchr = "2"
stable-pattern = "0.1"
Expand Down
6 changes: 3 additions & 3 deletions core/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0"
build = "build.rs"
categories = ["web-programming::http-server"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.64"

[package.metadata.docs.rs]
all-features = true
Expand Down Expand Up @@ -46,7 +46,7 @@ binascii = "0.1"
ref-cast = "1.0"
atomic = "0.5"
parking_lot = "0.12"
ubyte = {version = "0.10", features = ["serde"] }
ubyte = {version = "0.10.2", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
figment = { version = "0.10.6", features = ["toml", "env"] }
rand = "0.8"
Expand All @@ -56,7 +56,7 @@ indexmap = { version = "2", features = ["serde"] }
tempfile = "3"
async-trait = "0.1.43"
async-stream = "0.3.2"
multer = { version = "2", features = ["tokio-io"] }
multer = { version = "3.0.0", features = ["tokio-io"] }
tokio-stream = { version = "0.1.6", features = ["signal", "time"] }
state = "0.6"

Expand Down
10 changes: 8 additions & 2 deletions core/lib/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
fn main() {
if let Some(true) = version_check::is_feature_flaggable() {
println!("cargo:rustc-cfg=nightly");
if let Some((version, channel, _)) = version_check::triple() {
if channel.supports_features() {
println!("cargo:rustc-cfg=nightly");
}

if version.at_least("1.67") && version.at_most("1.68.2") {
println!("cargo:rustc-cfg=broken_fmt");
}
}
}
6 changes: 5 additions & 1 deletion core/lib/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ async fn hyper_service_fn(
// sends the response metadata (and a body channel) prior.
let (tx, rx) = oneshot::channel();

debug!("Received request: {:#?}", hyp_req);
#[cfg(not(broken_fmt))]
debug!("received request: {:#?}", hyp_req);

tokio::spawn(async move {
// We move the request next, so get the upgrade future now.
let pending_upgrade = hyper::upgrade::on(&mut hyp_req);
Expand Down Expand Up @@ -160,7 +162,9 @@ impl Rocket<Orbit> {
let hyp_response = hyp_res.body(hyp_body)
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;

#[cfg(not(broken_fmt))]
debug!("sending response: {:#?}", hyp_response);

tx.send(hyp_response).map_err(|_| {
let msg = "client disconnect before response started";
io::Error::new(io::ErrorKind::BrokenPipe, msg)
Expand Down

0 comments on commit a59f3c4

Please sign in to comment.