2015-09-19 00:42:57 +02:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
|
|
|
register_long_diagnostics! {
|
|
|
|
|
2015-10-09 15:59:10 +02:00
|
|
|
E0511: r##"
|
|
|
|
Invalid monomorphization of an intrinsic function was used. Erroneous code
|
|
|
|
example:
|
|
|
|
|
2017-06-20 15:15:16 +08:00
|
|
|
```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
|
2016-02-07 13:02:52 +01:00
|
|
|
#![feature(platform_intrinsics)]
|
|
|
|
|
2015-10-09 15:59:10 +02:00
|
|
|
extern "platform-intrinsic" {
|
|
|
|
fn simd_add<T>(a: T, b: T) -> T;
|
|
|
|
}
|
|
|
|
|
2016-08-26 00:14:01 +02:00
|
|
|
fn main() {
|
|
|
|
unsafe { simd_add(0, 1); }
|
|
|
|
// error: invalid monomorphization of `simd_add` intrinsic
|
|
|
|
}
|
2015-10-09 15:59:10 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
The generic type has to be a SIMD type. Example:
|
|
|
|
|
|
|
|
```
|
2016-02-07 13:02:52 +01:00
|
|
|
#![feature(repr_simd)]
|
|
|
|
#![feature(platform_intrinsics)]
|
|
|
|
|
2015-10-09 15:59:10 +02:00
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone)]
|
2017-10-18 10:30:29 -07:00
|
|
|
struct i32x2(i32, i32);
|
2015-10-09 15:59:10 +02:00
|
|
|
|
|
|
|
extern "platform-intrinsic" {
|
|
|
|
fn simd_add<T>(a: T, b: T) -> T;
|
|
|
|
}
|
|
|
|
|
2017-10-18 10:30:29 -07:00
|
|
|
unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
|
2015-10-09 15:59:10 +02:00
|
|
|
```
|
|
|
|
"##,
|
2017-09-12 12:18:11 -07:00
|
|
|
|
|
|
|
E0558: r##"
|
|
|
|
The `export_name` attribute was malformed.
|
|
|
|
|
|
|
|
Erroneous code example:
|
|
|
|
|
|
|
|
```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
|
|
|
|
#[export_name] // error: export_name attribute has invalid format
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
```
|
|
|
|
|
|
|
|
The `export_name` attribute expects a string in order to determine the name of
|
|
|
|
the exported symbol. Example:
|
|
|
|
|
|
|
|
```
|
|
|
|
#[export_name = "some_function"] // ok!
|
|
|
|
pub fn something() {}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
```
|
|
|
|
"##,
|
|
|
|
|
2015-09-19 00:42:57 +02:00
|
|
|
}
|