Skip to content

Commit 8e5b248

Browse files
committed
Updated all functions to use macros
1 parent 6f8c0d3 commit 8e5b248

File tree

1 file changed

+41
-0
lines changed
  • src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests

1 file changed

+41
-0
lines changed

src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests/intrinsics.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,11 @@ fn ptr_offset_from() {
244244
check_number(
245245
r#"
246246
//- minicore: index, slice, coerce_unsized
247+
247248
#[rustc_intrinsic]
248249
pub unsafe fn ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize;
250+
251+
#[rustc_intrinsic]
249252
pub unsafe fn ptr_offset_from_unsigned<T>(ptr: *const T, base: *const T) -> usize;
250253
251254
const GOAL: isize = {
@@ -402,9 +405,14 @@ fn floating_point() {
402405
// FIXME(#17451): Add `f16` and `f128` tests once intrinsics are added.
403406
check_number(
404407
r#"
408+
405409
#[rustc_intrinsic]
406410
pub unsafe fn sqrtf32(x: f32) -> f32;
411+
412+
#[rustc_intrinsic]
407413
pub unsafe fn powf32(a: f32, x: f32) -> f32;
414+
415+
#[rustc_intrinsic]
408416
pub unsafe fn fmaf32(a: f32, b: f32, c: f32) -> f32;
409417
410418
const GOAL: f32 = sqrtf32(1.2) + powf32(3.4, 5.6) + fmaf32(-7.8, 1.3, 2.4);
@@ -417,9 +425,14 @@ fn floating_point() {
417425
#[allow(unknown_lints, clippy::unnecessary_min_or_max)]
418426
check_number(
419427
r#"
428+
420429
#[rustc_intrinsic]
421430
pub unsafe fn powif64(a: f64, x: i32) -> f64;
431+
432+
#[rustc_intrinsic]
422433
pub unsafe fn sinf64(x: f64) -> f64;
434+
435+
#[rustc_intrinsic]
423436
pub unsafe fn minnumf64(x: f64, y: f64) -> f64;
424437
425438
const GOAL: f64 = powif64(1.2, 5) + sinf64(3.4) + minnumf64(-7.8, 1.3);
@@ -436,19 +449,44 @@ fn atomic() {
436449
check_number(
437450
r#"
438451
//- minicore: copy
452+
439453
#[rustc_intrinsic]
440454
pub unsafe fn atomic_load_seqcst<T: Copy>(src: *const T) -> T;
455+
456+
#[rustc_intrinsic]
441457
pub unsafe fn atomic_xchg_acquire<T: Copy>(dst: *mut T, src: T) -> T;
458+
459+
#[rustc_intrinsic]
442460
pub unsafe fn atomic_cxchg_release_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
461+
462+
#[rustc_intrinsic]
443463
pub unsafe fn atomic_cxchgweak_acquire_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
464+
465+
#[rustc_intrinsic]
444466
pub unsafe fn atomic_store_release<T: Copy>(dst: *mut T, val: T);
467+
468+
#[rustc_intrinsic]
445469
pub unsafe fn atomic_xadd_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
470+
471+
#[rustc_intrinsic]
446472
pub unsafe fn atomic_xsub_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
473+
474+
#[rustc_intrinsic]
447475
pub unsafe fn atomic_and_acquire<T: Copy>(dst: *mut T, src: T) -> T;
476+
477+
#[rustc_intrinsic]
448478
pub unsafe fn atomic_nand_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
479+
480+
#[rustc_intrinsic]
449481
pub unsafe fn atomic_or_release<T: Copy>(dst: *mut T, src: T) -> T;
482+
483+
#[rustc_intrinsic]
450484
pub unsafe fn atomic_xor_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
485+
486+
#[rustc_intrinsic]
451487
pub unsafe fn atomic_fence_seqcst();
488+
489+
#[rustc_intrinsic]
452490
pub unsafe fn atomic_singlethreadfence_acqrel();
453491
454492
fn should_not_reach() {
@@ -485,8 +523,11 @@ fn offset() {
485523
check_number(
486524
r#"
487525
//- minicore: coerce_unsized, index, slice
526+
488527
#[rustc_intrinsic]
489528
pub unsafe fn offset<Ptr, Delta>(dst: Ptr, offset: Delta) -> Ptr;
529+
530+
#[rustc_intrinsic]
490531
pub unsafe fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
491532
492533
const GOAL: i32 = unsafe {

0 commit comments

Comments
 (0)