Clean up E0622 explanation

This commit is contained in:
Guillaume Gomez 2020-05-31 14:09:15 +02:00
parent 698c5c6d95
commit 1fbc037da6

View file

@ -5,8 +5,7 @@ Erroneous code example:
```compile_fail,E0622 ```compile_fail,E0622
#![feature(intrinsics)] #![feature(intrinsics)]
extern "rust-intrinsic" { extern "rust-intrinsic" {
pub static breakpoint : unsafe extern "rust-intrinsic" fn(); pub static breakpoint : fn(); // error: intrinsic must be a function
// error: intrinsic must be a function
} }
fn main() { unsafe { breakpoint(); } } 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 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 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(); } }
```