Skip to content

Commit

Permalink
Rollup merge of #135936 - RalfJung:reify-intrinsic, r=oli-obk
Browse files Browse the repository at this point in the history
fix reify-intrinsic test

These are no longer `extern "rust-intrinsic"` functions so it no longer makes sense to try to cast them to that type.

r? `@oli-obk`
  • Loading branch information
matthiaskrgr authored Jan 24, 2025
2 parents 556d901 + b88dea2 commit 109def5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions tests/ui/intrinsics/reify-intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
#![feature(core_intrinsics, intrinsics)]

fn a() {
let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::transmute;
let _: unsafe fn(isize) -> usize = std::mem::transmute;
//~^ ERROR cannot coerce
}

fn b() {
let _ = std::mem::transmute as unsafe extern "rust-intrinsic" fn(isize) -> usize;
let _ = std::mem::transmute as unsafe fn(isize) -> usize;
//~^ ERROR casting
}

fn c() {
let _: [unsafe extern "rust-intrinsic" fn(f32) -> f32; 2] = [
let _: [unsafe fn(f32) -> f32; 2] = [
std::intrinsics::floorf32, //~ ERROR cannot coerce
std::intrinsics::log2f32,
];
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/intrinsics/reify-intrinsic.stderr
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
error[E0308]: cannot coerce intrinsics to function pointers
--> $DIR/reify-intrinsic.rs:6:64
--> $DIR/reify-intrinsic.rs:6:40
|
LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::transmute;
| ------------------------------------------------- ^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
LL | let _: unsafe fn(isize) -> usize = std::mem::transmute;
| ------------------------- ^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
| |
| expected due to this
|
= note: expected fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize`
= note: expected fn pointer `unsafe fn(isize) -> usize`
found fn item `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`

error[E0606]: casting `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid
error[E0606]: casting `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}` as `unsafe fn(isize) -> usize` is invalid
--> $DIR/reify-intrinsic.rs:11:13
|
LL | let _ = std::mem::transmute as unsafe extern "rust-intrinsic" fn(isize) -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | let _ = std::mem::transmute as unsafe fn(isize) -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: cannot coerce intrinsics to function pointers
--> $DIR/reify-intrinsic.rs:17:9
|
LL | std::intrinsics::floorf32,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
|
= note: expected fn pointer `unsafe extern "rust-intrinsic" fn(_) -> _`
= note: expected fn pointer `unsafe fn(_) -> _`
found fn item `unsafe fn(_) -> _ {floorf32}`

error: aborting due to 3 previous errors
Expand Down

0 comments on commit 109def5

Please sign in to comment.