diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-09-02 19:10:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-02 19:10:20 +0200 |
| commit | f4193346fe4378dfae003a6fb22b324a7ed0c0e6 (patch) | |
| tree | 029c9bf744f928b5f4dd908fe2548af4fbee7830 | |
| parent | e248c4d5d0459fbf2a796e5bb413adca37d37b16 (diff) | |
| parent | 4553a4baf2b365541c2322462a31eb5e5f43f3b5 (diff) | |
| download | rust-f4193346fe4378dfae003a6fb22b324a7ed0c0e6.tar.gz rust-f4193346fe4378dfae003a6fb22b324a7ed0c0e6.zip | |
Rollup merge of #88567 - camelid:query-job-info, r=cjgillot
Remove redundant `Span` in `QueryJobInfo` Previously, `QueryJobInfo` was composed of two parts: a `QueryInfo` and a `QueryJob`. However, both `QueryInfo` and `QueryJob` have a `span` field, which seem to be the same. So, the `span` was recorded twice. Now, `QueryJobInfo` is composed of a `QueryStackFrame` (the other field of `QueryInfo`) and a `QueryJob`. So, now, the `span` is only recorded once.
| -rw-r--r-- | compiler/rustc_query_system/src/query/job.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_query_system/src/query/plumbing.rs | 4 |
2 files changed, 8 insertions, 11 deletions
diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs index 63a8f062475..c3fdf4fc228 100644 --- a/compiler/rustc_query_system/src/query/job.rs +++ b/compiler/rustc_query_system/src/query/job.rs @@ -61,7 +61,7 @@ where } fn query(self, map: &QueryMap<D>) -> QueryStackFrame { - map.get(&self).unwrap().info.query.clone() + map.get(&self).unwrap().query.clone() } #[cfg(parallel_compiler)] @@ -81,7 +81,7 @@ where } pub struct QueryJobInfo<D> { - pub info: QueryInfo, + pub query: QueryStackFrame, pub job: QueryJob<D>, } @@ -155,7 +155,7 @@ where while let Some(job) = current_job { let info = query_map.get(&job).unwrap(); - cycle.push(info.info.clone()); + cycle.push(QueryInfo { span: info.job.span, query: info.query.clone() }); if job == *self { cycle.reverse(); @@ -170,7 +170,7 @@ where .job .parent .as_ref() - .map(|parent| (info.info.span, parent.query(&query_map))); + .map(|parent| (info.job.span, parent.query(&query_map))); return CycleError { usage, cycle }; } @@ -649,13 +649,10 @@ pub fn print_query_stack<CTX: QueryContext>( }; let mut diag = Diagnostic::new( Level::FailureNote, - &format!( - "#{} [{}] {}", - i, query_info.info.query.name, query_info.info.query.description - ), + &format!("#{} [{}] {}", i, query_info.query.name, query_info.query.description), ); diag.span = - tcx.dep_context().sess().source_map().guess_head_span(query_info.info.span).into(); + tcx.dep_context().sess().source_map().guess_head_span(query_info.job.span).into(); handler.force_print_diagnostic(diag); current_query = query_info.job.parent; diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index a7511846cad..3f22de6fba4 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -130,8 +130,8 @@ where for (k, v) in shard.active.iter() { if let QueryResult::Started(ref job) = *v { let id = QueryJobId::new(job.id, shard_id, kind); - let info = QueryInfo { span: job.span, query: make_query(tcx, k.clone()) }; - jobs.insert(id, QueryJobInfo { info, job: job.clone() }); + let query = make_query(tcx, k.clone()); + jobs.insert(id, QueryJobInfo { query, job: job.clone() }); } } } |
