Skip to content

fix reify-intrinsic test #135936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading