Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f7c2eca
Choose a base ref
...
head repository: rust-lang/rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a18a278
Choose a head ref
  • 1 commit
  • 5 files changed
  • 1 contributor

Commits on Mar 18, 2025

  1. 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
    BLANKatGITHUB committed Mar 18, 2025
    Copy the full SHA
    a18a278 View commit details
12 changes: 5 additions & 7 deletions compiler/rustc_error_codes/src/error_codes/E0092.md
Original file line number Diff line number Diff line change
@@ -6,10 +6,9 @@ Erroneous code example:
#![feature(intrinsics)]
#![allow(internal_features)]
extern "rust-intrinsic" {
fn atomic_foo(); // error: unrecognized atomic operation
// function
}
#[rustc_intrinsic]
unsafe fn atomic_foo(); // error: unrecognized atomic operation
// function
```

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)]
#![allow(internal_features)]
extern "rust-intrinsic" {
fn atomic_fence_seqcst(); // ok!
}
#[rustc_intrinsic]
unsafe fn atomic_fence_seqcst(); // ok!
```
10 changes: 4 additions & 6 deletions compiler/rustc_error_codes/src/error_codes/E0093.md
Original file line number Diff line number Diff line change
@@ -6,9 +6,8 @@ Erroneous code example:
#![feature(intrinsics)]
#![allow(internal_features)]
extern "rust-intrinsic" {
fn foo(); // error: unrecognized intrinsic function: `foo`
}
#[rustc_intrinsic]
unsafe fn foo(); // error: unrecognized intrinsic function: `foo`
fn main() {
unsafe {
@@ -25,9 +24,8 @@ functions are defined in `compiler/rustc_codegen_llvm/src/intrinsic.rs` and in
#![feature(intrinsics)]
#![allow(internal_features)]
extern "rust-intrinsic" {
fn atomic_fence_seqcst(); // ok!
}
#[rustc_intrinsic]
unsafe fn atomic_fence_seqcst(); // ok!
fn main() {
unsafe {
10 changes: 4 additions & 6 deletions compiler/rustc_error_codes/src/error_codes/E0211.md
Original file line number Diff line number Diff line change
@@ -7,9 +7,8 @@ used. Erroneous code examples:
#![feature(intrinsics)]
#![allow(internal_features)]
extern "rust-intrinsic" {
fn unreachable(); // error: intrinsic has wrong type
}
#[rustc_intrinsic]
unsafe fn unreachable(); // error: intrinsic has wrong type
// or:
@@ -43,9 +42,8 @@ For the first code example, please check the function definition. Example:
#![feature(intrinsics)]
#![allow(internal_features)]
extern "rust-intrinsic" {
fn unreachable() -> !; // ok!
}
#[rustc_intrinsic]
unsafe fn unreachable() -> !; // ok!
```

The second case example is a bit particular: the main function must always
10 changes: 4 additions & 6 deletions compiler/rustc_error_codes/src/error_codes/E0511.md
Original file line number Diff line number Diff line change
@@ -5,9 +5,8 @@ Erroneous code example:
```compile_fail,E0511
#![feature(intrinsics)]
extern "rust-intrinsic" {
fn simd_add<T>(a: T, b: T) -> T;
}
#[rustc_intrinsic]
unsafe fn simd_add<T>(a: T, b: T) -> T;
fn main() {
unsafe { simd_add(0, 1); }
@@ -25,9 +24,8 @@ The generic type has to be a SIMD type. Example:
#[derive(Copy, Clone)]
struct i32x2([i32; 2]);
extern "rust-intrinsic" {
fn simd_add<T>(a: T, b: T) -> T;
}
#[rustc_intrinsic]
unsafe fn simd_add<T>(a: T, b: T) -> T;
unsafe { simd_add(i32x2([0, 0]), i32x2([1, 2])); } // ok!
```
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0622.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ Erroneous code example:
#![allow(internal_features)]
extern "rust-intrinsic" {
pub static atomic_singlethreadfence_seqcst: fn();
pub static atomic_singlethreadfence_seqcst: fn() = || {};
// error: intrinsic must be a function
}
@@ -23,7 +23,7 @@ error, just declare a function. Example:
#![allow(internal_features)]
extern "rust-intrinsic" {
pub fn atomic_singlethreadfence_seqcst(); // ok!
pub unsafe fn atomic_singlethreadfence_seqcst(); // ok!
}
fn main() { unsafe { atomic_singlethreadfence_seqcst(); } }