about summary refs log tree commit diff
path: root/compiler/rustc_data_structures
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-26 05:47:23 +0000
committerbors <bors@rust-lang.org>2021-01-26 05:47:23 +0000
commita8f707553276a15565860af3d415aae18428aa96 (patch)
treecab6b5b5c79128ae7a396ce82fed0173356d3d66 /compiler/rustc_data_structures
parentff6ee2a70218543f410e557f390e246131847572 (diff)
parent056fbbf7eee75f503c2a037046101df91a2f7e2f (diff)
downloadrust-a8f707553276a15565860af3d415aae18428aa96.tar.gz
rust-a8f707553276a15565860af3d415aae18428aa96.zip
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.
Diffstat (limited to 'compiler/rustc_data_structures')
-rw-r--r--compiler/rustc_data_structures/src/stable_hasher.rs1
-rw-r--r--compiler/rustc_data_structures/src/steal.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs
index 579eb1cb7da..3850c9b74fd 100644
--- a/compiler/rustc_data_structures/src/stable_hasher.rs
+++ b/compiler/rustc_data_structures/src/stable_hasher.rs
@@ -552,6 +552,7 @@ pub fn hash_stable_hashmap<HCX, K, V, R, SK, F>(
 
 /// A vector container that makes sure that its items are hashed in a stable
 /// order.
+#[derive(Debug)]
 pub struct StableVec<T>(Vec<T>);
 
 impl<T> StableVec<T> {
diff --git a/compiler/rustc_data_structures/src/steal.rs b/compiler/rustc_data_structures/src/steal.rs
index 7f9e4160fcd..30f659c2f71 100644
--- a/compiler/rustc_data_structures/src/steal.rs
+++ b/compiler/rustc_data_structures/src/steal.rs
@@ -21,6 +21,7 @@ use crate::sync::{MappedReadGuard, ReadGuard, RwLock};
 /// -- once the value is stolen -- it will never be read from again.
 //
 // FIXME(#41710): what is the best way to model linear queries?
+#[derive(Debug)]
 pub struct Steal<T> {
     value: RwLock<Option<T>>,
 }