Skip to content

Commit 162b5a3

Browse files
Fix error codes mixup
1 parent aa3fa25 commit 162b5a3

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

src/librustc_typeck/check/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn equate_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
3737
match it.node {
3838
hir::ForeignItemFn(..) => {}
3939
_ => {
40-
struct_span_err!(tcx.sess, it.span, E0619,
40+
struct_span_err!(tcx.sess, it.span, E0622,
4141
"intrinsic must be a function")
4242
.span_label(it.span, "expected a function")
4343
.emit();

src/librustc_typeck/diagnostics.rs

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

46684668
E0619: r##"
4669-
<<<<<<< HEAD
46704669
The type-checker needed to know the type of an expression, but that type had not
46714670
yet been inferred.
46724671
@@ -4727,12 +4726,12 @@ let x = &[1_usize, 2] as &[usize]; // ok!
47274726
```
47284727
"##,
47294728

4730-
E0621: r##"
4729+
E0622: r##"
47314730
An intrinsic was declared without being a function.
47324731
47334732
Erroneous code example:
47344733
4735-
```compile_fail,E0621
4734+
```compile_fail,E0622
47364735
#![feature(intrinsics)]
47374736
extern "rust-intrinsic" {
47384737
pub static breakpoint : unsafe extern "rust-intrinsic" fn();

src/test/compile-fail/E0619.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 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,9 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

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

src/test/compile-fail/E0622.rs

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

0 commit comments

Comments
 (0)