diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-06-01 03:14:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-01 03:14:10 +0200 |
| commit | 2e3417a82d8480a96832842193c7100d32d2db1c (patch) | |
| tree | ea4bfcaac27e4889d4d21bf359f74695d3778e2f | |
| parent | fa2943975a34f3705f869968b03c268be718e744 (diff) | |
| parent | 1fbc037da6fea06b572391f5e3fe24c6903d8dae (diff) | |
| download | rust-2e3417a82d8480a96832842193c7100d32d2db1c.tar.gz rust-2e3417a82d8480a96832842193c7100d32d2db1c.zip | |
Rollup merge of #72818 - GuillaumeGomez:cleanup-e0622, r=Dylan-DPC
Clean up E0622 explanation r? @Dylan-DPC
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0622.md | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/librustc_error_codes/error_codes/E0622.md b/src/librustc_error_codes/error_codes/E0622.md index 1de81dabb29..990a2549412 100644 --- a/src/librustc_error_codes/error_codes/E0622.md +++ b/src/librustc_error_codes/error_codes/E0622.md @@ -5,8 +5,7 @@ Erroneous code example: ```compile_fail,E0622 #![feature(intrinsics)] extern "rust-intrinsic" { - pub static breakpoint : unsafe extern "rust-intrinsic" fn(); - // error: intrinsic must be a function + pub static breakpoint : fn(); // error: intrinsic must be a function } fn main() { unsafe { breakpoint(); } } @@ -14,4 +13,13 @@ fn main() { unsafe { breakpoint(); } } An intrinsic is a function available for use in a given programming language whose implementation is handled specially by the compiler. In order to fix this -error, just declare a function. +error, just declare a function. Example: + +```no_run +#![feature(intrinsics)] +extern "rust-intrinsic" { + pub fn breakpoint(); // ok! +} + +fn main() { unsafe { breakpoint(); } } +``` |
