Skip to content

Commit 6baf867

Browse files
authored
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
2 parents 3b41e54 + 68b4c03 commit 6baf867

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/librustc_error_codes/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ E0718: include_str!("./error_codes/E0718.md"),
409409
E0719: include_str!("./error_codes/E0719.md"),
410410
E0720: include_str!("./error_codes/E0720.md"),
411411
E0723: include_str!("./error_codes/E0723.md"),
412+
E0724: include_str!("./error_codes/E0724.md"),
412413
E0725: include_str!("./error_codes/E0725.md"),
413414
E0727: include_str!("./error_codes/E0727.md"),
414415
E0728: include_str!("./error_codes/E0728.md"),
@@ -617,7 +618,6 @@ E0762: include_str!("./error_codes/E0762.md"),
617618
E0717, // rustc_promotable without stability attribute
618619
// E0721, // `await` keyword
619620
E0722, // Malformed `#[optimize]` attribute
620-
E0724, // `#[ffi_returns_twice]` is only allowed in foreign functions
621621
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
622622
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
623623
E0755, // `#[ffi_pure]` is only allowed on foreign functions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
`#[ffi_returns_twice]` was used on non-foreign function.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0724
6+
#![feature(ffi_returns_twice)]
7+
#![crate_type = "lib"]
8+
9+
#[ffi_returns_twice] // error!
10+
pub fn foo() {}
11+
```
12+
13+
`#[ffi_returns_twice]` can only be used on foreign function declarations.
14+
For example, we might correct the previous example by declaring
15+
the function inside of an `extern` block.
16+
17+
```
18+
#![feature(ffi_returns_twice)]
19+
20+
extern {
21+
#[ffi_returns_twice] // ok!
22+
pub fn foo();
23+
}
24+
```

src/test/ui/ffi_returns_twice.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | #[ffi_returns_twice]
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0724`.

0 commit comments

Comments
 (0)