Skip to content

Commit

Permalink
chore: add parallel rust frontend and remove unused rust dependencies (
Browse files Browse the repository at this point in the history
…vercel/turborepo#7409)

### Description

Should improve compile times marginally, also added the new parallel
frontend.

Also includes some clippy fixes (`cargo-groups` seems to be broken).

`turbopack-cli`: 761 -> 719 compilation units
`turbo`: 574 -> 564 compilation units

Closes PACK-2525
  • Loading branch information
ForsakenHarmony authored Apr 9, 2024
1 parent 5ed785e commit 80847fb
Show file tree
Hide file tree
Showing 30 changed files with 18 additions and 65 deletions.
1 change: 0 additions & 1 deletion crates/tower-uds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ license = "MPL-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
http = "0.2.11"
tokio = { workspace = true, features = ["net"] }
tower = { version = "0.4.13", features = ["util"] }

Expand Down
1 change: 0 additions & 1 deletion crates/turbo-tasks-bytes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ bytes = { workspace = true }
futures = { workspace = true }
serde = { workspace = true }
serde_bytes = "0.11.9"
tokio = { workspace = true }
turbo-tasks = { workspace = true }

[dev-dependencies]
Expand Down
1 change: 0 additions & 1 deletion crates/turbo-tasks-fetch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ workspace = true

[dependencies]
anyhow = { workspace = true }
indexmap = { workspace = true }
lazy_static = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions crates/turbo-tasks-fs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![feature(io_error_more)]
#![feature(round_char_boundary)]
#![feature(arbitrary_self_types)]
#![feature(lint_reasons)]

pub mod attach;
pub mod embed;
Expand Down Expand Up @@ -249,6 +250,7 @@ impl DiskFileSystem {
}
}

#[allow(dead_code, reason = "we need to hold onto the locks")]
struct PathLockGuard<'a>(
#[allow(dead_code)] RwLockReadGuard<'a, ()>,
#[allow(dead_code)] mutex_map::MutexMapGuard<'a, PathBuf>,
Expand Down
1 change: 1 addition & 0 deletions crates/turbo-tasks-macros-tests/tests/value_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ register!();

