Add E0619 error explanation

This commit is contained in:
Guillaume Gomez 2017-06-29 00:02:21 +02:00
parent e72580cf09
commit aa3fa25476
3 changed files with 27 additions and 24 deletions

View File

@ -4666,6 +4666,7 @@ i_am_a_function();
"##,
E0619: r##"
<<<<<<< HEAD
The type-checker needed to know the type of an expression, but that type had not
yet been inferred.
@ -4726,6 +4727,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! {

View File

@ -1,4 +1,4 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -8,11 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
let x;
match x {
(..) => {} //~ ERROR E0619
_ => {}
}
#![feature(intrinsics)]
extern "rust-intrinsic" {
pub static breakpoint : unsafe extern "rust-intrinsic" fn();
//~^ ERROR intrinsic must be a function [E0619]
}
fn main() { unsafe { breakpoint(); } }

View File

@ -1,16 +0,0 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(intrinsics)]
extern "rust-intrinsic" {
pub static breakpoint : unsafe extern "rust-intrinsic" fn();
//~^ ERROR intrinsic must be a function
}
fn main() { unsafe { breakpoint(); } }