]>
Commit | Line | Data |
---|---|---|
8bb4bdeb XL |
1 | # `intrinsics` |
2 | ||
3 | The tracking issue for this feature is: None. | |
4 | ||
5 | Intrinsics are never intended to be stable directly, but intrinsics are often | |
6 | exported in some sort of stable manner. Prefer using the stable interfaces to | |
7 | the intrinsic directly when you can. | |
8 | ||
9 | ------------------------ | |
c34b1796 | 10 | |
c34b1796 AL |
11 | |
12 | These are imported as if they were FFI functions, with the special | |
13 | `rust-intrinsic` ABI. For example, if one was in a freestanding | |
14 | context, but wished to be able to `transmute` between types, and | |
15 | perform efficient pointer arithmetic, one would import those functions | |
16 | via a declaration like | |
17 | ||
62682a34 | 18 | ```rust |
c1a9b12d | 19 | #![feature(intrinsics)] |
c34b1796 AL |
20 | # fn main() {} |
21 | ||
22 | extern "rust-intrinsic" { | |
23 | fn transmute<T, U>(x: T) -> U; | |
24 | ||
25 | fn offset<T>(dst: *const T, offset: isize) -> *const T; | |
26 | } | |
27 | ``` | |
28 | ||
29 | As with any other FFI functions, these are always `unsafe` to call. |