Skip to content

Conversation

@xdoardo
Copy link
Contributor

@xdoardo xdoardo commented Jan 4, 2026

When running the codegen-llvm test suite, the needs-target-std directive is automatically added if and only if the #![no_std] line is not seen and the needs-target-std directive was not already seen.

This is a best-effort help to make running the codegen-llvm test suite for targets that do not support std slightly easier. Ideally, with time, the tests that aren't marked as no_std but in fact only use types from core/alloc will be patched to reflect this, so that they can be reused for targets without std.

For an explanation of this patch instead of a patch that marks all the tests that aren't #![no_std] with needs-target-std, see this Zulip thread. Let me know if, instead, a patch adding the needs-target-std is preferred.

A simple test of the introduced behaviour is ./x test tests/codegen-llvm/align-fn.rs --target=riscv32e-unknown-none-elf --force-rerun -v. The test does not have the needs-target-std directive, but it is ignored with this message:

test [codegen] tests/codegen-llvm/align-fn.rs ... ignored, ignored if target does not support std

@rustbot
Copy link
Collaborator

rustbot commented Jan 4, 2026

compiletest directives have been modified. Please add or update docs for the
new or modified directive in src/doc/rustc-dev-guide/.

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jan 4, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 4, 2026

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

When running the codegen-llvm test suite, the "needs-target-std"
directive is automatically added if and only if the "#![no_std]" line is
not seen and the "needs-target-std" directive was not already seen.

This is a best-effort utility to make running the codegen-llvm test
suite for targets that do not support std slightly easier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants