Skip to content

Commit 8cb2641

Browse files
committed
Move CycleErrorHandling.
From `rustc_query_system` to `rustc_middle`.
1 parent d07fcfd commit 8cb2641

6 files changed

Lines changed: 23 additions & 24 deletions

File tree

compiler/rustc_middle/src/query/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ pub use self::caches::{
77
pub use self::job::{QueryInfo, QueryJob, QueryJobId, QueryLatch, QueryWaiter};
88
pub use self::keys::{AsLocalKey, Key, LocalCrate};
99
pub use self::plumbing::{
10-
ActiveKeyStatus, CycleError, IntoQueryParam, QueryState, TyCtxtAt, TyCtxtEnsureDone,
11-
TyCtxtEnsureOk,
10+
ActiveKeyStatus, CycleError, CycleErrorHandling, IntoQueryParam, QueryState, TyCtxtAt,
11+
TyCtxtEnsureDone, TyCtxtEnsureOk,
1212
};
1313
pub use self::stack::{QueryStackDeferred, QueryStackFrame, QueryStackFrameExtra};
1414
pub use crate::queries::Providers;

compiler/rustc_middle/src/query/plumbing.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_hir::hir_id::OwnerId;
99
use rustc_macros::HashStable;
1010
use rustc_query_system::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
1111
use rustc_query_system::ich::StableHashingContext;
12-
use rustc_query_system::query::CycleErrorHandling;
1312
use rustc_span::{ErrorGuaranteed, Span};
1413
pub use sealed::IntoQueryParam;
1514

@@ -54,6 +53,18 @@ pub enum ActiveKeyStatus<'tcx> {
5453
Poisoned,
5554
}
5655

56+
/// How a particular query deals with query cycle errors.
57+
///
58+
/// Inspected by the code that actually handles cycle errors, to decide what
59+
/// approach to use.
60+
#[derive(Copy, Clone)]
61+
pub enum CycleErrorHandling {
62+
Error,
63+
Fatal,
64+
DelayBug,
65+
Stash,
66+
}
67+
5768
pub type WillCacheOnDiskForKeyFn<'tcx, Key> = fn(tcx: TyCtxt<'tcx>, key: &Key) -> bool;
5869

5970
pub type TryLoadFromDiskFn<'tcx, Key, Value> = fn(

compiler/rustc_query_impl/src/execution.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use rustc_data_structures::{outline, sharded, sync};
77
use rustc_errors::{Diag, FatalError, StashKey};
88
use rustc_middle::dep_graph::DepsType;
99
use rustc_middle::query::{
10-
ActiveKeyStatus, CycleError, QueryCache, QueryJob, QueryJobId, QueryLatch, QueryStackDeferred,
11-
QueryStackFrame, QueryState,
10+
ActiveKeyStatus, CycleError, CycleErrorHandling, QueryCache, QueryJob, QueryJobId, QueryLatch,
11+
QueryStackDeferred, QueryStackFrame, QueryState,
1212
};
1313
use rustc_middle::ty::TyCtxt;
1414
use rustc_query_system::dep_graph::{DepGraphData, DepNodeKey, HasDepContext};
15-
use rustc_query_system::query::{CycleErrorHandling, QueryMode, incremental_verify_ich};
15+
use rustc_query_system::query::{QueryMode, incremental_verify_ich};
1616
use rustc_span::{DUMMY_SP, Span};
1717

1818
use crate::dep_graph::{DepContext, DepNode, DepNodeIndex};

compiler/rustc_query_impl/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ use rustc_middle::query::on_disk_cache::{CacheEncoder, EncodedDepNodeIndex, OnDi
2121
use rustc_middle::query::plumbing::{
2222
HashResult, QueryState, QuerySystem, QuerySystemFns, QueryVTable,
2323
};
24-
use rustc_middle::query::{AsLocalKey, CycleError, QueryCache};
24+
use rustc_middle::query::{AsLocalKey, CycleError, CycleErrorHandling, QueryCache};
2525
use rustc_middle::ty::TyCtxt;
2626
use rustc_query_system::dep_graph::SerializedDepNodeIndex;
27-
use rustc_query_system::query::{CycleErrorHandling, QueryMode};
27+
use rustc_query_system::query::QueryMode;
2828
use rustc_span::{ErrorGuaranteed, Span};
2929

3030
pub use crate::job::{QueryJobMap, break_query_cycles, print_query_stack};

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,16 @@ pub fn query_key_hash_verify_all<'tcx>(tcx: TyCtxt<'tcx>) {
207207

208208
macro_rules! cycle_error_handling {
209209
([]) => {{
210-
rustc_query_system::query::CycleErrorHandling::Error
210+
rustc_middle::query::CycleErrorHandling::Error
211211
}};
212212
([(cycle_fatal) $($rest:tt)*]) => {{
213-
rustc_query_system::query::CycleErrorHandling::Fatal
213+
rustc_middle::query::CycleErrorHandling::Fatal
214214
}};
215215
([(cycle_stash) $($rest:tt)*]) => {{
216-
rustc_query_system::query::CycleErrorHandling::Stash
216+
rustc_middle::query::CycleErrorHandling::Stash
217217
}};
218218
([(cycle_delay_bug) $($rest:tt)*]) => {{
219-
rustc_query_system::query::CycleErrorHandling::DelayBug
219+
rustc_middle::query::CycleErrorHandling::DelayBug
220220
}};
221221
([$other:tt $($modifiers:tt)*]) => {
222222
cycle_error_handling!([$($modifiers)*])

compiler/rustc_query_system/src/query/mod.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ use crate::dep_graph::{DepNodeIndex, HasDepContext, SerializedDepNodeIndex};
99

1010
mod plumbing;
1111

12-
/// How a particular query deals with query cycle errors.
13-
///
14-
/// Inspected by the code that actually handles cycle errors, to decide what
15-
/// approach to use.
16-
#[derive(Copy, Clone)]
17-
pub enum CycleErrorHandling {
18-
Error,
19-
Fatal,
20-
DelayBug,
21-
Stash,
22-
}
23-
2412
/// Tracks 'side effects' for a particular query.
2513
/// This struct is saved to disk along with the query result,
2614
/// and loaded from disk if we mark the query as green.

0 commit comments

Comments
 (0)