Description
PR #38914 has added a tidy check for gate tests in compile-fail for all unstable lang features, helping ensure that they are actually unstable. See also issue #22820.
To be recognized as gate test for a specific feature, tests either need to follow a naming scheme feature-gate-NAME-OF-THE-FEAT.rs
or include a // gate-test-NAME-OF-THE-FEAT
comment. For most of the currently present features, I could easily find matching tests in the test suite. Sadly, there is still a whitelist of currently 20 features for which it tolerates that it can't detect any gate tests.
The goal is to eliminate that whitelist, which this issue is tracking.
The features on the whitelist fall into the following categories:
Has already tests, they just need to be marked (found this out only on a second look):
-
more_struct_aliases
→ marked by PR [Gate Tests] - marking feature tests #39243 -
custom_attribute
→ marked by PR [Gate Tests] - marking feature tests #39243 -
default_type_parameter_fallback
→ marked by PR [Gate Tests] - marking feature tests #39243 -
use_extern_macros
→ marked by PR [Gate Tests] - marking feature tests #39243 -
quote
→ marked by PR [Gate Tests] - marking feature tests #39250 -
macro_reexport
→ marked by PR [Gate Tests] - marking feature tests #39250 -
inclusive_range_syntax
→ marked by PR Added test for inclusive_range_syntax in compile-fail test suite #40031
Used nowhere in the codebase. Remove?
got all removed by PR #39071
-
safe_suggestion
-
pushpop_unsafe
Needs a test (or I just haven't found a suiting test to mark, even on second look):
-
cfg_target_has_atomic
→ got a test by Add compile test for cfg_target_has_atomic #40150 -
simd
→ got a test by Add compile fail test for SIMD #40101 -
abi_ptx
→ got a test by Add compile fail test for abi_ptx #40168 -
const_indexing
→ got a test by PR Adding compile fail test for const_indexing feature #39700 -
stmt_expr_attributes
→ got a test by PR Add compile fail test for stmt_expr_attributes #40252 -
unwind_attributes
→ got a test by PR Add compile-fail tests for remaining items in whitelist and remove it #40279 -
static_recursion
→ got a test by PR static recursion test added to compile-fail test suite #39834 -
cfg_target_thread_local
→ got a test by PR Add compile-fail tests for remaining items in whitelist and remove it #40279 -
unboxed_closures
→ got a test by PR Add compile fail test for unboxed_closures feature #40047 -
staged_api
→ got a test by PR Adding compile fail test for staged_api feature #39772
Don't know what to do with this one. Any ideas?
-
reflect
→ removed by PR Remove Reflect #39075
The "Needs a test" section is a good place for beginners to help out!
You basically need to:
- if you haven't already, read
CONTRIBUTING.md
andCOMPILER_TESTS.md
- search in the
src/test/run-pass
suite for tests of that feature - copy one of those tests over to the compile-fail suite
- rename it appropriately (
feature-gate-FEAT-NAME.rs
) and remove the#![feature(...)]
line - remove the feature from the whitelist
- test locally (
./x.py test src/tools/tidy
and./x.py test src/test/compile-fail --test-args feature-gate-FEAT-NAME
) - submit a PR!
It would also be very good if you searched the compile-fail
testsuite for already existing gate tests and mark those instead. A good place to look is the PR that introduced that feature, they usually also add gate tests.
You can help out in the "Has already tests" section as well. Here, contributing is even easier!
You'll need to:
- read
CONTRIBUTING.md
andCOMPILER_TESTS.md
(second one is not strictly required, but it never harms :D) - add a line with
// gate-test-FEATURE_NAME
to the files that were mentioned above - remove the feature from the whitelist
- test locally (
./x.py test src/tools/tidy
, since you only added comments) - submit a PR!
If you need help, ask in this thread. Also, its best to prevent duplicate work, so it would be nice if you could announce that you work on some of the items. Thanks in advance!