Skip to content

Tracking Issue for moving UI tests for libstd into unit tests #76268

Closed
@jyn514

Description

@jyn514

This is a tracking issue for switching UI tests in src/test/ui which only test the standard library into unit tests.

Rationale

This will:

  • Improve compile times for the test suite as a whole, since fewer binaries are being linked and run
  • Make it easier to find the code corresponding to a failing test
  • Allow running more tests without having to first build the stage1 compiler
  • Allow running more tests with miri (https://github.com/RalfJung/miri-test-libstd)

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Mentoring instructions (or rather, suggested workflow for contributors)

Please first leave a comment here stating that you want to work on file xxx.rs or module xxx, to make sure that this implements Sync.

  1. Find a test in src/test/ui that has both // run-pass and a use of the standard library. The test also cannot use //~ WARN or any other error annotations, since that is not supported by #[test]. For more information about annotations see https://rustc-dev-guide.rust-lang.org/tests/adding.html#header_commands; if there is an annotation on the test that can't be replicated with #[test] or #[cfg(...)], feel free to skip it.
rg run-pass src/test/ui -l | xargs rg '(std|alloc|core)::' -l | xargs rg -v 'WARN' -l
  1. Move the test into the relevant part of library/. Add a #[test] annotation so it will be run by x.py test library/std. Make sure that it is actually being run - you can be sure by running x.py test --stage 0 library/std --test-args name_of_the_new_test and seeing at least one test run.

If it is unclear whether run-pass exercises standard library or a particular facet of the compiler, you can look at the PR/commit that introduced the test. If it was introduced together with the stdlib API it exercises, then it definitely belongs to library/. If the test would still work with #![no_core], it's testing the compiler and not the standard library, and shouldn't be moved.

Implementation history

For other candidates, see, for example, the tests in https://github.com/rust-lang/rust/blob/master/src/test/ui/consts/std/net/ipv6.rs.

Mentoring instructions for reviewers

I highly recommend git show -w --reverse --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change <base>.., where <base> is git merge-base origin/master <tip commit> and <tip commit> is the head of the branch.

@matklad has volunteered to review PRs implementing this. Add r? @matklad to the PR description to automatically assign review to them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testsuiteArea: The testsuite used to check the correctness of rustcC-cleanupCategory: PRs that clean code up or issues documenting cleanup.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Libs-TrackedLibs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions