]>
Commit | Line | Data |
---|---|---|
c34b1796 AL |
1 | % Intrinsics |
2 | ||
3 | > **Note**: intrinsics will forever have an unstable interface, it is | |
4 | > recommended to use the stable interfaces of libcore rather than intrinsics | |
5 | > directly. | |
6 | ||
7 | These are imported as if they were FFI functions, with the special | |
8 | `rust-intrinsic` ABI. For example, if one was in a freestanding | |
9 | context, but wished to be able to `transmute` between types, and | |
10 | perform efficient pointer arithmetic, one would import those functions | |
11 | via a declaration like | |
12 | ||
62682a34 | 13 | ```rust |
c1a9b12d | 14 | #![feature(intrinsics)] |
c34b1796 AL |
15 | # fn main() {} |
16 | ||
17 | extern "rust-intrinsic" { | |
18 | fn transmute<T, U>(x: T) -> U; | |
19 | ||
20 | fn offset<T>(dst: *const T, offset: isize) -> *const T; | |
21 | } | |
22 | ``` | |
23 | ||
24 | As with any other FFI functions, these are always `unsafe` to call. | |
25 |