diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-06-12 00:05:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-12 00:05:29 +0200 |
| commit | 6baf867882da93f1a5132a2bde251549009eadf4 (patch) | |
| tree | f1afadcb4b67e8b84a47dccdeca9268d98184886 | |
| parent | 3b41e54799754fcdc7ae0429bd8fd64b5bd5a1fd (diff) | |
| parent | 68b4c03dbced1a0eae38138a7dd8ecb3ca30c02f (diff) | |
| download | rust-6baf867882da93f1a5132a2bde251549009eadf4.tar.gz rust-6baf867882da93f1a5132a2bde251549009eadf4.zip | |
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
| -rw-r--r-- | src/librustc_error_codes/error_codes.rs | 2 | ||||
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0724.md | 24 | ||||
| -rw-r--r-- | src/test/ui/ffi_returns_twice.stderr | 1 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 285242647b3..3fb5e04efc9 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -409,6 +409,7 @@ E0718: include_str!("./error_codes/E0718.md"), 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 @@ E0762: include_str!("./error_codes/E0762.md"), 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 diff --git a/src/librustc_error_codes/error_codes/E0724.md b/src/librustc_error_codes/error_codes/E0724.md new file mode 100644 index 00000000000..7a7ba154854 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0724.md @@ -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(); +} +``` diff --git a/src/test/ui/ffi_returns_twice.stderr b/src/test/ui/ffi_returns_twice.stderr index 862892e27be..2b7f5694f02 100644 --- a/src/test/ui/ffi_returns_twice.stderr +++ b/src/test/ui/ffi_returns_twice.stderr @@ -6,3 +6,4 @@ LL | #[ffi_returns_twice] error: aborting due to previous error +For more information about this error, try `rustc --explain E0724`. |