#[tokio::test]
async fn ignored_indexes() {
#[allow(dead_code)]
#[derive(ValueDebugFormat)]
struct IgnoredIndexes(
#[allow(dead_code)]
Expand Down
1 change: 0 additions & 1 deletion crates/turbo-tasks-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ workspace = true

[dependencies]
anyhow = { workspace = true }
convert_case = "0.6.0"
proc-macro-error = "1.0.4"
proc-macro2 = { workspace = true }
quote = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/turbo-tasks-memory/src/task/meta_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub(super) type TaskMetaStateAsPartialMut =
pub(super) type TaskMetaStateAsUnloadedMut =
for<'a> fn(&'a mut TaskMetaState) -> Option<&'a mut UnloadedTaskState>;

#[allow(dead_code, reason = "test")]
pub(super) enum TaskMetaStateReadGuard<'a> {
Full(ReadGuard<'a, TaskMetaState, TaskState, TaskMetaStateAsFull>),
Partial(ReadGuard<'a, TaskMetaState, PartialTaskState, TaskMetaStateAsPartial>),
Expand Down
2 changes: 2 additions & 0 deletions crates/turbo-tasks-signposter/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub struct Log {

// Safety: unclear
unsafe impl Sync for Log {}

// Safety: unclear
unsafe impl Send for Log {}

Expand Down Expand Up @@ -82,6 +83,7 @@ pub struct Signpost {

// Safety: unclear
unsafe impl Sync for Signpost {}

// Safety: unclear
unsafe impl Send for Signpost {}

Expand Down
1 change: 0 additions & 1 deletion crates/turbo-tasks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ regex = { workspace = true }
serde = { workspace = true, features = ["rc", "derive"] }
serde_json = { workspace = true }
serde_regex = "1.1.0"
stable_deref_trait = "1.2.0"
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions crates/turbo-tasks/src/task/concrete_task_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ impl PartialEq for SharedReference {
// only compares their addresses.
#[allow(ambiguous_wide_pointer_comparisons)]
fn eq(&self, other: &Self) -> bool {
PartialEq::eq(
&(&*self.1 as *const (dyn Any + Send + Sync)),
&(&*other.1 as *const (dyn Any + Send + Sync)),
std::ptr::addr_eq(
&*self.1 as *const (dyn Any + Send + Sync),
&*other.1 as *const (dyn Any + Send + Sync),
)
}
}
Expand Down
6 changes: 0 additions & 6 deletions crates/turbopack-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ anyhow = { workspace = true, features = ["backtrace"] }
chromiumoxide = { workspace = true, features = [
"tokio-runtime",
], default-features = false }
clap = { workspace = true, features = ["derive", "env"], optional = true }
console-subscriber = { workspace = true, optional = true }
criterion = { workspace = true, features = ["async_tokio"] }
dunce = { workspace = true }
futures = { workspace = true }
mime = { workspace = true }
once_cell = { workspace = true }
owo-colors = { workspace = true }
parking_lot = { workspace = true }
portpicker = "0.1.1"
rand = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true, features = ["full"] }
Expand All @@ -42,7 +37,6 @@ turbo-tasks = { workspace = true }
turbo-tasks-testing = { workspace = true }
turbopack-create-test-app = { workspace = true }
url = { workspace = true }
webbrowser = { workspace = true }

[target.'cfg(unix)'.dependencies]
nix = "0.26.1"
4 changes: 0 additions & 4 deletions crates/turbopack-browser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@ urlencoding = { workspace = true }
turbo-tasks = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbo-tasks-hash = { workspace = true }
turbopack = { workspace = true }
turbopack-core = { workspace = true }
turbopack-css = { workspace = true }
turbopack-ecmascript = { workspace = true }
turbopack-ecmascript-runtime = { workspace = true }
turbopack-resolve = { workspace = true }

swc_core = { workspace = true }

[build-dependencies]
turbo-tasks-build = { workspace = true }
2 changes: 0 additions & 2 deletions crates/turbopack-cli-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ workspace = true
anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }
crossterm = "0.26.0"
once_cell = { workspace = true }
owo-colors = { workspace = true }
serde = { workspace = true, features = ["derive"] }
turbo-tasks = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbopack-core = { workspace = true }
turbopack-ecmascript = { workspace = true }
turbopack-resolve = { workspace = true }

[build-dependencies]
Expand Down
5 changes: 1 addition & 4 deletions crates/turbopack-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,12 @@ workspace = true
anyhow = { workspace = true, features = ["backtrace"] }
clap = { workspace = true, features = ["derive", "env"] }
console-subscriber = { workspace = true, optional = true }
criterion = { workspace = true, features = ["async_tokio"] }
dunce = { workspace = true }
futures = { workspace = true }
mime = { workspace = true }
once_cell = { workspace = true }
owo-colors = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
turbo-tasks = { workspace = true }
turbo-tasks-env = { workspace = true }
Expand All @@ -76,6 +72,7 @@ turbopack-trace-utils = { workspace = true }
webbrowser = { workspace = true }

[dev-dependencies]
criterion = { workspace = true, features = ["async_tokio"] }
regex = { workspace = true }
turbopack-bench = { workspace = true }

Expand Down
2 changes: 0 additions & 2 deletions crates/turbopack-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ indexmap = { workspace = true }
lazy_static = { workspace = true }
once_cell = { workspace = true }
patricia_tree = "0.5.5"
qstring = { workspace = true }
ref-cast = "1.0.20"
regex = { workspace = true }
serde = { workspace = true, features = ["rc"] }
serde_json = { workspace = true, features = ["preserve_order"] }
serde_qs = { workspace = true }
sourcemap = { workspace = true }
swc_core = { workspace = true, features = ["ecma_preset_env", "common"] }
tracing = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/turbopack-core/src/resolve/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl Pattern {
static ref FORBIDDEN: Regex =
Regex::new(r"(/|^)(ROOT|\.|/|(node_modules|__tests?__)(/|$))").unwrap();
static ref FORBIDDEN_MATCH: Regex = Regex::new(r"\.d\.ts$|\.map$").unwrap();
};
}
if let Some(m) = FORBIDDEN.find(value) {
MatchResult::Consumed {
remaining: value,
Expand Down Expand Up @@ -569,7 +569,7 @@ impl Pattern {
static ref FORBIDDEN: Regex =
Regex::new(r"(/|^)(\.|(node_modules|__tests?__)(/|$))").unwrap();
static ref FORBIDDEN_MATCH: Regex = Regex::new(r"\.d\.ts$|\.map$").unwrap();
};
}
if let Some(m) = FORBIDDEN.find(value) {
NextConstantUntilResult::Consumed(value, Some(m.start()))
} else if FORBIDDEN_MATCH.find(value).is_some() {
Expand Down
1 change: 0 additions & 1 deletion crates/turbopack-css/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ workspace = true

[dependencies]
anyhow = { workspace = true }
async-trait = { workspace = true }
indexmap = { workspace = true }
indoc = { workspace = true }
lightningcss = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion crates/turbopack-dev-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ hyper-tungstenite = "0.9.0"
indexmap = { workspace = true, features = ["serde"] }
mime = { workspace = true }
mime_guess = "2.0.4"
once_cell = { workspace = true }
parking_lot = { workspace = true }
pin-project-lite = { workspace = true }
serde = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion crates/turbopack-ecmascript-plugins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ anyhow = { workspace = true }
async-trait = { workspace = true }
indexmap = { workspace = true }
lightningcss = { workspace = true }
parcel_selectors = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }

Expand Down
2 changes: 0 additions & 2 deletions crates/turbopack-ecmascript-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,5 @@ turbopack = { workspace = true }
turbopack-core = { workspace = true }
turbopack-ecmascript = { workspace = true }

swc_core = { workspace = true }

[build-dependencies]
turbo-tasks-build = { workspace = true }
3 changes: 0 additions & 3 deletions crates/turbopack-ecmascript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ workspace = true
anyhow = { workspace = true }
async-trait = { workspace = true }
either = { workspace = true }
futures = { workspace = true }
indexmap = { workspace = true }
indoc = { workspace = true }
lazy_static = { workspace = true }
Expand All @@ -25,12 +24,10 @@ num-traits = "0.2.15"
once_cell = { workspace = true }
parking_lot = { workspace = true }
petgraph = { workspace = true }
pin-project-lite = { workspace = true }
regex = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_qs = { workspace = true }
sourcemap = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
Expand Down
6 changes: 2 additions & 4 deletions crates/turbopack-ecmascript/src/tree_shake/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,8 @@ impl DepGraph {
_ => {}
},
ModuleDecl::ExportNamed(NamedExport {
src: None,
specifiers,
..
}) => {
src, specifiers, ..
}) if src.is_none() => {
// We are not interested in re-exports.
for s in specifiers {
match s {
Expand Down
1 change: 0 additions & 1 deletion crates/turbopack-image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ image = { workspace = true, default-features = false, features = [
"bmp",
"tga",
] }
indexmap = { workspace = true }
mime = { workspace = true }
once_cell = { workspace = true }
regex = { workspace = true }
Expand Down
5 changes: 1 addition & 4 deletions crates/turbopack-image/src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ impl BlurPlaceholder {
#[serde_as]
#[turbo_tasks::value]
#[derive(Default)]
#[non_exhaustive]
pub struct ImageMetaData {
pub width: u32,
pub height: u32,
#[turbo_tasks(trace_ignore, debug_ignore)]
#[serde_as(as = "Option<DisplayFromStr>")]
pub mime_type: Option<Mime>,
pub blur_placeholder: Option<BlurPlaceholder>,
placeholder_for_future_extensions: (),
}

impl ImageMetaData {
Expand All @@ -69,7 +69,6 @@ impl ImageMetaData {
height: 100,
mime_type,
blur_placeholder: Some(BlurPlaceholder::fallback()),
placeholder_for_future_extensions: (),
}
}
}
Expand Down Expand Up @@ -369,7 +368,6 @@ pub async fn get_meta_data(
height,
mime_type: Some(mime::IMAGE_SVG),
blur_placeholder: None,
placeholder_for_future_extensions: (),
}
.cell());
}
Expand Down Expand Up @@ -407,7 +405,6 @@ pub async fn get_meta_data(
None
},
blur_placeholder,
placeholder_for_future_extensions: (),
}
.cell())
}
Expand Down
7 changes: 3 additions & 4 deletions crates/turbopack-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ workspace = true
anyhow = { workspace = true }
async-stream = "0.3.4"
async-trait = { workspace = true }
bytes = { workspace = true }
const_format = "0.2.30"
futures = { workspace = true }
futures-retry = { workspace = true }
Expand All @@ -33,7 +32,7 @@ parking_lot = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_qs = { workspace = true }
#serde_qs = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
turbo-tasks = { workspace = true }
Expand All @@ -45,8 +44,8 @@ turbopack-core = { workspace = true }
turbopack-dev-server = { workspace = true }
turbopack-ecmascript = { workspace = true }
turbopack-resolve = { workspace = true }
url = { workspace = true }
urlencoding = { workspace = true }
#url = { workspace = true }
#urlencoding = { workspace = true }

[build-dependencies]
turbo-tasks-build = { workspace = true }
4 changes: 0 additions & 4 deletions crates/turbopack-nodejs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,13 @@ anyhow = { workspace = true }
indexmap = { workspace = true }
indoc = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_qs = { workspace = true }
sourcemap = { workspace = true }
tracing = { workspace = true }
urlencoding = { workspace = true }

turbo-tasks = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbo-tasks-hash = { workspace = true }
turbopack-core = { workspace = true }
turbopack-css = { workspace = true }
turbopack-ecmascript = { workspace = true }
turbopack-ecmascript-runtime = { workspace = true }

Expand Down
4 changes: 0 additions & 4 deletions crates/turbopack-resolve/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@ workspace = true

[dependencies]
anyhow = { workspace = true }
async-recursion = { workspace = true }
futures = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
lazy_static = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
turbo-tasks = { workspace = true }
turbo-tasks-env = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbopack-core = { workspace = true }

Expand Down
Loading

0 comments on commit 80847fb

Please sign in to comment.