Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/tests/compiletest.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,26 @@ still pass.
cause an Internal Compiler Error (ICE). This is a highly specialized directive
to check that the incremental cache continues to work after an ICE.

[`tests/incremental`]: https://github.com/rust-lang/rust/tree/HEAD/tests/incremental

Incremental tests may use the attribute `#[rustc_clean(...)]` attribute. This attribute compares
the fingerprint from the current compilation session with the previous one.
The first revision should never have an active `rustc_clean` attribute, since it will always be dirty.

In the default mode, it asserts that the fingerprints must be the same.
The attribute takes the following arguments:

* `cfg="<cond>"` — checks the cfg condition `<cond>`, and only runs the check if the config condition evaluates to true.
This can be used to only run the `rustc_clean` attribute in a specific revision.
* `except="<query1>,<query2>,..."` — asserts that the query results for the listed queries must be different,
rather than the same.
* `loaded_from_disk="<query1>,<query2>,..."` — asserts that the query results for the listed queries
Comment on lines +197 to +201
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you also add a bullet about label?

if it's not too much trouble, it would be nice to update the template at https://github.com/rust-lang/rust/blob/646a3f8c15baefb98dc6e0c1c1ba3356db702d2a/compiler/rustc_feature/src/builtin_attrs.rs#L1493 as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I've looked at the source code in dirty_clean.rs for a few minutes but I don't fully understand how they work. I don't want to explain it incorrectly so I'll leave this one for someone else to add

were actually loaded from disk (not just marked green).
This can be useful to ensure that a test is actually exercising the deserialization
logic for a particular query result. This can be combined with `except`.

A simple example of a test using `rustc_clean` is the [hello_world test].

[`tests/incremental`]: https://github.com/rust-lang/rust/tree/7b42543/tests/incremental
[hello_world test]: https://github.com/rust-lang/rust/blob/646a3f8c15baefb98dc6e0c1c1ba3356db702d2a/tests/incremental/hello_world.rs

### Debuginfo tests

Expand Down
Loading