Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebank

Enforce that query results implement Debug

Currently, we require that query keys implement `Debug`, but we do not do the same for query values. This can make incremental compilation bugs difficult to debug - there isn't a good place to print out the result loaded from disk.

This PR adds `Debug` bounds to several query-related functions, allowing us to debug-print the query value when an 'unstable fingerprint' error occurs. This required adding `#[derive(Debug)]` to a fairly large number of types - hopefully, this doesn't have much of an impact on compiler bootstrapping times.
This commit is contained in:
bors
2021-01-26 05:47:23 +00:00
23 changed files with 46 additions and 34 deletions

View File

@@ -85,11 +85,13 @@ fn is_body_owner<'hir>(node: Node<'hir>, hir_id: HirId) -> bool {
}
}
#[derive(Debug)]
pub(super) struct HirOwnerData<'hir> {
pub(super) signature: Option<&'hir Owner<'hir>>,
pub(super) with_bodies: Option<&'hir mut OwnerNodes<'hir>>,
}
#[derive(Debug)]
pub struct IndexedHir<'hir> {
/// The SVH of the local crate.
pub crate_hash: Svh,

View File

@@ -17,6 +17,7 @@ use rustc_hir::*;
use rustc_index::vec::IndexVec;
use rustc_span::DUMMY_SP;
#[derive(Debug)]
pub struct Owner<'tcx> {
parent: HirId,
node: Node<'tcx>,
@@ -32,12 +33,13 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for Owner<'tcx> {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct ParentedNode<'tcx> {
parent: ItemLocalId,
node: Node<'tcx>,
}
#[derive(Debug)]
pub struct OwnerNodes<'tcx> {
hash: Fingerprint,
nodes: IndexVec<ItemLocalId, Option<ParentedNode<'tcx>>>,