Add long explanation for E0757
This commit is contained in:
25
compiler/rustc_error_codes/src/error_codes/E0757.md
Normal file
25
compiler/rustc_error_codes/src/error_codes/E0757.md
Normal file
@@ -0,0 +1,25 @@
|
||||
A function was given both the `ffi_const` and `ffi_pure` attributes.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0757
|
||||
#![feature(ffi_const, ffi_pure)]
|
||||
|
||||
extern "C" {
|
||||
#[ffi_const]
|
||||
#[ffi_pure] // error: `#[ffi_const]` function cannot be `#[ffi_pure]`
|
||||
pub fn square(num: i32) -> i32;
|
||||
}
|
||||
```
|
||||
|
||||
As `const` has a stricter set of requirements than `pure`, remove the `ffi_pure`
|
||||
attribute:
|
||||
|
||||
```
|
||||
#![feature(ffi_const)]
|
||||
|
||||
extern "C" {
|
||||
#[ffi_const]
|
||||
pub fn square(num: i32) -> i32;
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user