]> git.proxmox.com Git - rustc.git/blob - src/doc/trpl/intrinsics.md
e0a8bb59e346a042119896a727cc0d0d986246ff
[rustc.git] / src / doc / trpl / intrinsics.md
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
13 ```rust
14 # #![feature(intrinsics)]
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