Skip to content

Commit f2ab763

Browse files
committed
rustc-dev-guide: document that //@ add-core-stubs imply -Cforce-unwind-tables=yes
1 parent c79f156 commit f2ab763

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/doc/rustc-dev-guide/src/tests/minicore.md

+19-7
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,37 @@
66
ui/codegen/assembly test suites. It provides `core` stubs for tests that need to
77
build for cross-compiled targets but do not need/want to run.
88

9+
<div class="warning">
10+
Please note that [`minicore`] is only intended for `core` items, and explicitly
11+
**not** `std` or `alloc` items because `core` items are applicable to a wider
12+
range of tests.
13+
</div>
14+
915
A test can use [`minicore`] by specifying the `//@ add-core-stubs` directive.
1016
Then, mark the test with `#![feature(no_core)]` + `#![no_std]` + `#![no_core]`.
1117
Due to Edition 2015 extern prelude rules, you will probably need to declare
1218
`minicore` as an extern crate.
1319

20+
## Implied compiler flags
21+
1422
Due to the `no_std` + `no_core` nature of these tests, `//@ add-core-stubs`
1523
implies and requires that the test will be built with `-C panic=abort`.
16-
Unwinding panics are not supported.
24+
**Unwinding panics are not supported.**
25+
26+
Tests will also be built with `-C force-unwind-tables=yes` to preserve CFI
27+
directives in assembly tests.
28+
29+
TL;DR: `//@ add-core-stubs` implies two compiler flags:
30+
31+
1. `-C panic=abort`
32+
2. `-C force-unwind-tables=yes`
33+
34+
## Adding more `core` stubs
1735

1836
If you find a `core` item to be missing from the [`minicore`] stub, consider
1937
adding it to the test auxiliary if it's likely to be used or is already needed
2038
by more than one test.
2139

22-
<div class="warning">
23-
Please note that [`minicore`] is only intended for `core` items, and explicitly
24-
**not** `std` or `alloc` items because `core` items are applicable to a wider
25-
range of tests.
26-
</div>
27-
2840
## Example codegen test that uses `minicore`
2941

3042
```rust,no_run

0 commit comments

Comments
 (0)