Skip to content

Commit

Permalink
chore: Bump nightly version (#7874)
Browse files Browse the repository at this point in the history
### Description

We need to bump the Rust version to use the latest biome crates.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes TURBO-2739

---------

Co-authored-by: Will Binns-Smith <[email protected]>
  • Loading branch information
NicholasLYang and wbinnssmith authored Apr 4, 2024
1 parent 0bbb466 commit 583bb09
Show file tree
Hide file tree
Showing 55 changed files with 138 additions and 139 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,15 @@ jobs:
uses: ./.github/actions/setup-rust
with:
components: clippy
targets: wasm32-unknown-unknown,wasm32-wasi-preview1-threads
targets: wasm32-unknown-unknown,wasm32-wasip1-threads

- name: Run cargo check release
run: |
RUSTFLAGS="-D warnings -A deprecated" cargo groups check turbopack --features rustls-tls --release
- name: Run cargo check for the wasi targets
run: |
CARGO_BUILD_TARGET="wasm32-wasi-preview1-threads" RUSTFLAGS="-D warnings -A deprecated" cargo groups check turbopack-wasi --release
CARGO_BUILD_TARGET="wasm32-wasip1-threads" RUSTFLAGS="-D warnings -A deprecated" cargo groups check turbopack-wasi --release
turbopack_rust_clippy:
needs: [turbopack_rust_check]
Expand Down
27 changes: 13 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ swc_core = { version = "0.90.24", features = [
swc_emotion = { version = "0.72.6" }
swc_relay = { version = "0.44.5" }
testing = { version = "0.35.21" }
# Temporary: Reference the latest git minor version of pathfinder_simd until it's published.
pathfinder_simd = "0.5.3"

auto-hash-map = { path = "crates/turbo-tasks-auto-hash-map" }
node-file-trace = { path = "crates/node-file-trace", default-features = false }
Expand Down Expand Up @@ -292,3 +294,6 @@ urlencoding = "2.1.2"
webbrowser = "0.8.7"
which = "4.4.0"
unicode-segmentation = "1.10.1"

[patch.crates-io]
pathfinder_simd = { git = "https://github.com/servo/pathfinder", rev = "30419d" }
14 changes: 7 additions & 7 deletions crates/turbo-tasks-fs/src/attach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ impl AttachedFileSystem {
let self_fs: Vc<Box<dyn FileSystem>> = Vc::upcast(self);

if path.fs != self_fs {
let self_fs_str = self_fs.to_string().await?;
let path_fs_str = path.fs.to_string().await?;
bail!(
"path fs does not match (expected {}, got {})",
self_fs.to_string().await?,
path.fs.to_string().await?
self_fs_str,
path_fs_str
)
}

Expand Down Expand Up @@ -184,10 +186,8 @@ impl FileSystem for AttachedFileSystem {
impl ValueToString for AttachedFileSystem {
#[turbo_tasks::function]
async fn to_string(&self) -> Result<Vc<String>> {
Ok(Vc::cell(format!(
"{}-with-{}",
self.root_fs.to_string().await?,
self.child_fs.to_string().await?
)))
let root_fs_str = self.root_fs.to_string().await?;
let child_fs_str = self.child_fs.to_string().await?;
Ok(Vc::cell(format!("{}-with-{}", root_fs_str, child_fs_str)))
}
}
4 changes: 1 addition & 3 deletions crates/turbo-tasks-fs/src/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,7 @@ impl<'a> Iterator for GlobPartMatchesIterator<'a> {
return None;
};
let mut chars_in_path = self.path[start..end].chars();
let Some(c) = chars_in_path.next() else {
return None;
};
let c = chars_in_path.next()?;
if chars_in_path.next().is_some() {
return None;
}
Expand Down
8 changes: 3 additions & 5 deletions crates/turbo-tasks-fs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ impl DiskFileSystem {
}

struct PathLockGuard<'a>(
RwLockReadGuard<'a, ()>,
mutex_map::MutexMapGuard<'a, PathBuf>,
#[allow(dead_code)] RwLockReadGuard<'a, ()>,
#[allow(dead_code)] mutex_map::MutexMapGuard<'a, PathBuf>,
);

fn format_absolute_fs_path(path: &Path, name: &str, root_path: &Path) -> Option<String> {
Expand Down Expand Up @@ -1939,9 +1939,7 @@ pub fn register() {

#[cfg(test)]
mod tests {
use turbo_tasks::Vc;

use super::{virtual_fs::VirtualFileSystem, *};
use super::*;

#[tokio::test]
async fn with_extension() {
Expand Down
2 changes: 1 addition & 1 deletion crates/turbo-tasks-fs/src/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ where
let mut attempt = 1;

loop {
return match { func(&path) } {
return match func(&path) {
Ok(r) => Ok(r),
Err(err) => {
if attempt < MAX_RETRY_ATTEMPTS && can_retry(&err) {
Expand Down
4 changes: 2 additions & 2 deletions crates/turbo-tasks-macros-shared/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub fn expand_fields<
/// Returns both the capture pattern token stream and the name of the bound
/// identifiers corresponding to the input fields.
pub fn generate_destructuring<'a, I: Fn(&Field) -> bool>(
fields: impl Iterator<Item = &'a Field> + ExactSizeIterator,
fields: impl ExactSizeIterator<Item = &'a Field>,
filter_field: &I,
) -> (TokenStream, Vec<TokenStream>) {
let fields_len = fields.len();
Expand Down Expand Up @@ -153,7 +153,7 @@ pub fn generate_destructuring<'a, I: Fn(&Field) -> bool>(
/// Returns both the capture pattern token stream and the name of the bound
/// identifiers corresponding to the input fields.
pub fn generate_exhaustive_destructuring<'a>(
fields: impl Iterator<Item = &'a Field> + ExactSizeIterator,
fields: impl ExactSizeIterator<Item = &'a Field>,
) -> (TokenStream, Vec<TokenStream>) {
generate_destructuring(fields, &|_| true)
}
8 changes: 6 additions & 2 deletions crates/turbo-tasks-macros-tests/tests/value_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ register!();
async fn ignored_indexes() {
#[derive(ValueDebugFormat)]
struct IgnoredIndexes(
#[turbo_tasks(debug_ignore)] i32,
#[allow(dead_code)]
#[turbo_tasks(debug_ignore)]
i32,
i32,
#[allow(dead_code)]
#[turbo_tasks(debug_ignore)]
i32,
#[turbo_tasks(debug_ignore)] i32,
);

run! {
Expand Down
4 changes: 2 additions & 2 deletions crates/turbo-tasks-memory/src/memory_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ impl MemoryBackend {
result_task
}

fn lookup_and_connect_task<K: Hash + Eq, Q, H: BuildHasher + Clone>(
fn lookup_and_connect_task<K, Q, H: BuildHasher + Clone>(
&self,
parent_task: TaskId,
task_cache: &DashMap<K, TaskId, H>,
key: &Q,
turbo_tasks: &dyn TurboTasksBackendApi<MemoryBackend>,
) -> Option<TaskId>
where
K: Borrow<Q>,
K: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + ?Sized,
{
task_cache.get(key).map(|task| {
Expand Down
6 changes: 3 additions & 3 deletions crates/turbo-tasks-memory/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl Debug for Task {
TaskMetaStateReadGuard::Partial(_) => {
result.field("state", &"partial");
}
TaskMetaStateReadGuard::Unloaded(_) => {
TaskMetaStateReadGuard::Unloaded => {
result.field("state", &"unloaded");
}
}
Expand Down Expand Up @@ -1416,7 +1416,7 @@ impl Task {
executions: None,
unloaded: true,
},
TaskMetaStateReadGuard::Unloaded(_) => TaskStatsInfo {
TaskMetaStateReadGuard::Unloaded => TaskStatsInfo {
total_duration: None,
last_duration: Duration::ZERO,
executions: None,
Expand Down Expand Up @@ -1547,7 +1547,7 @@ impl Task {
TaskMetaStateReadGuard::Partial(state) => state
.aggregation_leaf
.get_root_info(&aggregation_context, &RootInfoType::IsActive),
TaskMetaStateReadGuard::Unloaded(_) => false,
TaskMetaStateReadGuard::Unloaded => false,
};
if active {
child.schedule_when_dirty_from_aggregation(backend, turbo_tasks);
Expand Down
22 changes: 10 additions & 12 deletions crates/turbo-tasks-memory/src/task/meta_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ impl TaskMetaState {
}
}

// These need to be impl types since there is no way to reference the zero-sized
// function item type
pub(super) type TaskMetaStateAsFull = impl Fn(&TaskMetaState) -> Option<&TaskState>;
pub(super) type TaskMetaStateAsPartial = impl Fn(&TaskMetaState) -> Option<&PartialTaskState>;
pub(super) type TaskMetaStateAsUnloaded = impl Fn(&TaskMetaState) -> Option<&UnloadedTaskState>;
pub(super) type TaskMetaStateAsFullMut = impl Fn(&mut TaskMetaState) -> Option<&mut TaskState>;
pub(super) type TaskMetaStateAsFull = for<'a> fn(&'a TaskMetaState) -> Option<&'a TaskState>;
pub(super) type TaskMetaStateAsPartial = for<'a> fn(&'a TaskMetaState) -> Option<&PartialTaskState>;
pub(super) type TaskMetaStateAsUnloaded =
for<'a> fn(&'a TaskMetaState) -> Option<&'a UnloadedTaskState>;
pub(super) type TaskMetaStateAsFullMut =
for<'a> fn(&'a mut TaskMetaState) -> Option<&'a mut TaskState>;
pub(super) type TaskMetaStateAsPartialMut =
impl Fn(&mut TaskMetaState) -> Option<&mut PartialTaskState>;
for<'a> fn(&'a mut TaskMetaState) -> Option<&'a mut PartialTaskState>;
pub(super) type TaskMetaStateAsUnloadedMut =
impl Fn(&mut TaskMetaState) -> Option<&mut UnloadedTaskState>;
for<'a> fn(&'a mut TaskMetaState) -> Option<&'a mut UnloadedTaskState>;

pub(super) enum TaskMetaStateReadGuard<'a> {
Full(ReadGuard<'a, TaskMetaState, TaskState, TaskMetaStateAsFull>),
Partial(ReadGuard<'a, TaskMetaState, PartialTaskState, TaskMetaStateAsPartial>),
Unloaded(ReadGuard<'a, TaskMetaState, UnloadedTaskState, TaskMetaStateAsUnloaded>),
Unloaded,
}

pub(super) type FullTaskWriteGuard<'a> =
Expand Down Expand Up @@ -128,9 +128,7 @@ impl<'a> From<RwLockReadGuard<'a, TaskMetaState>> for TaskMetaStateReadGuard<'a>
TaskMetaState::Partial(_) => {
TaskMetaStateReadGuard::Partial(ReadGuard::new(guard, TaskMetaState::as_partial))
}
TaskMetaState::Unloaded(_) => {
TaskMetaStateReadGuard::Unloaded(ReadGuard::new(guard, TaskMetaState::as_unloaded))
}
TaskMetaState::Unloaded(_) => TaskMetaStateReadGuard::Unloaded,
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/turbo-tasks-signposter/src/log.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
ffi::{CStr, CString},
ptr::null,
ptr::{addr_of, null},
};

use signposter_sys::*;
Expand Down Expand Up @@ -48,7 +48,7 @@ unsafe impl Send for Log {}
impl Default for Log {
fn default() -> Self {
Log {
os_log: unsafe { &_os_log_default as *const _ as *mut _ },
os_log: unsafe { addr_of!(_os_log_default) as *const _ as *mut _ },
}
}
}
Expand Down Expand Up @@ -148,7 +148,7 @@ impl Signpost {
fn emit(&self, name: &CStr, message: Option<&CStr>, signpost_type: SignpostType) {
unsafe {
_os_signpost_emit_with_name_impl(
&__dso_handle as *const _ as *mut _,
addr_of!(__dso_handle) as *const _ as *mut _,
self.log,
signpost_type as _,
self.id,
Expand Down
8 changes: 4 additions & 4 deletions crates/turbo-tasks/src/magic_any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ pub struct MagicAnyDeserializeSeed {
}

impl MagicAnyDeserializeSeed {
pub fn new<T: Debug + Eq + Ord + Hash + Send + Sync + 'static>() -> Self
pub fn new<T>() -> Self
where
T: for<'de> Deserialize<'de>,
T: for<'de> Deserialize<'de> + Debug + Eq + Ord + Hash + Send + Sync + 'static,
{
fn deserialize<
T: Debug + Eq + Ord + Hash + for<'de> Deserialize<'de> + Send + Sync + 'static,
Expand Down Expand Up @@ -189,9 +189,9 @@ pub struct AnyDeserializeSeed {
}

impl AnyDeserializeSeed {
pub fn new<T: Any + Send + Sync + 'static>() -> Self
pub fn new<T>() -> Self
where
T: for<'de> Deserialize<'de>,
T: for<'de> Deserialize<'de> + Any + Send + Sync + 'static,
{
fn deserialize<T: Any + for<'de> Deserialize<'de> + Send + Sync + 'static>(
deserializer: &mut dyn erased_serde::Deserializer<'_>,
Expand Down
3 changes: 2 additions & 1 deletion crates/turbo-tasks/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ impl TaskIdProvider for &dyn TaskIdProvider {
}
}

#[allow(clippy::manual_non_exhaustive)]
pub struct UpdateInfo {
pub duration: Duration,
pub tasks: usize,
Expand Down Expand Up @@ -460,7 +461,7 @@ impl<B: Backend + 'static> TurboTasks<B> {

let this = self.pin();
let future = async move {
#[allow(clippy::blocks_in_if_conditions)]
#[allow(clippy::blocks_in_conditions)]
while CURRENT_TASK_STATE
.scope(Default::default(), async {
if this.stopped.load(Ordering::Acquire) {
Expand Down
7 changes: 5 additions & 2 deletions crates/turbo-tasks/src/task/concrete_task_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ impl Hash for SharedReference {
}
}
impl PartialEq for SharedReference {
// Must compare with PartialEq rather than std::ptr::addr_eq since the latter
// 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)),
Expand All @@ -53,8 +56,8 @@ impl PartialOrd for SharedReference {
impl Ord for SharedReference {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
Ord::cmp(
&(&*self.1 as *const (dyn Any + Send + Sync)),
&(&*other.1 as *const (dyn Any + Send + Sync)),
&(&*self.1 as *const (dyn Any + Send + Sync)).cast::<()>(),
&(&*other.1 as *const (dyn Any + Send + Sync)).cast::<()>(),
)
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/turbo-tasks/src/task/task_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ tuple_impls! { A B C D E F G H I J K L }

#[cfg(test)]
mod tests {
use anyhow::Result;
use turbo_tasks_macros::TaskInput;

use super::*;
Expand Down
Loading

0 comments on commit 583bb09

Please sign in to comment.