Skip to content

Commit 76d54c0

Browse files
Add E0619 error explanation
1 parent 686ec28 commit 76d54c0

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

src/librustc_typeck/diagnostics.rs

+21
Original file line numberDiff line numberDiff line change
@@ -4666,6 +4666,7 @@ i_am_a_function();
46664666
"##,
46674667

46684668
E0619: r##"
4669+
<<<<<<< HEAD
46694670
The type-checker needed to know the type of an expression, but that type had not
46704671
yet been inferred.
46714672
@@ -4726,6 +4727,26 @@ let x = &[1_usize, 2] as &[usize]; // ok!
47264727
```
47274728
"##,
47284729

4730+
E0621: r##"
4731+
An intrinsic was declared without being a function.
4732+
4733+
Erroneous code example:
4734+
4735+
```compile_fail,E0621
4736+
#![feature(intrinsics)]
4737+
extern "rust-intrinsic" {
4738+
pub static breakpoint : unsafe extern "rust-intrinsic" fn();
4739+
// error: intrinsic must be a function
4740+
}
4741+
4742+
fn main() { unsafe { breakpoint(); } }
4743+
```
4744+
4745+
An intrinsic is a function available for use in a given programming language
4746+
whose implementation is handled specially by the compiler. In order to fix this
4747+
error, just declare a function.
4748+
"##,
4749+
47294750
}
47304751

47314752
register_diagnostics! {

src/test/compile-fail/E0619.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,11 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn main() {
12-
let x;
13-
14-
match x {
15-
(..) => {} //~ ERROR E0619
16-
_ => {}
17-
}
11+
#![feature(intrinsics)]
12+
extern "rust-intrinsic" {
13+
pub static breakpoint : unsafe extern "rust-intrinsic" fn();
14+
//~^ ERROR intrinsic must be a function [E0619]
1815
}
16+
fn main() { unsafe { breakpoint(); } }

src/test/compile-fail/invalid-intrinsic.rs

-16
This file was deleted.

0 commit comments

Comments
 (0)