Commit 5018dcfb authored by Tobias Koppers's avatar Tobias Koppers

Turbopack: remove TaskInput from AutoSet

parent 90bc934b
......@@ -19,6 +19,11 @@ use crate::{
/// Trait to implement in order for a type to be accepted as a
/// [`#[turbo_tasks::function]`][crate::function] argument.
///
/// Note that in addition to the trait bounds, the type must also be deterministic serializable when
/// used for a persisted task (is_transient = false). This means serialization of equal values
/// should lead to byte-identical results. This is not enforced by the trait itself, but is required
/// for correct behavior.
pub trait TaskInput: Send + Sync + Clone + Debug + PartialEq + Eq + Hash + TraceRawVcs {
fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
async { Ok(self.clone()) }
......@@ -332,19 +337,6 @@ where
}
}
impl<T> TaskInput for auto_hash_map::AutoSet<T>
where
T: TaskInput,
{
fn is_resolved(&self) -> bool {
self.iter().all(TaskInput::is_resolved)
}
fn is_transient(&self) -> bool {
self.iter().any(TaskInput::is_transient)
}
}
macro_rules! tuple_impls {
( $( $name:ident )+ ) => {
impl<$($name: TaskInput),+> TaskInput for ($($name,)+)
......
......@@ -6,7 +6,6 @@ pub mod resolve;
use std::{
cmp::min,
fmt::{Display, Formatter},
sync::Arc,
};
use anyhow::{Result, anyhow};
......@@ -164,9 +163,7 @@ pub trait ImportTracer {
fn get_traces(self: Vc<Self>, path: FileSystemPath) -> Vc<ImportTraces>;
}
#[derive(
Debug, Clone, TaskInput, TraceRawVcs, Hash, Eq, PartialEq, Serialize, Deserialize, NonLocalValue,
)]
#[turbo_tasks::value]
pub struct DelegatingImportTracer {
delegates: AutoSet<ResolvedVc<Box<dyn ImportTracer>>>,
}
......@@ -220,7 +217,7 @@ pub struct Issues(Vec<ResolvedVc<Box<dyn Issue>>>);
#[derive(Debug)]
pub struct CapturedIssues {
issues: AutoSet<ResolvedVc<Box<dyn Issue>>>,
tracer: Arc<DelegatingImportTracer>,
tracer: ResolvedVc<DelegatingImportTracer>,
}
#[turbo_tasks::value_impl]
......@@ -250,14 +247,12 @@ impl CapturedIssues {
// Returns all the issues as formatted `PlainIssues`.
pub async fn get_plain_issues(&self) -> Result<Vec<ReadRef<PlainIssue>>> {
let mut list =
self.issues
.iter()
.map(|issue| async move {
PlainIssue::from_issue(**issue, Some(self.tracer.clone())).await
})
.try_join()
.await?;
let mut list = self
.issues
.iter()
.map(|issue| async move { PlainIssue::from_issue(**issue, Some(*self.tracer)).await })
.try_join()
.await?;
list.sort();
Ok(list)
}
......@@ -716,7 +711,7 @@ impl PlainIssue {
#[turbo_tasks::function]
pub async fn from_issue(
issue: ResolvedVc<Box<dyn Issue>>,
import_tracer: Option<Arc<DelegatingImportTracer>>,
import_tracer: Option<ResolvedVc<DelegatingImportTracer>>,
) -> Result<Vc<Self>> {
let description: Option<StyledString> = match *issue.description().await? {
Some(description) => Some(description.owned().await?),
......@@ -747,8 +742,13 @@ impl PlainIssue {
},
import_traces: match import_tracer {
Some(tracer) => {
into_plain_trace(tracer.get_traces(issue.file_path().owned().await?).await?)
.await?
into_plain_trace(
tracer
.await?
.get_traces(issue.file_path().owned().await?)
.await?,
)
.await?
}
None => vec![],
},
......@@ -835,9 +835,10 @@ where
CapturedIssues {
issues: self.peek_collectibles(),
tracer: Arc::new(DelegatingImportTracer {
tracer: DelegatingImportTracer {
delegates: self.peek_collectibles(),
}),
}
.resolved_cell(),
}
}
......@@ -845,9 +846,10 @@ where
CapturedIssues {
issues: self.take_collectibles(),
tracer: Arc::new(DelegatingImportTracer {
tracer: DelegatingImportTracer {
delegates: self.take_collectibles(),
}),
}
.resolved_cell(),
}
}
}
......
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