]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_llvm/diagnostics.rs
57cc33d09bbea94e1f36f7fa1c82fe58ae831ce5
[rust.git] / src / librustc_codegen_llvm / diagnostics.rs
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 #![allow(non_snake_case)]
12
13 register_long_diagnostics! {
14
15 E0511: r##"
16 Invalid monomorphization of an intrinsic function was used. Erroneous code
17 example:
18
19 ```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
20 #![feature(platform_intrinsics)]
21
22 extern "platform-intrinsic" {
23     fn simd_add<T>(a: T, b: T) -> T;
24 }
25
26 fn main() {
27     unsafe { simd_add(0, 1); }
28     // error: invalid monomorphization of `simd_add` intrinsic
29 }
30 ```
31
32 The generic type has to be a SIMD type. Example:
33
34 ```
35 #![feature(repr_simd)]
36 #![feature(platform_intrinsics)]
37
38 #[repr(simd)]
39 #[derive(Copy, Clone)]
40 struct i32x2(i32, i32);
41
42 extern "platform-intrinsic" {
43     fn simd_add<T>(a: T, b: T) -> T;
44 }
45
46 unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
47 ```
48 "##,
49
50 }
51
52
53 register_diagnostics! {
54     E0558
55 }