Skip to content

Commit e7396aa

Browse files
committed
Add section about rustc_* TEST attrs to UI test chapter
1 parent fa362ad commit e7396aa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/tests/ui.md

+13
Original file line numberDiff line numberDiff line change
@@ -530,3 +530,16 @@ run something like the following to generate the alternate stderr file:
530530
```
531531

532532
Currently none of the compare modes are checked in CI for UI tests.
533+
534+
## `rustc_*` TEST attributes
535+
536+
The compiler defines several perma-unstable `#[rustc_*]` attributes gated behind the internal feature
537+
`rustc_attrs` that dump extra compiler-internal information. See the analogous subsection in
538+
[compiler debugging] for more details.
539+
540+
They can be used in tests to more precisely, legibly and easily test internal compiler state in cases
541+
where it would otherwise be very hard to do the same with "user-facing" Rust alone. Indeed, one could
542+
say that this slightly abuses the term "UI" (*user* interfacing) and turns such UI tests from black-box
543+
tests into white-box ones. Use them carefully and sparingly.
544+
545+
[compiler debugging]: ../compiler-debugging.md#rustc_-attributes

0 commit comments

Comments
 (0)