about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-12-21 16:31:35 -0500
committerAaron Hill <aa1ronham@gmail.com>2021-12-21 16:34:12 -0500
commitf1d682334d07e125595bb73735b6045bedfb30c4 (patch)
tree75b6c4b5469f4166668ab3c67721ee0a169240b0 /src
parente100ec5bc7cd768ec17d75448b29c9ab4a39272b (diff)
downloadrust-f1d682334d07e125595bb73735b6045bedfb30c4.tar.gz
rust-f1d682334d07e125595bb73735b6045bedfb30c4.zip
Add `#[rustc_clean(loaded_from_disk)]` to assert loading of query result
Currently, you can use `#[rustc_clean]` to assert to that a particular
query (technically, a `DepNode`) is green or red. However, a green
`DepNode` does not mean that the query result was actually deserialized
from disk - we might have never re-run a query that needed the result.

Some incremental tests are written as regression tests for ICEs that
occured during query result decoding. Using
`#[rustc_clean(loaded_from_disk="typeck")]`, you can now assert
that the result of a particular query (e.g. `typeck`) was actually
loaded from disk, in addition to being green.
Diffstat (limited to 'src')
-rw-r--r--src/test/incremental/change_private_fn/struct_point.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/incremental/change_private_fn/struct_point.rs b/src/test/incremental/change_private_fn/struct_point.rs
index 1791c089cfa..d57267adc6b 100644
--- a/src/test/incremental/change_private_fn/struct_point.rs
+++ b/src/test/incremental/change_private_fn/struct_point.rs
@@ -51,7 +51,11 @@ pub mod point {
 pub mod fn_calls_methods_in_same_impl {
     use point::Point;
 
-    #[rustc_clean(cfg="cfail2")]
+    // The cached result should actually be loaded from disk
+    // (not just marked green) - for example, `DeadVisitor`
+    // always runs during compilation as a "pass", and loads
+    // the typeck results for bodies.
+    #[rustc_clean(cfg="cfail2", loaded_from_disk="typeck")]
     pub fn check() {
         let x = Point { x: 2.0, y: 2.0 };
         x.distance_from_origin();