This is a tracking issue for an initiative of improving ui test suite organization and ui test usability. This issue is not meant for general discussions, but is instead intended for tracking logistics of PRs. For specific matters, please discuss in the zulip thread https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Discussion.20for.20ui.20test.20suite.20improvements.
Tip
Please don't claim this issue; it's intended to be available to be worked by multiple contributors.
ContextThe ui
test suite (tests/ui/
) has a lot of tests. Often, many ui tests suffer from:
tests/ui/
. Some ui tests fall into multiple categories, which is fine, but it may make sense to rehome an ui test if it's better organized under a different directory. See Tracking issue for moving ui tests to subdirectories #73494.The guiding rationale for improving ui test usability is to:
rustfmt
the test as it will regress test coverage.See Best practices for writing tests in rustc-dev-guide for advice on how to make ui tests more useful. However, don't take the advice at face value -- they should be evaluated on a case-by-case basis. For instance, some subdirectory might contain a collection of specific regression tests related to issues, and in that case having tests be named just issue-xxxxx.rs
isn't bad. On the contrary, a top-level issue-xxxxx.rs
under tests/ui/
is not very informative.
Example of things that might be done, but only if it makes sense on a case-by-case basis:
//! Issue: <https://github.com/rust-lang/rust/issues/374>.
or whatever useful relevant context.macro-empty-suggestion-span-123456.rs
.tests/ui/macro-empty-suggestion-span-123456.rs
-> tests/ui/hir-typeck/suggestions/macro-empty-suggestion-span-123456.rs
(hypothetical, or some other better organization).Because these require discretion (changes are not always improvements!), this issue is labeled E-medium
and not just E-easy
. Having "insider" compiler implementation knowledge helps a lot here.
No fixed format, adapt as suitable for the test at hand. But an example:
//! Check that `-A warnings` cli flag applies to *all* warnings, including feature gate warnings. //! //! This test tries to exercise that by checking that the "empty trait list for derive" warning for //! `#[derive()]` is permitted by `-A warnings`, which is a non-lint warning. //! //! # Relevant context //! //! - Original impl PR: <https://github.com/rust-lang/rust/pull/21248>. //! - RFC 507 "Release channels": //! <https://github.com/rust-lang/rfcs/blob/c017755b9bfa0421570d92ba38082302e0f3ad4f/text/0507-release-channels.md>.Long-term plan
tests/ui
and place them into suitable subdirectories, improving the tests themselves along the way. As of tests/ui
: A New Order [0/28] #143908, there are no more top-level tests/ui/*.rs
tests!tests/ui/
, and see if they need to be fusioned/fissioned/renamed or otherwise adjusted. Where suitable, we can also introduce some subdirectory-level README.md
to document subdirectory intention/area.tests/ui/issues/
directory and rehome the tests properly.Note: these are some of the earlier PRs (so not necessarily exhaustive), I may stop updating this listing if we have more PRs. Writing "Part of #133895" will cause the PR to still show-up via backlinks.
-l
and #[link(..)]
into tests/ui/link-native-libs
#133996tests/ui
(misc cleanups and improvements) [1/N] #133900tests/ui
(misc cleanups and improvements) [2/N] #134024tests/ui
(misc cleanups and improvements) [3/N] #134418tests/ui
(misc cleanups and improvements) [4/N] #140036not always problematic! Requires discretion. ↩
ehuss, Nadrieril, RalfJung, tshepang, reddevilmidzy and 3 more
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4