diff options
| -rw-r--r-- | src/librustc_typeck/check/intrinsic.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 5 | ||||
| -rw-r--r-- | src/test/compile-fail/E0619.rs | 15 | ||||
| -rw-r--r-- | src/test/compile-fail/E0622.rs | 16 |
4 files changed, 28 insertions, 10 deletions
diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 3acfbd1d844..96643ae72ab 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -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(); diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 8181dba1e96..37f6f3753d7 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -4666,7 +4666,6 @@ 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 @@ let x = &[1_usize, 2] as &[usize]; // ok! ``` "##, -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(); diff --git a/src/test/compile-fail/E0619.rs b/src/test/compile-fail/E0619.rs index 7c61a61f0bd..a5a5ff7218d 100644 --- a/src/test/compile-fail/E0619.rs +++ b/src/test/compile-fail/E0619.rs @@ -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(); } } + diff --git a/src/test/compile-fail/E0622.rs b/src/test/compile-fail/E0622.rs new file mode 100644 index 00000000000..f2bde5b0364 --- /dev/null +++ b/src/test/compile-fail/E0622.rs @@ -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(); } } |
