intrinsics.rs.html -- source
Description: Source to the Rust file `src/libcore/intrinsics.rs`.
Keywords: rust, rustlang, rust-lang

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      95
      96
      97
      98
      99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
     548
     549
     550
     551
     552
     553
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
     579
     580
     581
     582
     583
     584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
     692
     693
     694
     695
     696
     697
     698
     699
     700
     701
     702
     703
     704
     705
     706
     707
     708
     709
     710
     711
     712
     713
     714
     715
     716
     717
     718
     719
     720
     721
     722
     723
     724
     725
     726
     727
     728
     729
     730
     731
     732
     733
     734
     735
     736
     737
     738
     739
     740
     741
     742
     743
     744
     745
     746
     747
     748
     749
     750
     751
     752
     753
     754
     755
     756
     757
     758
     759
     760
     761
     762
     763
     764
     765
     766
     767
     768
     769
     770
     771
     772
     773
     774
     775
     776
     777
     778
     779
     780
     781
     782
     783
     784
     785
     786
     787
     788
     789
     790
     791
     792
     793
     794
     795
     796
     797
     798
     799
     800
     801
     802
     803
     804
     805
     806
     807
     808
     809
     810
     811
     812
     813
     814
     815
     816
     817
     818
     819
     820
     821
     822
     823
     824
     825
     826
     827
     828
     829
     830
     831
     832
     833
     834
     835
     836
     837
     838
     839
     840
     841
     842
     843
     844
     845
     846
     847
     848
     849
     850
     851
     852
     853
     854
     855
     856
     857
     858
     859
     860
     861
     862
     863
     864
     865
     866
     867
     868
     869
     870
     871
     872
     873
     874
     875
     876
     877
     878
     879
     880
     881
     882
     883
     884
     885
     886
     887
     888
     889
     890
     891
     892
     893
     894
     895
     896
     897
     898
     899
     900
     901
     902
     903
     904
     905
     906
     907
     908
     909
     910
     911
     912
     913
     914
     915
     916
     917
     918
     919
     920
     921
     922
     923
     924
     925
     926
     927
     928
     929
     930
     931
     932
     933
     934
     935
     936
     937
     938
     939
     940
     941
     942
     943
     944
     945
     946
     947
     948
     949
     950
     951
     952
     953
     954
     955
     956
     957
     958
     959
     960
     961
     962
     963
     964
     965
     966
     967
     968
     969
     970
     971
     972
     973
     974
     975
     976
     977
     978
     979
     980
     981
     982
     983
     984
     985
     986
     987
     988
     989
     990
     991
     992
     993
     994
     995
     996
     997
     998
     999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209
    1210
    1211
    1212
    1213
    1214
    1215
    1216
    1217
    1218
    1219
    1220
    1221
    1222
    1223
    1224
    1225
    1226
    1227
    1228
    1229
    1230
    1231
    1232
    1233
    1234
    1235
    1236
    1237
    1238
    1239
    1240
    1241
    1242
    1243
    1244
    1245
    1246
    1247
    1248
    1249
    1250
    1251
    1252
    1253
    1254
    1255
    1256
    1257
    1258
    1259
    1260
    1261
    1262
    1263
    1264
    1265
    1266
    1267
    1268
    1269
    1270
    1271
    1272
    1273
    1274
    1275
    1276
    1277
    1278
    1279
    1280
    1281
    1282
    1283
    1284
    1285
    1286
    1287
    1288
    1289
    1290
    1291
    1292
    1293
    1294
    1295
    1296
    1297
    1298
    1299
    1300
    1301
    1302
    1303
    1304
    1305
    1306
    1307
    1308
    1309
    1310
    1311
    1312
    1313
    1314
    1315
    1316
    1317
    1318
    1319
    1320
    1321
    1322
    1323
    1324
    1325
    1326
    1327
    1328
    1329
    1330
    1331
    1332
    1333
    1334
    1335
    1336
    1337
    1338
    1339
    1340
    1341
    1342
    1343
    1344
    1345
    1346
    1347
    1348
    1349
    1350
    1351
    1352
    1353
    1354
    1355
    1356
    1357
    1358
    1359
    1360
    1361
    1362
    1363
    1364
    1365
    1366
    1367
    1368
    1369
    1370
    1371
    1372
    1373
    1374
    1375
    1376
    1377
    1378
    1379
    1380
    1381
    1382
    1383
    1384
    1385
    1386
    1387
    1388
    1389
    1390
    1391
    1392
    1393
    1394
    1395
    1396
    1397
    1398
    1399
    1400
    1401
    1402
    1403
    1404
    1405
    1406
    1407
    1408
    1409
    1410
    1411
    1412
    1413
    1414
    1415
    1416
    1417
    1418
    1419
    1420
    1421
    1422
    1423
    1424
    1425
    1426
    1427
    1428
    1429
    1430
    1431
    1432
    1433
    1434
    1435
    1436
    1437
    1438
    1439
    1440
    1441
    1442
    1443
    1444
    1445
    1446
    1447
    1448
    1449
    1450
    1451
    1452
    1453
    1454
    1455
    1456
    1457
    1458
    1459
    1460
    1461
    1462
    1463
    1464
    1465
    1466
    1467
    1468
    1469
    1470
    1471
    1472
    1473
    1474
    1475
    1476
    1477
    1478
    1479
    1480
    1481
    1482
    1483
    1484
    1485
    1486
    1487
    1488
    1489
    1490
    1491
    1492
    1493
    1494
    1495
    1496
    1497
    1498
    1499
    1500
    1501
    1502
    1503
    1504
    1505
    1506
    1507
    1508
    1509
    1510
    1511
    1512
    1513
    1514
    1515
    1516
    1517
    1518
    1519
    1520
    1521
    1522
    1523
    1524
    1525
    1526
    1527
    1528
    1529
    1530
    1531
    1532
    1533
    1534
    1535
    1536
    1537
    1538
    1539
    1540
    1541
    1542
    1543
    1544
    1545
    1546
    1547
    1548
    1549
    1550
    1551
    1552
    1553
    1554
    1555
    1556
    1557
    1558
    1559
    1560

    //! Compiler intrinsics.
    //!
    //! The corresponding definitions are in `librustc_codegen_llvm/intrinsic.rs`.
    //!
    //! # Volatiles
    //!
    //! The volatile intrinsics provide operations intended to act on I/O
    //! memory, which are guaranteed to not be reordered by the compiler
    //! across other volatile intrinsics. See the LLVM documentation on
    //! [[volatile]].
    //!
    //! [volatile]: http://llvm.org/docs/LangRef.html#volatile-memory-accesses
    //!
    //! # Atomics
    //!
    //! The atomic intrinsics provide common atomic operations on machine
    //! words, with multiple possible memory orderings. They obey the same
    //! semantics as C++11. See the LLVM documentation on [[atomics]].
    //!
    //! [atomics]: http://llvm.org/docs/Atomics.html
    //!
    //! A quick refresher on memory ordering:
    //!
    //! * Acquire - a barrier for acquiring a lock. Subsequent reads and writes
    //!   take place after the barrier.
    //! * Release - a barrier for releasing a lock. Preceding reads and writes
    //!   take place before the barrier.
    //! * Sequentially consistent - sequentially consistent operations are
    //!   guaranteed to happen in order. This is the standard mode for working
    //!   with atomic types and is equivalent to Java's `volatile`.

    #![unstable(feature = "core_intrinsics",
                reason = "intrinsics are unlikely to ever be stabilized, instead \
                          they should be used through stabilized interfaces \
                          in the rest of the standard library",
                issue = "0")]
    #![allow(missing_docs)]

    #[stable(feature = "drop_in_place", since = "1.8.0")]
    #[rustc_deprecated(reason = "no longer an intrinsic - use `ptr::drop_in_place` directly",
                       since = "1.18.0")]
    pub use ptr::drop_in_place;

    extern "rust-intrinsic" {
        // N.B., these intrinsics take raw pointers because they mutate aliased
        // memory, which is not valid for either `&` or `&mut`.

        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as both the `success` and `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as both the `success` and `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as both the `success` and `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange`][compare_exchange].
        ///
        /// [compare_exchange]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange
        pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);

        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as both the `success` and `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as both the `success` and `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as both the `success` and `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
        /// Stores a value if the current value is the same as the `old` value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `compare_exchange_weak` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `success` and
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `failure` parameters. For example,
        /// [`AtomicBool::compare_exchange_weak`][cew].
        ///
        /// [cew]: ../../std/sync/atomic/struct.AtomicBool.html#method.compare_exchange_weak
        pub fn atomic_cxchgweak_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);

        /// Loads the current value of the pointer.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `load` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::load`](../../std/sync/atomic/struct.AtomicBool.html#method.load).
        pub fn atomic_load<T>(src: *const T) -> T;
        /// Loads the current value of the pointer.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `load` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::load`](../../std/sync/atomic/struct.AtomicBool.html#method.load).
        pub fn atomic_load_acq<T>(src: *const T) -> T;
        /// Loads the current value of the pointer.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `load` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::load`](../../std/sync/atomic/struct.AtomicBool.html#method.load).
        pub fn atomic_load_relaxed<T>(src: *const T) -> T;
        pub fn atomic_load_unordered<T>(src: *const T) -> T;

        /// Stores the value at the specified memory location.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `store` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::store`](../../std/sync/atomic/struct.AtomicBool.html#method.store).
        pub fn atomic_store<T>(dst: *mut T, val: T);
        /// Stores the value at the specified memory location.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `store` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::store`](../../std/sync/atomic/struct.AtomicBool.html#method.store).
        pub fn atomic_store_rel<T>(dst: *mut T, val: T);
        /// Stores the value at the specified memory location.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `store` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::store`](../../std/sync/atomic/struct.AtomicBool.html#method.store).
        pub fn atomic_store_relaxed<T>(dst: *mut T, val: T);
        pub fn atomic_store_unordered<T>(dst: *mut T, val: T);

        /// Stores the value at the specified memory location, returning the old value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `swap` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::swap`](../../std/sync/atomic/struct.AtomicBool.html#method.swap).
        pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T;
        /// Stores the value at the specified memory location, returning the old value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `swap` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::swap`](../../std/sync/atomic/struct.AtomicBool.html#method.swap).
        pub fn atomic_xchg_acq<T>(dst: *mut T, src: T) -> T;
        /// Stores the value at the specified memory location, returning the old value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `swap` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::swap`](../../std/sync/atomic/struct.AtomicBool.html#method.swap).
        pub fn atomic_xchg_rel<T>(dst: *mut T, src: T) -> T;
        /// Stores the value at the specified memory location, returning the old value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `swap` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::swap`](../../std/sync/atomic/struct.AtomicBool.html#method.swap).
        pub fn atomic_xchg_acqrel<T>(dst: *mut T, src: T) -> T;
        /// Stores the value at the specified memory location, returning the old value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `swap` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::swap`](../../std/sync/atomic/struct.AtomicBool.html#method.swap).
        pub fn atomic_xchg_relaxed<T>(dst: *mut T, src: T) -> T;

        /// Adds to the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_add` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add).
        pub fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
        /// Adds to the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_add` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add).
        pub fn atomic_xadd_acq<T>(dst: *mut T, src: T) -> T;
        /// Adds to the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_add` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add).
        pub fn atomic_xadd_rel<T>(dst: *mut T, src: T) -> T;
        /// Adds to the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_add` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add).
        pub fn atomic_xadd_acqrel<T>(dst: *mut T, src: T) -> T;
        /// Adds to the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_add` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_add`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_add).
        pub fn atomic_xadd_relaxed<T>(dst: *mut T, src: T) -> T;

        /// Subtract from the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_sub` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_sub`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_sub).
        pub fn atomic_xsub<T>(dst: *mut T, src: T) -> T;
        /// Subtract from the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_sub` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_sub`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_sub).
        pub fn atomic_xsub_acq<T>(dst: *mut T, src: T) -> T;
        /// Subtract from the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_sub` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_sub`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_sub).
        pub fn atomic_xsub_rel<T>(dst: *mut T, src: T) -> T;
        /// Subtract from the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_sub` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_sub`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_sub).
        pub fn atomic_xsub_acqrel<T>(dst: *mut T, src: T) -> T;
        /// Subtract from the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_sub` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicIsize::fetch_sub`](../../std/sync/atomic/struct.AtomicIsize.html#method.fetch_sub).
        pub fn atomic_xsub_relaxed<T>(dst: *mut T, src: T) -> T;

        /// Bitwise and with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_and` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_and`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_and).
        pub fn atomic_and<T>(dst: *mut T, src: T) -> T;
        /// Bitwise and with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_and` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_and`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_and).
        pub fn atomic_and_acq<T>(dst: *mut T, src: T) -> T;
        /// Bitwise and with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_and` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_and`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_and).
        pub fn atomic_and_rel<T>(dst: *mut T, src: T) -> T;
        /// Bitwise and with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_and` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_and`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_and).
        pub fn atomic_and_acqrel<T>(dst: *mut T, src: T) -> T;
        /// Bitwise and with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_and` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_and`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_and).
        pub fn atomic_and_relaxed<T>(dst: *mut T, src: T) -> T;

        /// Bitwise nand with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic::AtomicBool` type via the `fetch_nand` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_nand`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_nand).
        pub fn atomic_nand<T>(dst: *mut T, src: T) -> T;
        /// Bitwise nand with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic::AtomicBool` type via the `fetch_nand` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_nand`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_nand).
        pub fn atomic_nand_acq<T>(dst: *mut T, src: T) -> T;
        /// Bitwise nand with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic::AtomicBool` type via the `fetch_nand` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_nand`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_nand).
        pub fn atomic_nand_rel<T>(dst: *mut T, src: T) -> T;
        /// Bitwise nand with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic::AtomicBool` type via the `fetch_nand` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_nand`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_nand).
        pub fn atomic_nand_acqrel<T>(dst: *mut T, src: T) -> T;
        /// Bitwise nand with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic::AtomicBool` type via the `fetch_nand` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_nand`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_nand).
        pub fn atomic_nand_relaxed<T>(dst: *mut T, src: T) -> T;

        /// Bitwise or with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_or` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_or`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_or).
        pub fn atomic_or<T>(dst: *mut T, src: T) -> T;
        /// Bitwise or with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_or` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_or`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_or).
        pub fn atomic_or_acq<T>(dst: *mut T, src: T) -> T;
        /// Bitwise or with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_or` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_or`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_or).
        pub fn atomic_or_rel<T>(dst: *mut T, src: T) -> T;
        /// Bitwise or with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_or` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_or`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_or).
        pub fn atomic_or_acqrel<T>(dst: *mut T, src: T) -> T;
        /// Bitwise or with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_or` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_or`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_or).
        pub fn atomic_or_relaxed<T>(dst: *mut T, src: T) -> T;

        /// Bitwise xor with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_xor` method by passing
        /// [`Ordering::SeqCst`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_xor`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_xor).
        pub fn atomic_xor<T>(dst: *mut T, src: T) -> T;
        /// Bitwise xor with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_xor` method by passing
        /// [`Ordering::Acquire`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_xor`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_xor).
        pub fn atomic_xor_acq<T>(dst: *mut T, src: T) -> T;
        /// Bitwise xor with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_xor` method by passing
        /// [`Ordering::Release`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_xor`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_xor).
        pub fn atomic_xor_rel<T>(dst: *mut T, src: T) -> T;
        /// Bitwise xor with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_xor` method by passing
        /// [`Ordering::AcqRel`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_xor`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_xor).
        pub fn atomic_xor_acqrel<T>(dst: *mut T, src: T) -> T;
        /// Bitwise xor with the current value, returning the previous value.
        /// The stabilized version of this intrinsic is available on the
        /// `std::sync::atomic` types via the `fetch_xor` method by passing
        /// [`Ordering::Relaxed`](../../std/sync/atomic/enum.Ordering.html)
        /// as the `order`. For example,
        /// [`AtomicBool::fetch_xor`](../../std/sync/atomic/struct.AtomicBool.html#method.fetch_xor).
        pub fn atomic_xor_relaxed<T>(dst: *mut T, src: T) -> T;

        pub fn atomic_max<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_max_acq<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_max_rel<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_max_relaxed<T>(dst: *mut T, src: T) -> T;

        pub fn atomic_min<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_min_acq<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_min_rel<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_min_acqrel<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_min_relaxed<T>(dst: *mut T, src: T) -> T;

        pub fn atomic_umin<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_umin_acq<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_umin_rel<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_umin_acqrel<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_umin_relaxed<T>(dst: *mut T, src: T) -> T;

        pub fn atomic_umax<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_umax_acq<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_umax_rel<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_umax_acqrel<T>(dst: *mut T, src: T) -> T;
        pub fn atomic_umax_relaxed<T>(dst: *mut T, src: T) -> T;

        /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
        /// if supported; otherwise, it is a no-op.
        /// Prefetches have no effect on the behavior of the program but can change its performance
        /// characteristics.
        ///
        /// The `locality` argument must be a constant integer and is a temporal locality specifier
        /// ranging from (0) - no locality, to (3) - extremely local keep in cache
        pub fn prefetch_read_data<T>(data: *const T, locality: i32);
        /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
        /// if supported; otherwise, it is a no-op.
        /// Prefetches have no effect on the behavior of the program but can change its performance
        /// characteristics.
        ///
        /// The `locality` argument must be a constant integer and is a temporal locality specifier
        /// ranging from (0) - no locality, to (3) - extremely local keep in cache
        pub fn prefetch_write_data<T>(data: *const T, locality: i32);
        /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
        /// if supported; otherwise, it is a no-op.
        /// Prefetches have no effect on the behavior of the program but can change its performance
        /// characteristics.
        ///
        /// The `locality` argument must be a constant integer and is a temporal locality specifier
        /// ranging from (0) - no locality, to (3) - extremely local keep in cache
        pub fn prefetch_read_instruction<T>(data: *const T, locality: i32);
        /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
        /// if supported; otherwise, it is a no-op.
        /// Prefetches have no effect on the behavior of the program but can change its performance
        /// characteristics.
        ///
        /// The `locality` argument must be a constant integer and is a temporal locality specifier
        /// ranging from (0) - no locality, to (3) - extremely local keep in cache
        pub fn prefetch_write_instruction<T>(data: *const T, locality: i32);
    }

    extern "rust-intrinsic" {

        pub fn atomic_fence();
        pub fn atomic_fence_acq();
        pub fn atomic_fence_rel();
        pub fn atomic_fence_acqrel();

        /// A compiler-only memory barrier.
        ///
        /// Memory accesses will never be reordered across this barrier by the
        /// compiler, but no instructions will be emitted for it. This is
        /// appropriate for operations on the same thread that may be preempted,
        /// such as when interacting with signal handlers.
        pub fn atomic_singlethreadfence();
        pub fn atomic_singlethreadfence_acq();
        pub fn atomic_singlethreadfence_rel();
        pub fn atomic_singlethreadfence_acqrel();

        /// Magic intrinsic that derives its meaning from attributes
        /// attached to the function.
        ///
        /// For example, dataflow uses this to inject static assertions so
        /// that `rustc_peek(potentially_uninitialized)` would actually
        /// double-check that dataflow did indeed compute that it is
        /// uninitialized at that point in the control flow.
        pub fn rustc_peek<T>(_: T) -> T;

        /// Aborts the execution of the process.
        ///
        /// The stabilized version of this intrinsic is
        /// [`std::process::abort`](../../std/process/fn.abort.html)
        pub fn abort() -> !;

        /// Tells LLVM that this point in the code is not reachable, enabling
        /// further optimizations.
        ///
        /// N.B., this is very different from the `unreachable!()` macro: Unlike the
        /// macro, which panics when it is executed, it is *undefined behavior* to
        /// reach code marked with this function.
        ///
        /// The stabilized version of this intrinsic is
        /// [`std::hint::unreachable_unchecked`](../../std/hint/fn.unreachable_unchecked.html).
        pub fn unreachable() -> !;

        /// Informs the optimizer that a condition is always true.
        /// If the condition is false, the behavior is undefined.
        ///
        /// No code is generated for this intrinsic, but the optimizer will try
        /// to preserve it (and its condition) between passes, which may interfere
        /// with optimization of surrounding code and reduce performance. It should
        /// not be used if the invariant can be discovered by the optimizer on its
        /// own, or if it does not enable any significant optimizations.
        pub fn assume(b: bool);

        /// Hints to the compiler that branch condition is likely to be true.
        /// Returns the value passed to it.
        ///
        /// Any use other than with `if` statements will probably not have an effect.
        pub fn likely(b: bool) -> bool;

        /// Hints to the compiler that branch condition is likely to be false.
        /// Returns the value passed to it.
        ///
        /// Any use other than with `if` statements will probably not have an effect.
        pub fn unlikely(b: bool) -> bool;

        /// Executes a breakpoint trap, for inspection by a debugger.
        pub fn breakpoint();

        /// The size of a type in bytes.
        ///
        /// More specifically, this is the offset in bytes between successive
        /// items of the same type, including alignment padding.
        ///
        /// The stabilized version of this intrinsic is
        /// [`std::mem::size_of`](../../std/mem/fn.size_of.html).
        pub fn size_of<T>() -> usize;

        /// Moves a value to an uninitialized memory location.
        ///
        /// Drop glue is not run on the destination.
        pub fn move_val_init<T>(dst: *mut T, src: T);

        pub fn min_align_of<T>() -> usize;
        pub fn pref_align_of<T>() -> usize;

        /// The size of the referenced value in bytes.
        ///
        /// The stabilized version of this intrinsic is
        /// [`std::mem::size_of_val`](../../std/mem/fn.size_of_val.html).
        pub fn size_of_val<T: ?Sized>(_: &T) -> usize;
        pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;

        /// Gets a static string slice containing the name of a type.
        pub fn type_name<T: ?Sized>() -> &'static str;

        /// Gets an identifier which is globally unique to the specified type. This
        /// function will return the same value for a type regardless of whichever
        /// crate it is invoked in.
        pub fn type_id<T: ?Sized + 'static>() -> u64;

        /// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
        /// This will statically either panic, or do nothing.
        pub fn panic_if_uninhabited<T>();

        /// Creates a value initialized to zero.
        ///
        /// `init` is unsafe because it returns a zeroed-out datum,
        /// which is unsafe unless `T` is `Copy`. Also, even if T is
        /// `Copy`, an all-zero value may not correspond to any legitimate
        /// state for the type in question.
        pub fn init<T>() -> T;

        /// Creates an uninitialized value.
        ///
        /// `uninit` is unsafe because there is no guarantee of what its
        /// contents are. In particular its drop-flag may be set to any
        /// state, which means it may claim either dropped or
        /// undropped. In the general case one must use `ptr::write` to
        /// initialize memory previous set to the result of `uninit`.
        pub fn uninit<T>() -> T;

        /// Moves a value out of scope without running drop glue.
        pub fn forget<T: ?Sized>(_: T);

        /// Reinterprets the bits of a value of one type as another type.
        ///
        /// Both types must have the same size. Neither the original, nor the result,
        /// may be an [invalid value](../../nomicon/what-unsafe-does.html).
        ///
        /// `transmute` is semantically equivalent to a bitwise move of one type
        /// into another. It copies the bits from the source value into the
        /// destination value, then forgets the original. It's equivalent to C's
        /// `memcpy` under the hood, just like `transmute_copy`.
        ///
        /// `transmute` is **incredibly** unsafe. There are a vast number of ways to
        /// cause [undefined behavior][ub] with this function. `transmute` should be
        /// the absolute last resort.
        ///
        /// The [nomicon](../../nomicon/transmutes.html) has additional
        /// documentation.
        ///
        /// [ub]: ../../reference/behavior-considered-undefined.html
        ///
        /// # Examples
        ///
        /// There are a few things that `transmute` is really useful for.
        ///
        /// Getting the bitpattern of a floating point type (or, more generally,
        /// type punning, when `T` and `U` aren't pointers):
        ///
        /// ```
        /// let bitpattern = unsafe {
        ///     std::mem::transmute::<f32, u32>(1.0)
        /// };
        /// assert_eq!(bitpattern, 0x3F800000);
        /// ```
        ///
        /// Turning a pointer into a function pointer. This is *not* portable to
        /// machines where function pointers and data pointers have different sizes.
        ///
        /// ```
        /// fn foo() -> i32 {
        ///     0
        /// }
        /// let pointer = foo as *const ();
        /// let function = unsafe {
        ///     std::mem::transmute::<*const (), fn() -> i32>(pointer)
        /// };
        /// assert_eq!(function(), 0);
        /// ```
        ///
        /// Extending a lifetime, or shortening an invariant lifetime. This is
        /// advanced, very unsafe Rust!
        ///
        /// ```
        /// struct R<'a>(&'a i32);
        /// unsafe fn extend_lifetime<'b>(r: R<'b>) -> R<'static> {
        ///     std::mem::transmute::<R<'b>, R<'static>>(r)
        /// }
        ///
        /// unsafe fn shorten_invariant_lifetime<'b, 'c>(r: &'b mut R<'static>)
        ///                                              -> &'b mut R<'c> {
        ///     std::mem::transmute::<&'b mut R<'static>, &'b mut R<'c>>(r)
        /// }
        /// ```
        ///
        /// # Alternatives
        ///
        /// Don't despair: many uses of `transmute` can be achieved through other means.
        /// Below are common applications of `transmute` which can be replaced with safer
        /// constructs.
        ///
        /// Turning a pointer into a `usize`:
        ///
        /// ```
        /// let ptr = &0;
        /// let ptr_num_transmute = unsafe {
        ///     std::mem::transmute::<&i32, usize>(ptr)
        /// };
        ///
        /// // Use an `as` cast instead
        /// let ptr_num_cast = ptr as *const i32 as usize;
        /// ```
        ///
        /// Turning a `*mut T` into an `&mut T`:
        ///
        /// ```
        /// let ptr: *mut i32 = &mut 0;
        /// let ref_transmuted = unsafe {
        ///     std::mem::transmute::<*mut i32, &mut i32>(ptr)
        /// };
        ///
        /// // Use a reborrow instead
        /// let ref_casted = unsafe { &mut *ptr };
        /// ```
        ///
        /// Turning an `&mut T` into an `&mut U`:
        ///
        /// ```
        /// let ptr = &mut 0;
        /// let val_transmuted = unsafe {
        ///     std::mem::transmute::<&mut i32, &mut u32>(ptr)
        /// };
        ///
        /// // Now, put together `as` and reborrowing - note the chaining of `as`
        /// // `as` is not transitive
        /// let val_casts = unsafe { &mut *(ptr as *mut i32 as *mut u32) };
        /// ```
        ///
        /// Turning an `&str` into an `&[u8]`:
        ///
        /// ```
        /// // this is not a good way to do this.
        /// let slice = unsafe { std::mem::transmute::<&str, &[u8]>("Rust") };
        /// assert_eq!(slice, &[82, 117, 115, 116]);
        ///
        /// // You could use `str::as_bytes`
        /// let slice = "Rust".as_bytes();
        /// assert_eq!(slice, &[82, 117, 115, 116]);
        ///
        /// // Or, just use a byte string, if you have control over the string
        /// // literal
        /// assert_eq!(b"Rust", &[82, 117, 115, 116]);
        /// ```
        ///
        /// Turning a `Vec<&T>` into a `Vec<Option<&T>>`:
        ///
        /// ```
        /// let store = [0, 1, 2, 3];
        /// let mut v_orig = store.iter().collect::<Vec<&i32>>();
        ///
        /// // Using transmute: this is Undefined Behavior, and a bad idea.
        /// // However, it is no-copy.
        /// let v_transmuted = unsafe {
        ///     std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(
        ///         v_orig.clone())
        /// };
        ///
        /// // This is the suggested, safe way.
        /// // It does copy the entire vector, though, into a new array.
        /// let v_collected = v_orig.clone()
        ///                         .into_iter()
        ///                         .map(|r| Some(r))
        ///                         .collect::<Vec<Option<&i32>>>();
        ///
        /// // The no-copy, unsafe way, still using transmute, but not UB.
        /// // This is equivalent to the original, but safer, and reuses the
        /// // same `Vec` internals. Therefore, the new inner type must have the
        /// // exact same size, and the same alignment, as the old type.
        /// // The same caveats exist for this method as transmute, for
        /// // the original inner type (`&i32`) to the converted inner type
        /// // (`Option<&i32>`), so read the nomicon pages linked above.
        /// let v_from_raw = unsafe {
        ///     Vec::from_raw_parts(v_orig.as_mut_ptr() as *mut Option<&i32>,
        ///                         v_orig.len(),
        ///                         v_orig.capacity())
        /// };
        /// std::mem::forget(v_orig);
        /// ```
        ///
        /// Implementing `split_at_mut`:
        ///
        /// ```
        /// use std::{slice, mem};
        ///
        /// // There are multiple ways to do this, and there are multiple problems
        /// // with the following (transmute) way.
        /// fn split_at_mut_transmute<T>(slice: &mut [T], mid: usize)
        ///                              -> (&mut [T], &mut [T]) {
        ///     let len = slice.len();
        ///     assert!(mid <= len);
        ///     unsafe {
        ///         let slice2 = mem::transmute::<&mut [T], &mut [T]>(slice);
        ///         // first: transmute is not typesafe; all it checks is that T and
        ///         // U are of the same size. Second, right here, you have two
        ///         // mutable references pointing to the same memory.
        ///         (&mut slice[0..mid], &mut slice2[mid..len])
        ///     }
        /// }
        ///
        /// // This gets rid of the typesafety problems; `&mut *` will *only* give
        /// // you an `&mut T` from an `&mut T` or `*mut T`.
        /// fn split_at_mut_casts<T>(slice: &mut [T], mid: usize)
        ///                          -> (&mut [T], &mut [T]) {
        ///     let len = slice.len();
        ///     assert!(mid <= len);
        ///     unsafe {
        ///         let slice2 = &mut *(slice as *mut [T]);
        ///         // however, you still have two mutable references pointing to
        ///         // the same memory.
        ///         (&mut slice[0..mid], &mut slice2[mid..len])
        ///     }
        /// }
        ///
        /// // This is how the standard library does it. This is the best method, if
        /// // you need to do something like this
        /// fn split_at_stdlib<T>(slice: &mut [T], mid: usize)
        ///                       -> (&mut [T], &mut [T]) {
        ///     let len = slice.len();
        ///     assert!(mid <= len);
        ///     unsafe {
        ///         let ptr = slice.as_mut_ptr();
        ///         // This now has three mutable references pointing at the same
        ///         // memory. `slice`, the rvalue ret.0, and the rvalue ret.1.
        ///         // `slice` is never used after `let ptr = ...`, and so one can
        ///         // treat it as "dead", and therefore, you only have two real
        ///         // mutable slices.
        ///         (slice::from_raw_parts_mut(ptr, mid),
        ///          slice::from_raw_parts_mut(ptr.add(mid), len - mid))
        ///     }
        /// }
        /// ```
        #[stable(feature = "rust1", since = "1.0.0")]
        pub fn transmute<T, U>(e: T) -> U;

        /// Returns `true` if the actual type given as `T` requires drop
        /// glue; returns `false` if the actual type provided for `T`
        /// implements `Copy`.
        ///
        /// If the actual type neither requires drop glue nor implements
        /// `Copy`, then may return `true` or `false`.
        ///
        /// The stabilized version of this intrinsic is
        /// [`std::mem::needs_drop`](../../std/mem/fn.needs_drop.html).
        pub fn needs_drop<T>() -> bool;

        /// Calculates the offset from a pointer.
        ///
        /// This is implemented as an intrinsic to avoid converting to and from an
        /// integer, since the conversion would throw away aliasing information.
        ///
        /// # Safety
        ///
        /// Both the starting and resulting pointer must be either in bounds or one
        /// byte past the end of an allocated object. If either pointer is out of
        /// bounds or arithmetic overflow occurs then any further use of the
        /// returned value will result in undefined behavior.
        pub fn offset<T>(dst: *const T, offset: isize) -> *const T;

        /// Calculates the offset from a pointer, potentially wrapping.
        ///
        /// This is implemented as an intrinsic to avoid converting to and from an
        /// integer, since the conversion inhibits certain optimizations.
        ///
        /// # Safety
        ///
        /// Unlike the `offset` intrinsic, this intrinsic does not restrict the
        /// resulting pointer to point into or one byte past the end of an allocated
        /// object, and it wraps with two's complement arithmetic. The resulting
        /// value is not necessarily valid to be used to actually access memory.
        pub fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;

        /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
        /// a size of `count` * `size_of::<T>()` and an alignment of
        /// `min_align_of::<T>()`
        ///
        /// The volatile parameter is set to `true`, so it will not be optimized out
        /// unless size is equal to zero.
        pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T,
                                                      count: usize);
        /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
        /// a size of `count` * `size_of::<T>()` and an alignment of
        /// `min_align_of::<T>()`
        ///
        /// The volatile parameter is set to `true`, so it will not be optimized out
        /// unless size is equal to zero.
        pub fn volatile_copy_memory<T>(dst: *mut T, src: *const T, count: usize);
        /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
        /// size of `count` * `size_of::<T>()` and an alignment of
        /// `min_align_of::<T>()`.
        ///
        /// The volatile parameter is set to `true`, so it will not be optimized out
        /// unless size is equal to zero.
        pub fn volatile_set_memory<T>(dst: *mut T, val: u8, count: usize);

        /// Performs a volatile load from the `src` pointer.
        /// The stabilized version of this intrinsic is
        /// [`std::ptr::read_volatile`](../../std/ptr/fn.read_volatile.html).
        pub fn volatile_load<T>(src: *const T) -> T;
        /// Performs a volatile store to the `dst` pointer.
        /// The stabilized version of this intrinsic is
        /// [`std::ptr::write_volatile`](../../std/ptr/fn.write_volatile.html).
        pub fn volatile_store<T>(dst: *mut T, val: T);

        /// Performs a volatile load from the `src` pointer
        /// The pointer is not required to be aligned.
        pub fn unaligned_volatile_load<T>(src: *const T) -> T;
        /// Performs a volatile store to the `dst` pointer.
        /// The pointer is not required to be aligned.
        pub fn unaligned_volatile_store<T>(dst: *mut T, val: T);

        /// Returns the square root of an `f32`
        pub fn sqrtf32(x: f32) -> f32;
        /// Returns the square root of an `f64`
        pub fn sqrtf64(x: f64) -> f64;

        /// Raises an `f32` to an integer power.
        pub fn powif32(a: f32, x: i32) -> f32;
        /// Raises an `f64` to an integer power.
        pub fn powif64(a: f64, x: i32) -> f64;

        /// Returns the sine of an `f32`.
        pub fn sinf32(x: f32) -> f32;
        /// Returns the sine of an `f64`.
        pub fn sinf64(x: f64) -> f64;

        /// Returns the cosine of an `f32`.
        pub fn cosf32(x: f32) -> f32;
        /// Returns the cosine of an `f64`.
        pub fn cosf64(x: f64) -> f64;

        /// Raises an `f32` to an `f32` power.
        pub fn powf32(a: f32, x: f32) -> f32;
        /// Raises an `f64` to an `f64` power.
        pub fn powf64(a: f64, x: f64) -> f64;

        /// Returns the exponential of an `f32`.
        pub fn expf32(x: f32) -> f32;
        /// Returns the exponential of an `f64`.
        pub fn expf64(x: f64) -> f64;

        /// Returns 2 raised to the power of an `f32`.
        pub fn exp2f32(x: f32) -> f32;
        /// Returns 2 raised to the power of an `f64`.
        pub fn exp2f64(x: f64) -> f64;

        /// Returns the natural logarithm of an `f32`.
        pub fn logf32(x: f32) -> f32;
        /// Returns the natural logarithm of an `f64`.
        pub fn logf64(x: f64) -> f64;

        /// Returns the base 10 logarithm of an `f32`.
        pub fn log10f32(x: f32) -> f32;
        /// Returns the base 10 logarithm of an `f64`.
        pub fn log10f64(x: f64) -> f64;

        /// Returns the base 2 logarithm of an `f32`.
        pub fn log2f32(x: f32) -> f32;
        /// Returns the base 2 logarithm of an `f64`.
        pub fn log2f64(x: f64) -> f64;

        /// Returns `a * b + c` for `f32` values.
        pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
        /// Returns `a * b + c` for `f64` values.
        pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;

        /// Returns the absolute value of an `f32`.
        pub fn fabsf32(x: f32) -> f32;
        /// Returns the absolute value of an `f64`.
        pub fn fabsf64(x: f64) -> f64;

        /// Copies the sign from `y` to `x` for `f32` values.
        pub fn copysignf32(x: f32, y: f32) -> f32;
        /// Copies the sign from `y` to `x` for `f64` values.
        pub fn copysignf64(x: f64, y: f64) -> f64;

        /// Returns the largest integer less than or equal to an `f32`.
        pub fn floorf32(x: f32) -> f32;
        /// Returns the largest integer less than or equal to an `f64`.
        pub fn floorf64(x: f64) -> f64;

        /// Returns the smallest integer greater than or equal to an `f32`.
        pub fn ceilf32(x: f32) -> f32;
        /// Returns the smallest integer greater than or equal to an `f64`.
        pub fn ceilf64(x: f64) -> f64;

        /// Returns the integer part of an `f32`.
        pub fn truncf32(x: f32) -> f32;
        /// Returns the integer part of an `f64`.
        pub fn truncf64(x: f64) -> f64;

        /// Returns the nearest integer to an `f32`. May raise an inexact floating-point exception
        /// if the argument is not an integer.
        pub fn rintf32(x: f32) -> f32;
        /// Returns the nearest integer to an `f64`. May raise an inexact floating-point exception
        /// if the argument is not an integer.
        pub fn rintf64(x: f64) -> f64;

        /// Returns the nearest integer to an `f32`.
        pub fn nearbyintf32(x: f32) -> f32;
        /// Returns the nearest integer to an `f64`.
        pub fn nearbyintf64(x: f64) -> f64;

        /// Returns the nearest integer to an `f32`. Rounds half-way cases away from zero.
        pub fn roundf32(x: f32) -> f32;
        /// Returns the nearest integer to an `f64`. Rounds half-way cases away from zero.
        pub fn roundf64(x: f64) -> f64;

        /// Float addition that allows optimizations based on algebraic rules.
        /// May assume inputs are finite.
        pub fn fadd_fast<T>(a: T, b: T) -> T;

        /// Float subtraction that allows optimizations based on algebraic rules.
        /// May assume inputs are finite.
        pub fn fsub_fast<T>(a: T, b: T) -> T;

        /// Float multiplication that allows optimizations based on algebraic rules.
        /// May assume inputs are finite.
        pub fn fmul_fast<T>(a: T, b: T) -> T;

        /// Float division that allows optimizations based on algebraic rules.
        /// May assume inputs are finite.
        pub fn fdiv_fast<T>(a: T, b: T) -> T;

        /// Float remainder that allows optimizations based on algebraic rules.
        /// May assume inputs are finite.
        pub fn frem_fast<T>(a: T, b: T) -> T;

        /// Returns the number of bits set in an integer type `T`
        pub fn ctpop<T>(x: T) -> T;

        /// Returns the number of leading unset bits (zeroes) in an integer type `T`.
        ///
        /// # Examples
        ///
        /// ```
        /// #![feature(core_intrinsics)]
        ///
        /// use std::intrinsics::ctlz;
        ///
        /// let x = 0b0001_1100_u8;
        /// let num_leading = ctlz(x);
        /// assert_eq!(num_leading, 3);
        /// ```
        ///
        /// An `x` with value `0` will return the bit width of `T`.
        ///
        /// ```
        /// #![feature(core_intrinsics)]
        ///
        /// use std::intrinsics::ctlz;
        ///
        /// let x = 0u16;
        /// let num_leading = ctlz(x);
        /// assert_eq!(num_leading, 16);
        /// ```
        pub fn ctlz<T>(x: T) -> T;

        /// Like `ctlz`, but extra-unsafe as it returns `undef` when
        /// given an `x` with value `0`.
        ///
        /// # Examples
        ///
        /// ```
        /// #![feature(core_intrinsics)]
        ///
        /// use std::intrinsics::ctlz_nonzero;
        ///
        /// let x = 0b0001_1100_u8;
        /// let num_leading = unsafe { ctlz_nonzero(x) };
        /// assert_eq!(num_leading, 3);
        /// ```
        pub fn ctlz_nonzero<T>(x: T) -> T;

        /// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
        ///
        /// # Examples
        ///
        /// ```
        /// #![feature(core_intrinsics)]
        ///
        /// use std::intrinsics::cttz;
        ///
        /// let x = 0b0011_1000_u8;
        /// let num_trailing = cttz(x);
        /// assert_eq!(num_trailing, 3);
        /// ```
        ///
        /// An `x` with value `0` will return the bit width of `T`:
        ///
        /// ```
        /// #![feature(core_intrinsics)]
        ///
        /// use std::intrinsics::cttz;
        ///
        /// let x = 0u16;
        /// let num_trailing = cttz(x);
        /// assert_eq!(num_trailing, 16);
        /// ```
        pub fn cttz<T>(x: T) -> T;

        /// Like `cttz`, but extra-unsafe as it returns `undef` when
        /// given an `x` with value `0`.
        ///
        /// # Examples
        ///
        /// ```
        /// #![feature(core_intrinsics)]
        ///
        /// use std::intrinsics::cttz_nonzero;
        ///
        /// let x = 0b0011_1000_u8;
        /// let num_trailing = unsafe { cttz_nonzero(x) };
        /// assert_eq!(num_trailing, 3);
        /// ```
        pub fn cttz_nonzero<T>(x: T) -> T;

        /// Reverses the bytes in an integer type `T`.
        pub fn bswap<T>(x: T) -> T;

        /// Reverses the bits in an integer type `T`.
        pub fn bitreverse<T>(x: T) -> T;

        /// Performs checked integer addition.
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `overflowing_add` method. For example,
        /// [`std::u32::overflowing_add`](../../std/primitive.u32.html#method.overflowing_add)
        pub fn add_with_overflow<T>(x: T, y: T) -> (T, bool);

        /// Performs checked integer subtraction
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `overflowing_sub` method. For example,
        /// [`std::u32::overflowing_sub`](../../std/primitive.u32.html#method.overflowing_sub)
        pub fn sub_with_overflow<T>(x: T, y: T) -> (T, bool);

        /// Performs checked integer multiplication
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `overflowing_mul` method. For example,
        /// [`std::u32::overflowing_mul`](../../std/primitive.u32.html#method.overflowing_mul)
        pub fn mul_with_overflow<T>(x: T, y: T) -> (T, bool);

        /// Performs an exact division, resulting in undefined behavior where
        /// `x % y != 0` or `y == 0` or `x == T::min_value() && y == -1`
        pub fn exact_div<T>(x: T, y: T) -> T;

        /// Performs an unchecked division, resulting in undefined behavior
        /// where y = 0 or x = `T::min_value()` and y = -1
        pub fn unchecked_div<T>(x: T, y: T) -> T;
        /// Returns the remainder of an unchecked division, resulting in
        /// undefined behavior where y = 0 or x = `T::min_value()` and y = -1
        pub fn unchecked_rem<T>(x: T, y: T) -> T;

        /// Performs an unchecked left shift, resulting in undefined behavior when
        /// y < 0 or y >= N, where N is the width of T in bits.
        pub fn unchecked_shl<T>(x: T, y: T) -> T;
        /// Performs an unchecked right shift, resulting in undefined behavior when
        /// y < 0 or y >= N, where N is the width of T in bits.
        pub fn unchecked_shr<T>(x: T, y: T) -> T;

        /// Performs rotate left.
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `rotate_left` method. For example,
        /// [`std::u32::rotate_left`](../../std/primitive.u32.html#method.rotate_left)
        pub fn rotate_left<T>(x: T, y: T) -> T;

        /// Performs rotate right.
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `rotate_right` method. For example,
        /// [`std::u32::rotate_right`](../../std/primitive.u32.html#method.rotate_right)
        pub fn rotate_right<T>(x: T, y: T) -> T;

        /// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `wrapping_add` method. For example,
        /// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
        pub fn overflowing_add<T>(a: T, b: T) -> T;
        /// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `wrapping_sub` method. For example,
        /// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
        pub fn overflowing_sub<T>(a: T, b: T) -> T;
        /// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `wrapping_mul` method. For example,
        /// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
        pub fn overflowing_mul<T>(a: T, b: T) -> T;

        /// Computes `a + b`, while saturating at numeric bounds.
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `saturating_add` method. For example,
        /// [`std::u32::saturating_add`](../../std/primitive.u32.html#method.saturating_add)
        #[cfg(not(stage0))]
        pub fn saturating_add<T>(a: T, b: T) -> T;
        /// Computes `a - b`, while saturating at numeric bounds.
        /// The stabilized versions of this intrinsic are available on the integer
        /// primitives via the `saturating_sub` method. For example,
        /// [`std::u32::saturating_sub`](../../std/primitive.u32.html#method.saturating_sub)
        #[cfg(not(stage0))]
        pub fn saturating_sub<T>(a: T, b: T) -> T;

        /// Returns the value of the discriminant for the variant in 'v',
        /// cast to a `u64`; if `T` has no discriminant, returns 0.
        pub fn discriminant_value<T>(v: &T) -> u64;

        /// Rust's "try catch" construct which invokes the function pointer `f` with
        /// the data pointer `data`.
        ///
        /// The third pointer is a target-specific data pointer which is filled in
        /// with the specifics of the exception that occurred. For examples on Unix
        /// platforms this is a `*mut *mut T` which is filled in by the compiler and
        /// on MSVC it's `*mut [usize; 2]`. For more information see the compiler's
        /// source as well as std's catch implementation.
        pub fn try(f: fn(*mut u8), data: *mut u8, local_ptr: *mut u8) -> i32;

        /// Emits a `!nontemporal` store according to LLVM (see their docs).
        /// Probably will never become stable.
        pub fn nontemporal_store<T>(ptr: *mut T, val: T);
    }

    mod real_intrinsics {
      extern "rust-intrinsic" {
        /// Copies `count * size_of::<T>()` bytes from `src` to `dst`. The source
        /// and destination must *not* overlap.
        /// For the full docs, see the stabilized wrapper [`copy_nonoverlapping`].
        ///
        /// [`copy_nonoverlapping`]: ../../std/ptr/fn.copy_nonoverlapping.html
        pub fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);

        /// Copies `count * size_of::<T>()` bytes from `src` to `dst`. The source
        /// and destination may overlap.
        /// For the full docs, see the stabilized wrapper [`copy`].
        ///
        /// [`copy`]: ../../std/ptr/fn.copy.html
        pub fn copy<T>(src: *const T, dst: *mut T, count: usize);

        /// Sets `count * size_of::<T>()` bytes of memory starting at `dst` to
        /// `val`.
        /// For the full docs, see the stabilized wrapper [`write_bytes`].
        ///
        /// [`write_bytes`]: ../../std/ptr/fn.write_bytes.html
        pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
      }
    }

    /// Copies `count * size_of::<T>()` bytes from `src` to `dst`. The source
    /// and destination must *not* overlap.
    ///
    /// For regions of memory which might overlap, use [`copy`] instead.
    ///
    /// `copy_nonoverlapping` is semantically equivalent to C's [`memcpy`], but
    /// with the argument order swapped.
    ///
    /// [`copy`]: ./fn.copy.html
    /// [`memcpy`]: https://en.cppreference.com/w/c/string/byte/memcpy
    ///
    /// # Safety
    ///
    /// Behavior is undefined if any of the following conditions are violated:
    ///
    /// * `src` must be [valid] for reads of `count * size_of::<T>()` bytes.
    ///
    /// * `dst` must be [valid] for writes of `count * size_of::<T>()` bytes.
    ///
    /// * Both `src` and `dst` must be properly aligned.
    ///
    /// * The region of memory beginning at `src` with a size of `count *
    ///   size_of::<T>()` bytes must *not* overlap with the region of memory
    ///   beginning at `dst` with the same size.
    ///
    /// Like [`read`], `copy_nonoverlapping` creates a bitwise copy of `T`, regardless of
    /// whether `T` is [`Copy`]. If `T` is not [`Copy`], using *both* the values
    /// in the region beginning at `*src` and the region beginning at `*dst` can
    /// [violate memory safety][read-ownership].
    ///
    /// Note that even if the effectively copied size (`count * size_of::<T>()`) is
    /// `0`, the pointers must be non-NULL and properly aligned.
    ///
    /// [`Copy`]: ../marker/trait.Copy.html
    /// [`read`]: ../ptr/fn.read.html
    /// [read-ownership]: ../ptr/fn.read.html#ownership-of-the-returned-value
    /// [valid]: ../ptr/index.html#safety
    ///
    /// # Examples
    ///
    /// Manually implement [`Vec::append`]:
    ///
    /// ```
    /// use std::ptr;
    ///
    /// /// Moves all the elements of `src` into `dst`, leaving `src` empty.
    /// fn append<T>(dst: &mut Vec<T>, src: &mut Vec<T>) {
    ///     let src_len = src.len();
    ///     let dst_len = dst.len();
    ///
    ///     // Ensure that `dst` has enough capacity to hold all of `src`.
    ///     dst.reserve(src_len);
    ///
    ///     unsafe {
    ///         // The call to offset is always safe because `Vec` will never
    ///         // allocate more than `isize::MAX` bytes.
    ///         let dst_ptr = dst.as_mut_ptr().offset(dst_len as isize);
    ///         let src_ptr = src.as_ptr();
    ///
    ///         // Truncate `src` without dropping its contents. We do this first,
    ///         // to avoid problems in case something further down panics.
    ///         src.set_len(0);
    ///
    ///         // The two regions cannot overlap because mutable references do
    ///         // not alias, and two different vectors cannot own the same
    ///         // memory.
    ///         ptr::copy_nonoverlapping(src_ptr, dst_ptr, src_len);
    ///
    ///         // Notify `dst` that it now holds the contents of `src`.
    ///         dst.set_len(dst_len + src_len);
    ///     }
    /// }
    ///
    /// let mut a = vec!['r'];
    /// let mut b = vec!['u', 's', 't'];
    ///
    /// append(&mut a, &mut b);
    ///
    /// assert_eq!(a, &['r', 'u', 's', 't']);
    /// assert!(b.is_empty());
    /// ```
    ///
    /// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append
    #[stable(feature = "rust1", since = "1.0.0")]
    #[inline]
    pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
        real_intrinsics::copy_nonoverlapping(src, dst, count);
    }

    /// Copies `count * size_of::<T>()` bytes from `src` to `dst`. The source
    /// and destination may overlap.
    ///
    /// If the source and destination will *never* overlap,
    /// [`copy_nonoverlapping`] can be used instead.
    ///
    /// `copy` is semantically equivalent to C's [`memmove`], but with the argument
    /// order swapped. Copying takes place as if the bytes were copied from `src`
    /// to a temporary array and then copied from the array to `dst`.
    ///
    /// [`copy_nonoverlapping`]: ./fn.copy_nonoverlapping.html
    /// [`memmove`]: https://en.cppreference.com/w/c/string/byte/memmove
    ///
    /// # Safety
    ///
    /// Behavior is undefined if any of the following conditions are violated:
    ///
    /// * `src` must be [valid] for reads of `count * size_of::<T>()` bytes.
    ///
    /// * `dst` must be [valid] for writes of `count * size_of::<T>()` bytes.
    ///
    /// * Both `src` and `dst` must be properly aligned.
    ///
    /// Like [`read`], `copy` creates a bitwise copy of `T`, regardless of
    /// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the values
    /// in the region beginning at `*src` and the region beginning at `*dst` can
    /// [violate memory safety][read-ownership].
    ///
    /// Note that even if the effectively copied size (`count * size_of::<T>()`) is
    /// `0`, the pointers must be non-NULL and properly aligned.
    ///
    /// [`Copy`]: ../marker/trait.Copy.html
    /// [`read`]: ../ptr/fn.read.html
    /// [read-ownership]: ../ptr/fn.read.html#ownership-of-the-returned-value
    /// [valid]: ../ptr/index.html#safety
    ///
    /// # Examples
    ///
    /// Efficiently create a Rust vector from an unsafe buffer:
    ///
    /// ```
    /// use std::ptr;
    ///
    /// # #[allow(dead_code)]
    /// unsafe fn from_buf_raw<T>(ptr: *const T, elts: usize) -> Vec<T> {
    ///     let mut dst = Vec::with_capacity(elts);
    ///     dst.set_len(elts);
    ///     ptr::copy(ptr, dst.as_mut_ptr(), elts);
    ///     dst
    /// }
    /// ```
    #[stable(feature = "rust1", since = "1.0.0")]
    #[inline]
    pub unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
        real_intrinsics::copy(src, dst, count)
    }

    /// Sets `count * size_of::<T>()` bytes of memory starting at `dst` to
    /// `val`.
    ///
    /// `write_bytes` is similar to C's [`memset`], but sets `count *
    /// size_of::<T>()` bytes to `val`.
    ///
    /// [`memset`]: https://en.cppreference.com/w/c/string/byte/memset
    ///
    /// # Safety
    ///
    /// Behavior is undefined if any of the following conditions are violated:
    ///
    /// * `dst` must be [valid] for writes of `count * size_of::<T>()` bytes.
    ///
    /// * `dst` must be properly aligned.
    ///
    /// Additionally, the caller must ensure that writing `count *
    /// size_of::<T>()` bytes to the given region of memory results in a valid
    /// value of `T`. Using a region of memory typed as a `T` that contains an
    /// invalid value of `T` is undefined behavior.
    ///
    /// Note that even if the effectively copied size (`count * size_of::<T>()`) is
    /// `0`, the pointer must be non-NULL and properly aligned.
    ///
    /// [valid]: ../ptr/index.html#safety
    ///
    /// # Examples
    ///
    /// Basic usage:
    ///
    /// ```
    /// use std::ptr;
    ///
    /// let mut vec = vec![0u32; 4];
    /// unsafe {
    ///     let vec_ptr = vec.as_mut_ptr();
    ///     ptr::write_bytes(vec_ptr, 0xfe, 2);
    /// }
    /// assert_eq!(vec, [0xfefefefe, 0xfefefefe, 0, 0]);
    /// ```
    ///
    /// Creating an invalid value:
    ///
    /// ```
    /// use std::ptr;
    ///
    /// let mut v = Box::new(0i32);
    ///
    /// unsafe {
    ///     // Leaks the previously held value by overwriting the `Box<T>` with
    ///     // a null pointer.
    ///     ptr::write_bytes(&mut v as *mut Box<i32>, 0, 1);
    /// }
    ///
    /// // At this point, using or dropping `v` results in undefined behavior.
    /// // drop(v); // ERROR
    ///
    /// // Even leaking `v` "uses" it, and hence is undefined behavior.
    /// // mem::forget(v); // ERROR
    ///
    /// // In fact, `v` is invalid according to basic type layout invariants, so *any*
    /// // operation touching it is undefined behavior.
    /// // let v2 = v; // ERROR
    ///
    /// unsafe {
    ///     // Let us instead put in a valid value
    ///     ptr::write(&mut v as *mut Box<i32>, Box::new(42i32));
    /// }
    ///
    /// // Now the box is fine
    /// assert_eq!(*v, 42);
    /// ```
    #[stable(feature = "rust1", since = "1.0.0")]
    #[inline]
    pub unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
        real_intrinsics::write_bytes(dst, val, count)
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)