Rollup merge of #73163 - ayushmishra2005:61137-add-long-error-code-e0724, r=davidtwco
Add long error explanation for E0724 Add long explanation for the E0724 error code Part of #61137
This commit is contained in:
commit
6baf867882
@ -409,6 +409,7 @@
|
||||
E0719: include_str!("./error_codes/E0719.md"),
|
||||
E0720: include_str!("./error_codes/E0720.md"),
|
||||
E0723: include_str!("./error_codes/E0723.md"),
|
||||
E0724: include_str!("./error_codes/E0724.md"),
|
||||
E0725: include_str!("./error_codes/E0725.md"),
|
||||
E0727: include_str!("./error_codes/E0727.md"),
|
||||
E0728: include_str!("./error_codes/E0728.md"),
|
||||
@ -617,7 +618,6 @@
|
||||
E0717, // rustc_promotable without stability attribute
|
||||
// E0721, // `await` keyword
|
||||
E0722, // Malformed `#[optimize]` attribute
|
||||
E0724, // `#[ffi_returns_twice]` is only allowed in foreign functions
|
||||
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
|
||||
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
|
||||
E0755, // `#[ffi_pure]` is only allowed on foreign functions
|
||||
|
24
src/librustc_error_codes/error_codes/E0724.md
Normal file
24
src/librustc_error_codes/error_codes/E0724.md
Normal file
@ -0,0 +1,24 @@
|
||||
`#[ffi_returns_twice]` was used on non-foreign function.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0724
|
||||
#![feature(ffi_returns_twice)]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#[ffi_returns_twice] // error!
|
||||
pub fn foo() {}
|
||||
```
|
||||
|
||||
`#[ffi_returns_twice]` can only be used on foreign function declarations.
|
||||
For example, we might correct the previous example by declaring
|
||||
the function inside of an `extern` block.
|
||||
|
||||
```
|
||||
#![feature(ffi_returns_twice)]
|
||||
|
||||
extern {
|
||||
#[ffi_returns_twice] // ok!
|
||||
pub fn foo();
|
||||
}
|
||||
```
|
@ -6,3 +6,4 @@ LL | #[ffi_returns_twice]
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0724`.
|
||||
|
Loading…
Reference in New Issue
Block a user