updated compiler tests for rustc_intrinsic'
Update compiler/rustc_error_codes/src/error_codes/E0622.md Co-authored-by: Ralf Jung <post@ralfj.de> reverted chages on E0622.md updated E0622.md
This commit is contained in:
parent
ebf0cf75d3
commit
a3669b8982
4 changed files with 17 additions and 25 deletions
|
@ -6,10 +6,9 @@ Erroneous code example:
|
||||||
#![feature(intrinsics)]
|
#![feature(intrinsics)]
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
#[rustc_intrinsic]
|
||||||
fn atomic_foo(); // error: unrecognized atomic operation
|
unsafe fn atomic_foo(); // error: unrecognized atomic operation
|
||||||
// function
|
// function
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Please check you didn't make a mistake in the function's name. All intrinsic
|
Please check you didn't make a mistake in the function's name. All intrinsic
|
||||||
|
@ -20,7 +19,6 @@ functions are defined in `compiler/rustc_codegen_llvm/src/intrinsic.rs` and in
|
||||||
#![feature(intrinsics)]
|
#![feature(intrinsics)]
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
#[rustc_intrinsic]
|
||||||
fn atomic_fence_seqcst(); // ok!
|
unsafe fn atomic_fence_seqcst(); // ok!
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -6,9 +6,8 @@ Erroneous code example:
|
||||||
#![feature(intrinsics)]
|
#![feature(intrinsics)]
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
#[rustc_intrinsic]
|
||||||
fn foo(); // error: unrecognized intrinsic function: `foo`
|
unsafe fn foo(); // error: unrecognized intrinsic function: `foo`
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -25,9 +24,8 @@ functions are defined in `compiler/rustc_codegen_llvm/src/intrinsic.rs` and in
|
||||||
#![feature(intrinsics)]
|
#![feature(intrinsics)]
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
#[rustc_intrinsic]
|
||||||
fn atomic_fence_seqcst(); // ok!
|
unsafe fn atomic_fence_seqcst(); // ok!
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -7,9 +7,8 @@ used. Erroneous code examples:
|
||||||
#![feature(intrinsics)]
|
#![feature(intrinsics)]
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
#[rustc_intrinsic]
|
||||||
fn unreachable(); // error: intrinsic has wrong type
|
unsafe fn unreachable(); // error: intrinsic has wrong type
|
||||||
}
|
|
||||||
|
|
||||||
// or:
|
// or:
|
||||||
|
|
||||||
|
@ -43,9 +42,8 @@ For the first code example, please check the function definition. Example:
|
||||||
#![feature(intrinsics)]
|
#![feature(intrinsics)]
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
#[rustc_intrinsic]
|
||||||
fn unreachable() -> !; // ok!
|
unsafe fn unreachable() -> !; // ok!
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The second case example is a bit particular: the main function must always
|
The second case example is a bit particular: the main function must always
|
||||||
|
|
|
@ -5,9 +5,8 @@ Erroneous code example:
|
||||||
```compile_fail,E0511
|
```compile_fail,E0511
|
||||||
#![feature(intrinsics)]
|
#![feature(intrinsics)]
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
#[rustc_intrinsic]
|
||||||
fn simd_add<T>(a: T, b: T) -> T;
|
unsafe fn simd_add<T>(a: T, b: T) -> T;
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe { simd_add(0, 1); }
|
unsafe { simd_add(0, 1); }
|
||||||
|
@ -25,9 +24,8 @@ The generic type has to be a SIMD type. Example:
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
struct i32x2([i32; 2]);
|
struct i32x2([i32; 2]);
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
#[rustc_intrinsic]
|
||||||
fn simd_add<T>(a: T, b: T) -> T;
|
unsafe fn simd_add<T>(a: T, b: T) -> T;
|
||||||
}
|
|
||||||
|
|
||||||
unsafe { simd_add(i32x2([0, 0]), i32x2([1, 2])); } // ok!
|
unsafe { simd_add(i32x2([0, 0]), i32x2([1, 2])); } // ok!
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue