diff --git a/.devcontainer/rust/devcontainer-feature.json b/.devcontainer/rust/devcontainer-feature.json index 9fc58fd6e0e48..9674a6e7d7317 100644 --- a/.devcontainer/rust/devcontainer-feature.json +++ b/.devcontainer/rust/devcontainer-feature.json @@ -5,7 +5,7 @@ "dependsOn": { "ghcr.io/devcontainers/features/rust:1": { // this should match the `rust-toolchain.toml` - "version": "nightly-2025-09-21", + "version": "nightly-2026-01-04", "profile": "minimal", "components": "rustfmt,clippy,rust-analyzer" } diff --git a/Cargo.lock b/Cargo.lock index 4c41141e5fa9f..dd4617887fc69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3208,18 +3208,16 @@ checksum = "e7c5cedc30da3a610cac6b4ba17597bdf7152cf974e8aab3afb3d54455e371c8" [[package]] name = "include_dir" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +version = "0.7.4" +source = "git+https://github.com/vercel-labs/include_dir?branch=turbopack#0f23fcc20e37577a75a02d39ec55abfaf015faa3" dependencies = [ "include_dir_macros", ] [[package]] name = "include_dir_macros" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" +version = "0.7.4" +source = "git+https://github.com/vercel-labs/include_dir?branch=turbopack#0f23fcc20e37577a75a02d39ec55abfaf015faa3" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 586cae7195c6b..2fbb3495488b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -484,4 +484,7 @@ webbrowser = "1.0.6" [patch.crates-io] bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" } virtue = { git = "https://github.com/bgw/virtue.git", branch = "bgw/fix-generic-default-parsing" } +# We have to very frequently bump the swc major version of mdxjs-rs mdxjs = { git = "https://github.com/vercel-labs/mdxjs-rs-turbopack.git", branch = "turbopack" } +# Doesn't compile on recent nightly versions because of https://github.com/Michael-F-Bryan/include_dir/pull/117 +include_dir = { git = "https://github.com/vercel-labs/include_dir", branch = "turbopack" } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a3e5d17ae639e..a90764c7ed8cc 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ # if you update this, also update `.devcontainer/rust/devcontainer-feature.json` [toolchain] -channel = "nightly-2025-10-27" +channel = "nightly-2026-01-04" components = ["rustfmt", "clippy", "rust-analyzer"] profile = "minimal" diff --git a/turbopack/crates/turbo-tasks-fs/Cargo.toml b/turbopack/crates/turbo-tasks-fs/Cargo.toml index 9de72429caba2..57477aa9f4028 100644 --- a/turbopack/crates/turbo-tasks-fs/Cargo.toml +++ b/turbopack/crates/turbo-tasks-fs/Cargo.toml @@ -32,7 +32,7 @@ concurrent-queue = { workspace = true } dashmap = { workspace = true } dunce = { workspace = true } futures = { workspace = true } -include_dir = { version = "0.7.2", features = ["nightly"] } +include_dir = { version = "0.7.3", features = ["nightly"] } indexmap = { workspace = true } jsonc-parser = { version = "0.26.3", features = ["serde"] } mime = { workspace = true } diff --git a/turbopack/crates/turbo-tasks-fs/src/lib.rs b/turbopack/crates/turbo-tasks-fs/src/lib.rs index e97a511025425..f6413a874021e 100644 --- a/turbopack/crates/turbo-tasks-fs/src/lib.rs +++ b/turbopack/crates/turbo-tasks-fs/src/lib.rs @@ -8,6 +8,7 @@ // stdlib into our source tree #![feature(normalize_lexically)] #![feature(trivial_bounds)] +#![feature(downcast_unchecked)] // Junction points are used on Windows. We could use a third-party crate for this if the junction // API isn't eventually stabilized. #![cfg_attr(windows, feature(junction_point))] diff --git a/turbopack/crates/turbo-tasks/src/effect.rs b/turbopack/crates/turbo-tasks/src/effect.rs index 6373306853477..bde25a6720f9c 100644 --- a/turbopack/crates/turbo-tasks/src/effect.rs +++ b/turbopack/crates/turbo-tasks/src/effect.rs @@ -298,7 +298,7 @@ impl ApplyEffectsContext { .get_mut(&TypeId::of::()) .map(|value| { // Safety: the map is keyed by TypeId - unsafe { value.downcast_mut_unchecked() } + unsafe { value.downcast_unchecked_mut() } }) .map(f) }) @@ -315,7 +315,7 @@ impl ApplyEffectsContext { }); f( // Safety: the map is keyed by TypeId - unsafe { value.downcast_mut_unchecked() }, + unsafe { value.downcast_unchecked_mut() }, ) }) } diff --git a/turbopack/crates/turbo-tasks/src/lib.rs b/turbopack/crates/turbo-tasks/src/lib.rs index 017bd69ea543e..1632e73d66df4 100644 --- a/turbopack/crates/turbo-tasks/src/lib.rs +++ b/turbopack/crates/turbo-tasks/src/lib.rs @@ -37,7 +37,6 @@ #![feature(downcast_unchecked)] #![feature(ptr_metadata)] #![feature(sync_unsafe_cell)] -#![feature(vec_into_raw_parts)] #![feature(async_fn_traits)] pub mod backend; diff --git a/turbopack/crates/turbo-tasks/src/scope.rs b/turbopack/crates/turbo-tasks/src/scope.rs index ff4fc5b69d7e9..300578ab83b13 100644 --- a/turbopack/crates/turbo-tasks/src/scope.rs +++ b/turbopack/crates/turbo-tasks/src/scope.rs @@ -209,13 +209,16 @@ impl<'scope, 'env: 'scope, R: Send + 'env> Scope<'scope, 'env, R> { *result_cell.lock() = Some(result); }); let f: *mut (dyn FnOnce() + Send + 'scope) = Box::into_raw(f); + // SAFETY: Scope ensures (e. g. in Drop) that spawned tasks is awaited before the // lifetime `'env` ends. - #[allow( - clippy::unnecessary_cast, - reason = "Clippy thinks this is unnecessary, but it actually changes the lifetime" - )] - let f = f as *mut (dyn FnOnce() + Send + 'static); + let f = unsafe { + std::mem::transmute::< + *mut (dyn FnOnce() + Send + 'scope), + *mut (dyn FnOnce() + Send + 'static), + >(f) + }; + // SAFETY: We just called `Box::into_raw`. let f = unsafe { Box::from_raw(f) };