Skip to content

Commit

Permalink
Update Rust toolchain to nightly-2024-10-04
Browse files Browse the repository at this point in the history
This:

- Updates the toolchain file
- Adds `#![feature(arbitrary_self_types_pointers)]` as necessary
- Removes opt-ins for now-stable features like `option_get_or_insert_default`
- Removes now-detectable dead code
  • Loading branch information
wbinnssmith committed Oct 7, 2024
1 parent 8a513eb commit 94a408c
Show file tree
Hide file tree
Showing 183 changed files with 402 additions and 248 deletions.
22 changes: 16 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ serde_path_to_error = "0.1.9"
serde_qs = "0.11.0"
serde_with = "2.3.2"
serde_yaml = "0.9.17"
shadow-rs = { version = "0.23.0", default-features = false, features = [
shadow-rs = { version = "0.35.0", default-features = false, features = [
"tzdb",
] }
smallvec = { version = "1.13.1", features = [
Expand Down
1 change: 1 addition & 0 deletions crates/napi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ DEALINGS IN THE SOFTWARE.
#![recursion_limit = "2048"]
//#![deny(clippy::all)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]

#[macro_use]
extern crate napi_derive;
Expand Down
1 change: 1 addition & 0 deletions crates/napi/src/next_api/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ impl From<UpdateInfo> for NapiUpdateInfo {
}

/// Subscribes to lifecycle events of the compilation.

Check warning on line 933 in crates/napi/src/next_api/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_update_info_subscribe` links to private item `UpdateMessage::Start`

Check warning on line 933 in crates/napi/src/next_api/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_update_info_subscribe` links to private item `UpdateMessage::End`

Check warning on line 933 in crates/napi/src/next_api/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_update_info_subscribe` links to private item `UpdateMessage::End`

Check warning on line 933 in crates/napi/src/next_api/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_update_info_subscribe` links to private item `UpdateMessage::Start`
///
/// Emits an [UpdateMessage::Start] event when any computation starts.
/// Emits an [UpdateMessage::End] event when there was no computation for the
/// specified time (`aggregation_ms`). The [UpdateMessage::End] event contains
Expand Down
1 change: 1 addition & 0 deletions crates/next-api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(future_join)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![feature(impl_trait_in_assoc_type)]

mod app;
Expand Down
1 change: 1 addition & 0 deletions crates/next-build-test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![feature(future_join)]
#![feature(min_specialization)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]

use std::{str::FromStr, time::Instant};

Expand Down
1 change: 1 addition & 0 deletions crates/next-build/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(type_alias_impl_trait)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]

pub mod build_options;

Expand Down
1 change: 1 addition & 0 deletions crates/next-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![feature(str_split_remainder)]
#![feature(impl_trait_in_assoc_type)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![feature(iter_intersperse)]

mod app_page_loader_tree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use turbopack_core::{
};
use turbopack_ecmascript::chunk::EcmascriptChunkPlaceable;

/// An [EcmascriptClientReferenceModule] is a marker module, used by the
/// A marker module used by the
/// [super::ecmascript_client_reference_proxy_module::EcmascriptClientReferenceProxyModule] to
/// indicate which client reference should appear in the client reference manifest.
#[turbo_tasks::value]
Expand Down
4 changes: 3 additions & 1 deletion crates/next-core/src/next_dynamic/dynamic_transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use turbopack_core::{context::ProcessResult, reference_type::ReferenceType, sour
use super::NextDynamicEntryModule;

/// This transition is used to create the marker asset for a next/dynamic
/// import. This will get picked up during module processing and will be used to
/// import.
///
/// This will get picked up during module processing and will be used to
/// create the dynamic entry, and the dynamic manifest entry.
#[turbo_tasks::value]
pub struct NextDynamicTransition {
Expand Down
9 changes: 5 additions & 4 deletions crates/next-core/src/next_edge/route_regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ fn get_named_parametrized_route(

/// This function extends `getRouteRegex` generating also a named regexp where
/// each group is named along with a routeKeys object that indexes the assigned
/// named group with its corresponding key. When the routeKeys need to be
/// prefixed to uniquely identify internally the "prefixRouteKey" arg should
/// be "true" currently this is only the case when creating the routes-manifest
/// during the build
/// named group with its corresponding key.
///
/// When the routeKeys need to be prefixed to uniquely identify internally the
/// "prefixRouteKey" arg should be "true" currently this is only the case when
/// creating the routes-manifest during the build
pub fn get_named_route_regex(normalized_route: &str) -> NamedRouteRegex {
let (parameterized_route, route_keys) = get_named_parametrized_route(normalized_route, false);
let regex = get_route_regex(normalized_route);
Expand Down
5 changes: 4 additions & 1 deletion crates/next-core/src/next_telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use turbo_tasks::{RcStr, Vc};
use turbopack_core::diagnostics::{Diagnostic, DiagnosticPayload};

/// A structure that keeps track of whether a particular Next.js feature is
/// enabled for the telemetry. The original implementation code can be found at the following [link](https://github.com/vercel/next.js/blob/9da305fe320b89ee2f8c3cfb7ecbf48856368913/packages/next/src/build/webpack-config.ts#L2516).
/// enabled for the telemetry.
///
/// The original implementation code can be found
/// [here](https://github.com/vercel/next.js/blob/9da305fe320b89ee2f8c3cfb7ecbf48856368913/packages/next/src/build/webpack-config.ts#L2516).
#[turbo_tasks::value(shared)]
pub struct NextFeatureTelemetry {
pub event_name: RcStr,
Expand Down
1 change: 1 addition & 0 deletions crates/next-custom-transforms/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ DEALINGS IN THE SOFTWARE.
#![deny(clippy::all)]
#![feature(box_patterns)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]

pub mod chain_transforms;
pub mod transforms;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct FindFunctionsOutsideModuleScope<'a> {
pub state: &'a super::State,
}

impl<'a> Visit for FindFunctionsOutsideModuleScope<'a> {
impl Visit for FindFunctionsOutsideModuleScope<'_> {
noop_visit_type!();

fn visit_ident(&mut self, ident: &Ident) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct FontFunctionsCollector<'a> {
pub state: &'a mut super::State,
}

impl<'a> Visit for FontFunctionsCollector<'a> {
impl Visit for FontFunctionsCollector<'_> {
noop_visit_type!();

fn visit_import_decl(&mut self, import_decl: &ImportDecl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct FontImportsGenerator<'a> {
pub relative_path: &'a str,
}

impl<'a> FontImportsGenerator<'a> {
impl FontImportsGenerator<'_> {
fn check_call_expr(
&mut self,
call_expr: &CallExpr,
Expand Down Expand Up @@ -145,7 +145,7 @@ impl<'a> FontImportsGenerator<'a> {
}
}

impl<'a> Visit for FontImportsGenerator<'a> {
impl Visit for FontImportsGenerator<'_> {
noop_visit_type!();

fn visit_module_item(&mut self, item: &ModuleItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,6 @@ impl ReactServerComponentValidator {
/// dynamic(() => import(...), { ssr: true }) // ✅
/// dynamic(() => import(...), { ssr: false }) // ❌
/// ```

fn check_for_next_ssr_false(&self, node: &CallExpr) -> Option<()> {
if !self.is_callee_next_dynamic(&node.callee) {
return None;
Expand Down Expand Up @@ -934,8 +933,10 @@ impl Visit for ReactServerComponentValidator {

/// Returns a visitor to assert react server components without any transform.
/// This is for the Turbopack which have its own transform phase for the server
/// components proxy. Also this returns a visitor instead of fold, performs
/// better than running whole transform as a folder.
/// components proxy.
///
/// This also returns a visitor instead of fold and performs better than running
/// whole transform as a folder.
pub fn server_components_assert(
filename: FileName,
config: Config,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-08-01"
channel = "nightly-2024-10-04"
components = ["rustfmt", "clippy", "rust-analyzer"]
profile = "minimal"
1 change: 1 addition & 0 deletions turbopack/crates/node-file-trace/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(min_specialization)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]

mod nft_json;

Expand Down
2 changes: 2 additions & 0 deletions turbopack/crates/node-file-trace/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(min_specialization)]
#![allow(clippy::needless_return)] // clippy bug causes false positive

use std::sync::Arc;

Expand Down Expand Up @@ -26,5 +27,6 @@ async fn main() -> Result<()> {
println!("{}", file);
}
}

Ok(())
}
2 changes: 1 addition & 1 deletion turbopack/crates/turbo-static/src/call_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct CallResolver<'a> {
}

/// On drop, serialize the state to disk
impl<'a> Drop for CallResolver<'a> {
impl Drop for CallResolver<'_> {
fn drop(&mut self) {
let file = OpenOptions::new()
.create(true)
Expand Down
2 changes: 0 additions & 2 deletions turbopack/crates/turbo-static/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(entry_insert)]

use std::{
collections::{HashMap, HashSet},
error::Error,
Expand Down
8 changes: 3 additions & 5 deletions turbopack/crates/turbo-tasks-auto-hash-map/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
}
}

impl<'a, K, V> Clone for Iter<'a, K, V> {
impl<K, V> Clone for Iter<'_, K, V> {
fn clone(&self) -> Self {
match self {
Iter::List(iter) => Iter::List(iter.clone()),
Expand Down Expand Up @@ -590,7 +590,7 @@ impl<'a, K: Eq + Hash, V, H: BuildHasher, const I: usize> OccupiedEntry<'a, K, V
}
}

impl<'a, K: Eq + Hash, V, H: BuildHasher + Default, const I: usize> OccupiedEntry<'a, K, V, H, I> {
impl<K: Eq + Hash, V, H: BuildHasher + Default, const I: usize> OccupiedEntry<'_, K, V, H, I> {
/// see [HashMap::OccupiedEntry::remove](https://doc.rust-lang.org/std/collections/hash_map/enum.OccupiedEntry.html#method.remove)
pub fn remove(self) -> V {
match self {
Expand Down Expand Up @@ -663,9 +663,7 @@ impl<'a, K: Eq + Hash, V, H: BuildHasher, const I: usize> OccupiedRawEntry<'a, K
}
}

impl<'a, K: Eq + Hash, V, H: BuildHasher + Default, const I: usize>
OccupiedRawEntry<'a, K, V, H, I>
{
impl<K: Eq + Hash, V, H: BuildHasher + Default, const I: usize> OccupiedRawEntry<'_, K, V, H, I> {
/// see [HashMap::OccupiedEntry::remove](https://doc.rust-lang.org/std/collections/hash_map/enum.OccupiedEntry.html#method.remove)
pub fn remove(self) -> V {
match self {
Expand Down
2 changes: 1 addition & 1 deletion turbopack/crates/turbo-tasks-auto-hash-map/src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<'a, K> Iterator for Iter<'a, K> {
}
}

impl<'a, K> Clone for Iter<'a, K> {
impl<K> Clone for Iter<'_, K> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
Expand Down
2 changes: 1 addition & 1 deletion turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub(crate) struct OperationGuard<'a> {
backend: &'a TurboTasksBackend,
}

impl<'a> Drop for OperationGuard<'a> {
impl Drop for OperationGuard<'_> {
fn drop(&mut self) {
let fetch_sub = self
.backend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub struct TaskGuard<'a> {
backend: &'a TurboTasksBackend,
}

impl<'a> Debug for TaskGuard<'a> {
impl Debug for TaskGuard<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut d = f.debug_struct("TaskGuard");
d.field("task_id", &self.task_id);
Expand All @@ -149,7 +149,7 @@ impl<'a> Debug for TaskGuard<'a> {
}
}

impl<'a> TaskGuard<'a> {
impl TaskGuard<'_> {
pub fn id(&self) -> TaskId {
self.task_id
}
Expand Down
4 changes: 2 additions & 2 deletions turbopack/crates/turbo-tasks-backend/src/backend/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ where
inner: RefMut<'a, K, InnerStorage<T>, BuildHasherDefault<FxHasher>>,
}

impl<'a, K, T> Deref for StorageWriteGuard<'a, K, T>
impl<K, T> Deref for StorageWriteGuard<'_, K, T>
where
T: KeyValuePair,
T::Key: Indexed,
Expand All @@ -242,7 +242,7 @@ where
}
}

impl<'a, K, T> DerefMut for StorageWriteGuard<'a, K, T>
impl<K, T> DerefMut for StorageWriteGuard<'_, K, T>
where
T: KeyValuePair,
T::Key: Indexed,
Expand Down
4 changes: 4 additions & 0 deletions turbopack/crates/turbo-tasks-backend/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// TODO: Remove when persistent cache stack is fully landed
// https://linear.app/vercel/issue/PACK-3289
#![allow(dead_code)]

mod backend;
mod data;
mod utils;
Expand Down
14 changes: 5 additions & 9 deletions turbopack/crates/turbo-tasks-backend/src/utils/dash_map_multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ where
},
}

unsafe impl<'a, K: Eq + Hash + Sync, V: Sync, S: BuildHasher> Send for RefMut<'a, K, V, S> {}
unsafe impl<'a, K: Eq + Hash + Sync, V: Sync, S: BuildHasher> Sync for RefMut<'a, K, V, S> {}

impl<'a, K: Eq + Hash, V, S: BuildHasher> RefMut<'a, K, V, S> {
pub fn key(&self) -> &K {
self.pair().0
}
unsafe impl<K: Eq + Hash + Sync, V: Sync, S: BuildHasher> Send for RefMut<'_, K, V, S> {}
unsafe impl<K: Eq + Hash + Sync, V: Sync, S: BuildHasher> Sync for RefMut<'_, K, V, S> {}

impl<K: Eq + Hash, V, S: BuildHasher> RefMut<'_, K, V, S> {
pub fn value(&self) -> &V {
self.pair().1
}
Expand All @@ -57,15 +53,15 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> RefMut<'a, K, V, S> {
}
}

impl<'a, K: Eq + Hash, V, S: BuildHasher> Deref for RefMut<'a, K, V, S> {
impl<K: Eq + Hash, V, S: BuildHasher> Deref for RefMut<'_, K, V, S> {
type Target = V;

fn deref(&self) -> &V {
self.value()
}
}

impl<'a, K: Eq + Hash, V, S: BuildHasher> DerefMut for RefMut<'a, K, V, S> {
impl<K: Eq + Hash, V, S: BuildHasher> DerefMut for RefMut<'_, K, V, S> {
fn deref_mut(&mut self) -> &mut V {
self.value_mut()
}
Expand Down
Loading

0 comments on commit 94a408c

Please sign in to comment.