From c84fae13e5eb5a475dcb214b170aaf77a8c3783d Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 1 Nov 2019 15:16:52 +1100 Subject: [PATCH] Move the definition of `QueryResult` into `plumbing.rs`. Because it's the only file that uses it, and removes the need for importing it. --- src/librustc/ty/query/job.rs | 10 ---------- src/librustc/ty/query/plumbing.rs | 14 +++++++++++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index 391ea762a083b..e5f4e793132f4 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -22,16 +22,6 @@ use { std::iter::FromIterator, }; -/// Indicates the state of a query for a given key in a query map. -pub(super) enum QueryResult<'tcx> { - /// An already executing query. The query job can be used to await for its completion. - Started(Lrc>), - - /// The query panicked. Queries trying to wait on this will raise a fatal error or - /// silently panic. - Poisoned, -} - /// Represents a span and a query key. #[derive(Clone, Debug)] pub struct QueryInfo<'tcx> { diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 52a784d3fc0be..fc55b665c1d0e 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -7,7 +7,7 @@ use crate::ty::tls; use crate::ty::{self, TyCtxt}; use crate::ty::query::Query; use crate::ty::query::config::{QueryConfig, QueryDescription}; -use crate::ty::query::job::{QueryJob, QueryResult, QueryInfo}; +use crate::ty::query::job::{QueryJob, QueryInfo}; use errors::DiagnosticBuilder; use errors::Level; @@ -52,6 +52,16 @@ impl QueryValue { } } +/// Indicates the state of a query for a given key in a query map. +pub(super) enum QueryResult<'tcx> { + /// An already executing query. The query job can be used to await for its completion. + Started(Lrc>), + + /// The query panicked. Queries trying to wait on this will raise a fatal error or + /// silently panic. + Poisoned, +} + impl<'tcx, M: QueryConfig<'tcx>> Default for QueryCache<'tcx, M> { fn default() -> QueryCache<'tcx, M> { QueryCache { @@ -676,8 +686,6 @@ macro_rules! define_queries_inner { [$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*) => { use std::mem; - #[cfg(parallel_compiler)] - use ty::query::job::QueryResult; use rustc_data_structures::sharded::Sharded; use crate::{ rustc_data_structures::stable_hasher::HashStable,