提交 bbdb21ef 编写于 作者: G Guillaume Gomez 提交者: GitHub

Rollup merge of #42957 - GuillaumeGomez:add-e0619, r=nikomatsakis

Add E0619 error explanation

r? @EddyB
......@@ -37,7 +37,7 @@ fn equate_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
match it.node {
hir::ForeignItemFn(..) => {}
_ => {
struct_span_err!(tcx.sess, it.span, E0619,
struct_span_err!(tcx.sess, it.span, E0622,
"intrinsic must be a function")
.span_label(it.span, "expected a function")
.emit();
......
......@@ -4726,6 +4726,26 @@ fn i_am_a_function() {}
```
"##,
E0622: r##"
An intrinsic was declared without being a function.
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
}
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.
"##,
}
register_diagnostics! {
......
......@@ -16,3 +16,4 @@ fn main() {
_ => {}
}
}
......@@ -11,6 +11,6 @@
#![feature(intrinsics)]
extern "rust-intrinsic" {
pub static breakpoint : unsafe extern "rust-intrinsic" fn();
//~^ ERROR intrinsic must be a function
//~^ ERROR intrinsic must be a function [E0622]
}
fn main() { unsafe { breakpoint(); } }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册