Skip to content

Commit

Permalink
Rollup merge of rust-lang#42957 - GuillaumeGomez:add-e0619, r=nikomat…
Browse files Browse the repository at this point in the history
…sakis

Add E0619 error explanation

r? @eddyb
  • Loading branch information
GuillaumeGomez authored Jun 30, 2017
2 parents 995f063 + 2c86ff4 commit ad914f2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, E0621,
"intrinsic must be a function")
.span_label(it.span, "expected a function")
.emit();
Expand Down
20 changes: 20 additions & 0 deletions src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4726,6 +4726,26 @@ let x = &[1_usize, 2] as &[usize]; // ok!
```
"##,

E0621: r##"
An intrinsic was declared without being a function.
Erroneous code example:
```compile_fail,E0621
#![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! {
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0619.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ fn main() {
_ => {}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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 [E0621]
}
fn main() { unsafe { breakpoint(); } }

0 comments on commit ad914f2

Please sign in to comment.