Skip to content

Commit 06f8bf6

Browse files
committed
document Miri extern functions
1 parent bc05692 commit 06f8bf6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,29 @@ different Miri binaries, and as such worth documenting:
233233
interpret the code but compile it like rustc would. This is useful to be sure
234234
that the compiled `rlib`s are compatible with Miri.
235235

236+
## Miri `extern` functions
237+
238+
Miri provides some `extern` functions that programs can import to access
239+
Miri-specific functionality:
240+
241+
```rust
242+
#[cfg(miri)]
243+
extern "Rust" {
244+
/// Miri-provided extern function to mark the block `ptr` points to as a "root"
245+
/// for some static memory. This memory and everything reachable by it is not
246+
/// considered leaking even if it still exists when the program terminates.
247+
///
248+
/// `ptr` has to point to the beginning of an allocated block.
249+
fn miri_static_root(ptr: *const u8);
250+
251+
/// Miri-provided extern function to begin unwinding with the given payload.
252+
///
253+
/// This is internal and unstable and should not be used; we give it here
254+
/// just to be complete.
255+
fn miri_start_panic(payload: *mut u8) -> !;
256+
}
257+
```
258+
236259
## Contributing and getting help
237260

238261
If you want to contribute to Miri, great! Please check out our

0 commit comments

Comments
 (0)