remove "debug_probe"

We are using "peek fields" methods instead;
I like that approach better.
This commit is contained in:
Niko Matsakis 2024-07-21 07:11:18 -04:00
parent 4e015483fe
commit 61b1671b69
3 changed files with 0 additions and 75 deletions

View file

@ -149,22 +149,6 @@ impl Runtime {
self.empty_dependencies.clone()
}
/// Executes `op` but ignores its effect on
/// the query dependencies; intended for use
/// by `DebugWithDb` only.
///
/// # Danger: intended for debugging only
///
/// This operation is intended for **debugging only**.
/// Misuse will cause Salsa to give incorrect results.
/// The expectation is that the type `R` produced will be
/// logged or printed out. **The type `R` that is produced
/// should not affect the result or other outputs
/// (such as accumulators) from the current Salsa query.**
pub fn debug_probe<R>(&self, op: impl FnOnce() -> R) -> R {
self.local_state.debug_probe(op)
}
pub(crate) fn report_tracked_read(
&self,
key_index: DependencyIndex,

View file

@ -40,26 +40,6 @@ pub(super) struct ActiveQuery {
pub(super) disambiguator_map: FxIndexMap<u64, Disambiguator>,
}
pub(super) struct SavedQueryState {
database_key_index: DatabaseKeyIndex,
durability: Durability,
changed_at: Revision,
input_outputs_len: usize,
untracked_read: bool,
}
impl SavedQueryState {
fn new(query: &ActiveQuery) -> Self {
Self {
database_key_index: query.database_key_index,
durability: query.durability,
changed_at: query.changed_at,
input_outputs_len: query.input_outputs.len(),
untracked_read: query.untracked_read,
}
}
}
impl ActiveQuery {
pub(super) fn new(database_key_index: DatabaseKeyIndex) -> Self {
ActiveQuery {
@ -73,26 +53,6 @@ impl ActiveQuery {
}
}
pub(super) fn save_query_state(&self) -> SavedQueryState {
SavedQueryState::new(self)
}
pub(super) fn restore_query_state(&mut self, state: SavedQueryState) {
assert_eq!(self.database_key_index, state.database_key_index);
assert!(self.durability <= state.durability);
self.durability = state.durability;
assert!(self.changed_at >= state.changed_at);
self.changed_at = state.changed_at;
assert!(self.input_outputs.len() >= state.input_outputs_len);
self.input_outputs.truncate(state.input_outputs_len);
assert!(self.untracked_read >= state.untracked_read);
self.untracked_read = state.untracked_read;
}
pub(super) fn add_read(
&mut self,
input: DependencyIndex,

View file

@ -183,25 +183,6 @@ impl LocalState {
self.with_query_stack(|stack| !stack.is_empty())
}
/// Dangerous operation: executes `op` but ignores its effect on
/// the query dependencies. Useful for debugging statements, but
/// otherwise not to be toyed with!
pub(super) fn debug_probe<R>(&self, op: impl FnOnce() -> R) -> R {
let saved_state: Option<_> =
self.with_query_stack(|stack| Some(stack.last()?.save_query_state()));
let result = op();
if let Some(saved_state) = saved_state {
self.with_query_stack(|stack| {
let active_query = stack.last_mut().expect("query stack not empty");
active_query.restore_query_state(saved_state);
});
}
result
}
/// Returns the index of the active query along with its *current* durability/changed-at
/// information. As the query continues to execute, naturally, that information may change.
pub(super) fn active_query(&self) -> Option<(DatabaseKeyIndex, StampedValue<()>)> {