diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-02-19 17:35:12 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-03-04 16:13:50 +0000 |
| commit | 1e57df19697fd4f7f1e9dfd24ccfb00051c25bda (patch) | |
| tree | f0730d02b56b2eb8d180b1845f8e0a88557b3938 /src | |
| parent | f2612daf58bfa2d747ddae02243a6ec1d6528992 (diff) | |
| download | rust-1e57df19697fd4f7f1e9dfd24ccfb00051c25bda.tar.gz rust-1e57df19697fd4f7f1e9dfd24ccfb00051c25bda.zip | |
Add a scheme for moving away from `extern "rust-intrinsic"` entirely
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/intrinsics.md | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/doc/unstable-book/src/language-features/intrinsics.md b/src/doc/unstable-book/src/language-features/intrinsics.md index 1a8c1c0b36a..02a009d56d3 100644 --- a/src/doc/unstable-book/src/language-features/intrinsics.md +++ b/src/doc/unstable-book/src/language-features/intrinsics.md @@ -52,12 +52,23 @@ with any regular function. Various intrinsics have native MIR operations that they correspond to. Instead of requiring backends to implement both the intrinsic and the MIR operation, the `lower_intrinsics` pass will convert the calls to the MIR operation. Backends do not need to know about these intrinsics -at all. +at all. These intrinsics only make sense without a body, and can either be declared as a "rust-intrinsic" +or as a `#[rustc_intrinsic]`. The body is never used, as calls to the intrinsic do not exist +anymore after MIR analyses. ## Intrinsics without fallback logic These must be implemented by all backends. +### `#[rustc_intrinsic]` declarations + +These are written like intrinsics with fallback bodies, but the body is irrelevant. +Use `loop {}` for the body or call the intrinsic recursively and add +`#[rustc_intrinsic_must_be_overridden]` to the function to ensure that backends don't +invoke the body. + +### Legacy extern ABI based intrinsics + These are imported as if they were FFI functions, with the special `rust-intrinsic` ABI. For example, if one was in a freestanding context, but wished to be able to `transmute` between types, and |
