Unverified Commit 189f2da2 authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

Update Rust toolchain to nightly-2024-10-04 (#70803)

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
parent 4c3d1926
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "Inflector"
......@@ -6077,9 +6077,9 @@ dependencies = [
[[package]]
name = "shadow-rs"
version = "0.23.0"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "970538704756fd0bb4ec8cb89f80674afb661e7c0fe716f9ba5be57717742300"
checksum = "fca0e9bdc073d7173ba993fb7886477af5df75588b57afcb4b96f21911ab0bfa"
dependencies = [
"const_format",
"is_debug",
......@@ -8414,7 +8414,7 @@ dependencies = [
[[package]]
name = "triomphe"
version = "0.1.12"
source = "git+https://github.com/sokra/triomphe?branch=sokra/unstable#9c591aba443d01a9f525fe9b4a671359d1b455d2"
source = "git+https://github.com/sokra/triomphe?branch=sokra%2Funstable#9c591aba443d01a9f525fe9b4a671359d1b455d2"
dependencies = [
"serde",
"stable_deref_trait",
......@@ -9403,12 +9403,22 @@ dependencies = [
[[package]]
name = "tzdb"
version = "0.5.7"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec758958f2fb5069cd7fae385be95cc8eceb8cdfd270c7d14de6034f0108d99e"
checksum = "1b580f6b365fa89f5767cdb619a55d534d04a4e14c2d7e5b9a31e94598687fb1"
dependencies = [
"iana-time-zone",
"tz-rs",
"tzdb_data",
]
[[package]]
name = "tzdb_data"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "654c1ec546942ce0594e8d220e6b8e3899e0a0a8fe70ddd54d32a376dfefe3f8"
dependencies = [
"tz-rs",
]
[[package]]
......
......@@ -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 = [
......
......@@ -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;
......
......@@ -931,6 +931,7 @@ impl From<UpdateInfo> for NapiUpdateInfo {
}
/// Subscribes to lifecycle events of the compilation.
///
/// 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
......
#![feature(future_join)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![feature(impl_trait_in_assoc_type)]
mod app;
......
#![feature(future_join)]
#![feature(min_specialization)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use std::{str::FromStr, time::Instant};
......
#![feature(type_alias_impl_trait)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
pub mod build_options;
......
......@@ -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;
......
......@@ -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]
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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,
......
......@@ -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;
......@@ -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) {
......
......@@ -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) {
......
......@@ -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,
......@@ -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) {
......
......@@ -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;
......@@ -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,
......
[toolchain]
channel = "nightly-2024-08-01"
channel = "nightly-2024-10-04"
components = ["rustfmt", "clippy", "rust-analyzer"]
profile = "minimal"
#![feature(min_specialization)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
mod nft_json;
......
#![feature(min_specialization)]
#![allow(clippy::needless_return)] // clippy bug causes false positive
use std::sync::Arc;
......@@ -26,5 +27,6 @@ async fn main() -> Result<()> {
println!("{}", file);
}
}
Ok(())
}
......@@ -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)
......
#![feature(entry_insert)]
use std::{
collections::{HashMap, HashSet},
error::Error,
......
......@@ -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()),
......@@ -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 {
......@@ -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 {
......
......@@ -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())
}
......
......@@ -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
......
......@@ -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);
......@@ -149,7 +149,7 @@ impl<'a> Debug for TaskGuard<'a> {
}
}
impl<'a> TaskGuard<'a> {
impl TaskGuard<'_> {
pub fn id(&self) -> TaskId {
self.task_id
}
......
......@@ -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,
......@@ -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,
......
// 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;
......
......@@ -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
}
......@@ -57,7 +53,7 @@ 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 {
......@@ -65,7 +61,7 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> Deref for RefMut<'a, K, V, S> {
}
}
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()
}
......
......@@ -228,7 +228,7 @@ struct RegisterContext<'a> {
values: &'a mut HashMap<ValueKey, ValueEntry>,
}
impl<'a> RegisterContext<'a> {
impl RegisterContext<'_> {
fn process_item(&mut self, item: &Item) -> Result<()> {
match item {
Item::Enum(enum_item) => self.process_enum(enum_item),
......@@ -437,7 +437,7 @@ impl<'a> RegisterContext<'a> {
}
}
impl<'a> RegisterContext<'a> {
impl RegisterContext<'_> {
fn get_global_name(&self, parts: &[&Ident]) -> String {
format!(
"r##\"{}{}::{}\"##",
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
pub mod bytes;
pub mod stream;
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
mod command_line;
mod custom;
......
#![feature(min_specialization)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use anyhow::Result;
use turbo_tasks::{RcStr, Vc};
......
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
#![cfg(test)]
use turbo_tasks::Vc;
......
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
#![feature(trivial_bounds)]
use std::{
......
#![feature(trivial_bounds)]
#![allow(clippy::needless_return)] // clippy false positive
use std::{
collections::BTreeMap,
......
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
#![feature(trivial_bounds)]
#![feature(hash_extract_if)]
#![feature(min_specialization)]
......@@ -5,6 +6,7 @@
#![feature(io_error_more)]
#![feature(round_char_boundary)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::mutable_key_type)]
pub mod attach;
......@@ -1826,7 +1828,7 @@ mod mime_option_serde {
{
struct Visitor;
impl<'de> de::Visitor<'de> for Visitor {
impl de::Visitor<'_> for Visitor {
type Value = Option<Mime>;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
......
......@@ -61,7 +61,7 @@ pub struct MutexMapGuard<'a, K: Eq + Hash> {
key: Option<K>,
}
impl<'a, K: Eq + Hash> Drop for MutexMapGuard<'a, K> {
impl<K: Eq + Hash> Drop for MutexMapGuard<'_, K> {
fn drop(&mut self) {
if let Some(key) = self.key.take() {
let mut map = self.map.map.lock();
......@@ -94,7 +94,7 @@ impl<K> Serialize for MutexMap<K> {
impl<'de, K> Deserialize<'de> for MutexMap<K> {
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
struct Visitor<K>(PhantomData<MutexMap<K>>);
impl<'de, K> serde::de::Visitor<'de> for Visitor<K> {
impl<K> serde::de::Visitor<'_> for Visitor<K> {
type Value = MutexMap<K>;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
formatter.write_str("a unit")
......
......@@ -21,8 +21,9 @@ use RopeElem::{Local, Shared};
static EMPTY_BUF: &[u8] = &[];
/// A Rope provides an efficient structure for sharing bytes/strings between
/// multiple sources. Cloning a Rope is extremely cheap (Arc and usize), and
/// An efficient structure for sharing bytes/strings between multiple sources.
///
/// Cloning a Rope is extremely cheap (Arc and usize), and
/// sharing the contents of one Rope can be done by just cloning an Arc.
///
/// Ropes are immutable, in order to construct one see [RopeBuilder].
......
......@@ -27,7 +27,7 @@ pub enum SourceContextLine<'a> {
},
}
impl<'a> Display for SourceContextLine<'a> {
impl Display for SourceContextLine<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
SourceContextLine::Context { line, outside } => {
......@@ -91,7 +91,7 @@ impl<'a> Display for SourceContextLine<'a> {
pub struct SourceContextLines<'a>(pub Vec<SourceContextLine<'a>>);
impl<'a> Display for SourceContextLines<'a> {
impl Display for SourceContextLines<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for line in &self.0 {
write!(f, "{}", line)?;
......
......@@ -85,8 +85,9 @@ pub fn normalize_path(str: &str) -> Option<String> {
}
/// Normalizes a /-separated request into a form that contains no leading /, no
/// double /, and no "." or ".." segments in the middle of the request. A
/// request might only start with a single "." segment and no ".." segments, or
/// double /, and no "." or ".." segments in the middle of the request.
///
/// A request might only start with a single "." segment and no ".." segments, or
/// any positive number of ".." segments but no "." segment.
pub fn normalize_request(str: &str) -> String {
let mut segments = vec!["."];
......
......@@ -25,8 +25,9 @@ macro_rules! impl_write_number {
}
/// DeterministicHash is a custom trait that signals the implementor can safely
/// be hashed in a replicatable way across platforms and process runs. Note that
/// the default Hash trait used by Rust is not deterministic for our purposes.
/// be hashed in a replicatable way across platforms and process runs.
///
/// Note that the default Hash trait used by Rust is not deterministic for our purposes.
///
/// It's very important that Vcs never implement this, since they cannot be
/// deterministic. The value that they wrap, however, can implement the trait.
......@@ -36,9 +37,10 @@ pub trait DeterministicHash {
fn deterministic_hash<H: DeterministicHasher>(&self, state: &mut H);
}
/// DeterministicHasher is a custom trait that signals the implementor can
/// safely hash in a replicatable way across platforms and process runs. Note
/// that the default Hasher trait used by Rust allows for non-deterministic
/// A custom trait that signals the implementor can safely hash in a replicatable way across
/// platforms and process runs.
///
/// Note that the default Hasher trait used by Rust allows for non-deterministic
/// hashing, so it is not suitable for our purposes.
pub trait DeterministicHasher {
fn finish(&self) -> u64;
......@@ -180,7 +182,7 @@ tuple_impls! { A B C D E F G H I J K L }
/// HasherWrapper allows the DeterministicHasher to be used as a Hasher, for
/// standard types that do not allow us to directly access their internals.
struct HasherWrapper<'a, D: DeterministicHasher>(&'a mut D);
impl<'a, D: DeterministicHasher> std::hash::Hasher for HasherWrapper<'a, D> {
impl<D: DeterministicHasher> std::hash::Hasher for HasherWrapper<'_, D> {
fn write(&mut self, bytes: &[u8]) {
self.0.write_bytes(bytes);
}
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use turbo_tasks::{ResolvedVc, Vc};
......
error: unexpected token, expected one of: "fs", "network", "resolved", "local_cells"
--> tests/function/fail_attribute_invalid_args.rs:8:25
--> tests/function/fail_attribute_invalid_args.rs:9:25
|
8 | #[turbo_tasks::function(invalid_argument)]
9 | #[turbo_tasks::function(invalid_argument)]
| ^^^^^^^^^^^^^^^^
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use turbo_tasks::{ResolvedVc, Vc};
......
error: unexpected token, expected one of: "fs", "network", "resolved", "local_cells"
--> tests/function/fail_attribute_invalid_args_inherent_impl.rs:13:29
--> tests/function/fail_attribute_invalid_args_inherent_impl.rs:14:29
|
13 | #[turbo_tasks::function(invalid_argument)]
14 | #[turbo_tasks::function(invalid_argument)]
| ^^^^^^^^^^^^^^^^
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(dead_code)]
use turbo_tasks::Vc;
......
error[E0277]: the trait bound `IntegersVec: ResolvedValue` is not satisfied
--> tests/function/fail_resolved_inherent_impl.rs:14:29
--> tests/function/fail_resolved_inherent_impl.rs:15:29
|
14 | #[turbo_tasks::function(resolved)]
15 | #[turbo_tasks::function(resolved)]
| ^^^^^^^^ the trait `ResolvedValue` is not implemented for `IntegersVec`
|
= help: the following other types implement trait `ResolvedValue`:
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(dead_code)]
use turbo_tasks::Vc;
......
error[E0277]: the trait bound `IntegersVec: ResolvedValue` is not satisfied
--> tests/function/fail_resolved_static.rs:9:25
|
9 | #[turbo_tasks::function(resolved)]
| ^^^^^^^^ the trait `ResolvedValue` is not implemented for `IntegersVec`
|
= help: the following other types implement trait `ResolvedValue`:
&T
&mut T
()
(A, Z, Y, X, W, V, U, T)
(B, A, Z, Y, X, W, V, U, T)
(C, B, A, Z, Y, X, W, V, U, T)
(D, C, B, A, Z, Y, X, W, V, U, T)
(E, D, C, B, A, Z, Y, X, W, V, U, T)
and $N others
--> tests/function/fail_resolved_static.rs:10:25
|
10 | #[turbo_tasks::function(resolved)]
| ^^^^^^^^ the trait `ResolvedValue` is not implemented for `IntegersVec`
|
= help: the following other types implement trait `ResolvedValue`:
&T
&mut T
()
(A, Z, Y, X, W, V, U, T)
(B, A, Z, Y, X, W, V, U, T)
(C, B, A, Z, Y, X, W, V, U, T)
(D, C, B, A, Z, Y, X, W, V, U, T)
(E, D, C, B, A, Z, Y, X, W, V, U, T)
and $N others
note: required by a bound in `assert_returns_resolved_value`
--> $WORKSPACE/turbopack/crates/turbo-tasks/src/macro_helpers.rs
|
| pub fn assert_returns_resolved_value<ReturnType, Rv>()
| ----------------------------- required by a bound in this function
--> $WORKSPACE/turbopack/crates/turbo-tasks/src/macro_helpers.rs
|
| pub fn assert_returns_resolved_value<ReturnType, Rv>()
| ----------------------------- required by a bound in this function
...
| Rv: ResolvedValue + Send,
| ^^^^^^^^^^^^^ required by this bound in `assert_returns_resolved_value`
| Rv: ResolvedValue + Send,
| ^^^^^^^^^^^^^ required by this bound in `assert_returns_resolved_value`
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(dead_code)]
use turbo_tasks::Vc;
......
error[E0277]: the trait bound `IntegersVec: ResolvedValue` is not satisfied
--> tests/function/fail_resolved_trait_impl.rs:19:29
--> tests/function/fail_resolved_trait_impl.rs:20:29
|
19 | #[turbo_tasks::function(resolved)]
20 | #[turbo_tasks::function(resolved)]
| ^^^^^^^^ the trait `ResolvedValue` is not implemented for `IntegersVec`
|
= help: the following other types implement trait `ResolvedValue`:
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(dead_code)]
use turbo_tasks::{ResolvedVc, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(dead_code)]
use turbo_tasks::{ResolvedVc, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(dead_code)]
use turbo_tasks::{ResolvedVc, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(dead_code)]
use anyhow::Result;
......
//! Tests for the `#[derive(TaskInput)]` macro are in `turbo_tasks` itself.
//! However, we keep one test here as an integration test between the derive
//! macro and the `#[turbo_tasks::function]` macro.
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use serde::{Deserialize, Serialize};
use turbo_tasks::{Completion, ReadRef, TaskInput, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use turbo_tasks::Vc;
......
error[E0277]: the trait bound `Vc<i32>: ResolvedValue` is not satisfied
--> tests/value/fail_resolved.rs:7:12
--> tests/value/fail_resolved.rs:8:12
|
7 | value: Vc<i32>,
8 | value: Vc<i32>,
| ^^^^^^^ the trait `ResolvedValue` is not implemented for `Vc<i32>`
|
= help: the following other types implement trait `ResolvedValue`:
......@@ -15,8 +15,8 @@ error[E0277]: the trait bound `Vc<i32>: ResolvedValue` is not satisfied
(E, D, C, B, A, Z, Y, X, W, V, U, T)
and $N others
note: required by a bound in `DeriveResolvedValueAssertion::assert_impl_resolved_value`
--> tests/value/fail_resolved.rs:5:22
--> tests/value/fail_resolved.rs:6:22
|
5 | #[turbo_tasks::value(resolved)]
6 | #[turbo_tasks::value(resolved)]
| ^^^^^^^^ required by this bound in `DeriveResolvedValueAssertion::assert_impl_resolved_value`
= note: this error originates in the derive macro `turbo_tasks::ResolvedValue` (in Nightly builds, run with -Z macro-backtrace for more info)
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#[turbo_tasks::value(resolved)]
struct MyValue {
......
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use turbo_tasks::debug::ValueDebugFormat;
use turbo_tasks_testing::{register, run, Registration};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#[turbo_tasks::value_trait(resolved)]
trait MyTrait {}
......
......@@ -108,7 +108,7 @@ struct ReplaceGenericsVisitor<'a> {
generics: &'a std::collections::HashSet<String>,
}
impl<'a> VisitMut for ReplaceGenericsVisitor<'a> {
impl VisitMut for ReplaceGenericsVisitor<'_> {
fn visit_type_mut(&mut self, node: &mut Type) {
if let Type::Path(type_path) = node {
if type_path.qself.is_none()
......
......@@ -49,6 +49,7 @@ pub fn derive_task_input(input: TokenStream) -> TokenStream {
/// Derives the `turbo_tasks::KeyValuePair` trait for a enum. Each variant need to have a `value`
/// field which becomes part of the value enum and all remaining fields become part of the key.
///
/// Assuming the enum is called `Abc` it exposes `AbcKey` and `AbcValue` types for it too. The key
/// enum will have `Debug, Clone, PartialEq, Eq, Hash` derived and the value enum will have `Debug,
/// Clone` derived. It's expected that all fields implement these traits.
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use criterion::{criterion_group, criterion_main, Criterion};
......
......@@ -92,7 +92,7 @@ pub enum PreparedChangeRef<'l, C: AggregationContext> {
},
}
impl<'l, C: AggregationContext> PreparedOperation<C> for PreparedChangeRef<'l, C> {
impl<C: AggregationContext> PreparedOperation<C> for PreparedChangeRef<'_, C> {
type Result = ();
fn apply(self, ctx: &C) {
let (uppers, change) = match self {
......
......@@ -49,14 +49,14 @@ pub fn on_added<C: AggregationContext>(
let followers_len = aggregating.followers.len();
let optimize = (!already_optimizing_for_node
&& followers_len >= MAX_FOLLOWERS
&& followers_len.count_ones() == 1)
.then(|| {
aggregating
.followers
.iter()
.cloned()
.collect::<StackVec<_>>()
});
&& followers_len.is_power_of_two())
.then(|| {
aggregating
.followers
.iter()
.cloned()
.collect::<StackVec<_>>()
});
let uppers = aggregating.uppers.iter().cloned().collect::<StackVec<_>>();
start_in_progress_all(ctx, &uppers);
drop(node);
......
......@@ -147,7 +147,10 @@ impl AggregationNodeGuard for NodeGuard {
}
impl AggregationContext for NodeAggregationContext {
type Guard<'l> = NodeGuard where Self: 'l;
type Guard<'l>
= NodeGuard
where
Self: 'l;
type Data = Aggregated;
type NodeRef = NodeRef;
type DataChange = Change;
......
......@@ -31,7 +31,7 @@ pub fn handle_new_edge<C: AggregationContext>(
ref mut aggregation_number,
ref uppers,
} => {
if number_of_children.count_ones() == 1
if number_of_children.is_power_of_two()
&& (uppers.len() + 1) * number_of_children >= MAX_UPPERS_TIMES_CHILDREN
{
let uppers = uppers.iter().cloned().collect::<StackVec<_>>();
......
......@@ -491,8 +491,11 @@ impl AggregationNodeGuard for NodeGuard {
}
}
impl<'a> AggregationContext for NodeAggregationContext<'a> {
type Guard<'l> = NodeGuard where Self: 'l;
impl AggregationContext for NodeAggregationContext<'_> {
type Guard<'l>
= NodeGuard
where
Self: 'l;
type Data = Aggregated;
type NodeRef = NodeRef;
type DataChange = Change;
......
......@@ -52,7 +52,7 @@ pub fn on_added<C: AggregationContext>(
let uppers = node.uppers();
let uppers_len = uppers.len();
let optimize =
(!already_optimizing_for_upper && uppers_len >= MAX_UPPERS && uppers_len.count_ones() == 1)
(!already_optimizing_for_upper && uppers_len >= MAX_UPPERS && uppers_len.is_power_of_two())
.then(|| (true, uppers.iter().cloned().collect::<StackVec<_>>()));
let (add_change, followers) = match &mut *node {
AggregationNode::Leaf { .. } => {
......
......@@ -173,13 +173,6 @@ impl<T: Eq + Hash, H: BuildHasher + Default> CountHashSet<T, H> {
}
}
pub fn get_count(&self, item: &T) -> isize {
match self.inner.get(item) {
Some(value) => *value,
None => 0,
}
}
/// Frees unused memory
pub fn shrink_to_fit(&mut self) {
self.inner.shrink_to_fit();
......@@ -232,6 +225,7 @@ impl<T: Eq + Hash + Clone, H: BuildHasher + Default> CountHashSet<T, H> {
self.add_clonable_count(item, 1)
}
#[allow(dead_code)]
/// Returns true when the value is no longer visible from outside
pub fn remove_clonable_count(&mut self, item: &T, count: usize) -> bool {
if count == 0 {
......
#![feature(hash_extract_if)]
#![feature(option_get_or_insert_default)]
#![feature(type_alias_impl_trait)]
#![feature(box_patterns)]
#![feature(int_roundings)]
......
......@@ -194,7 +194,7 @@ impl<'a> TaskAggregationContext<'a> {
}
#[cfg(debug_assertions)]
impl<'a> Drop for TaskAggregationContext<'a> {
impl Drop for TaskAggregationContext<'_> {
fn drop(&mut self) {
let tasks_to_schedule = self.dirty_tasks_to_schedule.get_mut();
if let Some(tasks_to_schedule) = tasks_to_schedule.as_ref() {
......@@ -211,8 +211,11 @@ impl<'a> Drop for TaskAggregationContext<'a> {
}
}
impl<'a> AggregationContext for TaskAggregationContext<'a> {
type Guard<'l> = TaskGuard<'l> where Self: 'l;
impl AggregationContext for TaskAggregationContext<'_> {
type Guard<'l>
= TaskGuard<'l>
where
Self: 'l;
type Data = Aggregated;
type DataChange = TaskChange;
type NodeRef = TaskId;
......@@ -452,7 +455,7 @@ impl<'l> TaskGuard<'l> {
}
}
impl<'l> Deref for TaskGuard<'l> {
impl Deref for TaskGuard<'_> {
type Target = AggregationNode<
<Self as AggregationNodeGuard>::NodeRef,
<Self as AggregationNodeGuard>::Data,
......@@ -468,7 +471,7 @@ impl<'l> Deref for TaskGuard<'l> {
}
}
impl<'l> DerefMut for TaskGuard<'l> {
impl DerefMut for TaskGuard<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
match self.guard {
TaskMetaStateWriteGuard::Full(ref mut guard) => &mut guard.aggregation_node,
......@@ -483,7 +486,10 @@ impl<'l> AggregationNodeGuard for TaskGuard<'l> {
type Data = Aggregated;
type NodeRef = TaskId;
type DataChange = TaskChange;
type ChildrenIter<'a> = impl Iterator<Item = TaskId> + 'a where Self: 'a;
type ChildrenIter<'a>
= impl Iterator<Item = TaskId> + 'a
where
Self: 'a;
fn children(&self) -> Self::ChildrenIter<'_> {
match self.guard {
......
......@@ -80,7 +80,8 @@ impl TaskMetaState {
}
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 TaskMetaStateAsPartial =
for<'a> fn(&'a TaskMetaState) -> Option<&'a PartialTaskState>;
pub(super) type TaskMetaStateAsUnloaded =
for<'a> fn(&'a TaskMetaState) -> Option<&'a UnloadedTaskState>;
pub(super) type TaskMetaStateAsFullMut =
......@@ -159,7 +160,7 @@ impl<'a> From<RwLockWriteGuard<'a, TaskMetaState>> for TaskMetaStateWriteGuard<'
}
}
impl<'a> TaskMetaStateReadGuard<'a> {
impl TaskMetaStateReadGuard<'_> {
pub(super) fn as_full(&mut self) -> Option<&TaskState> {
match self {
TaskMetaStateReadGuard::Full(state) => Some(&**state),
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use std::{
future::{Future, IntoFuture},
......
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use anyhow::{anyhow, bail, Result};
use turbo_tasks::{RcStr, Value, ValueToString, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use anyhow::Result;
use turbo_tasks::Vc;
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use anyhow::Result;
use turbo_tasks::Vc;
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use std::{collections::HashSet, time::Duration};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use std::sync::Mutex;
......
#![allow(clippy::needless_return)] // clippy bug causes false positive
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use tokio::{
sync::{watch, Notify},
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use std::time::Duration;
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use anyhow::Result;
use turbo_tasks::{State, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use std::sync::{Arc, Mutex};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use anyhow::Result;
use turbo_tasks::{
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use std::time::Duration;
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // clippy bug causes false positive
use std::sync::Mutex;
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use anyhow::Result;
use turbo_tasks::{State, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // clippy bug causes false positive
use anyhow::{bail, Result};
use turbo_tasks::{emit, CollectiblesSource, RcStr, State, ValueToString, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use anyhow::Result;
use turbo_tasks::{ReadRef, ResolvedVc, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use anyhow::Result;
use turbo_tasks::{run_once, Completion, TryJoinIterExt, Vc};
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use std::sync::Mutex;
......
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
use anyhow::Result;
use turbo_tasks::{IntoTraitRef, State, TraitRef, Upcast, Vc};
......
......@@ -193,7 +193,7 @@ mod ser {
},
}
impl<'a> Serialize for FunctionAndArg<'a> {
impl Serialize for FunctionAndArg<'_> {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: Serializer,
......
......@@ -2,6 +2,7 @@ use anyhow::Result;
use crate::{self as turbo_tasks, RawVc, TryJoinIterExt, Vc};
/// Just an empty type, but it's never equal to itself.
///
/// [`Vc<Completion>`] can be used as return value instead of `()`
/// to have a concrete reference that can be awaited.
/// It will invalidate the awaiting task everytime the referenced
......
......@@ -87,7 +87,7 @@ impl<'a> FormattingStruct<'a> {
}
}
impl<'a> std::fmt::Debug for FormattingStruct<'a> {
impl std::fmt::Debug for FormattingStruct<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
FormattingStruct::Named { name, fields } => {
......@@ -122,7 +122,7 @@ impl<'a> PassthroughDebug<'a> {
}
}
impl<'a> std::fmt::Debug for PassthroughDebug<'a> {
impl std::fmt::Debug for PassthroughDebug<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.0.as_ref())
}
......
......@@ -25,8 +25,9 @@ impl<F: FnOnce(u64)> Drop for DurationSpanGuard<F> {
}
/// Creates a event-based span that traces a certain duration (lifetime of the
/// guard). It's not a real span, which means it can be used across threads. It
/// will trace a duration and not the time the cpu is doing actual work. This
/// guard). It's not a real span, which means it can be used across threads.
///
/// It will trace a duration and not the time the cpu is doing actual work. This
/// way it can be used to trace non-cpu-time or time that is spend in other
/// processes.
#[macro_export]
......
......@@ -43,7 +43,9 @@ impl<Node> GraphNode<Node> {
}
/// A [`GraphStore`] wrapper that skips nodes that have already been
/// visited. This is necessary to avoid repeated work when traversing non-tree
/// visited.
///
/// This is necessary to avoid repeated work when traversing non-tree
/// graphs (i.e. where a node can have more than one incoming edge).
#[derive(Debug)]
pub struct SkipDuplicates<StoreImpl>
......
......@@ -14,8 +14,9 @@ use super::{
pub struct VisitedNodes<T>(pub HashSet<T>);
/// [`GraphTraversal`] is a utility type that can be used to traverse a graph of
/// nodes, where each node can have a variable number of outgoing edges. The
/// traversal is done in parallel, and the order of the nodes in the traversal
/// nodes, where each node can have a variable number of outgoing edges.
///
/// The traversal is done in parallel, and the order of the nodes in the traversal
/// result is determined by the [`GraphStore`] parameter.
pub trait GraphTraversal: GraphStore + Sized {
fn visit<RootEdgesIt, VisitImpl, Abort, Impl>(
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment