Skip to content

Commit

Permalink
Change test to use likely/unlikely instead of copy/`copy_overla…
Browse files Browse the repository at this point in the history
…pping`.

Test was added in PR rust-lang#84404.

The intent here is: The `copy`/`copy_overlapping` intrinsics are going through
some flip-flopping now of "are they intrinsics or not". We can achieve the same
effect that the test intended by using `likely`/`unlikely`.
  • Loading branch information
pnkfelix committed Jun 4, 2021
1 parent e118a2c commit a5cb9af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/test/ui/reify-intrinsic.rs
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
// check-fail

#![feature(intrinsics)]
#![feature(core_intrinsics, intrinsics)]

fn a() {
let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::transmute;
Expand All @@ -14,8 14,8 @@ fn b() {

fn c() {
let _ = [
std::intrinsics::copy_nonoverlapping::<i32>,
std::intrinsics::copy::<i32>,
std::intrinsics::likely,
std::intrinsics::unlikely,
//~^ ERROR cannot coerce
];
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/reify-intrinsic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 22,11 @@ LL | let _ = std::mem::transmute as unsafe extern "rust-intrinsic" fn(isize)
error[E0308]: cannot coerce intrinsics to function pointers
--> $DIR/reify-intrinsic.rs:18:9
|
LL | std::intrinsics::copy::<i32>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
LL | std::intrinsics::unlikely,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
|
= note: expected type `unsafe extern "rust-intrinsic" fn(_, _, _) {copy_nonoverlapping::<i32>}`
found fn item `unsafe extern "rust-intrinsic" fn(_, _, _) {std::intrinsics::copy::<i32>}`
= note: expected type `extern "rust-intrinsic" fn(_) -> _ {likely}`
found fn item `extern "rust-intrinsic" fn(_) -> _ {unlikely}`

error: aborting due to 3 previous errors

Expand Down

0 comments on commit a5cb9af

Please sign in to comment.