compiletest/codegen-llvm: automatically add needs-target-std if needed
#150672
+54
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running the codegen-llvm test suite, the
needs-target-stddirective is automatically added if and only if the#![no_std]line is not seen and theneeds-target-stddirective 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]withneeds-target-std, see this Zulip thread. Let me know if, instead, a patch adding theneeds-target-stdis 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 theneeds-target-stddirective, but it is ignored with this message: