]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0755.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0755.md
1 The `ffi_pure` attribute was used on a non-foreign function.
2
3 Erroneous code example:
4
5 ```compile_fail,E0755
6 #![feature(ffi_pure)]
7
8 #[ffi_pure] // error!
9 pub fn foo() {}
10 # fn main() {}
11 ```
12
13 The `ffi_pure` attribute can only be used on foreign functions which do not have
14 side effects or infinite loops:
15
16 ```
17 #![feature(ffi_pure)]
18
19 extern "C" {
20     #[ffi_pure] // ok!
21     pub fn strlen(s: *const i8) -> isize;
22 }
23 # fn main() {}
24 ```
25
26 You can find more information about it in the [unstable Rust Book].
27
28 [unstable Rust Book]: https://doc.rust-lang.org/unstable-book/language-features/ffi-pure.html