Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions compiler/rustc_middle/src/query/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ impl<'tcx> QueryJob<'tcx> {
pub struct QueryWaiter<'tcx> {
pub query: Option<QueryJobId>,
pub condvar: Condvar,
pub span: Span,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of spans here doesn't seem great.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving unused struct fields doesn't seem like a good long-term approach either. I can split its removal into a separate commit for a fast revert if necessary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean it should still be used. Each query call has an associated span and that should be propagated to the cycle error.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the span is currently unused, correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 6c56188

pub cycle: Mutex<Option<CycleError<QueryStackDeferred<'tcx>>>>,
}

Expand All @@ -100,10 +99,9 @@ impl<'tcx> QueryLatch<'tcx> {
&self,
tcx: TyCtxt<'tcx>,
query: Option<QueryJobId>,
span: Span,
) -> Result<(), CycleError<QueryStackDeferred<'tcx>>> {
let waiter =
Arc::new(QueryWaiter { query, span, cycle: Mutex::new(None), condvar: Condvar::new() });
Arc::new(QueryWaiter { query, cycle: Mutex::new(None), condvar: Condvar::new() });
self.wait_on_inner(tcx, &waiter);
// FIXME: Get rid of this lock. We have ownership of the QueryWaiter
// although another thread may still have a Arc reference so we cannot
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_query_impl/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ fn cycle_error<'tcx, C: QueryCache>(
fn wait_for_query<'tcx, C: QueryCache>(
query: &'tcx QueryVTable<'tcx, C>,
tcx: TyCtxt<'tcx>,
span: Span,
key: C::Key,
latch: QueryLatch<'tcx>,
current: Option<QueryJobId>,
Expand All @@ -240,7 +239,7 @@ fn wait_for_query<'tcx, C: QueryCache>(

// With parallel queries we might just have to wait on some other
// thread.
let result = latch.wait_on(tcx, current, span);
let result = latch.wait_on(tcx, current);

match result {
Ok(()) => {
Expand Down Expand Up @@ -320,7 +319,7 @@ fn try_execute_query<'tcx, C: QueryCache, const INCR: bool>(

// Only call `wait_for_query` if we're using a Rayon thread pool
// as it will attempt to mark the worker thread as blocked.
return wait_for_query(query, tcx, span, key, latch, current_job_id);
return wait_for_query(query, tcx, key, latch, current_job_id);
}

let id = job.id;
Expand Down
Loading
Loading