Fix error codes mixup

This commit is contained in:
Guillaume Gomez 2017-06-29 21:03:19 +02:00
parent aa3fa25476
commit 162b5a3475
4 changed files with 28 additions and 10 deletions

View file

@ -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();

View file

@ -4666,7 +4666,6 @@ fn 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.
@ -4727,12 +4726,12 @@ fn i_am_a_function() {}
```
"##,
E0621: r##"
E0622: r##"
An intrinsic was declared without being a function.
Erroneous code example:
```compile_fail,E0621
```compile_fail,E0622
#![feature(intrinsics)]
extern "rust-intrinsic" {
pub static breakpoint : unsafe extern "rust-intrinsic" fn();

View file

@ -1,4 +1,4 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -8,9 +8,12 @@
// 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 [E0619]
fn main() {
let x;
match x {
(..) => {} //~ ERROR E0619
_ => {}
}
}
fn main() { unsafe { breakpoint(); } }

View file

@ -0,0 +1,16 @@
// 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 [E0622]
}
fn main() { unsafe { breakpoint(); } }