diff options
| author | Jieyou Xu <jieyouxu@outlook.com> | 2025-04-23 17:18:20 +0800 |
|---|---|---|
| committer | Jieyou Xu <jieyouxu@outlook.com> | 2025-04-23 17:18:20 +0800 |
| commit | f2ab763c20c468411cd99bc367b479c12c44fd25 (patch) | |
| tree | e4133466891b80a154104ecd26807aaf8ebd9ff1 /src/doc/rustc-dev-guide | |
| parent | c79f15687a7eb01bf9eab041fe0401770268cec9 (diff) | |
| download | rust-f2ab763c20c468411cd99bc367b479c12c44fd25.tar.gz rust-f2ab763c20c468411cd99bc367b479c12c44fd25.zip | |
rustc-dev-guide: document that `//@ add-core-stubs` imply `-Cforce-unwind-tables=yes`
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/tests/minicore.md | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/doc/rustc-dev-guide/src/tests/minicore.md b/src/doc/rustc-dev-guide/src/tests/minicore.md index e4853b6d40e..507b259e027 100644 --- a/src/doc/rustc-dev-guide/src/tests/minicore.md +++ b/src/doc/rustc-dev-guide/src/tests/minicore.md @@ -6,25 +6,37 @@ ui/codegen/assembly test suites. It provides `core` stubs for tests that need to build for cross-compiled targets but do not need/want to run. +<div class="warning"> +Please note that [`minicore`] is only intended for `core` items, and explicitly +**not** `std` or `alloc` items because `core` items are applicable to a wider +range of tests. +</div> + A test can use [`minicore`] by specifying the `//@ add-core-stubs` directive. Then, mark the test with `#![feature(no_core)]` + `#![no_std]` + `#![no_core]`. Due to Edition 2015 extern prelude rules, you will probably need to declare `minicore` as an extern crate. +## Implied compiler flags + Due to the `no_std` + `no_core` nature of these tests, `//@ add-core-stubs` implies and requires that the test will be built with `-C panic=abort`. -Unwinding panics are not supported. +**Unwinding panics are not supported.** + +Tests will also be built with `-C force-unwind-tables=yes` to preserve CFI +directives in assembly tests. + +TL;DR: `//@ add-core-stubs` implies two compiler flags: + +1. `-C panic=abort` +2. `-C force-unwind-tables=yes` + +## Adding more `core` stubs If you find a `core` item to be missing from the [`minicore`] stub, consider adding it to the test auxiliary if it's likely to be used or is already needed by more than one test. -<div class="warning"> -Please note that [`minicore`] is only intended for `core` items, and explicitly -**not** `std` or `alloc` items because `core` items are applicable to a wider -range of tests. -</div> - ## Example codegen test that uses `minicore` ```rust,no_run |
