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.
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.
11 #![allow(non_snake_case)]
13 register_long_diagnostics! {
16 Invalid monomorphization of an intrinsic function was used. Erroneous code
19 ```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
20 #![feature(platform_intrinsics)]
22 extern "platform-intrinsic" {
23 fn simd_add<T>(a: T, b: T) -> T;
27 unsafe { simd_add(0, 1); }
28 // error: invalid monomorphization of `simd_add` intrinsic
32 The generic type has to be a SIMD type. Example:
35 #![feature(repr_simd)]
36 #![feature(platform_intrinsics)]
39 #[derive(Copy, Clone)]
40 struct i32x2(i32, i32);
42 extern "platform-intrinsic" {
43 fn simd_add<T>(a: T, b: T) -> T;
46 unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
51 Malformed inline assembly rejected by LLVM.
53 LLVM checks the validity of the constraints and the assembly string passed to
54 it. This error implies that LLVM seems something wrong with the inline
57 In particular, it can happen if you forgot the closing bracket of a register
58 constraint (see issue #51430):
59 ```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
65 asm!("" :"={rax"(rax));
66 println!("Accumulator is: {}", rax);