summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/alloc/src/alloc.rs12
-rw-r--r--library/alloc/src/borrow.rs8
-rw-r--r--library/alloc/src/boxed.rs72
-rw-r--r--library/alloc/src/boxed/thin.rs10
-rw-r--r--library/alloc/src/collections/btree/map.rs66
-rw-r--r--library/alloc/src/collections/btree/map/tests.rs19
-rw-r--r--library/alloc/src/collections/btree/set.rs20
-rw-r--r--library/alloc/src/collections/linked_list.rs359
-rw-r--r--library/alloc/src/collections/vec_deque/mod.rs2
-rw-r--r--library/alloc/src/collections/vec_deque/spec_from_iter.rs2
-rw-r--r--library/alloc/src/fmt.rs10
-rw-r--r--library/alloc/src/lib.rs4
-rw-r--r--library/alloc/src/rc.rs2
-rw-r--r--library/alloc/src/str.rs6
-rw-r--r--library/alloc/src/string.rs27
-rw-r--r--library/alloc/src/sync.rs27
-rw-r--r--library/alloc/src/task.rs3
-rw-r--r--library/alloc/src/vec/drain.rs8
-rw-r--r--library/alloc/src/vec/drain_filter.rs8
-rw-r--r--library/alloc/src/vec/in_place_collect.rs11
-rw-r--r--library/alloc/src/vec/mod.rs20
-rw-r--r--library/alloc/src/vec/splice.rs2
-rw-r--r--library/alloc/tests/boxed.rs2
-rw-r--r--library/alloc/tests/const_fns.rs19
-rw-r--r--library/alloc/tests/lib.rs2
-rw-r--r--library/alloc/tests/slice.rs42
-rw-r--r--library/alloc/tests/vec.rs2
-rw-r--r--library/backtrace/.github/workflows/main.yml36
-rw-r--r--library/backtrace/Cargo.toml22
-rw-r--r--library/backtrace/src/backtrace/libunwind.rs3
-rw-r--r--library/backtrace/src/dbghelp.rs2
-rw-r--r--library/backtrace/src/print.rs2
-rw-r--r--library/backtrace/src/print/fuchsia.rs2
-rw-r--r--library/backtrace/src/symbolize/gimli.rs2
-rw-r--r--library/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs20
-rw-r--r--library/backtrace/src/symbolize/gimli/libs_macos.rs4
-rw-r--r--library/backtrace/src/symbolize/gimli/macho.rs4
-rw-r--r--library/backtrace/src/symbolize/gimli/mmap_windows.rs2
-rw-r--r--library/backtrace/src/symbolize/gimli/parse_running_mmaps_unix.rs242
-rw-r--r--library/backtrace/src/windows.rs6
-rw-r--r--library/backtrace/tests/common/mod.rs14
-rw-r--r--library/backtrace/tests/concurrent-panics.rs14
-rw-r--r--library/backtrace/tests/current-exe-mismatch.rs137
-rw-r--r--library/backtrace/tests/skip_inner_frames.rs2
-rw-r--r--library/core/benches/fmt.rs24
-rw-r--r--library/core/benches/iter.rs46
-rw-r--r--library/core/benches/num/dec2flt/mod.rs24
-rw-r--r--library/core/benches/num/flt2dec/mod.rs6
-rw-r--r--library/core/benches/num/flt2dec/strategy/grisu.rs27
-rw-r--r--library/core/benches/num/mod.rs6
-rw-r--r--library/core/src/alloc/global.rs3
-rw-r--r--library/core/src/alloc/layout.rs15
-rw-r--r--library/core/src/alloc/mod.rs1
-rw-r--r--library/core/src/any.rs13
-rw-r--r--library/core/src/array/ascii.rs47
-rw-r--r--library/core/src/array/iter.rs18
-rw-r--r--library/core/src/array/mod.rs35
-rw-r--r--library/core/src/ascii.rs75
-rw-r--r--library/core/src/ascii/ascii_char.rs565
-rw-r--r--library/core/src/bool.rs15
-rw-r--r--library/core/src/borrow.rs17
-rw-r--r--library/core/src/cell.rs53
-rw-r--r--library/core/src/cell/lazy.rs28
-rw-r--r--library/core/src/cell/once.rs3
-rw-r--r--library/core/src/char/convert.rs12
-rw-r--r--library/core/src/char/methods.rs76
-rw-r--r--library/core/src/char/mod.rs252
-rw-r--r--library/core/src/clone.rs23
-rw-r--r--library/core/src/cmp.rs212
-rw-r--r--library/core/src/convert/mod.rs49
-rw-r--r--library/core/src/convert/num.rs24
-rw-r--r--library/core/src/default.rs4
-rw-r--r--library/core/src/escape.rs112
-rw-r--r--library/core/src/ffi/c_str.rs21
-rw-r--r--library/core/src/ffi/mod.rs20
-rw-r--r--library/core/src/fmt/builders.rs14
-rw-r--r--library/core/src/fmt/float.rs12
-rw-r--r--library/core/src/fmt/mod.rs416
-rw-r--r--library/core/src/fmt/num.rs15
-rw-r--r--library/core/src/fmt/rt.rs212
-rw-r--r--library/core/src/fmt/rt/v1.rs63
-rw-r--r--library/core/src/future/into_future.rs1
-rw-r--r--library/core/src/future/join.rs6
-rw-r--r--library/core/src/future/mod.rs8
-rw-r--r--library/core/src/hash/mod.rs95
-rw-r--r--library/core/src/hash/sip.rs17
-rw-r--r--library/core/src/hint.rs13
-rw-r--r--library/core/src/internal_macros.rs71
-rw-r--r--library/core/src/intrinsics.rs79
-rw-r--r--library/core/src/intrinsics/mir.rs7
-rw-r--r--library/core/src/iter/adapters/chain.rs2
-rw-r--r--library/core/src/iter/adapters/filter.rs55
-rw-r--r--library/core/src/iter/adapters/filter_map.rs62
-rw-r--r--library/core/src/iter/adapters/flatten.rs68
-rw-r--r--library/core/src/iter/range.rs20
-rw-r--r--library/core/src/iter/sources/empty.rs3
-rw-r--r--library/core/src/iter/traits/collect.rs13
-rw-r--r--library/core/src/iter/traits/iterator.rs1
-rw-r--r--library/core/src/lib.rs18
-rw-r--r--library/core/src/macros/mod.rs3
-rw-r--r--library/core/src/macros/panic.md2
-rw-r--r--library/core/src/marker.rs211
-rw-r--r--library/core/src/mem/manually_drop.rs6
-rw-r--r--library/core/src/mem/maybe_uninit.rs14
-rw-r--r--library/core/src/mem/mod.rs62
-rw-r--r--library/core/src/mem/transmutability.rs6
-rw-r--r--library/core/src/net/socket_addr.rs27
-rw-r--r--library/core/src/num/error.rs6
-rw-r--r--library/core/src/num/f32.rs36
-rw-r--r--library/core/src/num/f64.rs36
-rw-r--r--library/core/src/num/flt2dec/strategy/grisu.rs16
-rw-r--r--library/core/src/num/int_macros.rs49
-rw-r--r--library/core/src/num/mod.rs87
-rw-r--r--library/core/src/num/nonzero.rs130
-rw-r--r--library/core/src/num/uint_macros.rs4
-rw-r--r--library/core/src/num/wrapping.rs168
-rw-r--r--library/core/src/ops/arith.rs78
-rw-r--r--library/core/src/ops/bit.rs69
-rw-r--r--library/core/src/ops/control_flow.rs9
-rw-r--r--library/core/src/ops/deref.rs8
-rw-r--r--library/core/src/ops/drop.rs68
-rw-r--r--library/core/src/ops/function.rs25
-rw-r--r--library/core/src/ops/index.rs5
-rw-r--r--library/core/src/ops/range.rs95
-rw-r--r--library/core/src/ops/try_trait.rs19
-rw-r--r--library/core/src/option.rs217
-rw-r--r--library/core/src/panic.rs40
-rw-r--r--library/core/src/panic/panic_info.rs2
-rw-r--r--library/core/src/panicking.rs2
-rw-r--r--library/core/src/pin.rs2
-rw-r--r--library/core/src/primitive_docs.rs96
-rw-r--r--library/core/src/ptr/alignment.rs16
-rw-r--r--library/core/src/ptr/const_ptr.rs27
-rw-r--r--library/core/src/ptr/mod.rs305
-rw-r--r--library/core/src/ptr/mut_ptr.rs39
-rw-r--r--library/core/src/ptr/non_null.rs30
-rw-r--r--library/core/src/ptr/unique.rs14
-rw-r--r--library/core/src/result.rs74
-rw-r--r--library/core/src/slice/ascii.rs79
-rw-r--r--library/core/src/slice/index.rs27
-rw-r--r--library/core/src/slice/iter.rs42
-rw-r--r--library/core/src/slice/iter/macros.rs75
-rw-r--r--library/core/src/slice/memchr.rs14
-rw-r--r--library/core/src/slice/mod.rs372
-rw-r--r--library/core/src/slice/select.rs302
-rw-r--r--library/core/src/slice/sort.rs181
-rw-r--r--library/core/src/str/mod.rs35
-rw-r--r--library/core/src/str/pattern.rs8
-rw-r--r--library/core/src/str/traits.rs22
-rw-r--r--library/core/src/sync/atomic.rs18
-rw-r--r--library/core/src/task/mod.rs2
-rw-r--r--library/core/src/task/poll.rs36
-rw-r--r--library/core/src/task/ready.rs61
-rw-r--r--library/core/src/task/wake.rs2
-rw-r--r--library/core/src/time.rs26
-rw-r--r--library/core/src/tuple.rs50
-rw-r--r--library/core/tests/asserting.rs6
-rw-r--r--library/core/tests/atomic.rs2
-rw-r--r--library/core/tests/bool.rs2
-rw-r--r--library/core/tests/cell.rs2
-rw-r--r--library/core/tests/char.rs2
-rw-r--r--library/core/tests/clone.rs1
-rw-r--r--library/core/tests/cmp.rs6
-rw-r--r--library/core/tests/convert.rs2
-rw-r--r--library/core/tests/hash/mod.rs24
-rw-r--r--library/core/tests/hash/sip.rs4
-rw-r--r--library/core/tests/lazy.rs4
-rw-r--r--library/core/tests/lib.rs6
-rw-r--r--library/core/tests/mem.rs210
-rw-r--r--library/core/tests/nonzero.rs20
-rw-r--r--library/core/tests/num/const_from.rs2
-rw-r--r--library/core/tests/num/ieee754.rs1
-rw-r--r--library/core/tests/num/int_macros.rs26
-rw-r--r--library/core/tests/num/mod.rs58
-rw-r--r--library/core/tests/num/uint_macros.rs26
-rw-r--r--library/core/tests/option.rs24
-rw-r--r--library/core/tests/time.rs12
-rw-r--r--library/panic_unwind/src/emcc.rs2
-rw-r--r--library/panic_unwind/src/gcc.rs4
-rw-r--r--library/panic_unwind/src/seh.rs2
-rw-r--r--library/portable-simd/.github/workflows/ci.yml4
-rw-r--r--library/portable-simd/README.md34
-rw-r--r--library/portable-simd/crates/core_simd/Cargo.toml9
-rw-r--r--library/portable-simd/crates/core_simd/examples/README.md13
-rw-r--r--library/portable-simd/crates/core_simd/examples/dot_product.rs169
-rw-r--r--library/portable-simd/crates/core_simd/src/alias.rs227
-rw-r--r--library/portable-simd/crates/core_simd/src/cast.rs55
-rw-r--r--library/portable-simd/crates/core_simd/src/elements.rs4
-rw-r--r--library/portable-simd/crates/core_simd/src/elements/const_ptr.rs141
-rw-r--r--library/portable-simd/crates/core_simd/src/elements/mut_ptr.rs136
-rw-r--r--library/portable-simd/crates/core_simd/src/eq.rs38
-rw-r--r--library/portable-simd/crates/core_simd/src/fmt.rs50
-rw-r--r--library/portable-simd/crates/core_simd/src/intrinsics.rs16
-rw-r--r--library/portable-simd/crates/core_simd/src/lane_count.rs36
-rw-r--r--library/portable-simd/crates/core_simd/src/lib.rs8
-rw-r--r--library/portable-simd/crates/core_simd/src/masks.rs69
-rw-r--r--library/portable-simd/crates/core_simd/src/masks/bitmask.rs4
-rw-r--r--library/portable-simd/crates/core_simd/src/masks/full_masks.rs4
-rw-r--r--library/portable-simd/crates/core_simd/src/masks/to_bitmask.rs4
-rw-r--r--library/portable-simd/crates/core_simd/src/mod.rs6
-rw-r--r--library/portable-simd/crates/core_simd/src/ops/deref.rs2
-rw-r--r--library/portable-simd/crates/core_simd/src/ord.rs102
-rw-r--r--library/portable-simd/crates/core_simd/src/swizzle.rs72
-rw-r--r--library/portable-simd/crates/core_simd/src/swizzle_dyn.rs157
-rw-r--r--library/portable-simd/crates/core_simd/src/vector.rs665
-rw-r--r--library/portable-simd/crates/core_simd/src/vector/float.rs24
-rw-r--r--library/portable-simd/crates/core_simd/src/vector/int.rs63
-rw-r--r--library/portable-simd/crates/core_simd/src/vector/ptr.rs51
-rw-r--r--library/portable-simd/crates/core_simd/src/vector/uint.rs63
-rw-r--r--library/portable-simd/crates/core_simd/tests/autoderef.rs2
-rw-r--r--library/portable-simd/crates/core_simd/tests/mask_ops_impl/mask_macros.rs2
-rw-r--r--library/portable-simd/crates/core_simd/tests/masks.rs59
-rw-r--r--library/portable-simd/crates/core_simd/tests/ops_macros.rs14
-rw-r--r--library/portable-simd/crates/core_simd/tests/pointers.rs111
-rw-r--r--library/portable-simd/crates/core_simd/tests/round.rs2
-rw-r--r--library/portable-simd/crates/core_simd/tests/swizzle.rs16
-rw-r--r--library/portable-simd/crates/core_simd/tests/swizzle_dyn.rs74
-rw-r--r--library/portable-simd/crates/core_simd/tests/to_bytes.rs2
-rw-r--r--library/portable-simd/crates/core_simd/tests/try_from_slice.rs25
-rw-r--r--library/portable-simd/crates/test_helpers/Cargo.toml3
-rw-r--r--library/portable-simd/crates/test_helpers/src/array.rs2
-rw-r--r--library/portable-simd/crates/test_helpers/src/biteq.rs20
-rw-r--r--library/portable-simd/crates/test_helpers/src/lib.rs346
-rw-r--r--library/proc_macro/src/bridge/mod.rs10
-rw-r--r--library/proc_macro/src/lib.rs8
-rw-r--r--library/std/Cargo.toml12
-rw-r--r--library/std/build.rs1
-rw-r--r--library/std/src/alloc.rs8
-rw-r--r--library/std/src/ascii.rs3
-rw-r--r--library/std/src/collections/hash/map.rs6
-rw-r--r--library/std/src/fs.rs73
-rw-r--r--library/std/src/fs/tests.rs60
-rw-r--r--library/std/src/io/buffered/tests.rs13
-rw-r--r--library/std/src/io/copy.rs2
-rw-r--r--library/std/src/io/impls.rs56
-rw-r--r--library/std/src/io/mod.rs37
-rw-r--r--library/std/src/io/readbuf/tests.rs2
-rw-r--r--library/std/src/io/tests.rs2
-rw-r--r--library/std/src/keyword_docs.rs6
-rw-r--r--library/std/src/lib.rs1
-rw-r--r--library/std/src/net/tcp.rs11
-rw-r--r--library/std/src/net/udp.rs10
-rw-r--r--library/std/src/os/fuchsia/raw.rs6
-rw-r--r--library/std/src/os/ios/fs.rs22
-rw-r--r--library/std/src/os/linux/process.rs2
-rw-r--r--library/std/src/os/macos/fs.rs22
-rw-r--r--library/std/src/os/mod.rs2
-rw-r--r--library/std/src/os/unix/fs.rs2
-rw-r--r--library/std/src/os/unix/mod.rs2
-rw-r--r--library/std/src/os/vita/fs.rs95
-rw-r--r--library/std/src/os/vita/mod.rs6
-rw-r--r--library/std/src/os/vita/raw.rs70
-rw-r--r--library/std/src/os/watchos/fs.rs22
-rw-r--r--library/std/src/os/windows/fs.rs19
-rw-r--r--library/std/src/os/windows/io/handle.rs56
-rw-r--r--library/std/src/os/windows/io/raw.rs17
-rw-r--r--library/std/src/os/windows/io/socket.rs77
-rw-r--r--library/std/src/panic.rs8
-rw-r--r--library/std/src/panicking.rs122
-rw-r--r--library/std/src/path.rs37
-rw-r--r--library/std/src/personality/dwarf/eh.rs5
-rw-r--r--library/std/src/personality/gcc.rs11
-rw-r--r--library/std/src/prelude/v1.rs8
-rw-r--r--library/std/src/primitive_docs.rs96
-rw-r--r--library/std/src/process.rs10
-rw-r--r--library/std/src/sync/lazy_lock.rs38
-rw-r--r--library/std/src/sync/mpmc/error.rs2
-rw-r--r--library/std/src/sync/mpsc/mod.rs4
-rw-r--r--library/std/src/sync/once_lock.rs3
-rw-r--r--library/std/src/sync/once_lock/tests.rs2
-rw-r--r--library/std/src/sync/remutex.rs2
-rw-r--r--library/std/src/sys/common/thread_local/fast_local.rs259
-rw-r--r--library/std/src/sys/common/thread_local/mod.rs36
-rw-r--r--library/std/src/sys/common/thread_local/os_local.rs215
-rw-r--r--library/std/src/sys/common/thread_local/static_local.rs80
-rw-r--r--library/std/src/sys/hermit/fd.rs1
-rw-r--r--library/std/src/sys/hermit/fs.rs3
-rw-r--r--library/std/src/sys/hermit/net.rs2
-rw-r--r--library/std/src/sys/hermit/time.rs12
-rw-r--r--library/std/src/sys/mod.rs25
-rw-r--r--library/std/src/sys/sgx/abi/entry.S10
-rw-r--r--library/std/src/sys/sgx/fd.rs1
-rw-r--r--library/std/src/sys/sgx/net.rs3
-rw-r--r--library/std/src/sys/sgx/waitqueue/mod.rs16
-rw-r--r--library/std/src/sys/solid/net.rs2
-rw-r--r--library/std/src/sys/solid/time.rs4
-rw-r--r--library/std/src/sys/unix/alloc.rs3
-rw-r--r--library/std/src/sys/unix/args.rs2
-rw-r--r--library/std/src/sys/unix/env.rs11
-rw-r--r--library/std/src/sys/unix/fd.rs15
-rw-r--r--library/std/src/sys/unix/fs.rs96
-rw-r--r--library/std/src/sys/unix/l4re.rs5
-rw-r--r--library/std/src/sys/unix/mod.rs17
-rw-r--r--library/std/src/sys/unix/net.rs2
-rw-r--r--library/std/src/sys/unix/os.rs8
-rw-r--r--library/std/src/sys/unix/os_str.rs1
-rw-r--r--library/std/src/sys/unix/pipe.rs1
-rw-r--r--library/std/src/sys/unix/process/mod.rs2
-rw-r--r--library/std/src/sys/unix/process/process_unix.rs2
-rw-r--r--library/std/src/sys/unix/process/process_vxworks.rs2
-rw-r--r--library/std/src/sys/unix/rand.rs5
-rw-r--r--library/std/src/sys/unix/thread.rs19
-rw-r--r--library/std/src/sys/unix/time.rs38
-rw-r--r--library/std/src/sys/unsupported/io.rs2
-rw-r--r--library/std/src/sys/unsupported/mod.rs1
-rw-r--r--library/std/src/sys/unsupported/thread_parking.rs11
-rw-r--r--library/std/src/sys/wasi/fd.rs3
-rw-r--r--library/std/src/sys/wasi/fs.rs2
-rw-r--r--library/std/src/sys/wasi/mod.rs11
-rw-r--r--library/std/src/sys/wasi/net.rs7
-rw-r--r--library/std/src/sys/wasm/mod.rs2
-rw-r--r--library/std/src/sys/windows/args.rs5
-rw-r--r--library/std/src/sys/windows/c.rs1315
-rw-r--r--library/std/src/sys/windows/c/errors.rs1883
-rw-r--r--library/std/src/sys/windows/c/windows_sys.lst2590
-rw-r--r--library/std/src/sys/windows/c/windows_sys.rs4276
-rw-r--r--library/std/src/sys/windows/compat.rs16
-rw-r--r--library/std/src/sys/windows/fs.rs128
-rw-r--r--library/std/src/sys/windows/handle.rs7
-rw-r--r--library/std/src/sys/windows/io.rs7
-rw-r--r--library/std/src/sys/windows/mod.rs9
-rw-r--r--library/std/src/sys/windows/net.rs5
-rw-r--r--library/std/src/sys/windows/os_str.rs1
-rw-r--r--library/std/src/sys/windows/pipe.rs2
-rw-r--r--library/std/src/sys/windows/process.rs10
-rw-r--r--library/std/src/sys/windows/rand.rs6
-rw-r--r--library/std/src/sys/windows/stack_overflow.rs4
-rw-r--r--library/std/src/sys/windows/stdio.rs22
-rw-r--r--library/std/src/sys/windows/thread.rs5
-rw-r--r--library/std/src/sys_common/backtrace.rs11
-rw-r--r--library/std/src/sys_common/net.rs4
-rw-r--r--library/std/src/sys_common/thread_local_key.rs61
-rw-r--r--library/std/src/sys_common/thread_local_key/tests.rs20
-rw-r--r--library/std/src/sys_common/thread_parking/generic.rs125
-rw-r--r--library/std/src/sys_common/thread_parking/mod.rs5
-rw-r--r--library/std/src/sys_common/wtf8.rs1
-rw-r--r--library/std/src/thread/local.rs34
-rw-r--r--library/std/src/thread/mod.rs35
-rw-r--r--library/std/src/thread/tests.rs4
-rw-r--r--library/std/src/time.rs4
-rw-r--r--library/std/src/time/tests.rs27
-rw-r--r--library/std/tests/run-time-detect.rs1
-rw-r--r--library/stdarch/.cirrus.yml7
-rw-r--r--library/stdarch/.github/workflows/main.yml10
-rwxr-xr-xlibrary/stdarch/ci/build-std-detect.sh40
-rw-r--r--library/stdarch/ci/docker/wasm32-wasi/Dockerfile4
-rwxr-xr-xlibrary/stdarch/ci/run.sh3
-rw-r--r--library/stdarch/crates/core_arch/avx512f.md2
-rw-r--r--library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs42
-rw-r--r--library/stdarch/crates/core_arch/src/arm_shared/crypto.rs98
-rw-r--r--library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs928
-rw-r--r--library/stdarch/crates/core_arch/src/powerpc/altivec.rs2148
-rw-r--r--library/stdarch/crates/core_arch/src/powerpc/macros.rs88
-rw-r--r--library/stdarch/crates/core_arch/src/powerpc/mod.rs5
-rw-r--r--library/stdarch/crates/core_arch/src/powerpc/vsx.rs27
-rw-r--r--library/stdarch/crates/core_arch/src/wasm32/simd128.rs4
-rw-r--r--library/stdarch/crates/core_arch/src/x86/avx.rs14
-rw-r--r--library/stdarch/crates/core_arch/src/x86/avx2.rs1
-rw-r--r--library/stdarch/crates/core_arch/src/x86/avx512bw.rs12
-rw-r--r--library/stdarch/crates/core_arch/src/x86/avx512f.rs38
-rw-r--r--library/stdarch/crates/core_arch/src/x86/sse.rs6
-rw-r--r--library/stdarch/crates/core_arch/src/x86/sse2.rs10
-rw-r--r--library/stdarch/crates/core_arch/src/x86_64/avx512f.rs14
-rw-r--r--library/stdarch/crates/std_detect/README.md9
-rw-r--r--library/stdarch/crates/std_detect/src/detect/arch/arm.rs2
-rw-r--r--library/stdarch/crates/std_detect/src/detect/os/freebsd/arm.rs7
-rw-r--r--library/stdarch/crates/std_detect/src/detect/os/linux/arm.rs16
-rw-r--r--library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs39
-rw-r--r--library/stdarch/crates/std_detect/tests/cpu-detection.rs1
-rw-r--r--library/stdarch/crates/stdarch-gen/neon.spec42
-rw-r--r--library/stdarch/crates/stdarch-test/src/disassembly.rs2
-rw-r--r--library/sysroot/Cargo.toml27
-rw-r--r--library/sysroot/src/lib.rs1
-rw-r--r--library/test/Cargo.toml20
-rw-r--r--library/test/src/cli.rs4
-rw-r--r--library/test/src/formatters/json.rs146
-rw-r--r--library/test/src/formatters/junit.rs40
-rw-r--r--library/test/src/options.rs6
-rw-r--r--library/test/src/tests.rs100
-rw-r--r--library/test/src/types.rs5
380 files changed, 19055 insertions, 8745 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
index 6f2ba957b..01d1fdc9b 100644
--- a/library/alloc/src/alloc.rs
+++ b/library/alloc/src/alloc.rs
@@ -37,6 +37,9 @@ extern "Rust" {
#[rustc_allocator_zeroed]
#[rustc_nounwind]
fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
+
+ #[cfg(not(bootstrap))]
+ static __rust_no_alloc_shim_is_unstable: u8;
}
/// The global memory allocator.
@@ -90,7 +93,14 @@ pub use std::alloc::Global;
#[must_use = "losing the pointer will leak memory"]
#[inline]
pub unsafe fn alloc(layout: Layout) -> *mut u8 {
- unsafe { __rust_alloc(layout.size(), layout.align()) }
+ unsafe {
+ // Make sure we don't accidentally allow omitting the allocator shim in
+ // stable code until it is actually stabilized.
+ #[cfg(not(bootstrap))]
+ core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
+
+ __rust_alloc(layout.size(), layout.align())
+ }
}
/// Deallocate memory with the global allocator.
diff --git a/library/alloc/src/borrow.rs b/library/alloc/src/borrow.rs
index 0c8c796ae..84331eba2 100644
--- a/library/alloc/src/borrow.rs
+++ b/library/alloc/src/borrow.rs
@@ -115,7 +115,7 @@ where
/// ```
/// use std::borrow::Cow;
///
-/// fn abs_all(input: &mut Cow<[i32]>) {
+/// fn abs_all(input: &mut Cow<'_, [i32]>) {
/// for i in 0..input.len() {
/// let v = input[i];
/// if v < 0 {
@@ -145,7 +145,7 @@ where
/// ```
/// use std::borrow::Cow;
///
-/// struct Items<'a, X: 'a> where [X]: ToOwned<Owned = Vec<X>> {
+/// struct Items<'a, X> where [X]: ToOwned<Owned = Vec<X>> {
/// values: Cow<'a, [X]>,
/// }
///
@@ -267,7 +267,7 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
///
/// assert_eq!(
/// cow,
- /// Cow::Owned(String::from("FOO")) as Cow<str>
+ /// Cow::Owned(String::from("FOO")) as Cow<'_, str>
/// );
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
@@ -311,7 +311,7 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
/// use std::borrow::Cow;
///
/// let s = "Hello world!";
- /// let cow: Cow<str> = Cow::Owned(String::from(s));
+ /// let cow: Cow<'_, str> = Cow::Owned(String::from(s));
///
/// assert_eq!(
/// cow.into_owned(),
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs
index 7f88327bf..1768687e8 100644
--- a/library/alloc/src/boxed.rs
+++ b/library/alloc/src/boxed.rs
@@ -576,8 +576,7 @@ impl<T, A: Allocator> Box<T, A> {
///
/// This conversion does not allocate on the heap and happens in place.
#[unstable(feature = "box_into_boxed_slice", issue = "71582")]
- #[rustc_const_unstable(feature = "const_box", issue = "92521")]
- pub const fn into_boxed_slice(boxed: Self) -> Box<[T], A> {
+ pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> {
let (raw, alloc) = Box::into_raw_with_allocator(boxed);
unsafe { Box::from_raw_in(raw as *mut [T; 1], alloc) }
}
@@ -809,9 +808,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
/// assert_eq!(*five, 5)
/// ```
#[unstable(feature = "new_uninit", issue = "63291")]
- #[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[inline]
- pub const unsafe fn assume_init(self) -> Box<T, A> {
+ pub unsafe fn assume_init(self) -> Box<T, A> {
let (raw, alloc) = Box::into_raw_with_allocator(self);
unsafe { Box::from_raw_in(raw as *mut T, alloc) }
}
@@ -844,9 +842,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
/// }
/// ```
#[unstable(feature = "new_uninit", issue = "63291")]
- #[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[inline]
- pub const fn write(mut boxed: Self, value: T) -> Box<T, A> {
+ pub fn write(mut boxed: Self, value: T) -> Box<T, A> {
unsafe {
(*boxed).write(value);
boxed.assume_init()
@@ -1090,9 +1087,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
///
/// [memory layout]: self#memory-layout
#[unstable(feature = "allocator_api", issue = "32838")]
- #[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[inline]
- pub const fn into_raw_with_allocator(b: Self) -> (*mut T, A) {
+ pub fn into_raw_with_allocator(b: Self) -> (*mut T, A) {
let (leaked, alloc) = Box::into_unique(b);
(leaked.as_ptr(), alloc)
}
@@ -1102,10 +1098,9 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
issue = "none",
reason = "use `Box::leak(b).into()` or `Unique::from(Box::leak(b))` instead"
)]
- #[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[inline]
#[doc(hidden)]
- pub const fn into_unique(b: Self) -> (Unique<T>, A) {
+ pub fn into_unique(b: Self) -> (Unique<T>, A) {
// Box is recognized as a "unique pointer" by Stacked Borrows, but internally it is a
// raw pointer for the type system. Turning it directly into a raw pointer would not be
// recognized as "releasing" the unique pointer to permit aliased raw accesses,
@@ -1163,9 +1158,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
/// assert_eq!(*static_ref, [4, 2, 3]);
/// ```
#[stable(feature = "box_leak", since = "1.26.0")]
- #[rustc_const_unstable(feature = "const_box", issue = "92521")]
#[inline]
- pub const fn leak<'a>(b: Self) -> &'a mut T
+ pub fn leak<'a>(b: Self) -> &'a mut T
where
A: 'a,
{
@@ -1234,8 +1228,7 @@ impl<T: Default> Default for Box<T> {
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T> const Default for Box<[T]> {
+impl<T> Default for Box<[T]> {
#[inline]
fn default() -> Self {
let ptr: Unique<[T]> = Unique::<[T; 0]>::dangling();
@@ -1245,8 +1238,7 @@ impl<T> const Default for Box<[T]> {
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "default_box_extra", since = "1.17.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl const Default for Box<str> {
+impl Default for Box<str> {
#[inline]
fn default() -> Self {
// SAFETY: This is the same as `Unique::cast<U>` but with an unsized `U = str`.
@@ -1443,8 +1435,7 @@ impl<T> From<T> for Box<T> {
}
#[stable(feature = "pin", since = "1.33.0")]
-#[rustc_const_unstable(feature = "const_box", issue = "92521")]
-impl<T: ?Sized, A: Allocator> const From<Box<T, A>> for Pin<Box<T, A>>
+impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Pin<Box<T, A>>
where
A: 'static,
{
@@ -1464,9 +1455,36 @@ where
}
}
+/// Specialization trait used for `From<&[T]>`.
+#[cfg(not(no_global_oom_handling))]
+trait BoxFromSlice<T> {
+ fn from_slice(slice: &[T]) -> Self;
+}
+
+#[cfg(not(no_global_oom_handling))]
+impl<T: Clone> BoxFromSlice<T> for Box<[T]> {
+ #[inline]
+ default fn from_slice(slice: &[T]) -> Self {
+ slice.to_vec().into_boxed_slice()
+ }
+}
+
+#[cfg(not(no_global_oom_handling))]
+impl<T: Copy> BoxFromSlice<T> for Box<[T]> {
+ #[inline]
+ fn from_slice(slice: &[T]) -> Self {
+ let len = slice.len();
+ let buf = RawVec::with_capacity(len);
+ unsafe {
+ ptr::copy_nonoverlapping(slice.as_ptr(), buf.ptr(), len);
+ buf.into_box(slice.len()).assume_init()
+ }
+ }
+}
+
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "box_from_slice", since = "1.17.0")]
-impl<T: Copy> From<&[T]> for Box<[T]> {
+impl<T: Clone> From<&[T]> for Box<[T]> {
/// Converts a `&[T]` into a `Box<[T]>`
///
/// This conversion allocates on the heap
@@ -1480,19 +1498,15 @@ impl<T: Copy> From<&[T]> for Box<[T]> {
///
/// println!("{boxed_slice:?}");
/// ```
+ #[inline]
fn from(slice: &[T]) -> Box<[T]> {
- let len = slice.len();
- let buf = RawVec::with_capacity(len);
- unsafe {
- ptr::copy_nonoverlapping(slice.as_ptr(), buf.ptr(), len);
- buf.into_box(slice.len()).assume_init()
- }
+ <Self as BoxFromSlice<T>>::from_slice(slice)
}
}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "box_from_cow", since = "1.45.0")]
-impl<T: Copy> From<Cow<'_, [T]>> for Box<[T]> {
+impl<T: Clone> From<Cow<'_, [T]>> for Box<[T]> {
/// Converts a `Cow<'_, [T]>` into a `Box<[T]>`
///
/// When `cow` is the `Cow::Borrowed` variant, this
@@ -1880,8 +1894,7 @@ impl<T: ?Sized, A: Allocator> fmt::Pointer for Box<T, A> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_box", issue = "92521")]
-impl<T: ?Sized, A: Allocator> const Deref for Box<T, A> {
+impl<T: ?Sized, A: Allocator> Deref for Box<T, A> {
type Target = T;
fn deref(&self) -> &T {
@@ -1890,8 +1903,7 @@ impl<T: ?Sized, A: Allocator> const Deref for Box<T, A> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_box", issue = "92521")]
-impl<T: ?Sized, A: Allocator> const DerefMut for Box<T, A> {
+impl<T: ?Sized, A: Allocator> DerefMut for Box<T, A> {
fn deref_mut(&mut self) -> &mut T {
&mut **self
}
diff --git a/library/alloc/src/boxed/thin.rs b/library/alloc/src/boxed/thin.rs
index ad48315fd..f83c8f83c 100644
--- a/library/alloc/src/boxed/thin.rs
+++ b/library/alloc/src/boxed/thin.rs
@@ -7,7 +7,7 @@ use core::fmt::{self, Debug, Display, Formatter};
use core::marker::PhantomData;
#[cfg(not(no_global_oom_handling))]
use core::marker::Unsize;
-use core::mem;
+use core::mem::{self, SizedTypeProperties};
use core::ops::{Deref, DerefMut};
use core::ptr::Pointee;
use core::ptr::{self, NonNull};
@@ -202,9 +202,7 @@ impl<H> WithHeader<H> {
let ptr = if layout.size() == 0 {
// Some paranoia checking, mostly so that the ThinBox tests are
// more able to catch issues.
- debug_assert!(
- value_offset == 0 && mem::size_of::<T>() == 0 && mem::size_of::<H>() == 0
- );
+ debug_assert!(value_offset == 0 && T::IS_ZST && H::IS_ZST);
layout.dangling()
} else {
let ptr = alloc::alloc(layout);
@@ -249,9 +247,7 @@ impl<H> WithHeader<H> {
alloc::dealloc(self.ptr.as_ptr().sub(value_offset), layout);
} else {
debug_assert!(
- value_offset == 0
- && mem::size_of::<H>() == 0
- && self.value_layout.size() == 0
+ value_offset == 0 && H::IS_ZST && self.value_layout.size() == 0
);
}
}
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index afdc99817..1f8a1ecba 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -1543,11 +1543,17 @@ impl<'a, K: 'a, V: 'a> Iterator for Iter<'a, K, V> {
self.next_back()
}
- fn min(mut self) -> Option<(&'a K, &'a V)> {
+ fn min(mut self) -> Option<(&'a K, &'a V)>
+ where
+ (&'a K, &'a V): Ord,
+ {
self.next()
}
- fn max(mut self) -> Option<(&'a K, &'a V)> {
+ fn max(mut self) -> Option<(&'a K, &'a V)>
+ where
+ (&'a K, &'a V): Ord,
+ {
self.next_back()
}
}
@@ -1612,11 +1618,17 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
self.next_back()
}
- fn min(mut self) -> Option<(&'a K, &'a mut V)> {
+ fn min(mut self) -> Option<(&'a K, &'a mut V)>
+ where
+ (&'a K, &'a mut V): Ord,
+ {
self.next()
}
- fn max(mut self) -> Option<(&'a K, &'a mut V)> {
+ fn max(mut self) -> Option<(&'a K, &'a mut V)>
+ where
+ (&'a K, &'a mut V): Ord,
+ {
self.next_back()
}
}
@@ -1779,11 +1791,17 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
self.next_back()
}
- fn min(mut self) -> Option<&'a K> {
+ fn min(mut self) -> Option<&'a K>
+ where
+ &'a K: Ord,
+ {
self.next()
}
- fn max(mut self) -> Option<&'a K> {
+ fn max(mut self) -> Option<&'a K>
+ where
+ &'a K: Ord,
+ {
self.next_back()
}
}
@@ -2008,11 +2026,17 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
self.next_back()
}
- fn min(mut self) -> Option<(&'a K, &'a V)> {
+ fn min(mut self) -> Option<(&'a K, &'a V)>
+ where
+ (&'a K, &'a V): Ord,
+ {
self.next()
}
- fn max(mut self) -> Option<(&'a K, &'a V)> {
+ fn max(mut self) -> Option<(&'a K, &'a V)>
+ where
+ (&'a K, &'a V): Ord,
+ {
self.next_back()
}
}
@@ -2081,11 +2105,17 @@ impl<K, V, A: Allocator + Clone> Iterator for IntoKeys<K, V, A> {
self.next_back()
}
- fn min(mut self) -> Option<K> {
+ fn min(mut self) -> Option<K>
+ where
+ K: Ord,
+ {
self.next()
}
- fn max(mut self) -> Option<K> {
+ fn max(mut self) -> Option<K>
+ where
+ K: Ord,
+ {
self.next_back()
}
}
@@ -2204,11 +2234,17 @@ impl<'a, K, V> Iterator for RangeMut<'a, K, V> {
self.next_back()
}
- fn min(mut self) -> Option<(&'a K, &'a mut V)> {
+ fn min(mut self) -> Option<(&'a K, &'a mut V)>
+ where
+ (&'a K, &'a mut V): Ord,
+ {
self.next()
}
- fn max(mut self) -> Option<(&'a K, &'a mut V)> {
+ fn max(mut self) -> Option<(&'a K, &'a mut V)>
+ where
+ (&'a K, &'a mut V): Ord,
+ {
self.next_back()
}
}
@@ -2985,7 +3021,7 @@ impl<'a, K, V, A> CursorMut<'a, K, V, A> {
})
}
- /// Returns a mutable reference to the of the element that the cursor is
+ /// Returns a mutable reference to the key of the element that the cursor is
/// currently pointing to.
///
/// This returns `None` if the cursor is currently pointing to the
@@ -3043,8 +3079,8 @@ impl<'a, K, V, A> CursorMut<'a, K, V, A> {
unsafe { self.root.reborrow() }
.as_mut()?
.borrow_mut()
- .first_leaf_edge()
- .next_kv()
+ .last_leaf_edge()
+ .next_back_kv()
.ok()?
.into_kv_valmut()
}
diff --git a/library/alloc/src/collections/btree/map/tests.rs b/library/alloc/src/collections/btree/map/tests.rs
index da00d83bd..7ecffe3ee 100644
--- a/library/alloc/src/collections/btree/map/tests.rs
+++ b/library/alloc/src/collections/btree/map/tests.rs
@@ -8,6 +8,7 @@ use crate::testing::crash_test::{CrashTestDummy, Panic};
use crate::testing::ord_chaos::{Cyclic3, Governed, Governor};
use crate::testing::rng::DeterministicRng;
use crate::vec::Vec;
+use core::assert_matches::assert_matches;
use std::cmp::Ordering;
use std::iter;
use std::mem;
@@ -2448,3 +2449,21 @@ fn test_cursor_mut_insert_after_4() {
let mut cur = map.upper_bound_mut(Bound::Included(&2));
cur.insert_after(4, 'd');
}
+
+#[test]
+fn cursor_peek_prev_agrees_with_cursor_mut() {
+ let mut map = BTreeMap::from([(1, 1), (2, 2), (3, 3)]);
+
+ let cursor = map.lower_bound(Bound::Excluded(&3));
+ assert!(cursor.key().is_none());
+
+ let prev = cursor.peek_prev();
+ assert_matches!(prev, Some((&3, _)));
+
+ // Shadow names so the two parts of this test match.
+ let mut cursor = map.lower_bound_mut(Bound::Excluded(&3));
+ assert!(cursor.key().is_none());
+
+ let prev = cursor.peek_prev();
+ assert_matches!(prev, Some((&3, _)));
+}
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index da952a13f..940fa30af 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -1501,11 +1501,17 @@ impl<'a, T> Iterator for Iter<'a, T> {
self.next_back()
}
- fn min(mut self) -> Option<&'a T> {
+ fn min(mut self) -> Option<&'a T>
+ where
+ &'a T: Ord,
+ {
self.next()
}
- fn max(mut self) -> Option<&'a T> {
+ fn max(mut self) -> Option<&'a T>
+ where
+ &'a T: Ord,
+ {
self.next_back()
}
}
@@ -1604,11 +1610,17 @@ impl<'a, T> Iterator for Range<'a, T> {
self.next_back()
}
- fn min(mut self) -> Option<&'a T> {
+ fn min(mut self) -> Option<&'a T>
+ where
+ &'a T: Ord,
+ {
self.next()
}
- fn max(mut self) -> Option<&'a T> {
+ fn max(mut self) -> Option<&'a T>
+ where
+ &'a T: Ord,
+ {
self.next_back()
}
}
diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs
index 106d05c57..4cd34ac2f 100644
--- a/library/alloc/src/collections/linked_list.rs
+++ b/library/alloc/src/collections/linked_list.rs
@@ -18,9 +18,10 @@ use core::hash::{Hash, Hasher};
use core::iter::FusedIterator;
use core::marker::PhantomData;
use core::mem;
-use core::ptr::NonNull;
+use core::ptr::{NonNull, Unique};
use super::SpecExtend;
+use crate::alloc::{Allocator, Global};
use crate::boxed::Box;
#[cfg(test)]
@@ -47,11 +48,15 @@ mod tests;
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "LinkedList")]
#[rustc_insignificant_dtor]
-pub struct LinkedList<T> {
+pub struct LinkedList<
+ T,
+ #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
+> {
head: Option<NonNull<Node<T>>>,
tail: Option<NonNull<Node<T>>>,
len: usize,
- marker: PhantomData<Box<Node<T>>>,
+ alloc: A,
+ marker: PhantomData<Box<Node<T>, A>>,
}
struct Node<T> {
@@ -81,6 +86,7 @@ impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
head: self.head,
tail: self.tail,
len: self.len,
+ alloc: Global,
marker: PhantomData,
}))
.field(&self.len)
@@ -117,6 +123,7 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
head: self.head,
tail: self.tail,
len: self.len,
+ alloc: Global,
marker: PhantomData,
}))
.field(&self.len)
@@ -132,12 +139,15 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
/// [`into_iter`]: LinkedList::into_iter
#[derive(Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
-pub struct IntoIter<T> {
- list: LinkedList<T>,
+pub struct IntoIter<
+ T,
+ #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
+> {
+ list: LinkedList<T, A>,
}
#[stable(feature = "collection_debug", since = "1.17.0")]
-impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
+impl<T: fmt::Debug, A: Allocator> fmt::Debug for IntoIter<T, A> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("IntoIter").field(&self.list).finish()
}
@@ -148,22 +158,25 @@ impl<T> Node<T> {
Node { next: None, prev: None, element }
}
- fn into_element(self: Box<Self>) -> T {
+ fn into_element<A: Allocator>(self: Box<Self, A>) -> T {
self.element
}
}
// private methods
-impl<T> LinkedList<T> {
+impl<T, A: Allocator> LinkedList<T, A> {
/// Adds the given node to the front of the list.
+ ///
+ /// # Safety
+ /// `node` must point to a valid node that was boxed using the list's allocator.
#[inline]
- fn push_front_node(&mut self, mut node: Box<Node<T>>) {
+ unsafe fn push_front_node(&mut self, node: Unique<Node<T>>) {
// This method takes care not to create mutable references to whole nodes,
// to maintain validity of aliasing pointers into `element`.
unsafe {
- node.next = self.head;
- node.prev = None;
- let node = Some(Box::leak(node).into());
+ (*node.as_ptr()).next = self.head;
+ (*node.as_ptr()).prev = None;
+ let node = Some(NonNull::from(node));
match self.head {
None => self.tail = node,
@@ -178,11 +191,11 @@ impl<T> LinkedList<T> {
/// Removes and returns the node at the front of the list.
#[inline]
- fn pop_front_node(&mut self) -> Option<Box<Node<T>>> {
+ fn pop_front_node(&mut self) -> Option<Box<Node<T>, &A>> {
// This method takes care not to create mutable references to whole nodes,
// to maintain validity of aliasing pointers into `element`.
self.head.map(|node| unsafe {
- let node = Box::from_raw(node.as_ptr());
+ let node = Box::from_raw_in(node.as_ptr(), &self.alloc);
self.head = node.next;
match self.head {
@@ -197,14 +210,17 @@ impl<T> LinkedList<T> {
}
/// Adds the given node to the back of the list.
+ ///
+ /// # Safety
+ /// `node` must point to a valid node that was boxed using the list's allocator.
#[inline]
- fn push_back_node(&mut self, mut node: Box<Node<T>>) {
+ unsafe fn push_back_node(&mut self, node: Unique<Node<T>>) {
// This method takes care not to create mutable references to whole nodes,
// to maintain validity of aliasing pointers into `element`.
unsafe {
- node.next = None;
- node.prev = self.tail;
- let node = Some(Box::leak(node).into());
+ (*node.as_ptr()).next = None;
+ (*node.as_ptr()).prev = self.tail;
+ let node = Some(NonNull::from(node));
match self.tail {
None => self.head = node,
@@ -219,11 +235,11 @@ impl<T> LinkedList<T> {
/// Removes and returns the node at the back of the list.
#[inline]
- fn pop_back_node(&mut self) -> Option<Box<Node<T>>> {
+ fn pop_back_node(&mut self) -> Option<Box<Node<T>, &A>> {
// This method takes care not to create mutable references to whole nodes,
// to maintain validity of aliasing pointers into `element`.
self.tail.map(|node| unsafe {
- let node = Box::from_raw(node.as_ptr());
+ let node = Box::from_raw_in(node.as_ptr(), &self.alloc);
self.tail = node.prev;
match self.tail {
@@ -321,7 +337,10 @@ impl<T> LinkedList<T> {
&mut self,
split_node: Option<NonNull<Node<T>>>,
at: usize,
- ) -> Self {
+ ) -> Self
+ where
+ A: Clone,
+ {
// The split node is the new head node of the second part
if let Some(mut split_node) = split_node {
let first_part_head;
@@ -342,6 +361,7 @@ impl<T> LinkedList<T> {
head: first_part_head,
tail: first_part_tail,
len: at,
+ alloc: self.alloc.clone(),
marker: PhantomData,
};
@@ -351,7 +371,7 @@ impl<T> LinkedList<T> {
first_part
} else {
- mem::replace(self, LinkedList::new())
+ mem::replace(self, LinkedList::new_in(self.alloc.clone()))
}
}
@@ -360,7 +380,10 @@ impl<T> LinkedList<T> {
&mut self,
split_node: Option<NonNull<Node<T>>>,
at: usize,
- ) -> Self {
+ ) -> Self
+ where
+ A: Clone,
+ {
// The split node is the new tail node of the first part and owns
// the head of the second part.
if let Some(mut split_node) = split_node {
@@ -382,6 +405,7 @@ impl<T> LinkedList<T> {
head: second_part_head,
tail: second_part_tail,
len: self.len - at,
+ alloc: self.alloc.clone(),
marker: PhantomData,
};
@@ -391,7 +415,7 @@ impl<T> LinkedList<T> {
second_part
} else {
- mem::replace(self, LinkedList::new())
+ mem::replace(self, LinkedList::new_in(self.alloc.clone()))
}
}
}
@@ -420,7 +444,7 @@ impl<T> LinkedList<T> {
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
pub const fn new() -> Self {
- LinkedList { head: None, tail: None, len: 0, marker: PhantomData }
+ LinkedList { head: None, tail: None, len: 0, alloc: Global, marker: PhantomData }
}
/// Moves all elements from `other` to the end of the list.
@@ -471,7 +495,26 @@ impl<T> LinkedList<T> {
}
}
}
+}
+impl<T, A: Allocator> LinkedList<T, A> {
+ /// Constructs an empty `LinkedList<T, A>`.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(allocator_api)]
+ ///
+ /// use std::alloc::System;
+ /// use std::collections::LinkedList;
+ ///
+ /// let list: LinkedList<u32, _> = LinkedList::new_in(System);
+ /// ```
+ #[inline]
+ #[unstable(feature = "allocator_api", issue = "32838")]
+ pub const fn new_in(alloc: A) -> Self {
+ LinkedList { head: None, tail: None, len: 0, alloc, marker: PhantomData }
+ }
/// Provides a forward iterator.
///
/// # Examples
@@ -532,7 +575,7 @@ impl<T> LinkedList<T> {
#[inline]
#[must_use]
#[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn cursor_front(&self) -> Cursor<'_, T> {
+ pub fn cursor_front(&self) -> Cursor<'_, T, A> {
Cursor { index: 0, current: self.head, list: self }
}
@@ -542,7 +585,7 @@ impl<T> LinkedList<T> {
#[inline]
#[must_use]
#[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn cursor_front_mut(&mut self) -> CursorMut<'_, T> {
+ pub fn cursor_front_mut(&mut self) -> CursorMut<'_, T, A> {
CursorMut { index: 0, current: self.head, list: self }
}
@@ -552,7 +595,7 @@ impl<T> LinkedList<T> {
#[inline]
#[must_use]
#[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn cursor_back(&self) -> Cursor<'_, T> {
+ pub fn cursor_back(&self) -> Cursor<'_, T, A> {
Cursor { index: self.len.checked_sub(1).unwrap_or(0), current: self.tail, list: self }
}
@@ -562,7 +605,7 @@ impl<T> LinkedList<T> {
#[inline]
#[must_use]
#[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn cursor_back_mut(&mut self) -> CursorMut<'_, T> {
+ pub fn cursor_back_mut(&mut self) -> CursorMut<'_, T, A> {
CursorMut { index: self.len.checked_sub(1).unwrap_or(0), current: self.tail, list: self }
}
@@ -638,7 +681,15 @@ impl<T> LinkedList<T> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) {
- *self = Self::new();
+ // We need to drop the nodes while keeping self.alloc
+ // We can do this by moving (head, tail, len) into a new list that borrows self.alloc
+ drop(LinkedList {
+ head: self.head.take(),
+ tail: self.tail.take(),
+ len: mem::take(&mut self.len),
+ alloc: &self.alloc,
+ marker: PhantomData,
+ });
}
/// Returns `true` if the `LinkedList` contains an element equal to the
@@ -790,7 +841,12 @@ impl<T> LinkedList<T> {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn push_front(&mut self, elt: T) {
- self.push_front_node(Box::new(Node::new(elt)));
+ let node = Box::new_in(Node::new(elt), &self.alloc);
+ let node_ptr = Unique::from(Box::leak(node));
+ // SAFETY: node_ptr is a unique pointer to a node we boxed with self.alloc
+ unsafe {
+ self.push_front_node(node_ptr);
+ }
}
/// Removes the first element and returns it, or `None` if the list is
@@ -833,7 +889,12 @@ impl<T> LinkedList<T> {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn push_back(&mut self, elt: T) {
- self.push_back_node(Box::new(Node::new(elt)));
+ let node = Box::new_in(Node::new(elt), &self.alloc);
+ let node_ptr = Unique::from(Box::leak(node));
+ // SAFETY: node_ptr is a unique pointer to a node we boxed with self.alloc
+ unsafe {
+ self.push_back_node(node_ptr);
+ }
}
/// Removes the last element from a list and returns it, or `None` if
@@ -883,13 +944,16 @@ impl<T> LinkedList<T> {
/// assert_eq!(split.pop_front(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn split_off(&mut self, at: usize) -> LinkedList<T> {
+ pub fn split_off(&mut self, at: usize) -> LinkedList<T, A>
+ where
+ A: Clone,
+ {
let len = self.len();
assert!(at <= len, "Cannot split off at a nonexistent index");
if at == 0 {
- return mem::take(self);
+ return mem::replace(self, Self::new_in(self.alloc.clone()));
} else if at == len {
- return Self::new();
+ return Self::new_in(self.alloc.clone());
}
// Below, we iterate towards the `i-1`th node, either from the start or the end,
@@ -987,7 +1051,7 @@ impl<T> LinkedList<T> {
/// assert_eq!(odds.into_iter().collect::<Vec<_>>(), vec![1, 3, 5, 9, 11, 13, 15]);
/// ```
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
- pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<'_, T, F>
+ pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<'_, T, F, A>
where
F: FnMut(&mut T) -> bool,
{
@@ -1000,11 +1064,11 @@ impl<T> LinkedList<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-unsafe impl<#[may_dangle] T> Drop for LinkedList<T> {
+unsafe impl<#[may_dangle] T, A: Allocator> Drop for LinkedList<T, A> {
fn drop(&mut self) {
- struct DropGuard<'a, T>(&'a mut LinkedList<T>);
+ struct DropGuard<'a, T, A: Allocator>(&'a mut LinkedList<T, A>);
- impl<'a, T> Drop for DropGuard<'a, T> {
+ impl<'a, T, A: Allocator> Drop for DropGuard<'a, T, A> {
fn drop(&mut self) {
// Continue the same loop we do below. This only runs when a destructor has
// panicked. If another one panics this will abort.
@@ -1012,11 +1076,10 @@ unsafe impl<#[may_dangle] T> Drop for LinkedList<T> {
}
}
- while let Some(node) = self.pop_front_node() {
- let guard = DropGuard(self);
- drop(node);
- mem::forget(guard);
- }
+ // Wrap self so that if a destructor panics, we can try to keep looping
+ let guard = DropGuard(self);
+ while guard.0.pop_front_node().is_some() {}
+ mem::forget(guard);
}
}
@@ -1159,14 +1222,18 @@ impl<T> Default for IterMut<'_, T> {
///
/// When created, cursors start at the front of the list, or the "ghost" non-element if the list is empty.
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-pub struct Cursor<'a, T: 'a> {
+pub struct Cursor<
+ 'a,
+ T: 'a,
+ #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
+> {
index: usize,
current: Option<NonNull<Node<T>>>,
- list: &'a LinkedList<T>,
+ list: &'a LinkedList<T, A>,
}
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-impl<T> Clone for Cursor<'_, T> {
+impl<T, A: Allocator> Clone for Cursor<'_, T, A> {
fn clone(&self) -> Self {
let Cursor { index, current, list } = *self;
Cursor { index, current, list }
@@ -1174,7 +1241,7 @@ impl<T> Clone for Cursor<'_, T> {
}
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-impl<T: fmt::Debug> fmt::Debug for Cursor<'_, T> {
+impl<T: fmt::Debug, A: Allocator> fmt::Debug for Cursor<'_, T, A> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Cursor").field(&self.list).field(&self.index()).finish()
}
@@ -1191,20 +1258,24 @@ impl<T: fmt::Debug> fmt::Debug for Cursor<'_, T> {
/// To accommodate this, there is a "ghost" non-element that yields `None` between the head and
/// tail of the list.
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-pub struct CursorMut<'a, T: 'a> {
+pub struct CursorMut<
+ 'a,
+ T: 'a,
+ #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
+> {
index: usize,
current: Option<NonNull<Node<T>>>,
- list: &'a mut LinkedList<T>,
+ list: &'a mut LinkedList<T, A>,
}
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-impl<T: fmt::Debug> fmt::Debug for CursorMut<'_, T> {
+impl<T: fmt::Debug, A: Allocator> fmt::Debug for CursorMut<'_, T, A> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("CursorMut").field(&self.list).field(&self.index()).finish()
}
}
-impl<'a, T> Cursor<'a, T> {
+impl<'a, T, A: Allocator> Cursor<'a, T, A> {
/// Returns the cursor position index within the `LinkedList`.
///
/// This returns `None` if the cursor is currently pointing to the
@@ -1321,7 +1392,7 @@ impl<'a, T> Cursor<'a, T> {
}
}
-impl<'a, T> CursorMut<'a, T> {
+impl<'a, T, A: Allocator> CursorMut<'a, T, A> {
/// Returns the cursor position index within the `LinkedList`.
///
/// This returns `None` if the cursor is currently pointing to the
@@ -1426,7 +1497,7 @@ impl<'a, T> CursorMut<'a, T> {
/// `CursorMut` is frozen for the lifetime of the `Cursor`.
#[must_use]
#[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn as_cursor(&self) -> Cursor<'_, T> {
+ pub fn as_cursor(&self) -> Cursor<'_, T, A> {
Cursor { list: self.list, current: self.current, index: self.index }
}
}
@@ -1434,6 +1505,51 @@ impl<'a, T> CursorMut<'a, T> {
// Now the list editing operations
impl<'a, T> CursorMut<'a, T> {
+ /// Inserts the elements from the given `LinkedList` after the current one.
+ ///
+ /// If the cursor is pointing at the "ghost" non-element then the new elements are
+ /// inserted at the start of the `LinkedList`.
+ #[unstable(feature = "linked_list_cursors", issue = "58533")]
+ pub fn splice_after(&mut self, list: LinkedList<T>) {
+ unsafe {
+ let (splice_head, splice_tail, splice_len) = match list.detach_all_nodes() {
+ Some(parts) => parts,
+ _ => return,
+ };
+ let node_next = match self.current {
+ None => self.list.head,
+ Some(node) => node.as_ref().next,
+ };
+ self.list.splice_nodes(self.current, node_next, splice_head, splice_tail, splice_len);
+ if self.current.is_none() {
+ // The "ghost" non-element's index has changed.
+ self.index = self.list.len;
+ }
+ }
+ }
+
+ /// Inserts the elements from the given `LinkedList` before the current one.
+ ///
+ /// If the cursor is pointing at the "ghost" non-element then the new elements are
+ /// inserted at the end of the `LinkedList`.
+ #[unstable(feature = "linked_list_cursors", issue = "58533")]
+ pub fn splice_before(&mut self, list: LinkedList<T>) {
+ unsafe {
+ let (splice_head, splice_tail, splice_len) = match list.detach_all_nodes() {
+ Some(parts) => parts,
+ _ => return,
+ };
+ let node_prev = match self.current {
+ None => self.list.tail,
+ Some(node) => node.as_ref().prev,
+ };
+ self.list.splice_nodes(node_prev, self.current, splice_head, splice_tail, splice_len);
+ self.index += splice_len;
+ }
+ }
+}
+
+impl<'a, T, A: Allocator> CursorMut<'a, T, A> {
/// Inserts a new element into the `LinkedList` after the current one.
///
/// If the cursor is pointing at the "ghost" non-element then the new element is
@@ -1441,7 +1557,7 @@ impl<'a, T> CursorMut<'a, T> {
#[unstable(feature = "linked_list_cursors", issue = "58533")]
pub fn insert_after(&mut self, item: T) {
unsafe {
- let spliced_node = Box::leak(Box::new(Node::new(item))).into();
+ let spliced_node = Box::leak(Box::new_in(Node::new(item), &self.list.alloc)).into();
let node_next = match self.current {
None => self.list.head,
Some(node) => node.as_ref().next,
@@ -1461,7 +1577,7 @@ impl<'a, T> CursorMut<'a, T> {
#[unstable(feature = "linked_list_cursors", issue = "58533")]
pub fn insert_before(&mut self, item: T) {
unsafe {
- let spliced_node = Box::leak(Box::new(Node::new(item))).into();
+ let spliced_node = Box::leak(Box::new_in(Node::new(item), &self.list.alloc)).into();
let node_prev = match self.current {
None => self.list.tail,
Some(node) => node.as_ref().prev,
@@ -1497,7 +1613,10 @@ impl<'a, T> CursorMut<'a, T> {
/// If the cursor is currently pointing to the "ghost" non-element then no element
/// is removed and `None` is returned.
#[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn remove_current_as_list(&mut self) -> Option<LinkedList<T>> {
+ pub fn remove_current_as_list(&mut self) -> Option<LinkedList<T, A>>
+ where
+ A: Clone,
+ {
let mut unlinked_node = self.current?;
unsafe {
self.current = unlinked_node.as_ref().next;
@@ -1509,54 +1628,12 @@ impl<'a, T> CursorMut<'a, T> {
head: Some(unlinked_node),
tail: Some(unlinked_node),
len: 1,
+ alloc: self.list.alloc.clone(),
marker: PhantomData,
})
}
}
- /// Inserts the elements from the given `LinkedList` after the current one.
- ///
- /// If the cursor is pointing at the "ghost" non-element then the new elements are
- /// inserted at the start of the `LinkedList`.
- #[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn splice_after(&mut self, list: LinkedList<T>) {
- unsafe {
- let (splice_head, splice_tail, splice_len) = match list.detach_all_nodes() {
- Some(parts) => parts,
- _ => return,
- };
- let node_next = match self.current {
- None => self.list.head,
- Some(node) => node.as_ref().next,
- };
- self.list.splice_nodes(self.current, node_next, splice_head, splice_tail, splice_len);
- if self.current.is_none() {
- // The "ghost" non-element's index has changed.
- self.index = self.list.len;
- }
- }
- }
-
- /// Inserts the elements from the given `LinkedList` before the current one.
- ///
- /// If the cursor is pointing at the "ghost" non-element then the new elements are
- /// inserted at the end of the `LinkedList`.
- #[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn splice_before(&mut self, list: LinkedList<T>) {
- unsafe {
- let (splice_head, splice_tail, splice_len) = match list.detach_all_nodes() {
- Some(parts) => parts,
- _ => return,
- };
- let node_prev = match self.current {
- None => self.list.tail,
- Some(node) => node.as_ref().prev,
- };
- self.list.splice_nodes(node_prev, self.current, splice_head, splice_tail, splice_len);
- self.index += splice_len;
- }
- }
-
/// Splits the list into two after the current element. This will return a
/// new list consisting of everything after the cursor, with the original
/// list retaining everything before.
@@ -1564,7 +1641,10 @@ impl<'a, T> CursorMut<'a, T> {
/// If the cursor is pointing at the "ghost" non-element then the entire contents
/// of the `LinkedList` are moved.
#[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn split_after(&mut self) -> LinkedList<T> {
+ pub fn split_after(&mut self) -> LinkedList<T, A>
+ where
+ A: Clone,
+ {
let split_off_idx = if self.index == self.list.len { 0 } else { self.index + 1 };
if self.index == self.list.len {
// The "ghost" non-element's index has changed to 0.
@@ -1580,7 +1660,10 @@ impl<'a, T> CursorMut<'a, T> {
/// If the cursor is pointing at the "ghost" non-element then the entire contents
/// of the `LinkedList` are moved.
#[unstable(feature = "linked_list_cursors", issue = "58533")]
- pub fn split_before(&mut self) -> LinkedList<T> {
+ pub fn split_before(&mut self) -> LinkedList<T, A>
+ where
+ A: Clone,
+ {
let split_off_idx = self.index;
self.index = 0;
unsafe { self.list.split_off_before_node(self.current, split_off_idx) }
@@ -1722,11 +1805,15 @@ impl<'a, T> CursorMut<'a, T> {
/// An iterator produced by calling `drain_filter` on LinkedList.
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
-pub struct DrainFilter<'a, T: 'a, F: 'a>
-where
+pub struct DrainFilter<
+ 'a,
+ T: 'a,
+ F: 'a,
+ #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
+> where
F: FnMut(&mut T) -> bool,
{
- list: &'a mut LinkedList<T>,
+ list: &'a mut LinkedList<T, A>,
it: Option<NonNull<Node<T>>>,
pred: F,
idx: usize,
@@ -1734,7 +1821,7 @@ where
}
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
-impl<T, F> Iterator for DrainFilter<'_, T, F>
+impl<T, F, A: Allocator> Iterator for DrainFilter<'_, T, F, A>
where
F: FnMut(&mut T) -> bool,
{
@@ -1763,16 +1850,16 @@ where
}
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
-impl<T, F> Drop for DrainFilter<'_, T, F>
+impl<T, F, A: Allocator> Drop for DrainFilter<'_, T, F, A>
where
F: FnMut(&mut T) -> bool,
{
fn drop(&mut self) {
- struct DropGuard<'r, 'a, T, F>(&'r mut DrainFilter<'a, T, F>)
+ struct DropGuard<'r, 'a, T, F, A: Allocator>(&'r mut DrainFilter<'a, T, F, A>)
where
F: FnMut(&mut T) -> bool;
- impl<'r, 'a, T, F> Drop for DropGuard<'r, 'a, T, F>
+ impl<'r, 'a, T, F, A: Allocator> Drop for DropGuard<'r, 'a, T, F, A>
where
F: FnMut(&mut T) -> bool,
{
@@ -1800,7 +1887,7 @@ where
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T> Iterator for IntoIter<T> {
+impl<T, A: Allocator> Iterator for IntoIter<T, A> {
type Item = T;
#[inline]
@@ -1815,7 +1902,7 @@ impl<T> Iterator for IntoIter<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T> DoubleEndedIterator for IntoIter<T> {
+impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A> {
#[inline]
fn next_back(&mut self) -> Option<T> {
self.list.pop_back()
@@ -1823,10 +1910,10 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T> ExactSizeIterator for IntoIter<T> {}
+impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A> {}
#[stable(feature = "fused", since = "1.26.0")]
-impl<T> FusedIterator for IntoIter<T> {}
+impl<T, A: Allocator> FusedIterator for IntoIter<T, A> {}
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T> Default for IntoIter<T> {
@@ -1852,19 +1939,19 @@ impl<T> FromIterator<T> for LinkedList<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T> IntoIterator for LinkedList<T> {
+impl<T, A: Allocator> IntoIterator for LinkedList<T, A> {
type Item = T;
- type IntoIter = IntoIter<T>;
+ type IntoIter = IntoIter<T, A>;
/// Consumes the list into an iterator yielding elements by value.
#[inline]
- fn into_iter(self) -> IntoIter<T> {
+ fn into_iter(self) -> IntoIter<T, A> {
IntoIter { list: self }
}
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T> IntoIterator for &'a LinkedList<T> {
+impl<'a, T, A: Allocator> IntoIterator for &'a LinkedList<T, A> {
type Item = &'a T;
type IntoIter = Iter<'a, T>;
@@ -1874,7 +1961,7 @@ impl<'a, T> IntoIterator for &'a LinkedList<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T> IntoIterator for &'a mut LinkedList<T> {
+impl<'a, T, A: Allocator> IntoIterator for &'a mut LinkedList<T, A> {
type Item = &'a mut T;
type IntoIter = IterMut<'a, T>;
@@ -1884,7 +1971,7 @@ impl<'a, T> IntoIterator for &'a mut LinkedList<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T> Extend<T> for LinkedList<T> {
+impl<T, A: Allocator> Extend<T> for LinkedList<T, A> {
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
<Self as SpecExtend<I>>::spec_extend(self, iter);
}
@@ -1895,7 +1982,7 @@ impl<T> Extend<T> for LinkedList<T> {
}
}
-impl<I: IntoIterator> SpecExtend<I> for LinkedList<I::Item> {
+impl<I: IntoIterator, A: Allocator> SpecExtend<I> for LinkedList<I::Item, A> {
default fn spec_extend(&mut self, iter: I) {
iter.into_iter().for_each(move |elt| self.push_back(elt));
}
@@ -1908,7 +1995,7 @@ impl<T> SpecExtend<LinkedList<T>> for LinkedList<T> {
}
#[stable(feature = "extend_ref", since = "1.2.0")]
-impl<'a, T: 'a + Copy> Extend<&'a T> for LinkedList<T> {
+impl<'a, T: 'a + Copy, A: Allocator> Extend<&'a T> for LinkedList<T, A> {
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
self.extend(iter.into_iter().cloned());
}
@@ -1920,7 +2007,7 @@ impl<'a, T: 'a + Copy> Extend<&'a T> for LinkedList<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: PartialEq> PartialEq for LinkedList<T> {
+impl<T: PartialEq, A: Allocator> PartialEq for LinkedList<T, A> {
fn eq(&self, other: &Self) -> bool {
self.len() == other.len() && self.iter().eq(other)
}
@@ -1931,17 +2018,17 @@ impl<T: PartialEq> PartialEq for LinkedList<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Eq> Eq for LinkedList<T> {}
+impl<T: Eq, A: Allocator> Eq for LinkedList<T, A> {}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: PartialOrd> PartialOrd for LinkedList<T> {
+impl<T: PartialOrd, A: Allocator> PartialOrd for LinkedList<T, A> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.iter().partial_cmp(other)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Ord> Ord for LinkedList<T> {
+impl<T: Ord, A: Allocator> Ord for LinkedList<T, A> {
#[inline]
fn cmp(&self, other: &Self) -> Ordering {
self.iter().cmp(other)
@@ -1949,9 +2036,11 @@ impl<T: Ord> Ord for LinkedList<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Clone> Clone for LinkedList<T> {
+impl<T: Clone, A: Allocator + Clone> Clone for LinkedList<T, A> {
fn clone(&self) -> Self {
- self.iter().cloned().collect()
+ let mut list = Self::new_in(self.alloc.clone());
+ list.extend(self.iter().cloned());
+ list
}
fn clone_from(&mut self, other: &Self) {
@@ -1969,14 +2058,14 @@ impl<T: Clone> Clone for LinkedList<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: fmt::Debug> fmt::Debug for LinkedList<T> {
+impl<T: fmt::Debug, A: Allocator> fmt::Debug for LinkedList<T, A> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self).finish()
}
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Hash> Hash for LinkedList<T> {
+impl<T: Hash, A: Allocator> Hash for LinkedList<T, A> {
fn hash<H: Hasher>(&self, state: &mut H) {
state.write_length_prefix(self.len());
for elt in self {
@@ -2016,10 +2105,10 @@ fn assert_covariance() {
}
#[stable(feature = "rust1", since = "1.0.0")]
-unsafe impl<T: Send> Send for LinkedList<T> {}
+unsafe impl<T: Send, A: Allocator + Send> Send for LinkedList<T, A> {}
#[stable(feature = "rust1", since = "1.0.0")]
-unsafe impl<T: Sync> Sync for LinkedList<T> {}
+unsafe impl<T: Sync, A: Allocator + Sync> Sync for LinkedList<T, A> {}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Sync> Send for Iter<'_, T> {}
@@ -2034,13 +2123,13 @@ unsafe impl<T: Send> Send for IterMut<'_, T> {}
unsafe impl<T: Sync> Sync for IterMut<'_, T> {}
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-unsafe impl<T: Sync> Send for Cursor<'_, T> {}
+unsafe impl<T: Sync, A: Allocator + Sync> Send for Cursor<'_, T, A> {}
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-unsafe impl<T: Sync> Sync for Cursor<'_, T> {}
+unsafe impl<T: Sync, A: Allocator + Sync> Sync for Cursor<'_, T, A> {}
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-unsafe impl<T: Send> Send for CursorMut<'_, T> {}
+unsafe impl<T: Send, A: Allocator + Send> Send for CursorMut<'_, T, A> {}
#[unstable(feature = "linked_list_cursors", issue = "58533")]
-unsafe impl<T: Sync> Sync for CursorMut<'_, T> {}
+unsafe impl<T: Sync, A: Allocator + Sync> Sync for CursorMut<'_, T, A> {}
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs
index 8916b42ed..896da37f9 100644
--- a/library/alloc/src/collections/vec_deque/mod.rs
+++ b/library/alloc/src/collections/vec_deque/mod.rs
@@ -2815,7 +2815,7 @@ impl<'a, T: 'a + Copy, A: Allocator> Extend<&'a T> for VecDeque<T, A> {
}
#[inline]
- fn extend_one(&mut self, &elem: &T) {
+ fn extend_one(&mut self, &elem: &'a T) {
self.push_back(elem);
}
diff --git a/library/alloc/src/collections/vec_deque/spec_from_iter.rs b/library/alloc/src/collections/vec_deque/spec_from_iter.rs
index 7650492eb..2708c7fe1 100644
--- a/library/alloc/src/collections/vec_deque/spec_from_iter.rs
+++ b/library/alloc/src/collections/vec_deque/spec_from_iter.rs
@@ -12,7 +12,7 @@ where
default fn spec_from_iter(iterator: I) -> Self {
// Since converting is O(1) now, just re-use the `Vec` logic for
// anything where we can't do something extra-special for `VecDeque`,
- // especially as that could save us some monomorphiziation work
+ // especially as that could save us some monomorphization work
// if one uses the same iterators (like slice ones) with both.
crate::vec::Vec::from_iter(iterator).into()
}
diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs
index 1da86e1a4..fb8d00e8d 100644
--- a/library/alloc/src/fmt.rs
+++ b/library/alloc/src/fmt.rs
@@ -363,7 +363,7 @@
//! # use std::fmt;
//! # struct Foo; // our custom type
//! # impl fmt::Display for Foo {
-//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+//! fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
//! # write!(f, "testing, testing")
//! # } }
//! ```
@@ -399,7 +399,7 @@
//! }
//!
//! impl fmt::Display for Vector2D {
-//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+//! fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
//! // The `f` value implements the `Write` trait, which is what the
//! // write! macro is expecting. Note that this formatting ignores the
//! // various flags provided to format strings.
@@ -410,7 +410,7 @@
//! // Different traits allow different forms of output of a type. The meaning
//! // of this format is to print the magnitude of a vector.
//! impl fmt::Binary for Vector2D {
-//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+//! fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
//! let magnitude = (self.x * self.x + self.y * self.y) as f64;
//! let magnitude = magnitude.sqrt();
//!
@@ -517,7 +517,7 @@
//! let mut some_writer = io::stdout();
//! write!(&mut some_writer, "{}", format_args!("print with a {}", "macro"));
//!
-//! fn my_fmt_fn(args: fmt::Arguments) {
+//! fn my_fmt_fn(args: fmt::Arguments<'_>) {
//! write!(&mut io::stdout(), "{args}");
//! }
//! my_fmt_fn(format_args!(", or a {} too", "function"));
@@ -551,8 +551,6 @@
#![stable(feature = "rust1", since = "1.0.0")]
-#[unstable(feature = "fmt_internals", issue = "none")]
-pub use core::fmt::rt;
#[stable(feature = "fmt_flags_align", since = "1.28.0")]
pub use core::fmt::Alignment;
#[stable(feature = "rust1", since = "1.0.0")]
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs
index aa240c37e..59fa91c10 100644
--- a/library/alloc/src/lib.rs
+++ b/library/alloc/src/lib.rs
@@ -101,19 +101,18 @@
#![feature(array_into_iter_constructors)]
#![feature(array_methods)]
#![feature(array_windows)]
+#![feature(ascii_char)]
#![feature(assert_matches)]
#![feature(async_iterator)]
#![feature(coerce_unsized)]
#![feature(const_align_of_val)]
#![feature(const_box)]
-#![feature(const_convert)]
#![feature(const_cow_is_borrowed)]
#![feature(const_eval_select)]
#![feature(const_maybe_uninit_as_mut_ptr)]
#![feature(const_maybe_uninit_write)]
#![feature(const_maybe_uninit_zeroed)]
#![feature(const_pin)]
-#![feature(const_ptr_read)]
#![feature(const_refs_to_cell)]
#![feature(const_size_of_val)]
#![feature(const_waker)]
@@ -174,7 +173,6 @@
#![feature(associated_type_bounds)]
#![feature(c_unwind)]
#![feature(cfg_sanitize)]
-#![feature(const_deref)]
#![feature(const_mut_refs)]
#![feature(const_precise_live_drops)]
#![feature(const_ptr_write)]
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs
index ba035fb06..38a711ac7 100644
--- a/library/alloc/src/rc.rs
+++ b/library/alloc/src/rc.rs
@@ -2039,7 +2039,7 @@ where
/// ```rust
/// # use std::rc::Rc;
/// # use std::borrow::Cow;
- /// let cow: Cow<str> = Cow::Borrowed("eggplant");
+ /// let cow: Cow<'_, str> = Cow::Borrowed("eggplant");
/// let shared: Rc<str> = Rc::from(cow);
/// assert_eq!("eggplant", &shared[..]);
/// ```
diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs
index b87ef59f6..849774099 100644
--- a/library/alloc/src/str.rs
+++ b/library/alloc/src/str.rs
@@ -404,12 +404,12 @@ impl str {
// See https://www.unicode.org/versions/Unicode7.0.0/ch03.pdf#G33992
// for the definition of `Final_Sigma`.
debug_assert!('Σ'.len_utf8() == 2);
- let is_word_final = case_ignoreable_then_cased(from[..i].chars().rev())
- && !case_ignoreable_then_cased(from[i + 2..].chars());
+ let is_word_final = case_ignorable_then_cased(from[..i].chars().rev())
+ && !case_ignorable_then_cased(from[i + 2..].chars());
to.push_str(if is_word_final { "ς" } else { "σ" });
}
- fn case_ignoreable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
+ fn case_ignorable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
use core::unicode::{Case_Ignorable, Cased};
match iter.skip_while(|&c| Case_Ignorable(c)).next() {
Some(c) => Cased(c),
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index be41919b9..59e3f887b 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -1851,7 +1851,7 @@ impl String {
}
/// Consumes and leaks the `String`, returning a mutable reference to the contents,
- /// `&'static mut str`.
+ /// `&'a mut str`.
///
/// This is mainly useful for data that lives for the remainder of
/// the program's life. Dropping the returned reference will cause a memory
@@ -1874,7 +1874,7 @@ impl String {
/// ```
#[unstable(feature = "string_leak", issue = "102929")]
#[inline]
- pub fn leak(self) -> &'static mut str {
+ pub fn leak<'a>(self) -> &'a mut str {
let slice = self.vec.leak();
unsafe { from_utf8_unchecked_mut(slice) }
}
@@ -2247,8 +2247,7 @@ impl_eq! { Cow<'a, str>, &'b str }
impl_eq! { Cow<'a, str>, String }
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl const Default for String {
+impl Default for String {
/// Creates an empty `String`.
#[inline]
fn default() -> String {
@@ -2528,6 +2527,15 @@ impl<T: fmt::Display + ?Sized> ToString for T {
}
#[cfg(not(no_global_oom_handling))]
+#[unstable(feature = "ascii_char", issue = "110998")]
+impl ToString for core::ascii::Char {
+ #[inline]
+ fn to_string(&self) -> String {
+ self.as_str().to_owned()
+ }
+}
+
+#[cfg(not(no_global_oom_handling))]
#[stable(feature = "char_to_string_specialization", since = "1.46.0")]
impl ToString for char {
#[inline]
@@ -2615,6 +2623,15 @@ impl ToString for String {
}
}
+#[cfg(not(no_global_oom_handling))]
+#[stable(feature = "fmt_arguments_to_string_specialization", since = "1.71.0")]
+impl ToString for fmt::Arguments<'_> {
+ #[inline]
+ fn to_string(&self) -> String {
+ crate::fmt::format(*self)
+ }
+}
+
#[stable(feature = "rust1", since = "1.0.0")]
impl AsRef<str> for String {
#[inline]
@@ -2733,7 +2750,7 @@ impl<'a> From<Cow<'a, str>> for String {
/// ```
/// # use std::borrow::Cow;
/// // If the string is not owned...
- /// let cow: Cow<str> = Cow::Borrowed("eggplant");
+ /// let cow: Cow<'_, str> = Cow::Borrowed("eggplant");
/// // It will allocate on the heap and copy the string.
/// let owned: String = String::from(cow);
/// assert_eq!(&owned[..], "eggplant");
diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs
index 24849d52d..bfdb7a92b 100644
--- a/library/alloc/src/sync.rs
+++ b/library/alloc/src/sync.rs
@@ -502,6 +502,7 @@ impl<T> Arc<T> {
/// assert_eq!(*five, 5)
/// ```
#[cfg(not(no_global_oom_handling))]
+ #[inline]
#[unstable(feature = "new_uninit", issue = "63291")]
#[must_use]
pub fn new_uninit() -> Arc<mem::MaybeUninit<T>> {
@@ -535,6 +536,7 @@ impl<T> Arc<T> {
///
/// [zeroed]: mem::MaybeUninit::zeroed
#[cfg(not(no_global_oom_handling))]
+ #[inline]
#[unstable(feature = "new_uninit", issue = "63291")]
#[must_use]
pub fn new_zeroed() -> Arc<mem::MaybeUninit<T>> {
@@ -844,6 +846,7 @@ impl<T> Arc<[T]> {
/// assert_eq!(*values, [1, 2, 3])
/// ```
#[cfg(not(no_global_oom_handling))]
+ #[inline]
#[unstable(feature = "new_uninit", issue = "63291")]
#[must_use]
pub fn new_uninit_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
@@ -871,6 +874,7 @@ impl<T> Arc<[T]> {
///
/// [zeroed]: mem::MaybeUninit::zeroed
#[cfg(not(no_global_oom_handling))]
+ #[inline]
#[unstable(feature = "new_uninit", issue = "63291")]
#[must_use]
pub fn new_zeroed_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
@@ -1300,10 +1304,10 @@ impl<T: ?Sized> Arc<T> {
mem_to_arcinner: impl FnOnce(*mut u8) -> *mut ArcInner<T>,
) -> *mut ArcInner<T> {
let layout = arcinner_layout_for_value_layout(value_layout);
- unsafe {
- Arc::try_allocate_for_layout(value_layout, allocate, mem_to_arcinner)
- .unwrap_or_else(|_| handle_alloc_error(layout))
- }
+
+ let ptr = allocate(layout).unwrap_or_else(|_| handle_alloc_error(layout));
+
+ unsafe { Self::initialize_arcinner(ptr, layout, mem_to_arcinner) }
}
/// Allocates an `ArcInner<T>` with sufficient space for
@@ -1321,7 +1325,16 @@ impl<T: ?Sized> Arc<T> {
let ptr = allocate(layout)?;
- // Initialize the ArcInner
+ let inner = unsafe { Self::initialize_arcinner(ptr, layout, mem_to_arcinner) };
+
+ Ok(inner)
+ }
+
+ unsafe fn initialize_arcinner(
+ ptr: NonNull<[u8]>,
+ layout: Layout,
+ mem_to_arcinner: impl FnOnce(*mut u8) -> *mut ArcInner<T>,
+ ) -> *mut ArcInner<T> {
let inner = mem_to_arcinner(ptr.as_non_null_ptr().as_ptr());
debug_assert_eq!(unsafe { Layout::for_value(&*inner) }, layout);
@@ -1330,7 +1343,7 @@ impl<T: ?Sized> Arc<T> {
ptr::write(&mut (*inner).weak, atomic::AtomicUsize::new(1));
}
- Ok(inner)
+ inner
}
/// Allocates an `ArcInner<T>` with sufficient space for an unsized inner value.
@@ -2768,7 +2781,7 @@ where
/// ```rust
/// # use std::sync::Arc;
/// # use std::borrow::Cow;
- /// let cow: Cow<str> = Cow::Borrowed("eggplant");
+ /// let cow: Cow<'_, str> = Cow::Borrowed("eggplant");
/// let shared: Arc<str> = Arc::from(cow);
/// assert_eq!("eggplant", &shared[..]);
/// ```
diff --git a/library/alloc/src/task.rs b/library/alloc/src/task.rs
index 9d8e309a9..5d9772b87 100644
--- a/library/alloc/src/task.rs
+++ b/library/alloc/src/task.rs
@@ -39,6 +39,7 @@ use crate::sync::Arc;
/// use std::sync::Arc;
/// use std::task::{Context, Poll, Wake};
/// use std::thread::{self, Thread};
+/// use core::pin::pin;
///
/// /// A waker that wakes up the current thread when called.
/// struct ThreadWaker(Thread);
@@ -52,7 +53,7 @@ use crate::sync::Arc;
/// /// Run a future to completion on the current thread.
/// fn block_on<T>(fut: impl Future<Output = T>) -> T {
/// // Pin the future so it can be polled.
-/// let mut fut = Box::pin(fut);
+/// let mut fut = pin!(fut);
///
/// // Create a new context to be passed to the future.
/// let t = thread::current();
diff --git a/library/alloc/src/vec/drain.rs b/library/alloc/src/vec/drain.rs
index 2b1a787cc..f0b63759a 100644
--- a/library/alloc/src/vec/drain.rs
+++ b/library/alloc/src/vec/drain.rs
@@ -16,7 +16,7 @@ use super::Vec;
///
/// ```
/// let mut v = vec![0, 1, 2];
-/// let iter: std::vec::Drain<_> = v.drain(..);
+/// let iter: std::vec::Drain<'_, _> = v.drain(..);
/// ```
#[stable(feature = "drain", since = "1.6.0")]
pub struct Drain<
@@ -112,9 +112,7 @@ impl<'a, T, A: Allocator> Drain<'a, T, A> {
let unyielded_ptr = this.iter.as_slice().as_ptr();
// ZSTs have no identity, so we don't need to move them around.
- let needs_move = mem::size_of::<T>() != 0;
-
- if needs_move {
+ if !T::IS_ZST {
let start_ptr = source_vec.as_mut_ptr().add(start);
// memmove back unyielded elements
@@ -197,7 +195,7 @@ impl<T, A: Allocator> Drop for Drain<'_, T, A> {
}
}
- let iter = mem::replace(&mut self.iter, (&mut []).iter());
+ let iter = mem::take(&mut self.iter);
let drop_len = iter.len();
let mut vec = self.vec;
diff --git a/library/alloc/src/vec/drain_filter.rs b/library/alloc/src/vec/drain_filter.rs
index 8c03f1692..21b090234 100644
--- a/library/alloc/src/vec/drain_filter.rs
+++ b/library/alloc/src/vec/drain_filter.rs
@@ -1,5 +1,5 @@
use crate::alloc::{Allocator, Global};
-use core::mem::{self, ManuallyDrop};
+use core::mem::{ManuallyDrop, SizedTypeProperties};
use core::ptr;
use core::slice;
@@ -16,7 +16,7 @@ use super::Vec;
/// #![feature(drain_filter)]
///
/// let mut v = vec![0, 1, 2];
-/// let iter: std::vec::DrainFilter<_, _> = v.drain_filter(|x| *x % 2 == 0);
+/// let iter: std::vec::DrainFilter<'_, _, _> = v.drain_filter(|x| *x % 2 == 0);
/// ```
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
#[derive(Debug)]
@@ -96,9 +96,7 @@ where
unsafe {
// ZSTs have no identity, so we don't need to move them around.
- let needs_move = mem::size_of::<T>() != 0;
-
- if needs_move && this.idx < this.old_len && this.del > 0 {
+ if !T::IS_ZST && this.idx < this.old_len && this.del > 0 {
let ptr = this.vec.as_mut_ptr();
let src = ptr.add(this.idx);
let dst = src.sub(this.del);
diff --git a/library/alloc/src/vec/in_place_collect.rs b/library/alloc/src/vec/in_place_collect.rs
index 87d61deb1..5ecd04799 100644
--- a/library/alloc/src/vec/in_place_collect.rs
+++ b/library/alloc/src/vec/in_place_collect.rs
@@ -178,7 +178,8 @@ where
)
};
- let len = SpecInPlaceCollect::collect_in_place(&mut iterator, dst_buf, dst_end);
+ // SAFETY: `dst_buf` and `dst_end` are the start and end of the buffer.
+ let len = unsafe { SpecInPlaceCollect::collect_in_place(&mut iterator, dst_buf, dst_end) };
let src = unsafe { iterator.as_inner().as_into_iter() };
// check if SourceIter contract was upheld
@@ -201,7 +202,7 @@ where
//
// Note: This access to the source wouldn't be allowed by the TrustedRandomIteratorNoCoerce
// contract (used by SpecInPlaceCollect below). But see the "O(1) collect" section in the
- // module documenttation why this is ok anyway.
+ // module documentation why this is ok anyway.
let dst_guard = InPlaceDstBufDrop { ptr: dst_buf, len, cap };
src.forget_allocation_drop_remaining();
mem::forget(dst_guard);
@@ -239,7 +240,7 @@ trait SpecInPlaceCollect<T, I>: Iterator<Item = T> {
/// `Iterator::__iterator_get_unchecked` calls with a `TrustedRandomAccessNoCoerce` bound
/// on `I` which means the caller of this method must take the safety conditions
/// of that trait into consideration.
- fn collect_in_place(&mut self, dst: *mut T, end: *const T) -> usize;
+ unsafe fn collect_in_place(&mut self, dst: *mut T, end: *const T) -> usize;
}
impl<T, I> SpecInPlaceCollect<T, I> for I
@@ -247,7 +248,7 @@ where
I: Iterator<Item = T>,
{
#[inline]
- default fn collect_in_place(&mut self, dst_buf: *mut T, end: *const T) -> usize {
+ default unsafe fn collect_in_place(&mut self, dst_buf: *mut T, end: *const T) -> usize {
// use try-fold since
// - it vectorizes better for some iterator adapters
// - unlike most internal iteration methods, it only takes a &mut self
@@ -265,7 +266,7 @@ where
I: Iterator<Item = T> + TrustedRandomAccessNoCoerce,
{
#[inline]
- fn collect_in_place(&mut self, dst_buf: *mut T, end: *const T) -> usize {
+ unsafe fn collect_in_place(&mut self, dst_buf: *mut T, end: *const T) -> usize {
let len = self.size();
let mut drop_guard = InPlaceDrop { inner: dst_buf, dst: dst_buf };
for i in 0..len {
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index 3736a6e0b..47661a3d3 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -646,14 +646,14 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// // The vector contains no items, even though it has capacity for more
/// assert_eq!(vec.len(), 0);
- /// assert_eq!(vec.capacity(), 10);
+ /// assert!(vec.capacity() >= 10);
///
/// // These are all done without reallocating...
/// for i in 0..10 {
/// vec.push(i);
/// }
/// assert_eq!(vec.len(), 10);
- /// assert_eq!(vec.capacity(), 10);
+ /// assert!(vec.capacity() >= 10);
///
/// // ...but this may make the vector reallocate
/// vec.push(11);
@@ -877,7 +877,7 @@ impl<T, A: Allocator> Vec<T, A> {
/// ```
/// let mut vec: Vec<i32> = Vec::with_capacity(10);
/// vec.push(42);
- /// assert_eq!(vec.capacity(), 10);
+ /// assert!(vec.capacity() >= 10);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1028,7 +1028,7 @@ impl<T, A: Allocator> Vec<T, A> {
/// ```
/// let mut vec = Vec::with_capacity(10);
/// vec.extend([1, 2, 3]);
- /// assert_eq!(vec.capacity(), 10);
+ /// assert!(vec.capacity() >= 10);
/// vec.shrink_to_fit();
/// assert!(vec.capacity() >= 3);
/// ```
@@ -1055,7 +1055,7 @@ impl<T, A: Allocator> Vec<T, A> {
/// ```
/// let mut vec = Vec::with_capacity(10);
/// vec.extend([1, 2, 3]);
- /// assert_eq!(vec.capacity(), 10);
+ /// assert!(vec.capacity() >= 10);
/// vec.shrink_to(4);
/// assert!(vec.capacity() >= 4);
/// vec.shrink_to(0);
@@ -1090,7 +1090,7 @@ impl<T, A: Allocator> Vec<T, A> {
/// let mut vec = Vec::with_capacity(10);
/// vec.extend([1, 2, 3]);
///
- /// assert_eq!(vec.capacity(), 10);
+ /// assert!(vec.capacity() >= 10);
/// let slice = vec.into_boxed_slice();
/// assert_eq!(slice.into_vec().capacity(), 3);
/// ```
@@ -2662,7 +2662,6 @@ impl<T: Clone, A: Allocator + Clone> Clone for Vec<T, A> {
/// as required by the `core::borrow::Borrow` implementation.
///
/// ```
-/// #![feature(build_hasher_simple_hash_one)]
/// use std::hash::BuildHasher;
///
/// let b = std::collections::hash_map::RandomState::new();
@@ -3022,8 +3021,7 @@ unsafe impl<#[may_dangle] T, A: Allocator> Drop for Vec<T, A> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T> const Default for Vec<T> {
+impl<T> Default for Vec<T> {
/// Creates an empty `Vec<T>`.
///
/// The vector will not allocate until elements are pushed onto it.
@@ -3143,8 +3141,8 @@ where
///
/// ```
/// # use std::borrow::Cow;
- /// let o: Cow<[i32]> = Cow::Owned(vec![1, 2, 3]);
- /// let b: Cow<[i32]> = Cow::Borrowed(&[1, 2, 3]);
+ /// let o: Cow<'_, [i32]> = Cow::Owned(vec![1, 2, 3]);
+ /// let b: Cow<'_, [i32]> = Cow::Borrowed(&[1, 2, 3]);
/// assert_eq!(Vec::from(o), Vec::from(b));
/// ```
fn from(s: Cow<'a, [T]>) -> Vec<T> {
diff --git a/library/alloc/src/vec/splice.rs b/library/alloc/src/vec/splice.rs
index 1861147fe..852fdcc3f 100644
--- a/library/alloc/src/vec/splice.rs
+++ b/library/alloc/src/vec/splice.rs
@@ -14,7 +14,7 @@ use super::{Drain, Vec};
/// ```
/// let mut v = vec![0, 1, 2];
/// let new = [7, 8];
-/// let iter: std::vec::Splice<_> = v.splice(1.., new);
+/// let iter: std::vec::Splice<'_, _> = v.splice(1.., new);
/// ```
#[derive(Debug)]
#[stable(feature = "vec_splice", since = "1.21.0")]
diff --git a/library/alloc/tests/boxed.rs b/library/alloc/tests/boxed.rs
index 68ebd8e35..4cacee041 100644
--- a/library/alloc/tests/boxed.rs
+++ b/library/alloc/tests/boxed.rs
@@ -61,7 +61,7 @@ fn box_deref_lval() {
pub struct ConstAllocator;
-unsafe impl const Allocator for ConstAllocator {
+unsafe impl Allocator for ConstAllocator {
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
match layout.size() {
0 => Ok(NonNull::slice_from_raw_parts(layout.dangling(), 0)),
diff --git a/library/alloc/tests/const_fns.rs b/library/alloc/tests/const_fns.rs
index 49b837bec..4e7d7fc83 100644
--- a/library/alloc/tests/const_fns.rs
+++ b/library/alloc/tests/const_fns.rs
@@ -1,13 +1,16 @@
// Test const functions in the library
pub const MY_VEC: Vec<usize> = Vec::new();
-pub const MY_VEC2: Vec<usize> = Default::default();
+
+// FIXME(#110395)
+// pub const MY_VEC2: Vec<usize> = Default::default();
pub const MY_STRING: String = String::new();
-pub const MY_STRING2: String = Default::default();
-pub const MY_BOXED_SLICE: Box<[usize]> = Default::default();
-pub const MY_BOXED_STR: Box<str> = Default::default();
+// pub const MY_STRING2: String = Default::default();
+
+// pub const MY_BOXED_SLICE: Box<[usize]> = Default::default();
+// pub const MY_BOXED_STR: Box<str> = Default::default();
use std::collections::{BTreeMap, BTreeSet};
@@ -23,11 +26,11 @@ pub const SET_IS_EMPTY: bool = SET.is_empty();
#[test]
fn test_const() {
- assert_eq!(MY_VEC, MY_VEC2);
- assert_eq!(MY_STRING, MY_STRING2);
+ assert_eq!(MY_VEC, /* MY_VEC */ vec![]);
+ assert_eq!(MY_STRING, /* MY_STRING2 */ String::default());
- assert_eq!(MY_VEC, *MY_BOXED_SLICE);
- assert_eq!(MY_STRING, *MY_BOXED_STR);
+ // assert_eq!(MY_VEC, *MY_BOXED_SLICE);
+ // assert_eq!(MY_STRING, *MY_BOXED_STR);
assert_eq!(MAP_LEN, 0);
assert_eq!(SET_LEN, 0);
diff --git a/library/alloc/tests/lib.rs b/library/alloc/tests/lib.rs
index 0667cd7bc..0eca4c9bb 100644
--- a/library/alloc/tests/lib.rs
+++ b/library/alloc/tests/lib.rs
@@ -3,7 +3,6 @@
#![feature(assert_matches)]
#![feature(btree_drain_filter)]
#![feature(cow_is_borrowed)]
-#![feature(const_convert)]
#![feature(const_cow_is_borrowed)]
#![feature(const_heap)]
#![feature(const_mut_refs)]
@@ -33,7 +32,6 @@
#![feature(slice_partition_dedup)]
#![feature(string_remove_matches)]
#![feature(const_btree_len)]
-#![feature(const_default_impls)]
#![feature(const_trait_impl)]
#![feature(const_str_from_utf8)]
#![feature(panic_update_hook)]
diff --git a/library/alloc/tests/slice.rs b/library/alloc/tests/slice.rs
index 0693beb48..9aa5575ca 100644
--- a/library/alloc/tests/slice.rs
+++ b/library/alloc/tests/slice.rs
@@ -705,7 +705,7 @@ fn test_move_rev_iterator() {
}
#[test]
-fn test_splitator() {
+fn test_split_iterator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1], &[3], &[5]];
@@ -725,7 +725,7 @@ fn test_splitator() {
}
#[test]
-fn test_splitator_inclusive() {
+fn test_split_iterator_inclusive() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
@@ -745,7 +745,7 @@ fn test_splitator_inclusive() {
}
#[test]
-fn test_splitator_inclusive_reverse() {
+fn test_split_iterator_inclusive_reverse() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
@@ -765,7 +765,7 @@ fn test_splitator_inclusive_reverse() {
}
#[test]
-fn test_splitator_mut_inclusive() {
+fn test_split_iterator_mut_inclusive() {
let xs = &mut [1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
@@ -785,7 +785,7 @@ fn test_splitator_mut_inclusive() {
}
#[test]
-fn test_splitator_mut_inclusive_reverse() {
+fn test_split_iterator_mut_inclusive_reverse() {
let xs = &mut [1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
@@ -805,7 +805,7 @@ fn test_splitator_mut_inclusive_reverse() {
}
#[test]
-fn test_splitnator() {
+fn test_splitn_iterator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
@@ -821,7 +821,7 @@ fn test_splitnator() {
}
#[test]
-fn test_splitnator_mut() {
+fn test_splitn_iterator_mut() {
let xs = &mut [1, 2, 3, 4, 5];
let splits: &[&mut [_]] = &[&mut [1, 2, 3, 4, 5]];
@@ -837,7 +837,7 @@ fn test_splitnator_mut() {
}
#[test]
-fn test_rsplitator() {
+fn test_rsplit_iterator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[5], &[3], &[1]];
@@ -855,7 +855,7 @@ fn test_rsplitator() {
}
#[test]
-fn test_rsplitnator() {
+fn test_rsplitn_iterator() {
let xs = &[1, 2, 3, 4, 5];
let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
@@ -932,7 +932,7 @@ fn test_split_iterators_size_hint() {
}
#[test]
-fn test_windowsator() {
+fn test_windows_iterator() {
let v = &[1, 2, 3, 4];
let wins: &[&[_]] = &[&[1, 2], &[2, 3], &[3, 4]];
@@ -948,13 +948,13 @@ fn test_windowsator() {
#[test]
#[should_panic]
-fn test_windowsator_0() {
+fn test_windows_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.windows(0);
}
#[test]
-fn test_chunksator() {
+fn test_chunks_iterator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.chunks(2).len(), 3);
@@ -972,13 +972,13 @@ fn test_chunksator() {
#[test]
#[should_panic]
-fn test_chunksator_0() {
+fn test_chunks_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.chunks(0);
}
#[test]
-fn test_chunks_exactator() {
+fn test_chunks_exact_iterator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.chunks_exact(2).len(), 2);
@@ -996,13 +996,13 @@ fn test_chunks_exactator() {
#[test]
#[should_panic]
-fn test_chunks_exactator_0() {
+fn test_chunks_exact_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.chunks_exact(0);
}
#[test]
-fn test_rchunksator() {
+fn test_rchunks_iterator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.rchunks(2).len(), 3);
@@ -1020,13 +1020,13 @@ fn test_rchunksator() {
#[test]
#[should_panic]
-fn test_rchunksator_0() {
+fn test_rchunks_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.rchunks(0);
}
#[test]
-fn test_rchunks_exactator() {
+fn test_rchunks_exact_iterator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.rchunks_exact(2).len(), 2);
@@ -1044,7 +1044,7 @@ fn test_rchunks_exactator() {
#[test]
#[should_panic]
-fn test_rchunks_exactator_0() {
+fn test_rchunks_exact_iterator_0() {
let v = &[1, 2, 3, 4];
let _it = v.rchunks_exact(0);
}
@@ -1219,7 +1219,7 @@ fn test_ends_with() {
}
#[test]
-fn test_mut_splitator() {
+fn test_mut_split_iterator() {
let mut xs = [0, 1, 0, 2, 3, 0, 0, 4, 5, 0];
assert_eq!(xs.split_mut(|x| *x == 0).count(), 6);
for slice in xs.split_mut(|x| *x == 0) {
@@ -1235,7 +1235,7 @@ fn test_mut_splitator() {
}
#[test]
-fn test_mut_splitator_rev() {
+fn test_mut_split_iterator_rev() {
let mut xs = [1, 2, 0, 3, 4, 0, 0, 5, 6, 0];
for slice in xs.split_mut(|x| *x == 0).rev().take(4) {
slice.reverse();
diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs
index 3ee16f04e..cc4c1f127 100644
--- a/library/alloc/tests/vec.rs
+++ b/library/alloc/tests/vec.rs
@@ -2470,7 +2470,7 @@ fn test_vec_dedup_panicking() {
// Regression test for issue #82533
#[test]
-fn test_extend_from_within_panicing_clone() {
+fn test_extend_from_within_panicking_clone() {
struct Panic<'dc> {
drop_count: &'dc AtomicU32,
aaaaa: bool,
diff --git a/library/backtrace/.github/workflows/main.yml b/library/backtrace/.github/workflows/main.yml
index c11b08dfd..24d814363 100644
--- a/library/backtrace/.github/workflows/main.yml
+++ b/library/backtrace/.github/workflows/main.yml
@@ -13,13 +13,14 @@ jobs:
name: Test
runs-on: ${{ matrix.os }}
strategy:
+ fail-fast: false
matrix:
include:
- - os: ubuntu-latest
+ - os: ubuntu-20.04
rust: stable
- - os: ubuntu-latest
+ - os: ubuntu-20.04
rust: beta
- - os: ubuntu-latest
+ - os: ubuntu-20.04
rust: nightly
- os: macos-latest
rust: stable
@@ -34,7 +35,7 @@ jobs:
- os: windows-latest
rust: stable-x86_64-gnu
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust (rustup)
@@ -118,7 +119,7 @@ jobs:
name: Windows AArch64
runs-on: windows-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
@@ -141,7 +142,7 @@ jobs:
- target: x86_64-apple-ios
sdk: iphonesimulator
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
submodules: true
- run: rustup target add ${{ matrix.target }}
@@ -154,8 +155,9 @@ jobs:
docker:
name: Docker
- runs-on: ubuntu-latest
+ runs-on: ubuntu-20.04
strategy:
+ fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
@@ -174,7 +176,7 @@ jobs:
- i686-linux-android
- x86_64-linux-android
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
@@ -187,9 +189,9 @@ jobs:
rustfmt:
name: Rustfmt
- runs-on: ubuntu-latest
+ runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
@@ -198,17 +200,17 @@ jobs:
build:
name: Build Targets
- runs-on: ubuntu-latest
+ runs-on: ubuntu-20.04
strategy:
matrix:
target:
- wasm32-unknown-unknown
- wasm32-wasi
- - x86_64-fuchsia
+ - x86_64-unknown-fuchsia
- x86_64-fortanix-unknown-sgx
- x86_64-unknown-illumos
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
@@ -221,9 +223,9 @@ jobs:
msrv:
name: MSRV
- runs-on: ubuntu-latest
+ runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
@@ -232,9 +234,9 @@ jobs:
miri:
name: Miri
- runs-on: ubuntu-latest
+ runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
submodules: true
- name: Install Miri
diff --git a/library/backtrace/Cargo.toml b/library/backtrace/Cargo.toml
index ef1c5ec00..477909111 100644
--- a/library/backtrace/Cargo.toml
+++ b/library/backtrace/Cargo.toml
@@ -1,9 +1,9 @@
[package]
name = "backtrace"
-version = "0.3.66"
+version = "0.3.67"
authors = ["The Rust Project Developers"]
build = "build.rs"
-license = "MIT/Apache-2.0"
+license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang/backtrace-rs"
homepage = "https://github.com/rust-lang/backtrace-rs"
@@ -35,16 +35,13 @@ serde = { version = "1.0", optional = true, features = ['derive'] }
rustc-serialize = { version = "0.3", optional = true }
# Optionally demangle C++ frames' symbols in backtraces.
-cpp_demangle = { default-features = false, version = "0.3.0", optional = true }
+cpp_demangle = { default-features = false, version = "0.4.0", optional = true, features = ["alloc"] }
-
-# Optional dependencies enabled through the `gimli-symbolize` feature, do not
-# use these features directly.
-addr2line = { version = "0.17.0", default-features = false }
-miniz_oxide = { version = "0.5.0", default-features = false }
+addr2line = { version = "0.19.0", default-features = false }
+miniz_oxide = { version = "0.6.0", default-features = false }
[dependencies.object]
-version = "0.29.0"
+version = "0.30.0"
default-features = false
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']
@@ -61,7 +58,7 @@ dylib-dep = { path = "crates/dylib-dep" }
libloading = "0.7"
[features]
-# By default libstd support and gimli-symbolize is used to symbolize addresses.
+# By default libstd support is enabled.
default = ["std"]
# Include std support. This enables types like `Backtrace`.
@@ -130,3 +127,8 @@ edition = '2018'
name = "concurrent-panics"
required-features = ["std"]
harness = false
+
+[[test]]
+name = "current-exe-mismatch"
+required-features = ["std"]
+harness = false
diff --git a/library/backtrace/src/backtrace/libunwind.rs b/library/backtrace/src/backtrace/libunwind.rs
index ef77edda5..c319fe45a 100644
--- a/library/backtrace/src/backtrace/libunwind.rs
+++ b/library/backtrace/src/backtrace/libunwind.rs
@@ -158,7 +158,8 @@ mod uw {
not(all(target_os = "android", target_arch = "arm")),
not(all(target_os = "freebsd", target_arch = "arm")),
not(all(target_os = "linux", target_arch = "arm")),
- not(all(target_os = "horizon", target_arch = "arm"))
+ not(all(target_os = "horizon", target_arch = "arm")),
+ not(all(target_os = "vita", target_arch = "arm")),
))] {
extern "C" {
pub fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t;
diff --git a/library/backtrace/src/dbghelp.rs b/library/backtrace/src/dbghelp.rs
index e01002beb..edeec653d 100644
--- a/library/backtrace/src/dbghelp.rs
+++ b/library/backtrace/src/dbghelp.rs
@@ -79,7 +79,7 @@ macro_rules! dbghelp {
static mut DBGHELP: Dbghelp = Dbghelp {
// Initially we haven't loaded the DLL
dll: 0 as *mut _,
- // Initiall all functions are set to zero to say they need to be
+ // Initially all functions are set to zero to say they need to be
// dynamically loaded.
$($name: 0,)*
};
diff --git a/library/backtrace/src/print.rs b/library/backtrace/src/print.rs
index cc677122a..174d8ae5c 100644
--- a/library/backtrace/src/print.rs
+++ b/library/backtrace/src/print.rs
@@ -135,7 +135,7 @@ impl BacktraceFrameFmt<'_, '_, '_> {
symbol.name(),
// TODO: this isn't great that we don't end up printing anything
// with non-utf8 filenames. Thankfully almost everything is utf8 so
- // this shouldn't be too too bad.
+ // this shouldn't be too bad.
symbol
.filename()
.and_then(|p| Some(BytesOrWideString::Bytes(p.to_str()?.as_bytes()))),
diff --git a/library/backtrace/src/print/fuchsia.rs b/library/backtrace/src/print/fuchsia.rs
index 959253acb..ce3f17862 100644
--- a/library/backtrace/src/print/fuchsia.rs
+++ b/library/backtrace/src/print/fuchsia.rs
@@ -25,7 +25,7 @@ const PT_NOTE: u32 = 4;
// Now we have to replicate, bit for bit, the structure of the dl_phdr_info
// type used by fuchsia's current dynamic linker. Chromium also has this ABI
-// boundary as well as crashpad. Eventully we'd like to move these cases to
+// boundary as well as crashpad. Eventually we'd like to move these cases to
// use elf-search but we'd need to provide that in the SDK and that has not
// yet been done. Thus we (and they) are stuck having to use this method
// which incurs a tight coupling with the fuchsia libc.
diff --git a/library/backtrace/src/symbolize/gimli.rs b/library/backtrace/src/symbolize/gimli.rs
index 5f10122dd..cd4cec58c 100644
--- a/library/backtrace/src/symbolize/gimli.rs
+++ b/library/backtrace/src/symbolize/gimli.rs
@@ -184,6 +184,8 @@ cfg_if::cfg_if! {
))] {
mod libs_dl_iterate_phdr;
use libs_dl_iterate_phdr::native_libraries;
+ #[path = "gimli/parse_running_mmaps_unix.rs"]
+ mod parse_running_mmaps;
} else if #[cfg(target_env = "libnx")] {
mod libs_libnx;
use libs_libnx::native_libraries;
diff --git a/library/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs b/library/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs
index a011e6080..9f0304ce8 100644
--- a/library/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs
+++ b/library/backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs
@@ -17,6 +17,20 @@ pub(super) fn native_libraries() -> Vec<Library> {
return ret;
}
+fn infer_current_exe(base_addr: usize) -> OsString {
+ if let Ok(entries) = super::parse_running_mmaps::parse_maps() {
+ let opt_path = entries
+ .iter()
+ .find(|e| e.ip_matches(base_addr) && e.pathname().len() > 0)
+ .map(|e| e.pathname())
+ .cloned();
+ if let Some(path) = opt_path {
+ return path;
+ }
+ }
+ env::current_exe().map(|e| e.into()).unwrap_or_default()
+}
+
// `info` should be a valid pointers.
// `vec` should be a valid pointer to a `std::Vec`.
unsafe extern "C" fn callback(
@@ -28,8 +42,12 @@ unsafe extern "C" fn callback(
let libs = &mut *(vec as *mut Vec<Library>);
let is_main_prog = info.dlpi_name.is_null() || *info.dlpi_name == 0;
let name = if is_main_prog {
+ // The man page for dl_iterate_phdr says that the first object visited by
+ // callback is the main program; so the first time we encounter a
+ // nameless entry, we can assume its the main program and try to infer its path.
+ // After that, we cannot continue that assumption, and we use an empty string.
if libs.is_empty() {
- env::current_exe().map(|e| e.into()).unwrap_or_default()
+ infer_current_exe(info.dlpi_addr as usize)
} else {
OsString::new()
}
diff --git a/library/backtrace/src/symbolize/gimli/libs_macos.rs b/library/backtrace/src/symbolize/gimli/libs_macos.rs
index 17703b88a..438bbff6f 100644
--- a/library/backtrace/src/symbolize/gimli/libs_macos.rs
+++ b/library/backtrace/src/symbolize/gimli/libs_macos.rs
@@ -113,8 +113,8 @@ fn native_library(i: u32) -> Option<Library> {
// file offset 0 with a nonzero size. For whatever reason when this
// is present it appears to mean that the symbol table is relative
// to just the vmaddr slide for the library. If it's *not* present
- // then the symbol table is relative to the the vmaddr slide plus
- // the segment's stated address.
+ // then the symbol table is relative to the vmaddr slide plus the
+ // segment's stated address.
//
// To handle this situation if we *don't* find a text section at
// file offset zero then we increase the bias by the first text
diff --git a/library/backtrace/src/symbolize/gimli/macho.rs b/library/backtrace/src/symbolize/gimli/macho.rs
index ec5673843..adea97a09 100644
--- a/library/backtrace/src/symbolize/gimli/macho.rs
+++ b/library/backtrace/src/symbolize/gimli/macho.rs
@@ -13,8 +13,8 @@ type MachSection = <Mach as MachHeader>::Section;
type MachNlist = <Mach as MachHeader>::Nlist;
impl Mapping {
- // The loading path for OSX is is so different we just have a completely
- // different implementation of the function here. On OSX we need to go
+ // The loading path for macOS is so different we just have a completely
+ // different implementation of the function here. On macOS we need to go
// probing the filesystem for a bunch of files.
pub fn new(path: &Path) -> Option<Mapping> {
// First up we need to load the unique UUID which is stored in the macho
diff --git a/library/backtrace/src/symbolize/gimli/mmap_windows.rs b/library/backtrace/src/symbolize/gimli/mmap_windows.rs
index 22f53fe03..b39509d8c 100644
--- a/library/backtrace/src/symbolize/gimli/mmap_windows.rs
+++ b/library/backtrace/src/symbolize/gimli/mmap_windows.rs
@@ -6,7 +6,7 @@ use core::ptr;
use core::slice;
pub struct Mmap {
- // keep the file alive to prevent it from ebeing deleted which would cause
+ // keep the file alive to prevent it from being deleted which would cause
// us to read bad data.
_file: File,
ptr: *mut c_void,
diff --git a/library/backtrace/src/symbolize/gimli/parse_running_mmaps_unix.rs b/library/backtrace/src/symbolize/gimli/parse_running_mmaps_unix.rs
new file mode 100644
index 000000000..a196ffcfb
--- /dev/null
+++ b/library/backtrace/src/symbolize/gimli/parse_running_mmaps_unix.rs
@@ -0,0 +1,242 @@
+// Note: This file is only currently used on targets that call out to the code
+// in `mod libs_dl_iterate_phdr` (e.g. linux, freebsd, ...); it may be more
+// general purpose, but it hasn't been tested elsewhere.
+
+use super::mystd::fs::File;
+use super::mystd::io::Read;
+use super::mystd::str::FromStr;
+use super::{OsString, String, Vec};
+
+#[derive(PartialEq, Eq, Debug)]
+pub(super) struct MapsEntry {
+ /// start (inclusive) and limit (exclusive) of address range.
+ address: (usize, usize),
+ /// The perms field are the permissions for the entry
+ ///
+ /// r = read
+ /// w = write
+ /// x = execute
+ /// s = shared
+ /// p = private (copy on write)
+ perms: [char; 4],
+ /// Offset into the file (or "whatever").
+ offset: usize,
+ /// device (major, minor)
+ dev: (usize, usize),
+ /// inode on the device. 0 indicates that no inode is associated with the memory region (e.g. uninitalized data aka BSS).
+ inode: usize,
+ /// Usually the file backing the mapping.
+ ///
+ /// Note: The man page for proc includes a note about "coordination" by
+ /// using readelf to see the Offset field in ELF program headers. pnkfelix
+ /// is not yet sure if that is intended to be a comment on pathname, or what
+ /// form/purpose such coordination is meant to have.
+ ///
+ /// There are also some pseudo-paths:
+ /// "[stack]": The initial process's (aka main thread's) stack.
+ /// "[stack:<tid>]": a specific thread's stack. (This was only present for a limited range of Linux verisons; it was determined to be too expensive to provide.)
+ /// "[vdso]": Virtual dynamically linked shared object
+ /// "[heap]": The process's heap
+ ///
+ /// The pathname can be blank, which means it is an anonymous mapping
+ /// obtained via mmap.
+ ///
+ /// Newlines in pathname are replaced with an octal escape sequence.
+ ///
+ /// The pathname may have "(deleted)" appended onto it if the file-backed
+ /// path has been deleted.
+ ///
+ /// Note that modifications like the latter two indicated above imply that
+ /// in general the pathname may be ambiguous. (I.e. you cannot tell if the
+ /// denoted filename actually ended with the text "(deleted)", or if that
+ /// was added by the maps rendering.
+ pathname: OsString,
+}
+
+pub(super) fn parse_maps() -> Result<Vec<MapsEntry>, &'static str> {
+ let mut v = Vec::new();
+ let mut proc_self_maps =
+ File::open("/proc/self/maps").map_err(|_| "Couldn't open /proc/self/maps")?;
+ let mut buf = String::new();
+ let _bytes_read = proc_self_maps
+ .read_to_string(&mut buf)
+ .map_err(|_| "Couldn't read /proc/self/maps")?;
+ for line in buf.lines() {
+ v.push(line.parse()?);
+ }
+
+ Ok(v)
+}
+
+impl MapsEntry {
+ pub(super) fn pathname(&self) -> &OsString {
+ &self.pathname
+ }
+
+ pub(super) fn ip_matches(&self, ip: usize) -> bool {
+ self.address.0 <= ip && ip < self.address.1
+ }
+}
+
+impl FromStr for MapsEntry {
+ type Err = &'static str;
+
+ // Format: address perms offset dev inode pathname
+ // e.g.: "ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]"
+ // e.g.: "7f5985f46000-7f5985f48000 rw-p 00039000 103:06 76021795 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2"
+ // e.g.: "35b1a21000-35b1a22000 rw-p 00000000 00:00 0"
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ let mut parts = s
+ .split(' ') // space-separated fields
+ .filter(|s| s.len() > 0); // multiple spaces implies empty strings that need to be skipped.
+ let range_str = parts.next().ok_or("Couldn't find address")?;
+ let perms_str = parts.next().ok_or("Couldn't find permissions")?;
+ let offset_str = parts.next().ok_or("Couldn't find offset")?;
+ let dev_str = parts.next().ok_or("Couldn't find dev")?;
+ let inode_str = parts.next().ok_or("Couldn't find inode")?;
+ let pathname_str = parts.next().unwrap_or(""); // pathname may be omitted.
+
+ let hex = |s| usize::from_str_radix(s, 16).map_err(|_| "Couldn't parse hex number");
+ let address = {
+ // This could use `range_str.split_once('-')` once the MSRV passes 1.52.
+ if let Some(idx) = range_str.find('-') {
+ let (start, rest) = range_str.split_at(idx);
+ let (_div, limit) = rest.split_at(1);
+ (hex(start)?, hex(limit)?)
+ } else {
+ return Err("Couldn't parse address range");
+ }
+ };
+ let perms: [char; 4] = {
+ let mut chars = perms_str.chars();
+ let mut c = || chars.next().ok_or("insufficient perms");
+ let perms = [c()?, c()?, c()?, c()?];
+ if chars.next().is_some() {
+ return Err("too many perms");
+ }
+ perms
+ };
+ let offset = hex(offset_str)?;
+ let dev = {
+ // This could use `dev_str.split_once(':')` once the MSRV passes 1.52.
+ if let Some(idx) = dev_str.find(':') {
+ let (major, rest) = dev_str.split_at(idx);
+ let (_div, minor) = rest.split_at(1);
+ (hex(major)?, hex(minor)?)
+ } else {
+ return Err("Couldn't parse dev")?;
+ }
+ };
+ let inode = hex(inode_str)?;
+ let pathname = pathname_str.into();
+
+ Ok(MapsEntry {
+ address,
+ perms,
+ offset,
+ dev,
+ inode,
+ pathname,
+ })
+ }
+}
+
+// Make sure we can parse 64-bit sample output if we're on a 64-bit target.
+#[cfg(target_pointer_width = "64")]
+#[test]
+fn check_maps_entry_parsing_64bit() {
+ assert_eq!(
+ "ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 \
+ [vsyscall]"
+ .parse::<MapsEntry>()
+ .unwrap(),
+ MapsEntry {
+ address: (0xffffffffff600000, 0xffffffffff601000),
+ perms: ['-', '-', 'x', 'p'],
+ offset: 0x00000000,
+ dev: (0x00, 0x00),
+ inode: 0x0,
+ pathname: "[vsyscall]".into(),
+ }
+ );
+
+ assert_eq!(
+ "7f5985f46000-7f5985f48000 rw-p 00039000 103:06 76021795 \
+ /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2"
+ .parse::<MapsEntry>()
+ .unwrap(),
+ MapsEntry {
+ address: (0x7f5985f46000, 0x7f5985f48000),
+ perms: ['r', 'w', '-', 'p'],
+ offset: 0x00039000,
+ dev: (0x103, 0x06),
+ inode: 0x76021795,
+ pathname: "/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2".into(),
+ }
+ );
+ assert_eq!(
+ "35b1a21000-35b1a22000 rw-p 00000000 00:00 0"
+ .parse::<MapsEntry>()
+ .unwrap(),
+ MapsEntry {
+ address: (0x35b1a21000, 0x35b1a22000),
+ perms: ['r', 'w', '-', 'p'],
+ offset: 0x00000000,
+ dev: (0x00, 0x00),
+ inode: 0x0,
+ pathname: Default::default(),
+ }
+ );
+}
+
+// (This output was taken from a 32-bit machine, but will work on any target)
+#[test]
+fn check_maps_entry_parsing_32bit() {
+ /* Example snippet of output:
+ 08056000-08077000 rw-p 00000000 00:00 0 [heap]
+ b7c79000-b7e02000 r--p 00000000 08:01 60662705 /usr/lib/locale/locale-archive
+ b7e02000-b7e03000 rw-p 00000000 00:00 0
+ */
+ assert_eq!(
+ "08056000-08077000 rw-p 00000000 00:00 0 \
+ [heap]"
+ .parse::<MapsEntry>()
+ .unwrap(),
+ MapsEntry {
+ address: (0x08056000, 0x08077000),
+ perms: ['r', 'w', '-', 'p'],
+ offset: 0x00000000,
+ dev: (0x00, 0x00),
+ inode: 0x0,
+ pathname: "[heap]".into(),
+ }
+ );
+
+ assert_eq!(
+ "b7c79000-b7e02000 r--p 00000000 08:01 60662705 \
+ /usr/lib/locale/locale-archive"
+ .parse::<MapsEntry>()
+ .unwrap(),
+ MapsEntry {
+ address: (0xb7c79000, 0xb7e02000),
+ perms: ['r', '-', '-', 'p'],
+ offset: 0x00000000,
+ dev: (0x08, 0x01),
+ inode: 0x60662705,
+ pathname: "/usr/lib/locale/locale-archive".into(),
+ }
+ );
+ assert_eq!(
+ "b7e02000-b7e03000 rw-p 00000000 00:00 0"
+ .parse::<MapsEntry>()
+ .unwrap(),
+ MapsEntry {
+ address: (0xb7e02000, 0xb7e03000),
+ perms: ['r', 'w', '-', 'p'],
+ offset: 0x00000000,
+ dev: (0x00, 0x00),
+ inode: 0x0,
+ pathname: Default::default(),
+ }
+ );
+}
diff --git a/library/backtrace/src/windows.rs b/library/backtrace/src/windows.rs
index d091874f1..9ec3ba99b 100644
--- a/library/backtrace/src/windows.rs
+++ b/library/backtrace/src/windows.rs
@@ -162,8 +162,8 @@ macro_rules! ffi {
ffi!($($rest)*);
);
- (extern "system" { $(pub fn $name:ident($($args:tt)*) -> $ret:ty;)* } $($rest:tt)*) => (
- extern "system" {
+ ($(#[$meta:meta])* extern "system" { $(pub fn $name:ident($($args:tt)*) -> $ret:ty;)* } $($rest:tt)*) => (
+ $(#[$meta])* extern "system" {
$(pub fn $name($($args)*) -> $ret;)*
}
@@ -371,6 +371,7 @@ ffi! {
pub type LPCVOID = *const c_void;
pub type LPMODULEENTRY32W = *mut MODULEENTRY32W;
+ #[link(name = "kernel32")]
extern "system" {
pub fn GetCurrentProcess() -> HANDLE;
pub fn GetCurrentThread() -> HANDLE;
@@ -438,6 +439,7 @@ ffi! {
#[cfg(target_pointer_width = "64")]
ffi! {
+ #[link(name = "kernel32")]
extern "system" {
pub fn RtlLookupFunctionEntry(
ControlPc: DWORD64,
diff --git a/library/backtrace/tests/common/mod.rs b/library/backtrace/tests/common/mod.rs
new file mode 100644
index 000000000..3c07934fd
--- /dev/null
+++ b/library/backtrace/tests/common/mod.rs
@@ -0,0 +1,14 @@
+/// Some tests only make sense in contexts where they can re-exec the test
+/// itself. Not all contexts support this, so you can call this method to find
+/// out which case you are in.
+pub fn cannot_reexec_the_test() -> bool {
+ // These run in docker containers on CI where they can't re-exec the test,
+ // so just skip these for CI. No other reason this can't run on those
+ // platforms though.
+ // Miri does not have support for re-execing a file
+ cfg!(unix)
+ && (cfg!(target_arch = "arm")
+ || cfg!(target_arch = "aarch64")
+ || cfg!(target_arch = "s390x"))
+ || cfg!(miri)
+}
diff --git a/library/backtrace/tests/concurrent-panics.rs b/library/backtrace/tests/concurrent-panics.rs
index 470245cc9..a44a26771 100644
--- a/library/backtrace/tests/concurrent-panics.rs
+++ b/library/backtrace/tests/concurrent-panics.rs
@@ -9,17 +9,11 @@ const PANICS: usize = 100;
const THREADS: usize = 8;
const VAR: &str = "__THE_TEST_YOU_ARE_LUKE";
+mod common;
+
fn main() {
- // These run in docker containers on CI where they can't re-exec the test,
- // so just skip these for CI. No other reason this can't run on those
- // platforms though.
- // Miri does not have support for re-execing a file
- if cfg!(unix)
- && (cfg!(target_arch = "arm")
- || cfg!(target_arch = "aarch64")
- || cfg!(target_arch = "s390x"))
- || cfg!(miri)
- {
+ // If we cannot re-exec this test, there's no point in trying to do it.
+ if common::cannot_reexec_the_test() {
println!("test result: ok");
return;
}
diff --git a/library/backtrace/tests/current-exe-mismatch.rs b/library/backtrace/tests/current-exe-mismatch.rs
new file mode 100644
index 000000000..21c67bcbf
--- /dev/null
+++ b/library/backtrace/tests/current-exe-mismatch.rs
@@ -0,0 +1,137 @@
+// rust-lang/rust#101913: when you run your program explicitly via `ld.so`,
+// `std::env::current_exe` will return the path of *that* program, and not
+// the Rust program itself.
+
+use std::io::{BufRead, BufReader};
+use std::path::{Path, PathBuf};
+use std::process::Command;
+
+mod common;
+
+fn main() {
+ if std::env::var(VAR).is_err() {
+ // the parent waits for the child; then we then handle either printing
+ // "test result: ok", "test result: ignored", or panicking.
+ match parent() {
+ Ok(()) => {
+ println!("test result: ok");
+ }
+ Err(EarlyExit::IgnoreTest(_)) => {
+ println!("test result: ignored");
+ }
+ Err(EarlyExit::IoError(e)) => {
+ println!("{} parent encoutered IoError: {:?}", file!(), e);
+ panic!();
+ }
+ }
+ } else {
+ // println!("{} running child", file!());
+ child().unwrap();
+ }
+}
+
+const VAR: &str = "__THE_TEST_YOU_ARE_LUKE";
+
+#[derive(Debug)]
+enum EarlyExit {
+ IgnoreTest(String),
+ IoError(std::io::Error),
+}
+
+impl From<std::io::Error> for EarlyExit {
+ fn from(e: std::io::Error) -> Self {
+ EarlyExit::IoError(e)
+ }
+}
+
+fn parent() -> Result<(), EarlyExit> {
+ // If we cannot re-exec this test, there's no point in trying to do it.
+ if common::cannot_reexec_the_test() {
+ return Err(EarlyExit::IgnoreTest("(cannot reexec)".into()));
+ }
+
+ let me = std::env::current_exe().unwrap();
+ let ld_so = find_interpreter(&me)?;
+
+ // use interp to invoke current exe, yielding child test.
+ //
+ // (if you're curious what you might compare this against, you can try
+ // swapping in the below definition for `result`, which is the easy case of
+ // not using the ld.so interpreter directly that Rust handled fine even
+ // prior to resolution of rust-lang/rust#101913.)
+ //
+ // let result = Command::new(me).env(VAR, "1").output()?;
+ let result = Command::new(ld_so).env(VAR, "1").arg(&me).output().unwrap();
+
+ if result.status.success() {
+ return Ok(());
+ }
+ println!("stdout:\n{}", String::from_utf8_lossy(&result.stdout));
+ println!("stderr:\n{}", String::from_utf8_lossy(&result.stderr));
+ println!("code: {}", result.status);
+ panic!();
+}
+
+fn child() -> Result<(), EarlyExit> {
+ let bt = backtrace::Backtrace::new();
+ println!("{:?}", bt);
+
+ let mut found_my_name = false;
+
+ let my_filename = file!();
+ 'frames: for frame in bt.frames() {
+ let symbols = frame.symbols();
+ if symbols.is_empty() {
+ continue;
+ }
+
+ for sym in symbols {
+ if let Some(filename) = sym.filename() {
+ if filename.ends_with(my_filename) {
+ // huzzah!
+ found_my_name = true;
+ break 'frames;
+ }
+ }
+ }
+ }
+
+ assert!(found_my_name);
+
+ Ok(())
+}
+
+// we use the `readelf` command to extract the path to the interpreter requested
+// by our binary.
+//
+// if we cannot `readelf` for some reason, or if we fail to parse its output,
+// then we will just give up on this test (and not treat it as a test failure).
+fn find_interpreter(me: &Path) -> Result<PathBuf, EarlyExit> {
+ let result = Command::new("readelf")
+ .arg("-l")
+ .arg(me)
+ .output()
+ .map_err(|_err| EarlyExit::IgnoreTest("readelf invocation failed".into()))?;
+ if result.status.success() {
+ let r = BufReader::new(&result.stdout[..]);
+ for line in r.lines() {
+ let line = line?;
+ let line = line.trim();
+ let prefix = "[Requesting program interpreter: ";
+ // This could use `line.split_once` and `suffix.rsplit_once` once the MSRV passes 1.52
+ if let Some(idx) = line.find(prefix) {
+ let (_, suffix) = line.split_at(idx + prefix.len());
+ if let Some(idx) = suffix.rfind("]") {
+ let (found_path, _ignore_remainder) = suffix.split_at(idx);
+ return Ok(found_path.into());
+ }
+ }
+ }
+
+ Err(EarlyExit::IgnoreTest(
+ "could not find interpreter from readelf output".into(),
+ ))
+ } else {
+ Err(EarlyExit::IgnoreTest("readelf returned non-success".into()))
+ }
+}
diff --git a/library/backtrace/tests/skip_inner_frames.rs b/library/backtrace/tests/skip_inner_frames.rs
index 8b57bef52..60bba35e6 100644
--- a/library/backtrace/tests/skip_inner_frames.rs
+++ b/library/backtrace/tests/skip_inner_frames.rs
@@ -4,7 +4,7 @@ use backtrace::Backtrace;
// function for frames which reports the starting address of a symbol. As a
// result it's only enabled on a few platforms.
const ENABLED: bool = cfg!(all(
- // Windows hasn't really been tested, and OSX doesn't support actually
+ // Windows hasn't really been tested, and macOS doesn't support actually
// finding an enclosing frame, so disable this
target_os = "linux",
// On ARM finding the enclosing function is simply returning the ip itself.
diff --git a/library/core/benches/fmt.rs b/library/core/benches/fmt.rs
index ff726ff75..d1cdb12e5 100644
--- a/library/core/benches/fmt.rs
+++ b/library/core/benches/fmt.rs
@@ -1,13 +1,13 @@
use std::fmt::{self, Write as FmtWrite};
use std::io::{self, Write as IoWrite};
-use test::Bencher;
+use test::{black_box, Bencher};
#[bench]
fn write_vec_value(bh: &mut Bencher) {
bh.iter(|| {
let mut mem = Vec::new();
for _ in 0..1000 {
- mem.write_all("abc".as_bytes()).unwrap();
+ mem.write_all(black_box("abc").as_bytes()).unwrap();
}
});
}
@@ -18,7 +18,7 @@ fn write_vec_ref(bh: &mut Bencher) {
let mut mem = Vec::new();
let wr = &mut mem as &mut dyn io::Write;
for _ in 0..1000 {
- wr.write_all("abc".as_bytes()).unwrap();
+ wr.write_all(black_box("abc").as_bytes()).unwrap();
}
});
}
@@ -29,7 +29,7 @@ fn write_vec_macro1(bh: &mut Bencher) {
let mut mem = Vec::new();
let wr = &mut mem as &mut dyn io::Write;
for _ in 0..1000 {
- write!(wr, "abc").unwrap();
+ write!(wr, "{}", black_box("abc")).unwrap();
}
});
}
@@ -40,7 +40,7 @@ fn write_vec_macro2(bh: &mut Bencher) {
let mut mem = Vec::new();
let wr = &mut mem as &mut dyn io::Write;
for _ in 0..1000 {
- write!(wr, "{}", "abc").unwrap();
+ write!(wr, "{}", black_box("abc")).unwrap();
}
});
}
@@ -51,7 +51,7 @@ fn write_vec_macro_debug(bh: &mut Bencher) {
let mut mem = Vec::new();
let wr = &mut mem as &mut dyn io::Write;
for _ in 0..1000 {
- write!(wr, "{:?}", "☃").unwrap();
+ write!(wr, "{:?}", black_box("☃")).unwrap();
}
});
}
@@ -61,7 +61,7 @@ fn write_str_value(bh: &mut Bencher) {
bh.iter(|| {
let mut mem = String::new();
for _ in 0..1000 {
- mem.write_str("abc").unwrap();
+ mem.write_str(black_box("abc")).unwrap();
}
});
}
@@ -72,7 +72,7 @@ fn write_str_ref(bh: &mut Bencher) {
let mut mem = String::new();
let wr = &mut mem as &mut dyn fmt::Write;
for _ in 0..1000 {
- wr.write_str("abc").unwrap();
+ wr.write_str(black_box("abc")).unwrap();
}
});
}
@@ -82,7 +82,7 @@ fn write_str_macro1(bh: &mut Bencher) {
bh.iter(|| {
let mut mem = String::new();
for _ in 0..1000 {
- write!(mem, "abc").unwrap();
+ write!(mem, "{}", black_box("abc")).unwrap();
}
});
}
@@ -93,7 +93,7 @@ fn write_str_macro2(bh: &mut Bencher) {
let mut mem = String::new();
let wr = &mut mem as &mut dyn fmt::Write;
for _ in 0..1000 {
- write!(wr, "{}", "abc").unwrap();
+ write!(wr, "{}", black_box("abc")).unwrap();
}
});
}
@@ -104,7 +104,7 @@ fn write_str_macro_debug(bh: &mut Bencher) {
let mut mem = String::new();
let wr = &mut mem as &mut dyn fmt::Write;
for _ in 0..1000 {
- write!(wr, "{:?}", "☃").unwrap();
+ write!(wr, "{:?}", black_box("☃")).unwrap();
}
});
}
@@ -115,7 +115,7 @@ fn write_str_macro_debug_ascii(bh: &mut Bencher) {
let mut mem = String::new();
let wr = &mut mem as &mut dyn fmt::Write;
for _ in 0..1000 {
- write!(wr, "{:?}", "Hello, World!").unwrap();
+ write!(wr, "{:?}", black_box("Hello, World!")).unwrap();
}
});
}
diff --git a/library/core/benches/iter.rs b/library/core/benches/iter.rs
index 9193c79be..60ef83223 100644
--- a/library/core/benches/iter.rs
+++ b/library/core/benches/iter.rs
@@ -404,7 +404,7 @@ fn bench_trusted_random_access_adapters(b: &mut Bencher) {
/// Exercises the iter::Copied specialization for slice::Iter
#[bench]
-fn bench_copied_chunks(b: &mut Bencher) {
+fn bench_next_chunk_copied(b: &mut Bencher) {
let v = vec![1u8; 1024];
b.iter(|| {
@@ -421,7 +421,7 @@ fn bench_copied_chunks(b: &mut Bencher) {
/// Exercises the TrustedRandomAccess specialization in ArrayChunks
#[bench]
-fn bench_trusted_random_access_chunks(b: &mut Bencher) {
+fn bench_next_chunk_trusted_random_access(b: &mut Bencher) {
let v = vec![1u8; 1024];
b.iter(|| {
@@ -437,3 +437,45 @@ fn bench_trusted_random_access_chunks(b: &mut Bencher) {
.sum::<Wrapping<u64>>()
})
}
+
+#[bench]
+fn bench_next_chunk_filter_even(b: &mut Bencher) {
+ let a = (0..1024).next_chunk::<1024>().unwrap();
+
+ b.iter(|| black_box(&a).iter().filter(|&&i| i % 2 == 0).next_chunk::<32>())
+}
+
+#[bench]
+fn bench_next_chunk_filter_predictably_true(b: &mut Bencher) {
+ let a = (0..1024).next_chunk::<1024>().unwrap();
+
+ b.iter(|| black_box(&a).iter().filter(|&&i| i < 100).next_chunk::<32>())
+}
+
+#[bench]
+fn bench_next_chunk_filter_mostly_false(b: &mut Bencher) {
+ let a = (0..1024).next_chunk::<1024>().unwrap();
+
+ b.iter(|| black_box(&a).iter().filter(|&&i| i > 900).next_chunk::<32>())
+}
+
+#[bench]
+fn bench_next_chunk_filter_map_even(b: &mut Bencher) {
+ let a = (0..1024).next_chunk::<1024>().unwrap();
+
+ b.iter(|| black_box(&a).iter().filter_map(|&i| (i % 2 == 0).then(|| i)).next_chunk::<32>())
+}
+
+#[bench]
+fn bench_next_chunk_filter_map_predictably_true(b: &mut Bencher) {
+ let a = (0..1024).next_chunk::<1024>().unwrap();
+
+ b.iter(|| black_box(&a).iter().filter_map(|&i| (i < 100).then(|| i)).next_chunk::<32>())
+}
+
+#[bench]
+fn bench_next_chunk_filter_map_mostly_false(b: &mut Bencher) {
+ let a = (0..1024).next_chunk::<1024>().unwrap();
+
+ b.iter(|| black_box(&a).iter().filter_map(|&i| (i > 900).then(|| i)).next_chunk::<32>())
+}
diff --git a/library/core/benches/num/dec2flt/mod.rs b/library/core/benches/num/dec2flt/mod.rs
index 305baa687..fb4a786b2 100644
--- a/library/core/benches/num/dec2flt/mod.rs
+++ b/library/core/benches/num/dec2flt/mod.rs
@@ -1,57 +1,57 @@
-use test::Bencher;
+use test::{black_box, Bencher};
#[bench]
fn bench_0(b: &mut Bencher) {
- b.iter(|| "0.0".parse::<f64>());
+ b.iter(|| black_box("0.0").parse::<f64>());
}
#[bench]
fn bench_42(b: &mut Bencher) {
- b.iter(|| "42".parse::<f64>());
+ b.iter(|| black_box("42").parse::<f64>());
}
#[bench]
fn bench_huge_int(b: &mut Bencher) {
// 2^128 - 1
- b.iter(|| "170141183460469231731687303715884105727".parse::<f64>());
+ b.iter(|| black_box("170141183460469231731687303715884105727").parse::<f64>());
}
#[bench]
fn bench_short_decimal(b: &mut Bencher) {
- b.iter(|| "1234.5678".parse::<f64>());
+ b.iter(|| black_box("1234.5678").parse::<f64>());
}
#[bench]
fn bench_pi_long(b: &mut Bencher) {
- b.iter(|| "3.14159265358979323846264338327950288".parse::<f64>());
+ b.iter(|| black_box("3.14159265358979323846264338327950288").parse::<f64>());
}
#[bench]
fn bench_pi_short(b: &mut Bencher) {
- b.iter(|| "3.141592653589793".parse::<f64>())
+ b.iter(|| black_box("3.141592653589793").parse::<f64>())
}
#[bench]
fn bench_1e150(b: &mut Bencher) {
- b.iter(|| "1e150".parse::<f64>());
+ b.iter(|| black_box("1e150").parse::<f64>());
}
#[bench]
fn bench_long_decimal_and_exp(b: &mut Bencher) {
- b.iter(|| "727501488517303786137132964064381141071e-123".parse::<f64>());
+ b.iter(|| black_box("727501488517303786137132964064381141071e-123").parse::<f64>());
}
#[bench]
fn bench_min_subnormal(b: &mut Bencher) {
- b.iter(|| "5e-324".parse::<f64>());
+ b.iter(|| black_box("5e-324").parse::<f64>());
}
#[bench]
fn bench_min_normal(b: &mut Bencher) {
- b.iter(|| "2.2250738585072014e-308".parse::<f64>());
+ b.iter(|| black_box("2.2250738585072014e-308").parse::<f64>());
}
#[bench]
fn bench_max(b: &mut Bencher) {
- b.iter(|| "1.7976931348623157e308".parse::<f64>());
+ b.iter(|| black_box("1.7976931348623157e308").parse::<f64>());
}
diff --git a/library/core/benches/num/flt2dec/mod.rs b/library/core/benches/num/flt2dec/mod.rs
index 32fd5e626..1a330ef5f 100644
--- a/library/core/benches/num/flt2dec/mod.rs
+++ b/library/core/benches/num/flt2dec/mod.rs
@@ -7,7 +7,7 @@ use core::num::flt2dec::MAX_SIG_DIGITS;
use core::num::flt2dec::{decode, DecodableFloat, Decoded, FullDecoded};
use std::io::Write;
use std::vec::Vec;
-use test::Bencher;
+use test::{black_box, Bencher};
pub fn decode_finite<T: DecodableFloat>(v: T) -> Decoded {
match decode(v).1 {
@@ -22,7 +22,7 @@ fn bench_small_shortest(b: &mut Bencher) {
b.iter(|| {
buf.clear();
- write!(&mut buf, "{}", 3.1415926f64).unwrap()
+ write!(black_box(&mut buf), "{}", black_box(3.1415926f64)).unwrap()
});
}
@@ -32,6 +32,6 @@ fn bench_big_shortest(b: &mut Bencher) {
b.iter(|| {
buf.clear();
- write!(&mut buf, "{}", f64::MAX).unwrap()
+ write!(black_box(&mut buf), "{}", black_box(f64::MAX)).unwrap()
});
}
diff --git a/library/core/benches/num/flt2dec/strategy/grisu.rs b/library/core/benches/num/flt2dec/strategy/grisu.rs
index 6bea5e55d..17d6b474a 100644
--- a/library/core/benches/num/flt2dec/strategy/grisu.rs
+++ b/library/core/benches/num/flt2dec/strategy/grisu.rs
@@ -81,3 +81,30 @@ fn bench_big_exact_inf(b: &mut Bencher) {
format_exact(black_box(&decoded), &mut buf, i16::MIN);
});
}
+
+#[bench]
+fn bench_one_exact_inf(b: &mut Bencher) {
+ let decoded = decode_finite(1.0);
+ let mut buf = [MaybeUninit::new(0); 1024];
+ b.iter(|| {
+ format_exact(black_box(&decoded), &mut buf, i16::MIN);
+ });
+}
+
+#[bench]
+fn bench_trailing_zero_exact_inf(b: &mut Bencher) {
+ let decoded = decode_finite(250.000000000000000000000000);
+ let mut buf = [MaybeUninit::new(0); 1024];
+ b.iter(|| {
+ format_exact(black_box(&decoded), &mut buf, i16::MIN);
+ });
+}
+
+#[bench]
+fn bench_halfway_point_exact_inf(b: &mut Bencher) {
+ let decoded = decode_finite(1.00000000000000011102230246251565404236316680908203125);
+ let mut buf = [MaybeUninit::new(0); 1024];
+ b.iter(|| {
+ format_exact(black_box(&decoded), &mut buf, i16::MIN);
+ });
+}
diff --git a/library/core/benches/num/mod.rs b/library/core/benches/num/mod.rs
index 2f9cad272..b97014d9b 100644
--- a/library/core/benches/num/mod.rs
+++ b/library/core/benches/num/mod.rs
@@ -3,7 +3,7 @@ mod flt2dec;
mod int_log;
use std::str::FromStr;
-use test::Bencher;
+use test::{black_box, Bencher};
const ASCII_NUMBERS: [&str; 19] = [
"0",
@@ -36,7 +36,7 @@ macro_rules! from_str_bench {
.iter()
.cycle()
.take(5_000)
- .filter_map(|s| <$t>::from_str(s).ok())
+ .filter_map(|s| <$t>::from_str(black_box(s)).ok())
.max()
})
}
@@ -52,7 +52,7 @@ macro_rules! from_str_radix_bench {
.iter()
.cycle()
.take(5_000)
- .filter_map(|s| <$t>::from_str_radix(s, $radix).ok())
+ .filter_map(|s| <$t>::from_str_radix(black_box(s), $radix).ok())
.max()
})
}
diff --git a/library/core/src/alloc/global.rs b/library/core/src/alloc/global.rs
index 18da70451..c58211170 100644
--- a/library/core/src/alloc/global.rs
+++ b/library/core/src/alloc/global.rs
@@ -235,7 +235,8 @@ pub unsafe trait GlobalAlloc {
/// * `new_size` must be greater than zero.
///
/// * `new_size`, when rounded up to the nearest multiple of `layout.align()`,
- /// must not overflow (i.e., the rounded value must be less than `usize::MAX`).
+ /// must not overflow isize (i.e., the rounded value must be less than or
+ /// equal to `isize::MAX`).
///
/// (Extension subtraits might provide more specific bounds on
/// behavior, e.g., guarantee a sentinel address or a null pointer
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs
index ac3d84718..597303037 100644
--- a/library/core/src/alloc/layout.rs
+++ b/library/core/src/alloc/layout.rs
@@ -231,9 +231,8 @@ impl Layout {
/// Returns an error if the combination of `self.size()` and the given
/// `align` violates the conditions listed in [`Layout::from_size_align`].
#[stable(feature = "alloc_layout_manipulation", since = "1.44.0")]
- #[rustc_const_unstable(feature = "const_alloc_layout", issue = "67521")]
#[inline]
- pub const fn align_to(&self, align: usize) -> Result<Self, LayoutError> {
+ pub fn align_to(&self, align: usize) -> Result<Self, LayoutError> {
Layout::from_size_align(self.size(), cmp::max(self.align(), align))
}
@@ -315,9 +314,8 @@ impl Layout {
///
/// On arithmetic overflow, returns `LayoutError`.
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
- #[rustc_const_unstable(feature = "const_alloc_layout", issue = "67521")]
#[inline]
- pub const fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutError> {
+ pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutError> {
// This cannot overflow. Quoting from the invariant of Layout:
// > `size`, when rounded up to the nearest multiple of `align`,
// > must not overflow isize (i.e., the rounded value must be
@@ -376,9 +374,8 @@ impl Layout {
/// # assert_eq!(repr_c(&[u64, u32, u16, u32]), Ok((s, vec![0, 8, 12, 16])));
/// ```
#[stable(feature = "alloc_layout_manipulation", since = "1.44.0")]
- #[rustc_const_unstable(feature = "const_alloc_layout", issue = "67521")]
#[inline]
- pub const fn extend(&self, next: Self) -> Result<(Self, usize), LayoutError> {
+ pub fn extend(&self, next: Self) -> Result<(Self, usize), LayoutError> {
let new_align = cmp::max(self.align, next.align);
let pad = self.padding_needed_for(next.align());
@@ -403,9 +400,8 @@ impl Layout {
///
/// On arithmetic overflow, returns `LayoutError`.
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
- #[rustc_const_unstable(feature = "const_alloc_layout", issue = "67521")]
#[inline]
- pub const fn repeat_packed(&self, n: usize) -> Result<Self, LayoutError> {
+ pub fn repeat_packed(&self, n: usize) -> Result<Self, LayoutError> {
let size = self.size().checked_mul(n).ok_or(LayoutError)?;
// The safe constructor is called here to enforce the isize size limit.
Layout::from_size_alignment(size, self.align)
@@ -418,9 +414,8 @@ impl Layout {
///
/// On arithmetic overflow, returns `LayoutError`.
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
- #[rustc_const_unstable(feature = "const_alloc_layout", issue = "67521")]
#[inline]
- pub const fn extend_packed(&self, next: Self) -> Result<Self, LayoutError> {
+ pub fn extend_packed(&self, next: Self) -> Result<Self, LayoutError> {
let new_size = self.size().checked_add(next.size()).ok_or(LayoutError)?;
// The safe constructor is called here to enforce the isize size limit.
Layout::from_size_alignment(new_size, self.align)
diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs
index ff390322d..d6ae2b821 100644
--- a/library/core/src/alloc/mod.rs
+++ b/library/core/src/alloc/mod.rs
@@ -105,7 +105,6 @@ impl fmt::Display for AllocError {
///
/// [*currently allocated*]: #currently-allocated-memory
#[unstable(feature = "allocator_api", issue = "32838")]
-#[const_trait]
pub unsafe trait Allocator {
/// Attempts to allocate a block of memory.
///
diff --git a/library/core/src/any.rs b/library/core/src/any.rs
index c27646b8f..7969f4055 100644
--- a/library/core/src/any.rs
+++ b/library/core/src/any.rs
@@ -662,13 +662,20 @@ impl dyn Any + Send + Sync {
/// While `TypeId` implements `Hash`, `PartialOrd`, and `Ord`, it is worth
/// noting that the hashes and ordering will vary between Rust releases. Beware
/// of relying on them inside of your code!
-#[derive(Clone, Copy, Debug, Hash, Eq)]
-#[derive_const(PartialEq, PartialOrd, Ord)]
+#[derive(Clone, Copy, Debug, Hash, Eq, PartialOrd, Ord)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct TypeId {
t: u64,
}
+#[stable(feature = "rust1", since = "1.0.0")]
+impl PartialEq for TypeId {
+ #[inline]
+ fn eq(&self, other: &Self) -> bool {
+ self.t == other.t
+ }
+}
+
impl TypeId {
/// Returns the `TypeId` of the type this generic function has been
/// instantiated with.
@@ -867,7 +874,7 @@ where
///
/// A data provider provides values by calling this type's provide methods.
#[unstable(feature = "provide_any", issue = "96024")]
-#[repr(transparent)]
+#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
pub struct Demand<'a>(dyn Erased<'a> + 'a);
impl<'a> Demand<'a> {
diff --git a/library/core/src/array/ascii.rs b/library/core/src/array/ascii.rs
new file mode 100644
index 000000000..3fea9a440
--- /dev/null
+++ b/library/core/src/array/ascii.rs
@@ -0,0 +1,47 @@
+use crate::ascii;
+
+#[cfg(not(test))]
+impl<const N: usize> [u8; N] {
+ /// Converts this array of bytes into a array of ASCII characters,
+ /// or returns `None` if any of the characters is non-ASCII.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(ascii_char)]
+ /// #![feature(const_option)]
+ ///
+ /// const HEX_DIGITS: [std::ascii::Char; 16] =
+ /// *b"0123456789abcdef".as_ascii().unwrap();
+ ///
+ /// assert_eq!(HEX_DIGITS[1].as_str(), "1");
+ /// assert_eq!(HEX_DIGITS[10].as_str(), "a");
+ /// ```
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[must_use]
+ #[inline]
+ pub const fn as_ascii(&self) -> Option<&[ascii::Char; N]> {
+ if self.is_ascii() {
+ // SAFETY: Just checked that it's ASCII
+ Some(unsafe { self.as_ascii_unchecked() })
+ } else {
+ None
+ }
+ }
+
+ /// Converts this array of bytes into a array of ASCII characters,
+ /// without checking whether they're valid.
+ ///
+ /// # Safety
+ ///
+ /// Every byte in the array must be in `0..=127`, or else this is UB.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[must_use]
+ #[inline]
+ pub const unsafe fn as_ascii_unchecked(&self) -> &[ascii::Char; N] {
+ let byte_ptr: *const [u8; N] = self;
+ let ascii_ptr = byte_ptr as *const [ascii::Char; N];
+ // SAFETY: The caller promised all the bytes are ASCII
+ unsafe { &*ascii_ptr }
+ }
+}
diff --git a/library/core/src/array/iter.rs b/library/core/src/array/iter.rs
index 73e2c2cfb..587877dff 100644
--- a/library/core/src/array/iter.rs
+++ b/library/core/src/array/iter.rs
@@ -3,8 +3,9 @@
use crate::num::NonZeroUsize;
use crate::{
fmt,
+ intrinsics::transmute_unchecked,
iter::{self, ExactSizeIterator, FusedIterator, TrustedLen},
- mem::{self, MaybeUninit},
+ mem::MaybeUninit,
ops::{IndexRange, Range},
ptr,
};
@@ -63,18 +64,11 @@ impl<T, const N: usize> IntoIterator for [T; N] {
// an array of `T`.
//
// With that, this initialization satisfies the invariants.
-
- // FIXME(LukasKalbertodt): actually use `mem::transmute` here, once it
- // works with const generics:
- // `mem::transmute::<[T; N], [MaybeUninit<T>; N]>(array)`
//
- // Until then, we can use `mem::transmute_copy` to create a bitwise copy
- // as a different type, then forget `array` so that it is not dropped.
- unsafe {
- let iter = IntoIter { data: mem::transmute_copy(&self), alive: IndexRange::zero_to(N) };
- mem::forget(self);
- iter
- }
+ // FIXME: If normal `transmute` ever gets smart enough to allow this
+ // directly, use it instead of `transmute_unchecked`.
+ let data: [MaybeUninit<T>; N] = unsafe { transmute_unchecked(self) };
+ IntoIter { data, alive: IndexRange::zero_to(N) }
}
}
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 1643842d6..fec92320a 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -17,6 +17,7 @@ use crate::ops::{
};
use crate::slice::{Iter, IterMut};
+mod ascii;
mod drain;
mod equality;
mod iter;
@@ -148,8 +149,7 @@ impl Error for TryFromSliceError {
}
#[stable(feature = "try_from_slice_error", since = "1.36.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl const From<Infallible> for TryFromSliceError {
+impl From<Infallible> for TryFromSliceError {
fn from(x: Infallible) -> TryFromSliceError {
match x {}
}
@@ -172,16 +172,14 @@ impl<T, const N: usize> AsMut<[T]> for [T; N] {
}
#[stable(feature = "array_borrow", since = "1.4.0")]
-#[rustc_const_unstable(feature = "const_borrow", issue = "91522")]
-impl<T, const N: usize> const Borrow<[T]> for [T; N] {
+impl<T, const N: usize> Borrow<[T]> for [T; N] {
fn borrow(&self) -> &[T] {
self
}
}
#[stable(feature = "array_borrow", since = "1.4.0")]
-#[rustc_const_unstable(feature = "const_borrow", issue = "91522")]
-impl<T, const N: usize> const BorrowMut<[T]> for [T; N] {
+impl<T, const N: usize> BorrowMut<[T]> for [T; N] {
fn borrow_mut(&mut self) -> &mut [T] {
self
}
@@ -206,6 +204,7 @@ where
{
type Error = TryFromSliceError;
+ #[inline]
fn try_from(slice: &[T]) -> Result<[T; N], TryFromSliceError> {
<&Self>::try_from(slice).map(|r| *r)
}
@@ -230,6 +229,7 @@ where
{
type Error = TryFromSliceError;
+ #[inline]
fn try_from(slice: &mut [T]) -> Result<[T; N], TryFromSliceError> {
<Self>::try_from(&*slice)
}
@@ -251,7 +251,8 @@ where
impl<'a, T, const N: usize> TryFrom<&'a [T]> for &'a [T; N] {
type Error = TryFromSliceError;
- fn try_from(slice: &[T]) -> Result<&[T; N], TryFromSliceError> {
+ #[inline]
+ fn try_from(slice: &'a [T]) -> Result<&'a [T; N], TryFromSliceError> {
if slice.len() == N {
let ptr = slice.as_ptr() as *const [T; N];
// SAFETY: ok because we just checked that the length fits
@@ -278,7 +279,8 @@ impl<'a, T, const N: usize> TryFrom<&'a [T]> for &'a [T; N] {
impl<'a, T, const N: usize> TryFrom<&'a mut [T]> for &'a mut [T; N] {
type Error = TryFromSliceError;
- fn try_from(slice: &mut [T]) -> Result<&mut [T; N], TryFromSliceError> {
+ #[inline]
+ fn try_from(slice: &'a mut [T]) -> Result<&'a mut [T; N], TryFromSliceError> {
if slice.len() == N {
let ptr = slice.as_mut_ptr() as *mut [T; N];
// SAFETY: ok because we just checked that the length fits
@@ -293,7 +295,6 @@ impl<'a, T, const N: usize> TryFrom<&'a mut [T]> for &'a mut [T; N] {
/// as required by the `Borrow` implementation.
///
/// ```
-/// #![feature(build_hasher_simple_hash_one)]
/// use std::hash::BuildHasher;
///
/// let b = std::collections::hash_map::RandomState::new();
@@ -336,10 +337,9 @@ impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N] {
}
#[stable(feature = "index_trait_on_arrays", since = "1.50.0")]
-#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-impl<T, I, const N: usize> const Index<I> for [T; N]
+impl<T, I, const N: usize> Index<I> for [T; N]
where
- [T]: ~const Index<I>,
+ [T]: Index<I>,
{
type Output = <[T] as Index<I>>::Output;
@@ -350,10 +350,9 @@ where
}
#[stable(feature = "index_trait_on_arrays", since = "1.50.0")]
-#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-impl<T, I, const N: usize> const IndexMut<I> for [T; N]
+impl<T, I, const N: usize> IndexMut<I> for [T; N]
where
- [T]: ~const IndexMut<I>,
+ [T]: IndexMut<I>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut Self::Output {
@@ -435,8 +434,7 @@ impl<T: Copy> SpecArrayClone for T {
macro_rules! array_impl_default {
{$n:expr, $t:ident $($ts:ident)*} => {
#[stable(since = "1.4.0", feature = "array_default")]
- #[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
- impl<T> const Default for [T; $n] where T: ~const Default {
+ impl<T> Default for [T; $n] where T: Default {
fn default() -> [T; $n] {
[$t::default(), $($ts::default()),*]
}
@@ -445,8 +443,7 @@ macro_rules! array_impl_default {
};
{$n:expr,} => {
#[stable(since = "1.4.0", feature = "array_default")]
- #[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
- impl<T> const Default for [T; $n] {
+ impl<T> Default for [T; $n] {
fn default() -> [T; $n] { [] }
}
};
diff --git a/library/core/src/ascii.rs b/library/core/src/ascii.rs
index 8a4cb78cc..ef8e4d098 100644
--- a/library/core/src/ascii.rs
+++ b/library/core/src/ascii.rs
@@ -9,10 +9,14 @@
#![stable(feature = "core_ascii", since = "1.26.0")]
+use crate::escape;
use crate::fmt;
use crate::iter::FusedIterator;
-use crate::ops::Range;
-use crate::str::from_utf8_unchecked;
+use crate::num::NonZeroUsize;
+
+mod ascii_char;
+#[unstable(feature = "ascii_char", issue = "110998")]
+pub use ascii_char::AsciiChar as Char;
/// An iterator over the escaped version of a byte.
///
@@ -21,10 +25,7 @@ use crate::str::from_utf8_unchecked;
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Clone)]
-pub struct EscapeDefault {
- range: Range<u8>,
- data: [u8; 4],
-}
+pub struct EscapeDefault(escape::EscapeIterInner<4>);
/// Returns an iterator that produces an escaped version of a `u8`.
///
@@ -90,21 +91,9 @@ pub struct EscapeDefault {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn escape_default(c: u8) -> EscapeDefault {
- let (data, len) = match c {
- b'\t' => ([b'\\', b't', 0, 0], 2),
- b'\r' => ([b'\\', b'r', 0, 0], 2),
- b'\n' => ([b'\\', b'n', 0, 0], 2),
- b'\\' => ([b'\\', b'\\', 0, 0], 2),
- b'\'' => ([b'\\', b'\'', 0, 0], 2),
- b'"' => ([b'\\', b'"', 0, 0], 2),
- b'\x20'..=b'\x7e' => ([c, 0, 0, 0], 1),
- _ => {
- let hex_digits: &[u8; 16] = b"0123456789abcdef";
- ([b'\\', b'x', hex_digits[(c >> 4) as usize], hex_digits[(c & 0xf) as usize]], 4)
- }
- };
-
- return EscapeDefault { range: 0..len, data };
+ let mut data = [Char::Null; 4];
+ let range = escape::escape_ascii_into(&mut data, c);
+ EscapeDefault(escape::EscapeIterInner::new(data, range))
}
#[stable(feature = "rust1", since = "1.0.0")]
@@ -113,33 +102,59 @@ impl Iterator for EscapeDefault {
#[inline]
fn next(&mut self) -> Option<u8> {
- self.range.next().map(|i| self.data[i as usize])
+ self.0.next()
}
+
+ #[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
- self.range.size_hint()
+ let n = self.0.len();
+ (n, Some(n))
}
+
+ #[inline]
+ fn count(self) -> usize {
+ self.0.len()
+ }
+
+ #[inline]
fn last(mut self) -> Option<u8> {
- self.next_back()
+ self.0.next_back()
+ }
+
+ #[inline]
+ fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
+ self.0.advance_by(n)
}
}
+
#[stable(feature = "rust1", since = "1.0.0")]
impl DoubleEndedIterator for EscapeDefault {
+ #[inline]
fn next_back(&mut self) -> Option<u8> {
- self.range.next_back().map(|i| self.data[i as usize])
+ self.0.next_back()
+ }
+
+ #[inline]
+ fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
+ self.0.advance_back_by(n)
}
}
+
#[stable(feature = "rust1", since = "1.0.0")]
-impl ExactSizeIterator for EscapeDefault {}
+impl ExactSizeIterator for EscapeDefault {
+ #[inline]
+ fn len(&self) -> usize {
+ self.0.len()
+ }
+}
+
#[stable(feature = "fused", since = "1.26.0")]
impl FusedIterator for EscapeDefault {}
#[stable(feature = "ascii_escape_display", since = "1.39.0")]
impl fmt::Display for EscapeDefault {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- // SAFETY: ok because `escape_default` created only valid utf-8 data
- f.write_str(unsafe {
- from_utf8_unchecked(&self.data[(self.range.start as usize)..(self.range.end as usize)])
- })
+ f.write_str(self.0.as_str())
}
}
diff --git a/library/core/src/ascii/ascii_char.rs b/library/core/src/ascii/ascii_char.rs
new file mode 100644
index 000000000..f093a0990
--- /dev/null
+++ b/library/core/src/ascii/ascii_char.rs
@@ -0,0 +1,565 @@
+//! This uses the name `AsciiChar`, even though it's not exposed that way right now,
+//! because it avoids a whole bunch of "are you sure you didn't mean `char`?"
+//! suggestions from rustc if you get anything slightly wrong in here, and overall
+//! helps with clarity as we're also referring to `char` intentionally in here.
+
+use crate::fmt;
+use crate::mem::transmute;
+
+/// One of the 128 Unicode characters from U+0000 through U+007F,
+/// often known as the [ASCII] subset.
+///
+/// Officially, this is the first [block] in Unicode, _Basic Latin_.
+/// For details, see the [*C0 Controls and Basic Latin*][chart] code chart.
+///
+/// This block was based on older 7-bit character code standards such as
+/// ANSI X3.4-1977, ISO 646-1973, and [NIST FIPS 1-2].
+///
+/// # When to use this
+///
+/// The main advantage of this subset is that it's always valid UTF-8. As such,
+/// the `&[ascii::Char]` -> `&str` conversion function (as well as other related
+/// ones) are O(1): *no* runtime checks are needed.
+///
+/// If you're consuming strings, you should usually handle Unicode and thus
+/// accept `str`s, not limit yourself to `ascii::Char`s.
+///
+/// However, certain formats are intentionally designed to produce ASCII-only
+/// output in order to be 8-bit-clean. In those cases, it can be simpler and
+/// faster to generate `ascii::Char`s instead of dealing with the variable width
+/// properties of general UTF-8 encoded strings, while still allowing the result
+/// to be used freely with other Rust things that deal in general `str`s.
+///
+/// For example, a UUID library might offer a way to produce the string
+/// representation of a UUID as an `[ascii::Char; 36]` to avoid memory
+/// allocation yet still allow it to be used as UTF-8 via `as_str` without
+/// paying for validation (or needing `unsafe` code) the way it would if it
+/// were provided as a `[u8; 36]`.
+///
+/// # Layout
+///
+/// This type is guaranteed to have a size and alignment of 1 byte.
+///
+/// # Names
+///
+/// The variants on this type are [Unicode names][NamesList] of the characters
+/// in upper camel case, with a few tweaks:
+/// - For `<control>` characters, the primary alias name is used.
+/// - `LATIN` is dropped, as this block has no non-latin letters.
+/// - `LETTER` is dropped, as `CAPITAL`/`SMALL` suffices in this block.
+/// - `DIGIT`s use a single digit rather than writing out `ZERO`, `ONE`, etc.
+///
+/// [ASCII]: https://www.unicode.org/glossary/index.html#ASCII
+/// [block]: https://www.unicode.org/glossary/index.html#block
+/// [chart]: https://www.unicode.org/charts/PDF/U0000.pdf
+/// [NIST FIPS 1-2]: https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub1-2-1977.pdf
+/// [NamesList]: https://www.unicode.org/Public/15.0.0/ucd/NamesList.txt
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+#[unstable(feature = "ascii_char", issue = "110998")]
+#[repr(u8)]
+pub enum AsciiChar {
+ /// U+0000
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Null = 0,
+ /// U+0001
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ StartOfHeading = 1,
+ /// U+0002
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ StartOfText = 2,
+ /// U+0003
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ EndOfText = 3,
+ /// U+0004
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ EndOfTransmission = 4,
+ /// U+0005
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Enquiry = 5,
+ /// U+0006
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Acknowledge = 6,
+ /// U+0007
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Bell = 7,
+ /// U+0008
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Backspace = 8,
+ /// U+0009
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CharacterTabulation = 9,
+ /// U+000A
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ LineFeed = 10,
+ /// U+000B
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ LineTabulation = 11,
+ /// U+000C
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ FormFeed = 12,
+ /// U+000D
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CarriageReturn = 13,
+ /// U+000E
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ ShiftOut = 14,
+ /// U+000F
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ ShiftIn = 15,
+ /// U+0010
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ DataLinkEscape = 16,
+ /// U+0011
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ DeviceControlOne = 17,
+ /// U+0012
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ DeviceControlTwo = 18,
+ /// U+0013
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ DeviceControlThree = 19,
+ /// U+0014
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ DeviceControlFour = 20,
+ /// U+0015
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ NegativeAcknowledge = 21,
+ /// U+0016
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SynchronousIdle = 22,
+ /// U+0017
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ EndOfTransmissionBlock = 23,
+ /// U+0018
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Cancel = 24,
+ /// U+0019
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ EndOfMedium = 25,
+ /// U+001A
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Substitute = 26,
+ /// U+001B
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Escape = 27,
+ /// U+001C
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ InformationSeparatorFour = 28,
+ /// U+001D
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ InformationSeparatorThree = 29,
+ /// U+001E
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ InformationSeparatorTwo = 30,
+ /// U+001F
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ InformationSeparatorOne = 31,
+ /// U+0020
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Space = 32,
+ /// U+0021
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ ExclamationMark = 33,
+ /// U+0022
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ QuotationMark = 34,
+ /// U+0023
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ NumberSign = 35,
+ /// U+0024
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ DollarSign = 36,
+ /// U+0025
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ PercentSign = 37,
+ /// U+0026
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Ampersand = 38,
+ /// U+0027
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Apostrophe = 39,
+ /// U+0028
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ LeftParenthesis = 40,
+ /// U+0029
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ RightParenthesis = 41,
+ /// U+002A
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Asterisk = 42,
+ /// U+002B
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ PlusSign = 43,
+ /// U+002C
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Comma = 44,
+ /// U+002D
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ HyphenMinus = 45,
+ /// U+002E
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ FullStop = 46,
+ /// U+002F
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Solidus = 47,
+ /// U+0030
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit0 = 48,
+ /// U+0031
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit1 = 49,
+ /// U+0032
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit2 = 50,
+ /// U+0033
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit3 = 51,
+ /// U+0034
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit4 = 52,
+ /// U+0035
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit5 = 53,
+ /// U+0036
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit6 = 54,
+ /// U+0037
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit7 = 55,
+ /// U+0038
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit8 = 56,
+ /// U+0039
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Digit9 = 57,
+ /// U+003A
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Colon = 58,
+ /// U+003B
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Semicolon = 59,
+ /// U+003C
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ LessThanSign = 60,
+ /// U+003D
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ EqualsSign = 61,
+ /// U+003E
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ GreaterThanSign = 62,
+ /// U+003F
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ QuestionMark = 63,
+ /// U+0040
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CommercialAt = 64,
+ /// U+0041
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalA = 65,
+ /// U+0042
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalB = 66,
+ /// U+0043
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalC = 67,
+ /// U+0044
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalD = 68,
+ /// U+0045
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalE = 69,
+ /// U+0046
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalF = 70,
+ /// U+0047
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalG = 71,
+ /// U+0048
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalH = 72,
+ /// U+0049
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalI = 73,
+ /// U+004A
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalJ = 74,
+ /// U+004B
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalK = 75,
+ /// U+004C
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalL = 76,
+ /// U+004D
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalM = 77,
+ /// U+004E
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalN = 78,
+ /// U+004F
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalO = 79,
+ /// U+0050
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalP = 80,
+ /// U+0051
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalQ = 81,
+ /// U+0052
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalR = 82,
+ /// U+0053
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalS = 83,
+ /// U+0054
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalT = 84,
+ /// U+0055
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalU = 85,
+ /// U+0056
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalV = 86,
+ /// U+0057
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalW = 87,
+ /// U+0058
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalX = 88,
+ /// U+0059
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalY = 89,
+ /// U+005A
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CapitalZ = 90,
+ /// U+005B
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ LeftSquareBracket = 91,
+ /// U+005C
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ ReverseSolidus = 92,
+ /// U+005D
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ RightSquareBracket = 93,
+ /// U+005E
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ CircumflexAccent = 94,
+ /// U+005F
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ LowLine = 95,
+ /// U+0060
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ GraveAccent = 96,
+ /// U+0061
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallA = 97,
+ /// U+0062
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallB = 98,
+ /// U+0063
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallC = 99,
+ /// U+0064
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallD = 100,
+ /// U+0065
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallE = 101,
+ /// U+0066
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallF = 102,
+ /// U+0067
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallG = 103,
+ /// U+0068
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallH = 104,
+ /// U+0069
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallI = 105,
+ /// U+006A
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallJ = 106,
+ /// U+006B
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallK = 107,
+ /// U+006C
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallL = 108,
+ /// U+006D
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallM = 109,
+ /// U+006E
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallN = 110,
+ /// U+006F
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallO = 111,
+ /// U+0070
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallP = 112,
+ /// U+0071
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallQ = 113,
+ /// U+0072
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallR = 114,
+ /// U+0073
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallS = 115,
+ /// U+0074
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallT = 116,
+ /// U+0075
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallU = 117,
+ /// U+0076
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallV = 118,
+ /// U+0077
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallW = 119,
+ /// U+0078
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallX = 120,
+ /// U+0079
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallY = 121,
+ /// U+007A
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ SmallZ = 122,
+ /// U+007B
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ LeftCurlyBracket = 123,
+ /// U+007C
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ VerticalLine = 124,
+ /// U+007D
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ RightCurlyBracket = 125,
+ /// U+007E
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Tilde = 126,
+ /// U+007F
+ #[unstable(feature = "ascii_char_variants", issue = "110998")]
+ Delete = 127,
+}
+
+impl AsciiChar {
+ /// Creates an ascii character from the byte `b`,
+ /// or returns `None` if it's too large.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn from_u8(b: u8) -> Option<Self> {
+ if b <= 127 {
+ // SAFETY: Just checked that `b` is in-range
+ Some(unsafe { Self::from_u8_unchecked(b) })
+ } else {
+ None
+ }
+ }
+
+ /// Creates an ASCII character from the byte `b`,
+ /// without checking whether it's valid.
+ ///
+ /// # Safety
+ ///
+ /// `b` must be in `0..=127`, or else this is UB.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const unsafe fn from_u8_unchecked(b: u8) -> Self {
+ // SAFETY: Our safety precondition is that `b` is in-range.
+ unsafe { transmute(b) }
+ }
+
+ /// When passed the *number* `0`, `1`, …, `9`, returns the *character*
+ /// `'0'`, `'1'`, …, `'9'` respectively.
+ ///
+ /// If `d >= 10`, returns `None`.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn digit(d: u8) -> Option<Self> {
+ if d < 10 {
+ // SAFETY: Just checked it's in-range.
+ Some(unsafe { Self::digit_unchecked(d) })
+ } else {
+ None
+ }
+ }
+
+ /// When passed the *number* `0`, `1`, …, `9`, returns the *character*
+ /// `'0'`, `'1'`, …, `'9'` respectively, without checking that it's in-range.
+ ///
+ /// # Safety
+ ///
+ /// This is immediate UB if called with `d > 64`.
+ ///
+ /// If `d >= 10` and `d <= 64`, this is allowed to return any value or panic.
+ /// Notably, it should not be expected to return hex digits, or any other
+ /// reasonable extension of the decimal digits.
+ ///
+ /// (This lose safety condition is intended to simplify soundness proofs
+ /// when writing code using this method, since the implementation doesn't
+ /// need something really specific, not to make those other arguments do
+ /// something useful. It might be tightened before stabilization.)
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const unsafe fn digit_unchecked(d: u8) -> Self {
+ debug_assert!(d < 10);
+
+ // SAFETY: `'0'` through `'9'` are U+00030 through U+0039,
+ // so because `d` must be 64 or less the addition can return at most
+ // 112 (0x70), which doesn't overflow and is within the ASCII range.
+ unsafe {
+ let byte = b'0'.unchecked_add(d);
+ Self::from_u8_unchecked(byte)
+ }
+ }
+
+ /// Gets this ASCII character as a byte.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn as_u8(self) -> u8 {
+ self as u8
+ }
+
+ /// Gets this ASCII character as a `char` Unicode Scalar Value.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn as_char(self) -> char {
+ self as u8 as char
+ }
+
+ /// Views this ASCII character as a one-code-unit UTF-8 `str`.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn as_str(&self) -> &str {
+ crate::slice::from_ref(self).as_str()
+ }
+}
+
+impl [AsciiChar] {
+ /// Views this slice of ASCII characters as a UTF-8 `str`.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn as_str(&self) -> &str {
+ let ascii_ptr: *const Self = self;
+ let str_ptr = ascii_ptr as *const str;
+ // SAFETY: Each ASCII codepoint in UTF-8 is encoded as one single-byte
+ // code unit having the same value as the ASCII byte.
+ unsafe { &*str_ptr }
+ }
+
+ /// Views this slice of ASCII characters as a slice of `u8` bytes.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn as_bytes(&self) -> &[u8] {
+ self.as_str().as_bytes()
+ }
+}
+
+#[unstable(feature = "ascii_char", issue = "110998")]
+impl fmt::Display for AsciiChar {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ <str as fmt::Display>::fmt(self.as_str(), f)
+ }
+}
diff --git a/library/core/src/bool.rs b/library/core/src/bool.rs
index db1c505ba..03cdff9b1 100644
--- a/library/core/src/bool.rs
+++ b/library/core/src/bool.rs
@@ -1,7 +1,5 @@
//! impl bool {}
-use crate::marker::Destruct;
-
impl bool {
/// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html),
/// or `None` otherwise.
@@ -31,12 +29,8 @@ impl bool {
/// assert_eq!(a, 2);
/// ```
#[stable(feature = "bool_to_option", since = "1.62.0")]
- #[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
#[inline]
- pub const fn then_some<T>(self, t: T) -> Option<T>
- where
- T: ~const Destruct,
- {
+ pub fn then_some<T>(self, t: T) -> Option<T> {
if self { Some(t) } else { None }
}
@@ -61,13 +55,8 @@ impl bool {
/// assert_eq!(a, 1);
/// ```
#[stable(feature = "lazy_bool_to_option", since = "1.50.0")]
- #[rustc_const_unstable(feature = "const_bool_to_option", issue = "91917")]
#[inline]
- pub const fn then<T, F>(self, f: F) -> Option<T>
- where
- F: ~const FnOnce() -> T,
- F: ~const Destruct,
- {
+ pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
if self { Some(f()) } else { None }
}
}
diff --git a/library/core/src/borrow.rs b/library/core/src/borrow.rs
index 4a8302ee4..efc9ada38 100644
--- a/library/core/src/borrow.rs
+++ b/library/core/src/borrow.rs
@@ -154,7 +154,6 @@
/// [`String`]: ../../std/string/struct.String.html
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Borrow"]
-#[const_trait]
pub trait Borrow<Borrowed: ?Sized> {
/// Immutably borrows from an owned value.
///
@@ -185,7 +184,6 @@ pub trait Borrow<Borrowed: ?Sized> {
/// an underlying type by providing a mutable reference. See [`Borrow<T>`]
/// for more information on borrowing as another type.
#[stable(feature = "rust1", since = "1.0.0")]
-#[const_trait]
pub trait BorrowMut<Borrowed: ?Sized>: Borrow<Borrowed> {
/// Mutably borrows from an owned value.
///
@@ -207,8 +205,7 @@ pub trait BorrowMut<Borrowed: ?Sized>: Borrow<Borrowed> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_borrow", issue = "91522")]
-impl<T: ?Sized> const Borrow<T> for T {
+impl<T: ?Sized> Borrow<T> for T {
#[rustc_diagnostic_item = "noop_method_borrow"]
fn borrow(&self) -> &T {
self
@@ -216,32 +213,28 @@ impl<T: ?Sized> const Borrow<T> for T {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_borrow", issue = "91522")]
-impl<T: ?Sized> const BorrowMut<T> for T {
+impl<T: ?Sized> BorrowMut<T> for T {
fn borrow_mut(&mut self) -> &mut T {
self
}
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_borrow", issue = "91522")]
-impl<T: ?Sized> const Borrow<T> for &T {
+impl<T: ?Sized> Borrow<T> for &T {
fn borrow(&self) -> &T {
&**self
}
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_borrow", issue = "91522")]
-impl<T: ?Sized> const Borrow<T> for &mut T {
+impl<T: ?Sized> Borrow<T> for &mut T {
fn borrow(&self) -> &T {
&**self
}
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_borrow", issue = "91522")]
-impl<T: ?Sized> const BorrowMut<T> for &mut T {
+impl<T: ?Sized> BorrowMut<T> for &mut T {
fn borrow_mut(&mut self) -> &mut T {
&mut **self
}
diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs
index 33d928e23..744767aae 100644
--- a/library/core/src/cell.rs
+++ b/library/core/src/cell.rs
@@ -115,7 +115,7 @@
//! let shared_map: Rc<RefCell<_>> = Rc::new(RefCell::new(HashMap::new()));
//! // Create a new block to limit the scope of the dynamic borrow
//! {
-//! let mut map: RefMut<_> = shared_map.borrow_mut();
+//! let mut map: RefMut<'_, _> = shared_map.borrow_mut();
//! map.insert("africa", 92388);
//! map.insert("kyoto", 11837);
//! map.insert("piccadilly", 11826);
@@ -370,8 +370,7 @@ impl<T: Ord + Copy> Ord for Cell<T> {
}
#[stable(feature = "cell_from", since = "1.12.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<T> for Cell<T> {
+impl<T> From<T> for Cell<T> {
/// Creates a new `Cell<T>` containing the given value.
fn from(t: T) -> Cell<T> {
Cell::new(t)
@@ -1318,8 +1317,7 @@ impl<T: ?Sized + Ord> Ord for RefCell<T> {
}
#[stable(feature = "cell_from", since = "1.12.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<T> for RefCell<T> {
+impl<T> From<T> for RefCell<T> {
/// Creates a new `RefCell<T>` containing the given value.
fn from(t: T) -> RefCell<T> {
RefCell::new(t)
@@ -1437,8 +1435,8 @@ impl<'b, T: ?Sized> Ref<'b, T> {
/// use std::cell::{RefCell, Ref};
///
/// let c = RefCell::new((5, 'b'));
- /// let b1: Ref<(u32, char)> = c.borrow();
- /// let b2: Ref<u32> = Ref::map(b1, |t| &t.0);
+ /// let b1: Ref<'_, (u32, char)> = c.borrow();
+ /// let b2: Ref<'_, u32> = Ref::map(b1, |t| &t.0);
/// assert_eq!(*b2, 5)
/// ```
#[stable(feature = "cell_map", since = "1.8.0")]
@@ -1466,8 +1464,8 @@ impl<'b, T: ?Sized> Ref<'b, T> {
/// use std::cell::{RefCell, Ref};
///
/// let c = RefCell::new(vec![1, 2, 3]);
- /// let b1: Ref<Vec<u32>> = c.borrow();
- /// let b2: Result<Ref<u32>, _> = Ref::filter_map(b1, |v| v.get(1));
+ /// let b1: Ref<'_, Vec<u32>> = c.borrow();
+ /// let b2: Result<Ref<'_, u32>, _> = Ref::filter_map(b1, |v| v.get(1));
/// assert_eq!(*b2.unwrap(), 2);
/// ```
#[stable(feature = "cell_filter_map", since = "1.63.0")]
@@ -1579,8 +1577,8 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
///
/// let c = RefCell::new((5, 'b'));
/// {
- /// let b1: RefMut<(u32, char)> = c.borrow_mut();
- /// let mut b2: RefMut<u32> = RefMut::map(b1, |t| &mut t.0);
+ /// let b1: RefMut<'_, (u32, char)> = c.borrow_mut();
+ /// let mut b2: RefMut<'_, u32> = RefMut::map(b1, |t| &mut t.0);
/// assert_eq!(*b2, 5);
/// *b2 = 42;
/// }
@@ -1614,8 +1612,8 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
/// let c = RefCell::new(vec![1, 2, 3]);
///
/// {
- /// let b1: RefMut<Vec<u32>> = c.borrow_mut();
- /// let mut b2: Result<RefMut<u32>, _> = RefMut::filter_map(b1, |v| v.get_mut(1));
+ /// let b1: RefMut<'_, Vec<u32>> = c.borrow_mut();
+ /// let mut b2: Result<RefMut<'_, u32>, _> = RefMut::filter_map(b1, |v| v.get_mut(1));
///
/// if let Ok(mut b2) = b2 {
/// *b2 += 2;
@@ -2032,6 +2030,27 @@ impl<T> UnsafeCell<T> {
}
impl<T: ?Sized> UnsafeCell<T> {
+ /// Converts from `&mut T` to `&mut UnsafeCell<T>`.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # #![feature(unsafe_cell_from_mut)]
+ /// use std::cell::UnsafeCell;
+ ///
+ /// let mut val = 42;
+ /// let uc = UnsafeCell::from_mut(&mut val);
+ ///
+ /// *uc.get_mut() -= 1;
+ /// assert_eq!(*uc.get_mut(), 41);
+ /// ```
+ #[inline(always)]
+ #[unstable(feature = "unsafe_cell_from_mut", issue = "111645")]
+ pub const fn from_mut(value: &mut T) -> &mut UnsafeCell<T> {
+ // SAFETY: `UnsafeCell<T>` has the same memory layout as `T` due to #[repr(transparent)].
+ unsafe { &mut *(value as *mut T as *mut UnsafeCell<T>) }
+ }
+
/// Gets a mutable pointer to the wrapped value.
///
/// This can be cast to a pointer of any kind.
@@ -2102,6 +2121,8 @@ impl<T: ?Sized> UnsafeCell<T> {
///
/// let m = MaybeUninit::<UnsafeCell<i32>>::uninit();
/// unsafe { UnsafeCell::raw_get(m.as_ptr()).write(5); }
+ /// // avoid below which references to uninitialized data
+ /// // unsafe { UnsafeCell::get(&*m.as_ptr()).write(5); }
/// let uc = unsafe { m.assume_init() };
///
/// assert_eq!(uc.into_inner(), 5);
@@ -2126,8 +2147,7 @@ impl<T: Default> Default for UnsafeCell<T> {
}
#[stable(feature = "cell_from", since = "1.12.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<T> for UnsafeCell<T> {
+impl<T> From<T> for UnsafeCell<T> {
/// Creates a new `UnsafeCell<T>` containing the given value.
fn from(t: T) -> UnsafeCell<T> {
UnsafeCell::new(t)
@@ -2226,8 +2246,7 @@ impl<T: Default> Default for SyncUnsafeCell<T> {
}
#[unstable(feature = "sync_unsafe_cell", issue = "95439")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<T> for SyncUnsafeCell<T> {
+impl<T> From<T> for SyncUnsafeCell<T> {
/// Creates a new `SyncUnsafeCell<T>` containing the given value.
fn from(t: T) -> SyncUnsafeCell<T> {
SyncUnsafeCell::new(t)
diff --git a/library/core/src/cell/lazy.rs b/library/core/src/cell/lazy.rs
index 44adcfa1a..1b213f6a2 100644
--- a/library/core/src/cell/lazy.rs
+++ b/library/core/src/cell/lazy.rs
@@ -63,6 +63,34 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
LazyCell { state: UnsafeCell::new(State::Uninit(f)) }
}
+ /// Consumes this `LazyCell` returning the stored value.
+ ///
+ /// Returns `Ok(value)` if `Lazy` is initialized and `Err(f)` otherwise.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(lazy_cell)]
+ /// #![feature(lazy_cell_consume)]
+ ///
+ /// use std::cell::LazyCell;
+ ///
+ /// let hello = "Hello, World!".to_string();
+ ///
+ /// let lazy = LazyCell::new(|| hello.to_uppercase());
+ ///
+ /// assert_eq!(&*lazy, "HELLO, WORLD!");
+ /// assert_eq!(LazyCell::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string()));
+ /// ```
+ #[unstable(feature = "lazy_cell_consume", issue = "109736")]
+ pub fn into_inner(this: Self) -> Result<T, F> {
+ match this.state.into_inner() {
+ State::Init(data) => Ok(data),
+ State::Uninit(f) => Err(f),
+ State::Poisoned => panic!("LazyCell instance has previously been poisoned"),
+ }
+ }
+
/// Forces the evaluation of this lazy value and returns a reference to
/// the result.
///
diff --git a/library/core/src/cell/once.rs b/library/core/src/cell/once.rs
index f7cd3ec5f..5f06a7b07 100644
--- a/library/core/src/cell/once.rs
+++ b/library/core/src/cell/once.rs
@@ -284,8 +284,7 @@ impl<T: PartialEq> PartialEq for OnceCell<T> {
impl<T: Eq> Eq for OnceCell<T> {}
#[stable(feature = "once_cell", since = "1.70.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<T> for OnceCell<T> {
+impl<T> From<T> for OnceCell<T> {
/// Creates a new `OnceCell<T>` which already contains the given `value`.
#[inline]
fn from(value: T) -> Self {
diff --git a/library/core/src/char/convert.rs b/library/core/src/char/convert.rs
index 136bbcb8b..b84e4b35b 100644
--- a/library/core/src/char/convert.rs
+++ b/library/core/src/char/convert.rs
@@ -27,8 +27,7 @@ pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char {
}
#[stable(feature = "char_convert", since = "1.13.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl const From<char> for u32 {
+impl From<char> for u32 {
/// Converts a [`char`] into a [`u32`].
///
/// # Examples
@@ -47,8 +46,7 @@ impl const From<char> for u32 {
}
#[stable(feature = "more_char_conversions", since = "1.51.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl const From<char> for u64 {
+impl From<char> for u64 {
/// Converts a [`char`] into a [`u64`].
///
/// # Examples
@@ -69,8 +67,7 @@ impl const From<char> for u64 {
}
#[stable(feature = "more_char_conversions", since = "1.51.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl const From<char> for u128 {
+impl From<char> for u128 {
/// Converts a [`char`] into a [`u128`].
///
/// # Examples
@@ -123,8 +120,7 @@ impl TryFrom<char> for u8 {
/// for a superset of Windows-1252 that fills the remaining blanks with corresponding
/// C0 and C1 control codes.
#[stable(feature = "char_convert", since = "1.13.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl const From<u8> for char {
+impl From<u8> for char {
/// Converts a [`u8`] into a [`char`].
///
/// # Examples
diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs
index 9bc97ea0b..515b8d20e 100644
--- a/library/core/src/char/methods.rs
+++ b/library/core/src/char/methods.rs
@@ -1,5 +1,6 @@
//! impl char {}
+use crate::ascii;
use crate::slice;
use crate::str::from_utf8_unchecked_mut;
use crate::unicode::printable::is_printable;
@@ -380,20 +381,7 @@ impl char {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn escape_unicode(self) -> EscapeUnicode {
- let c = self as u32;
-
- // or-ing 1 ensures that for c==0 the code computes that one
- // digit should be printed and (which is the same) avoids the
- // (31 - 32) underflow
- let msb = 31 - (c | 1).leading_zeros();
-
- // the index of the most significant hex digit
- let ms_hex_digit = msb / 4;
- EscapeUnicode {
- c: self,
- state: EscapeUnicodeState::Backslash,
- hex_digit_idx: ms_hex_digit as usize,
- }
+ EscapeUnicode::new(self)
}
/// An extended version of `escape_debug` that optionally permits escaping
@@ -403,21 +391,20 @@ impl char {
/// characters, and double quotes in strings.
#[inline]
pub(crate) fn escape_debug_ext(self, args: EscapeDebugExtArgs) -> EscapeDebug {
- let init_state = match self {
- '\0' => EscapeDefaultState::Backslash('0'),
- '\t' => EscapeDefaultState::Backslash('t'),
- '\r' => EscapeDefaultState::Backslash('r'),
- '\n' => EscapeDefaultState::Backslash('n'),
- '\\' => EscapeDefaultState::Backslash(self),
- '"' if args.escape_double_quote => EscapeDefaultState::Backslash(self),
- '\'' if args.escape_single_quote => EscapeDefaultState::Backslash(self),
+ match self {
+ '\0' => EscapeDebug::backslash(ascii::Char::Digit0),
+ '\t' => EscapeDebug::backslash(ascii::Char::SmallT),
+ '\r' => EscapeDebug::backslash(ascii::Char::SmallR),
+ '\n' => EscapeDebug::backslash(ascii::Char::SmallN),
+ '\\' => EscapeDebug::backslash(ascii::Char::ReverseSolidus),
+ '\"' if args.escape_double_quote => EscapeDebug::backslash(ascii::Char::QuotationMark),
+ '\'' if args.escape_single_quote => EscapeDebug::backslash(ascii::Char::Apostrophe),
_ if args.escape_grapheme_extended && self.is_grapheme_extended() => {
- EscapeDefaultState::Unicode(self.escape_unicode())
+ EscapeDebug::from_unicode(self.escape_unicode())
}
- _ if is_printable(self) => EscapeDefaultState::Char(self),
- _ => EscapeDefaultState::Unicode(self.escape_unicode()),
- };
- EscapeDebug(EscapeDefault { state: init_state })
+ _ if is_printable(self) => EscapeDebug::printable(self),
+ _ => EscapeDebug::from_unicode(self.escape_unicode()),
+ }
}
/// Returns an iterator that yields the literal escape code of a character
@@ -515,15 +502,14 @@ impl char {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn escape_default(self) -> EscapeDefault {
- let init_state = match self {
- '\t' => EscapeDefaultState::Backslash('t'),
- '\r' => EscapeDefaultState::Backslash('r'),
- '\n' => EscapeDefaultState::Backslash('n'),
- '\\' | '\'' | '"' => EscapeDefaultState::Backslash(self),
- '\x20'..='\x7e' => EscapeDefaultState::Char(self),
- _ => EscapeDefaultState::Unicode(self.escape_unicode()),
- };
- EscapeDefault { state: init_state }
+ match self {
+ '\t' => EscapeDefault::backslash(ascii::Char::SmallT),
+ '\r' => EscapeDefault::backslash(ascii::Char::SmallR),
+ '\n' => EscapeDefault::backslash(ascii::Char::SmallN),
+ '\\' | '\'' | '"' => EscapeDefault::backslash(self.as_ascii().unwrap()),
+ '\x20'..='\x7e' => EscapeDefault::printable(self.as_ascii().unwrap()),
+ _ => EscapeDefault::from_unicode(self.escape_unicode()),
+ }
}
/// Returns the number of bytes this `char` would need if encoded in UTF-8.
@@ -1116,6 +1102,24 @@ impl char {
*self as u32 <= 0x7F
}
+ /// Returns `Some` if the value is within the ASCII range,
+ /// or `None` if it's not.
+ ///
+ /// This is preferred to [`Self::is_ascii`] when you're passing the value
+ /// along to something else that can take [`ascii::Char`] rather than
+ /// needing to check again for itself whether the value is in ASCII.
+ #[must_use]
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn as_ascii(&self) -> Option<ascii::Char> {
+ if self.is_ascii() {
+ // SAFETY: Just checked that this is ASCII.
+ Some(unsafe { ascii::Char::from_u8_unchecked(*self as u8) })
+ } else {
+ None
+ }
+ }
+
/// Makes a copy of the value in its ASCII upper case equivalent.
///
/// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
diff --git a/library/core/src/char/mod.rs b/library/core/src/char/mod.rs
index 8ec78e887..5c4291287 100644
--- a/library/core/src/char/mod.rs
+++ b/library/core/src/char/mod.rs
@@ -38,9 +38,12 @@ pub use self::methods::encode_utf16_raw;
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
pub use self::methods::encode_utf8_raw;
+use crate::ascii;
use crate::error::Error;
+use crate::escape;
use crate::fmt::{self, Write};
use crate::iter::FusedIterator;
+use crate::num::NonZeroUsize;
pub(crate) use self::methods::EscapeDebugExtArgs;
@@ -146,86 +149,44 @@ pub const fn from_digit(num: u32, radix: u32) -> Option<char> {
/// [`escape_unicode`]: char::escape_unicode
#[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
-pub struct EscapeUnicode {
- c: char,
- state: EscapeUnicodeState,
-
- // The index of the next hex digit to be printed (0 if none),
- // i.e., the number of remaining hex digits to be printed;
- // increasing from the least significant digit: 0x543210
- hex_digit_idx: usize,
-}
+pub struct EscapeUnicode(escape::EscapeIterInner<10>);
-// The enum values are ordered so that their representation is the
-// same as the remaining length (besides the hexadecimal digits). This
-// likely makes `len()` a single load from memory) and inline-worth.
-#[derive(Clone, Debug)]
-enum EscapeUnicodeState {
- Done,
- RightBrace,
- Value,
- LeftBrace,
- Type,
- Backslash,
+impl EscapeUnicode {
+ fn new(chr: char) -> Self {
+ let mut data = [ascii::Char::Null; 10];
+ let range = escape::escape_unicode_into(&mut data, chr);
+ Self(escape::EscapeIterInner::new(data, range))
+ }
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Iterator for EscapeUnicode {
type Item = char;
+ #[inline]
fn next(&mut self) -> Option<char> {
- match self.state {
- EscapeUnicodeState::Backslash => {
- self.state = EscapeUnicodeState::Type;
- Some('\\')
- }
- EscapeUnicodeState::Type => {
- self.state = EscapeUnicodeState::LeftBrace;
- Some('u')
- }
- EscapeUnicodeState::LeftBrace => {
- self.state = EscapeUnicodeState::Value;
- Some('{')
- }
- EscapeUnicodeState::Value => {
- let hex_digit = ((self.c as u32) >> (self.hex_digit_idx * 4)) & 0xf;
- let c = char::from_digit(hex_digit, 16).unwrap();
- if self.hex_digit_idx == 0 {
- self.state = EscapeUnicodeState::RightBrace;
- } else {
- self.hex_digit_idx -= 1;
- }
- Some(c)
- }
- EscapeUnicodeState::RightBrace => {
- self.state = EscapeUnicodeState::Done;
- Some('}')
- }
- EscapeUnicodeState::Done => None,
- }
+ self.0.next().map(char::from)
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
- let n = self.len();
+ let n = self.0.len();
(n, Some(n))
}
#[inline]
fn count(self) -> usize {
- self.len()
+ self.0.len()
}
- fn last(self) -> Option<char> {
- match self.state {
- EscapeUnicodeState::Done => None,
+ #[inline]
+ fn last(mut self) -> Option<char> {
+ self.0.next_back().map(char::from)
+ }
- EscapeUnicodeState::RightBrace
- | EscapeUnicodeState::Value
- | EscapeUnicodeState::LeftBrace
- | EscapeUnicodeState::Type
- | EscapeUnicodeState::Backslash => Some('}'),
- }
+ #[inline]
+ fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
+ self.0.advance_by(n)
}
}
@@ -233,16 +194,7 @@ impl Iterator for EscapeUnicode {
impl ExactSizeIterator for EscapeUnicode {
#[inline]
fn len(&self) -> usize {
- // The match is a single memory access with no branching
- self.hex_digit_idx
- + match self.state {
- EscapeUnicodeState::Done => 0,
- EscapeUnicodeState::RightBrace => 1,
- EscapeUnicodeState::Value => 2,
- EscapeUnicodeState::LeftBrace => 3,
- EscapeUnicodeState::Type => 4,
- EscapeUnicodeState::Backslash => 5,
- }
+ self.0.len()
}
}
@@ -252,10 +204,7 @@ impl FusedIterator for EscapeUnicode {}
#[stable(feature = "char_struct_display", since = "1.16.0")]
impl fmt::Display for EscapeUnicode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- for c in self.clone() {
- f.write_char(c)?;
- }
- Ok(())
+ f.write_str(self.0.as_str())
}
}
@@ -267,90 +216,60 @@ impl fmt::Display for EscapeUnicode {
/// [`escape_default`]: char::escape_default
#[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
-pub struct EscapeDefault {
- state: EscapeDefaultState,
-}
+pub struct EscapeDefault(escape::EscapeIterInner<10>);
-#[derive(Clone, Debug)]
-enum EscapeDefaultState {
- Done,
- Char(char),
- Backslash(char),
- Unicode(EscapeUnicode),
+impl EscapeDefault {
+ fn printable(chr: ascii::Char) -> Self {
+ let data = [chr];
+ Self(escape::EscapeIterInner::from_array(data))
+ }
+
+ fn backslash(chr: ascii::Char) -> Self {
+ let data = [ascii::Char::ReverseSolidus, chr];
+ Self(escape::EscapeIterInner::from_array(data))
+ }
+
+ fn from_unicode(esc: EscapeUnicode) -> Self {
+ Self(esc.0)
+ }
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Iterator for EscapeDefault {
type Item = char;
+ #[inline]
fn next(&mut self) -> Option<char> {
- match self.state {
- EscapeDefaultState::Backslash(c) => {
- self.state = EscapeDefaultState::Char(c);
- Some('\\')
- }
- EscapeDefaultState::Char(c) => {
- self.state = EscapeDefaultState::Done;
- Some(c)
- }
- EscapeDefaultState::Done => None,
- EscapeDefaultState::Unicode(ref mut iter) => iter.next(),
- }
+ self.0.next().map(char::from)
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
- let n = self.len();
+ let n = self.0.len();
(n, Some(n))
}
#[inline]
fn count(self) -> usize {
- self.len()
+ self.0.len()
}
- fn nth(&mut self, n: usize) -> Option<char> {
- match self.state {
- EscapeDefaultState::Backslash(c) if n == 0 => {
- self.state = EscapeDefaultState::Char(c);
- Some('\\')
- }
- EscapeDefaultState::Backslash(c) if n == 1 => {
- self.state = EscapeDefaultState::Done;
- Some(c)
- }
- EscapeDefaultState::Backslash(_) => {
- self.state = EscapeDefaultState::Done;
- None
- }
- EscapeDefaultState::Char(c) => {
- self.state = EscapeDefaultState::Done;
-
- if n == 0 { Some(c) } else { None }
- }
- EscapeDefaultState::Done => None,
- EscapeDefaultState::Unicode(ref mut i) => i.nth(n),
- }
+ #[inline]
+ fn last(mut self) -> Option<char> {
+ self.0.next_back().map(char::from)
}
- fn last(self) -> Option<char> {
- match self.state {
- EscapeDefaultState::Unicode(iter) => iter.last(),
- EscapeDefaultState::Done => None,
- EscapeDefaultState::Backslash(c) | EscapeDefaultState::Char(c) => Some(c),
- }
+ #[inline]
+ fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
+ self.0.advance_by(n)
}
}
#[stable(feature = "exact_size_escape", since = "1.11.0")]
impl ExactSizeIterator for EscapeDefault {
+ #[inline]
fn len(&self) -> usize {
- match self.state {
- EscapeDefaultState::Done => 0,
- EscapeDefaultState::Char(_) => 1,
- EscapeDefaultState::Backslash(_) => 2,
- EscapeDefaultState::Unicode(ref iter) => iter.len(),
- }
+ self.0.len()
}
}
@@ -360,10 +279,7 @@ impl FusedIterator for EscapeDefault {}
#[stable(feature = "char_struct_display", since = "1.16.0")]
impl fmt::Display for EscapeDefault {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- for c in self.clone() {
- f.write_char(c)?;
- }
- Ok(())
+ f.write_str(self.0.as_str())
}
}
@@ -375,21 +291,74 @@ impl fmt::Display for EscapeDefault {
/// [`escape_debug`]: char::escape_debug
#[stable(feature = "char_escape_debug", since = "1.20.0")]
#[derive(Clone, Debug)]
-pub struct EscapeDebug(EscapeDefault);
+pub struct EscapeDebug(EscapeDebugInner);
+
+#[derive(Clone, Debug)]
+// Note: It’s possible to manually encode the EscapeDebugInner inside of
+// EscapeIterInner (e.g. with alive=254..255 indicating that data[0..4] holds
+// a char) which would likely result in a more optimised code. For now we use
+// the option easier to implement.
+enum EscapeDebugInner {
+ Bytes(escape::EscapeIterInner<10>),
+ Char(char),
+}
+
+impl EscapeDebug {
+ fn printable(chr: char) -> Self {
+ Self(EscapeDebugInner::Char(chr))
+ }
+
+ fn backslash(chr: ascii::Char) -> Self {
+ let data = [ascii::Char::ReverseSolidus, chr];
+ let iter = escape::EscapeIterInner::from_array(data);
+ Self(EscapeDebugInner::Bytes(iter))
+ }
+
+ fn from_unicode(esc: EscapeUnicode) -> Self {
+ Self(EscapeDebugInner::Bytes(esc.0))
+ }
+
+ fn clear(&mut self) {
+ let bytes = escape::EscapeIterInner::from_array([]);
+ self.0 = EscapeDebugInner::Bytes(bytes);
+ }
+}
#[stable(feature = "char_escape_debug", since = "1.20.0")]
impl Iterator for EscapeDebug {
type Item = char;
+
+ #[inline]
fn next(&mut self) -> Option<char> {
- self.0.next()
+ match self.0 {
+ EscapeDebugInner::Bytes(ref mut bytes) => bytes.next().map(char::from),
+ EscapeDebugInner::Char(chr) => {
+ self.clear();
+ Some(chr)
+ }
+ }
}
+
fn size_hint(&self) -> (usize, Option<usize>) {
- self.0.size_hint()
+ let n = self.len();
+ (n, Some(n))
+ }
+
+ #[inline]
+ fn count(self) -> usize {
+ self.len()
}
}
#[stable(feature = "char_escape_debug", since = "1.20.0")]
-impl ExactSizeIterator for EscapeDebug {}
+impl ExactSizeIterator for EscapeDebug {
+ fn len(&self) -> usize {
+ match &self.0 {
+ EscapeDebugInner::Bytes(bytes) => bytes.len(),
+ EscapeDebugInner::Char(_) => 1,
+ }
+ }
+}
#[stable(feature = "fused", since = "1.26.0")]
impl FusedIterator for EscapeDebug {}
@@ -397,7 +366,10 @@ impl FusedIterator for EscapeDebug {}
#[stable(feature = "char_escape_debug", since = "1.20.0")]
impl fmt::Display for EscapeDebug {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- fmt::Display::fmt(&self.0, f)
+ match &self.0 {
+ EscapeDebugInner::Bytes(bytes) => f.write_str(bytes.as_str()),
+ EscapeDebugInner::Char(chr) => f.write_char(*chr),
+ }
}
}
diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs
index 398437d9a..a6d6230d3 100644
--- a/library/core/src/clone.rs
+++ b/library/core/src/clone.rs
@@ -36,8 +36,6 @@
#![stable(feature = "rust1", since = "1.0.0")]
-use crate::marker::Destruct;
-
/// A common trait for the ability to explicitly duplicate an object.
///
/// Differs from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while
@@ -106,7 +104,6 @@ use crate::marker::Destruct;
#[lang = "clone"]
#[rustc_diagnostic_item = "Clone"]
#[rustc_trivial_field_reads]
-#[const_trait]
pub trait Clone: Sized {
/// Returns a copy of the value.
///
@@ -129,10 +126,7 @@ pub trait Clone: Sized {
/// allocations.
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- fn clone_from(&mut self, source: &Self)
- where
- Self: ~const Destruct,
- {
+ fn clone_from(&mut self, source: &Self) {
*self = source.clone()
}
}
@@ -182,8 +176,7 @@ mod impls {
($($t:ty)*) => {
$(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_clone", issue = "91805")]
- impl const Clone for $t {
+ impl Clone for $t {
#[inline(always)]
fn clone(&self) -> Self {
*self
@@ -201,8 +194,7 @@ mod impls {
}
#[unstable(feature = "never_type", issue = "35121")]
- #[rustc_const_unstable(feature = "const_clone", issue = "91805")]
- impl const Clone for ! {
+ impl Clone for ! {
#[inline]
fn clone(&self) -> Self {
*self
@@ -210,8 +202,7 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_clone", issue = "91805")]
- impl<T: ?Sized> const Clone for *const T {
+ impl<T: ?Sized> Clone for *const T {
#[inline(always)]
fn clone(&self) -> Self {
*self
@@ -219,8 +210,7 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_clone", issue = "91805")]
- impl<T: ?Sized> const Clone for *mut T {
+ impl<T: ?Sized> Clone for *mut T {
#[inline(always)]
fn clone(&self) -> Self {
*self
@@ -229,8 +219,7 @@ mod impls {
/// Shared references can be cloned, but mutable references *cannot*!
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_clone", issue = "91805")]
- impl<T: ?Sized> const Clone for &T {
+ impl<T: ?Sized> Clone for &T {
#[inline(always)]
#[rustc_diagnostic_item = "noop_method_clone"]
fn clone(&self) -> Self {
diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs
index 55331475a..faf48ae57 100644
--- a/library/core/src/cmp.rs
+++ b/library/core/src/cmp.rs
@@ -25,8 +25,6 @@
mod bytewise;
pub(crate) use bytewise::BytewiseEq;
-use crate::marker::Destruct;
-
use self::Ordering::*;
/// Trait for equality comparisons.
@@ -212,7 +210,6 @@ use self::Ordering::*;
label = "no implementation for `{Self} == {Rhs}`",
append_const_msg
)]
-#[const_trait]
#[rustc_diagnostic_item = "PartialEq"]
pub trait PartialEq<Rhs: ?Sized = Self> {
/// This method tests for `self` and `other` values to be equal, and is used
@@ -324,17 +321,13 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
/// ```
/// use std::cmp::Ordering;
///
-/// let result = 1.cmp(&2);
-/// assert_eq!(Ordering::Less, result);
+/// assert_eq!(1.cmp(&2), Ordering::Less);
///
-/// let result = 1.cmp(&1);
-/// assert_eq!(Ordering::Equal, result);
+/// assert_eq!(1.cmp(&1), Ordering::Equal);
///
-/// let result = 2.cmp(&1);
-/// assert_eq!(Ordering::Greater, result);
+/// assert_eq!(2.cmp(&1), Ordering::Greater);
/// ```
-#[derive(Clone, Copy, Eq, Debug, Hash)]
-#[derive_const(PartialOrd, Ord, PartialEq)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
#[stable(feature = "rust1", since = "1.0.0")]
#[repr(i8)]
pub enum Ordering {
@@ -604,8 +597,7 @@ impl Ordering {
pub struct Reverse<T>(#[stable(feature = "reverse_cmp_key", since = "1.19.0")] pub T);
#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
-#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
-impl<T: ~const PartialOrd> const PartialOrd for Reverse<T> {
+impl<T: PartialOrd> PartialOrd for Reverse<T> {
#[inline]
fn partial_cmp(&self, other: &Reverse<T>) -> Option<Ordering> {
other.0.partial_cmp(&self.0)
@@ -763,7 +755,6 @@ impl<T: Clone> Clone for Reverse<T> {
#[doc(alias = ">=")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Ord"]
-#[const_trait]
pub trait Ord: Eq + PartialOrd<Self> {
/// This method returns an [`Ordering`] between `self` and `other`.
///
@@ -790,8 +781,8 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// # Examples
///
/// ```
- /// assert_eq!(2, 1.max(2));
- /// assert_eq!(2, 2.max(2));
+ /// assert_eq!(1.max(2), 2);
+ /// assert_eq!(2.max(2), 2);
/// ```
#[stable(feature = "ord_max_min", since = "1.21.0")]
#[inline]
@@ -799,7 +790,6 @@ pub trait Ord: Eq + PartialOrd<Self> {
fn max(self, other: Self) -> Self
where
Self: Sized,
- Self: ~const Destruct,
{
max_by(self, other, Ord::cmp)
}
@@ -811,8 +801,8 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// # Examples
///
/// ```
- /// assert_eq!(1, 1.min(2));
- /// assert_eq!(2, 2.min(2));
+ /// assert_eq!(1.min(2), 1);
+ /// assert_eq!(2.min(2), 2);
/// ```
#[stable(feature = "ord_max_min", since = "1.21.0")]
#[inline]
@@ -820,7 +810,6 @@ pub trait Ord: Eq + PartialOrd<Self> {
fn min(self, other: Self) -> Self
where
Self: Sized,
- Self: ~const Destruct,
{
min_by(self, other, Ord::cmp)
}
@@ -837,17 +826,16 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// # Examples
///
/// ```
- /// assert!((-3).clamp(-2, 1) == -2);
- /// assert!(0.clamp(-2, 1) == 0);
- /// assert!(2.clamp(-2, 1) == 1);
+ /// assert_eq!((-3).clamp(-2, 1), -2);
+ /// assert_eq!(0.clamp(-2, 1), 0);
+ /// assert_eq!(2.clamp(-2, 1), 1);
/// ```
#[must_use]
#[stable(feature = "clamp", since = "1.50.0")]
fn clamp(self, min: Self, max: Self) -> Self
where
Self: Sized,
- Self: ~const Destruct,
- Self: ~const PartialOrd,
+ Self: PartialOrd,
{
assert!(min <= max);
if self < min {
@@ -1035,7 +1023,6 @@ pub macro Ord($item:item) {
label = "no implementation for `{Self} < {Rhs}` and `{Self} > {Rhs}`",
append_const_msg
)]
-#[const_trait]
#[rustc_diagnostic_item = "PartialOrd"]
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// This method returns an ordering between `self` and `other` values if one exists.
@@ -1070,11 +1057,9 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// # Examples
///
/// ```
- /// let result = 1.0 < 2.0;
- /// assert_eq!(result, true);
- ///
- /// let result = 2.0 < 1.0;
- /// assert_eq!(result, false);
+ /// assert_eq!(1.0 < 1.0, false);
+ /// assert_eq!(1.0 < 2.0, true);
+ /// assert_eq!(2.0 < 1.0, false);
/// ```
#[inline]
#[must_use]
@@ -1089,11 +1074,9 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// # Examples
///
/// ```
- /// let result = 1.0 <= 2.0;
- /// assert_eq!(result, true);
- ///
- /// let result = 2.0 <= 2.0;
- /// assert_eq!(result, true);
+ /// assert_eq!(1.0 <= 1.0, true);
+ /// assert_eq!(1.0 <= 2.0, true);
+ /// assert_eq!(2.0 <= 1.0, false);
/// ```
#[inline]
#[must_use]
@@ -1107,11 +1090,9 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// # Examples
///
/// ```
- /// let result = 1.0 > 2.0;
- /// assert_eq!(result, false);
- ///
- /// let result = 2.0 > 2.0;
- /// assert_eq!(result, false);
+ /// assert_eq!(1.0 > 1.0, false);
+ /// assert_eq!(1.0 > 2.0, false);
+ /// assert_eq!(2.0 > 1.0, true);
/// ```
#[inline]
#[must_use]
@@ -1126,11 +1107,9 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// # Examples
///
/// ```
- /// let result = 2.0 >= 1.0;
- /// assert_eq!(result, true);
- ///
- /// let result = 2.0 >= 2.0;
- /// assert_eq!(result, true);
+ /// assert_eq!(1.0 >= 1.0, true);
+ /// assert_eq!(1.0 >= 2.0, false);
+ /// assert_eq!(2.0 >= 1.0, true);
/// ```
#[inline]
#[must_use]
@@ -1160,15 +1139,14 @@ pub macro PartialOrd($item:item) {
/// ```
/// use std::cmp;
///
-/// assert_eq!(1, cmp::min(1, 2));
-/// assert_eq!(2, cmp::min(2, 2));
+/// assert_eq!(cmp::min(1, 2), 1);
+/// assert_eq!(cmp::min(2, 2), 2);
/// ```
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
#[cfg_attr(not(test), rustc_diagnostic_item = "cmp_min")]
-pub const fn min<T: ~const Ord + ~const Destruct>(v1: T, v2: T) -> T {
+pub fn min<T: Ord>(v1: T, v2: T) -> T {
v1.min(v2)
}
@@ -1181,18 +1159,16 @@ pub const fn min<T: ~const Ord + ~const Destruct>(v1: T, v2: T) -> T {
/// ```
/// use std::cmp;
///
-/// assert_eq!(cmp::min_by(-2, 1, |x: &i32, y: &i32| x.abs().cmp(&y.abs())), 1);
-/// assert_eq!(cmp::min_by(-2, 2, |x: &i32, y: &i32| x.abs().cmp(&y.abs())), -2);
+/// let result = cmp::min_by(-2, 1, |x: &i32, y: &i32| x.abs().cmp(&y.abs()));
+/// assert_eq!(result, 1);
+///
+/// let result = cmp::min_by(-2, 3, |x: &i32, y: &i32| x.abs().cmp(&y.abs()));
+/// assert_eq!(result, -2);
/// ```
#[inline]
#[must_use]
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
-#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
-pub const fn min_by<T, F: ~const FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T
-where
- T: ~const Destruct,
- F: ~const Destruct,
-{
+pub fn min_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
match compare(&v1, &v2) {
Ordering::Less | Ordering::Equal => v1,
Ordering::Greater => v2,
@@ -1208,20 +1184,17 @@ where
/// ```
/// use std::cmp;
///
-/// assert_eq!(cmp::min_by_key(-2, 1, |x: &i32| x.abs()), 1);
-/// assert_eq!(cmp::min_by_key(-2, 2, |x: &i32| x.abs()), -2);
+/// let result = cmp::min_by_key(-2, 1, |x: &i32| x.abs());
+/// assert_eq!(result, 1);
+///
+/// let result = cmp::min_by_key(-2, 2, |x: &i32| x.abs());
+/// assert_eq!(result, -2);
/// ```
#[inline]
#[must_use]
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
-#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
-pub const fn min_by_key<T, F: ~const FnMut(&T) -> K, K: ~const Ord>(v1: T, v2: T, mut f: F) -> T
-where
- T: ~const Destruct,
- F: ~const Destruct,
- K: ~const Destruct,
-{
- min_by(v1, v2, const |v1, v2| f(v1).cmp(&f(v2)))
+pub fn min_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
+ min_by(v1, v2, |v1, v2| f(v1).cmp(&f(v2)))
}
/// Compares and returns the maximum of two values.
@@ -1235,15 +1208,14 @@ where
/// ```
/// use std::cmp;
///
-/// assert_eq!(2, cmp::max(1, 2));
-/// assert_eq!(2, cmp::max(2, 2));
+/// assert_eq!(cmp::max(1, 2), 2);
+/// assert_eq!(cmp::max(2, 2), 2);
/// ```
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
#[cfg_attr(not(test), rustc_diagnostic_item = "cmp_max")]
-pub const fn max<T: ~const Ord + ~const Destruct>(v1: T, v2: T) -> T {
+pub fn max<T: Ord>(v1: T, v2: T) -> T {
v1.max(v2)
}
@@ -1256,18 +1228,16 @@ pub const fn max<T: ~const Ord + ~const Destruct>(v1: T, v2: T) -> T {
/// ```
/// use std::cmp;
///
-/// assert_eq!(cmp::max_by(-2, 1, |x: &i32, y: &i32| x.abs().cmp(&y.abs())), -2);
-/// assert_eq!(cmp::max_by(-2, 2, |x: &i32, y: &i32| x.abs().cmp(&y.abs())), 2);
+/// let result = cmp::max_by(-2, 1, |x: &i32, y: &i32| x.abs().cmp(&y.abs()));
+/// assert_eq!(result, -2);
+///
+/// let result = cmp::max_by(-2, 2, |x: &i32, y: &i32| x.abs().cmp(&y.abs())) ;
+/// assert_eq!(result, 2);
/// ```
#[inline]
#[must_use]
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
-#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
-pub const fn max_by<T, F: ~const FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T
-where
- T: ~const Destruct,
- F: ~const Destruct,
-{
+pub fn max_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
match compare(&v1, &v2) {
Ordering::Less | Ordering::Equal => v2,
Ordering::Greater => v1,
@@ -1283,20 +1253,17 @@ where
/// ```
/// use std::cmp;
///
-/// assert_eq!(cmp::max_by_key(-2, 1, |x: &i32| x.abs()), -2);
-/// assert_eq!(cmp::max_by_key(-2, 2, |x: &i32| x.abs()), 2);
+/// let result = cmp::max_by_key(-2, 1, |x: &i32| x.abs());
+/// assert_eq!(result, -2);
+///
+/// let result = cmp::max_by_key(-2, 2, |x: &i32| x.abs());
+/// assert_eq!(result, 2);
/// ```
#[inline]
#[must_use]
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
-#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
-pub const fn max_by_key<T, F: ~const FnMut(&T) -> K, K: ~const Ord>(v1: T, v2: T, mut f: F) -> T
-where
- T: ~const Destruct,
- F: ~const Destruct,
- K: ~const Destruct,
-{
- max_by(v1, v2, const |v1, v2| f(v1).cmp(&f(v2)))
+pub fn max_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
+ max_by(v1, v2, |v1, v2| f(v1).cmp(&f(v2)))
}
// Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types
@@ -1307,8 +1274,7 @@ mod impls {
macro_rules! partial_eq_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const PartialEq for $t {
+ impl PartialEq for $t {
#[inline]
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
#[inline]
@@ -1318,8 +1284,7 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const PartialEq for () {
+ impl PartialEq for () {
#[inline]
fn eq(&self, _other: &()) -> bool {
true
@@ -1346,8 +1311,7 @@ mod impls {
macro_rules! partial_ord_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const PartialOrd for $t {
+ impl PartialOrd for $t {
#[inline]
fn partial_cmp(&self, other: &$t) -> Option<Ordering> {
match (*self <= *other, *self >= *other) {
@@ -1357,21 +1321,20 @@ mod impls {
(true, true) => Some(Equal),
}
}
- #[inline]
+ #[inline(always)]
fn lt(&self, other: &$t) -> bool { (*self) < (*other) }
- #[inline]
+ #[inline(always)]
fn le(&self, other: &$t) -> bool { (*self) <= (*other) }
- #[inline]
+ #[inline(always)]
fn ge(&self, other: &$t) -> bool { (*self) >= (*other) }
- #[inline]
+ #[inline(always)]
fn gt(&self, other: &$t) -> bool { (*self) > (*other) }
}
)*)
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const PartialOrd for () {
+ impl PartialOrd for () {
#[inline]
fn partial_cmp(&self, _: &()) -> Option<Ordering> {
Some(Equal)
@@ -1379,8 +1342,7 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const PartialOrd for bool {
+ impl PartialOrd for bool {
#[inline]
fn partial_cmp(&self, other: &bool) -> Option<Ordering> {
Some(self.cmp(other))
@@ -1392,25 +1354,23 @@ mod impls {
macro_rules! ord_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const PartialOrd for $t {
+ impl PartialOrd for $t {
#[inline]
fn partial_cmp(&self, other: &$t) -> Option<Ordering> {
Some(self.cmp(other))
}
- #[inline]
+ #[inline(always)]
fn lt(&self, other: &$t) -> bool { (*self) < (*other) }
- #[inline]
+ #[inline(always)]
fn le(&self, other: &$t) -> bool { (*self) <= (*other) }
- #[inline]
+ #[inline(always)]
fn ge(&self, other: &$t) -> bool { (*self) >= (*other) }
- #[inline]
+ #[inline(always)]
fn gt(&self, other: &$t) -> bool { (*self) > (*other) }
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const Ord for $t {
+ impl Ord for $t {
#[inline]
fn cmp(&self, other: &$t) -> Ordering {
// The order here is important to generate more optimal assembly.
@@ -1424,8 +1384,7 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const Ord for () {
+ impl Ord for () {
#[inline]
fn cmp(&self, _other: &()) -> Ordering {
Equal
@@ -1433,8 +1392,7 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const Ord for bool {
+ impl Ord for bool {
#[inline]
fn cmp(&self, other: &bool) -> Ordering {
// Casting to i8's and converting the difference to an Ordering generates
@@ -1453,8 +1411,8 @@ mod impls {
ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[unstable(feature = "never_type", issue = "35121")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const PartialEq for ! {
+ impl PartialEq for ! {
+ #[inline]
fn eq(&self, _: &!) -> bool {
*self
}
@@ -1464,16 +1422,16 @@ mod impls {
impl Eq for ! {}
#[unstable(feature = "never_type", issue = "35121")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const PartialOrd for ! {
+ impl PartialOrd for ! {
+ #[inline]
fn partial_cmp(&self, _: &!) -> Option<Ordering> {
*self
}
}
#[unstable(feature = "never_type", issue = "35121")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl const Ord for ! {
+ impl Ord for ! {
+ #[inline]
fn cmp(&self, _: &!) -> Ordering {
*self
}
@@ -1482,10 +1440,9 @@ mod impls {
// & pointers
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl<A: ?Sized, B: ?Sized> const PartialEq<&B> for &A
+ impl<A: ?Sized, B: ?Sized> PartialEq<&B> for &A
where
- A: ~const PartialEq<B>,
+ A: PartialEq<B>,
{
#[inline]
fn eq(&self, other: &&B) -> bool {
@@ -1497,10 +1454,9 @@ mod impls {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl<A: ?Sized, B: ?Sized> const PartialOrd<&B> for &A
+ impl<A: ?Sized, B: ?Sized> PartialOrd<&B> for &A
where
- A: ~const PartialOrd<B>,
+ A: PartialOrd<B>,
{
#[inline]
fn partial_cmp(&self, other: &&B) -> Option<Ordering> {
diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs
index 5888e2960..38a6d1ccd 100644
--- a/library/core/src/convert/mod.rs
+++ b/library/core/src/convert/mod.rs
@@ -214,7 +214,6 @@ pub const fn identity<T>(x: T) -> T {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AsRef")]
-#[const_trait]
pub trait AsRef<T: ?Sized> {
/// Converts this type into a shared reference of the (usually inferred) input type.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -366,7 +365,6 @@ pub trait AsRef<T: ?Sized> {
/// `&mut Vec<u8>`, for example, is the better choice (callers need to pass the correct type then).
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AsMut")]
-#[const_trait]
pub trait AsMut<T: ?Sized> {
/// Converts this type into a mutable reference of the (usually inferred) input type.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -443,7 +441,6 @@ pub trait AsMut<T: ?Sized> {
/// [`Vec`]: ../../std/vec/struct.Vec.html
#[rustc_diagnostic_item = "Into"]
#[stable(feature = "rust1", since = "1.0.0")]
-#[const_trait]
pub trait Into<T>: Sized {
/// Converts this type into the (usually inferred) input type.
#[must_use]
@@ -539,7 +536,6 @@ pub trait Into<T>: Sized {
all(_Self = "&str", T = "std::string::String"),
note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix",
))]
-#[const_trait]
pub trait From<T>: Sized {
/// Converts to this type from the input type.
#[rustc_diagnostic_item = "from_fn"]
@@ -564,7 +560,6 @@ pub trait From<T>: Sized {
/// [`Into`], see there for details.
#[rustc_diagnostic_item = "TryInto"]
#[stable(feature = "try_from", since = "1.34.0")]
-#[const_trait]
pub trait TryInto<T>: Sized {
/// The type returned in the event of a conversion error.
#[stable(feature = "try_from", since = "1.34.0")]
@@ -641,7 +636,6 @@ pub trait TryInto<T>: Sized {
/// [`try_from`]: TryFrom::try_from
#[rustc_diagnostic_item = "TryFrom"]
#[stable(feature = "try_from", since = "1.34.0")]
-#[const_trait]
pub trait TryFrom<T>: Sized {
/// The type returned in the event of a conversion error.
#[stable(feature = "try_from", since = "1.34.0")]
@@ -658,10 +652,9 @@ pub trait TryFrom<T>: Sized {
// As lifts over &
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T: ?Sized, U: ?Sized> const AsRef<U> for &T
+impl<T: ?Sized, U: ?Sized> AsRef<U> for &T
where
- T: ~const AsRef<U>,
+ T: AsRef<U>,
{
#[inline]
fn as_ref(&self) -> &U {
@@ -671,10 +664,9 @@ where
// As lifts over &mut
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T: ?Sized, U: ?Sized> const AsRef<U> for &mut T
+impl<T: ?Sized, U: ?Sized> AsRef<U> for &mut T
where
- T: ~const AsRef<U>,
+ T: AsRef<U>,
{
#[inline]
fn as_ref(&self) -> &U {
@@ -692,10 +684,9 @@ where
// AsMut lifts over &mut
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T: ?Sized, U: ?Sized> const AsMut<U> for &mut T
+impl<T: ?Sized, U: ?Sized> AsMut<U> for &mut T
where
- T: ~const AsMut<U>,
+ T: AsMut<U>,
{
#[inline]
fn as_mut(&mut self) -> &mut U {
@@ -713,10 +704,9 @@ where
// From implies Into
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T, U> const Into<U> for T
+impl<T, U> Into<U> for T
where
- U: ~const From<T>,
+ U: From<T>,
{
/// Calls `U::from(self)`.
///
@@ -730,8 +720,7 @@ where
// From (and thus Into) is reflexive
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<T> for T {
+impl<T> From<T> for T {
/// Returns the argument unchanged.
#[inline(always)]
fn from(t: T) -> T {
@@ -748,8 +737,7 @@ impl<T> const From<T> for T {
#[allow(unused_attributes)] // FIXME(#58633): do a principled fix instead.
#[rustc_reservation_impl = "permitting this impl would forbid us from adding \
`impl<T> From<!> for T` later; see rust-lang/rust#64715 for details"]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<!> for T {
+impl<T> From<!> for T {
fn from(t: !) -> T {
t
}
@@ -757,10 +745,9 @@ impl<T> const From<!> for T {
// TryFrom implies TryInto
#[stable(feature = "try_from", since = "1.34.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T, U> const TryInto<U> for T
+impl<T, U> TryInto<U> for T
where
- U: ~const TryFrom<T>,
+ U: TryFrom<T>,
{
type Error = U::Error;
@@ -773,10 +760,9 @@ where
// Infallible conversions are semantically equivalent to fallible conversions
// with an uninhabited error type.
#[stable(feature = "try_from", since = "1.34.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T, U> const TryFrom<U> for T
+impl<T, U> TryFrom<U> for T
where
- U: ~const Into<T>,
+ U: Into<T>,
{
type Error = Infallible;
@@ -876,8 +862,7 @@ impl AsMut<str> for str {
pub enum Infallible {}
#[stable(feature = "convert_infallible", since = "1.34.0")]
-#[rustc_const_unstable(feature = "const_clone", issue = "91805")]
-impl const Clone for Infallible {
+impl Clone for Infallible {
fn clone(&self) -> Infallible {
match *self {}
}
@@ -929,8 +914,8 @@ impl Ord for Infallible {
}
#[stable(feature = "convert_infallible", since = "1.34.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl const From<!> for Infallible {
+impl From<!> for Infallible {
+ #[inline]
fn from(x: !) -> Self {
x
}
diff --git a/library/core/src/convert/num.rs b/library/core/src/convert/num.rs
index a74a56bc5..56ab63be2 100644
--- a/library/core/src/convert/num.rs
+++ b/library/core/src/convert/num.rs
@@ -44,8 +44,7 @@ impl_float_to_int!(f64 => u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize);
macro_rules! impl_from {
($Small: ty, $Large: ty, #[$attr:meta], $doc: expr) => {
#[$attr]
- #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
- impl const From<$Small> for $Large {
+ impl From<$Small> for $Large {
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
// Rustdocs on functions do not.
#[doc = $doc]
@@ -170,8 +169,7 @@ impl_from! { f32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0"
// bool -> Float
#[stable(feature = "float_from_bool", since = "1.68.0")]
-#[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
-impl const From<bool> for f32 {
+impl From<bool> for f32 {
/// Converts `bool` to `f32` losslessly. The resulting value is positive
/// `0.0` for `false` and `1.0` for `true` values.
///
@@ -190,8 +188,7 @@ impl const From<bool> for f32 {
}
}
#[stable(feature = "float_from_bool", since = "1.68.0")]
-#[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
-impl const From<bool> for f64 {
+impl From<bool> for f64 {
/// Converts `bool` to `f64` losslessly. The resulting value is positive
/// `0.0` for `false` and `1.0` for `true` values.
///
@@ -214,8 +211,7 @@ impl const From<bool> for f64 {
macro_rules! try_from_unbounded {
($source:ty, $($target:ty),*) => {$(
#[stable(feature = "try_from", since = "1.34.0")]
- #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
- impl const TryFrom<$source> for $target {
+ impl TryFrom<$source> for $target {
type Error = TryFromIntError;
/// Try to create the target number type from a source
@@ -233,8 +229,7 @@ macro_rules! try_from_unbounded {
macro_rules! try_from_lower_bounded {
($source:ty, $($target:ty),*) => {$(
#[stable(feature = "try_from", since = "1.34.0")]
- #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
- impl const TryFrom<$source> for $target {
+ impl TryFrom<$source> for $target {
type Error = TryFromIntError;
/// Try to create the target number type from a source
@@ -256,8 +251,7 @@ macro_rules! try_from_lower_bounded {
macro_rules! try_from_upper_bounded {
($source:ty, $($target:ty),*) => {$(
#[stable(feature = "try_from", since = "1.34.0")]
- #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
- impl const TryFrom<$source> for $target {
+ impl TryFrom<$source> for $target {
type Error = TryFromIntError;
/// Try to create the target number type from a source
@@ -279,8 +273,7 @@ macro_rules! try_from_upper_bounded {
macro_rules! try_from_both_bounded {
($source:ty, $($target:ty),*) => {$(
#[stable(feature = "try_from", since = "1.34.0")]
- #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
- impl const TryFrom<$source> for $target {
+ impl TryFrom<$source> for $target {
type Error = TryFromIntError;
/// Try to create the target number type from a source
@@ -431,8 +424,7 @@ use crate::num::NonZeroUsize;
macro_rules! nzint_impl_from {
($Small: ty, $Large: ty, #[$attr:meta], $doc: expr) => {
#[$attr]
- #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
- impl const From<$Small> for $Large {
+ impl From<$Small> for $Large {
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
// Rustdocs on functions do not.
#[doc = $doc]
diff --git a/library/core/src/default.rs b/library/core/src/default.rs
index d96b53de0..09dbc9581 100644
--- a/library/core/src/default.rs
+++ b/library/core/src/default.rs
@@ -99,7 +99,6 @@
/// ```
#[cfg_attr(not(test), rustc_diagnostic_item = "Default")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[const_trait]
pub trait Default: Sized {
/// Returns the "default value" for a type.
///
@@ -190,8 +189,7 @@ pub macro Default($item:item) {
macro_rules! default_impl {
($t:ty, $v:expr, $doc:tt) => {
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
- impl const Default for $t {
+ impl Default for $t {
#[inline]
#[doc = $doc]
fn default() -> $t {
diff --git a/library/core/src/escape.rs b/library/core/src/escape.rs
new file mode 100644
index 000000000..3d471419b
--- /dev/null
+++ b/library/core/src/escape.rs
@@ -0,0 +1,112 @@
+//! Helper code for character escaping.
+
+use crate::ascii;
+use crate::num::NonZeroUsize;
+use crate::ops::Range;
+
+const HEX_DIGITS: [ascii::Char; 16] = *b"0123456789abcdef".as_ascii().unwrap();
+
+/// Escapes a byte into provided buffer; returns length of escaped
+/// representation.
+pub(crate) fn escape_ascii_into(output: &mut [ascii::Char; 4], byte: u8) -> Range<u8> {
+ #[inline]
+ fn backslash(a: ascii::Char) -> ([ascii::Char; 4], u8) {
+ ([ascii::Char::ReverseSolidus, a, ascii::Char::Null, ascii::Char::Null], 2)
+ }
+
+ let (data, len) = match byte {
+ b'\t' => backslash(ascii::Char::SmallT),
+ b'\r' => backslash(ascii::Char::SmallR),
+ b'\n' => backslash(ascii::Char::SmallN),
+ b'\\' => backslash(ascii::Char::ReverseSolidus),
+ b'\'' => backslash(ascii::Char::Apostrophe),
+ b'\"' => backslash(ascii::Char::QuotationMark),
+ _ => if let Some(a) = byte.as_ascii() && !byte.is_ascii_control() {
+ ([a, ascii::Char::Null, ascii::Char::Null, ascii::Char::Null], 1)
+ } else {
+ let hi = HEX_DIGITS[usize::from(byte >> 4)];
+ let lo = HEX_DIGITS[usize::from(byte & 0xf)];
+ ([ascii::Char::ReverseSolidus, ascii::Char::SmallX, hi, lo], 4)
+ }
+ };
+ *output = data;
+ 0..len
+}
+
+/// Escapes a character into provided buffer using `\u{NNNN}` representation.
+pub(crate) fn escape_unicode_into(output: &mut [ascii::Char; 10], ch: char) -> Range<u8> {
+ output[9] = ascii::Char::RightCurlyBracket;
+
+ let ch = ch as u32;
+ output[3] = HEX_DIGITS[((ch >> 20) & 15) as usize];
+ output[4] = HEX_DIGITS[((ch >> 16) & 15) as usize];
+ output[5] = HEX_DIGITS[((ch >> 12) & 15) as usize];
+ output[6] = HEX_DIGITS[((ch >> 8) & 15) as usize];
+ output[7] = HEX_DIGITS[((ch >> 4) & 15) as usize];
+ output[8] = HEX_DIGITS[((ch >> 0) & 15) as usize];
+
+ // or-ing 1 ensures that for ch==0 the code computes that one digit should
+ // be printed.
+ let start = (ch | 1).leading_zeros() as usize / 4 - 2;
+ const UNICODE_ESCAPE_PREFIX: &[ascii::Char; 3] = b"\\u{".as_ascii().unwrap();
+ output[start..][..3].copy_from_slice(UNICODE_ESCAPE_PREFIX);
+
+ (start as u8)..10
+}
+
+/// An iterator over an fixed-size array.
+///
+/// This is essentially equivalent to array’s IntoIter except that indexes are
+/// limited to u8 to reduce size of the structure.
+#[derive(Clone, Debug)]
+pub(crate) struct EscapeIterInner<const N: usize> {
+ // The element type ensures this is always ASCII, and thus also valid UTF-8.
+ pub(crate) data: [ascii::Char; N],
+
+ // Invariant: alive.start <= alive.end <= N.
+ pub(crate) alive: Range<u8>,
+}
+
+impl<const N: usize> EscapeIterInner<N> {
+ pub fn new(data: [ascii::Char; N], alive: Range<u8>) -> Self {
+ const { assert!(N < 256) };
+ debug_assert!(alive.start <= alive.end && usize::from(alive.end) <= N, "{alive:?}");
+ Self { data, alive }
+ }
+
+ pub fn from_array<const M: usize>(array: [ascii::Char; M]) -> Self {
+ const { assert!(M <= N) };
+
+ let mut data = [ascii::Char::Null; N];
+ data[..M].copy_from_slice(&array);
+ Self::new(data, 0..M as u8)
+ }
+
+ pub fn as_ascii(&self) -> &[ascii::Char] {
+ &self.data[usize::from(self.alive.start)..usize::from(self.alive.end)]
+ }
+
+ pub fn as_str(&self) -> &str {
+ self.as_ascii().as_str()
+ }
+
+ pub fn len(&self) -> usize {
+ usize::from(self.alive.end - self.alive.start)
+ }
+
+ pub fn next(&mut self) -> Option<u8> {
+ self.alive.next().map(|i| self.data[usize::from(i)].as_u8())
+ }
+
+ pub fn next_back(&mut self) -> Option<u8> {
+ self.alive.next_back().map(|i| self.data[usize::from(i)].as_u8())
+ }
+
+ pub fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
+ self.alive.advance_by(n)
+ }
+
+ pub fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
+ self.alive.advance_back_by(n)
+ }
+}
diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs
index 4a5306cca..e1e1a9b40 100644
--- a/library/core/src/ffi/c_str.rs
+++ b/library/core/src/ffi/c_str.rs
@@ -79,9 +79,9 @@ use crate::str;
///
/// [str]: prim@str "str"
#[derive(Hash)]
-#[cfg_attr(not(test), rustc_diagnostic_item = "CStr")]
#[stable(feature = "core_c_str", since = "1.64.0")]
#[rustc_has_incoherent_inherent_impls]
+#[cfg_attr(not(bootstrap), lang = "CStr")]
// FIXME:
// `fn from` in `impl From<&CStr> for Box<CStr>` current implementation relies
// on `CStr` being layout-compatible with `[u8]`.
@@ -324,14 +324,15 @@ impl CStr {
/// assert_eq!(c_str.to_str().unwrap(), "AAAAAAAA");
/// ```
///
- #[rustc_allow_const_fn_unstable(const_slice_index)]
#[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")]
#[rustc_const_stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")]
pub const fn from_bytes_until_nul(bytes: &[u8]) -> Result<&CStr, FromBytesUntilNulError> {
let nul_pos = memchr::memchr(0, bytes);
match nul_pos {
Some(nul_pos) => {
- let subslice = &bytes[..nul_pos + 1];
+ // FIXME(const-hack) replace with range index
+ // SAFETY: nul_pos + 1 <= bytes.len()
+ let subslice = unsafe { crate::slice::from_raw_parts(bytes.as_ptr(), nul_pos + 1) };
// SAFETY: We know there is a nul byte at nul_pos, so this slice
// (ending at the nul byte) is a well-formed C string.
Ok(unsafe { CStr::from_bytes_with_nul_unchecked(subslice) })
@@ -516,8 +517,6 @@ impl CStr {
/// # Examples
///
/// ```
- /// #![feature(cstr_is_empty)]
- ///
/// use std::ffi::CStr;
/// # use std::ffi::FromBytesWithNulError;
///
@@ -532,11 +531,13 @@ impl CStr {
/// # }
/// ```
#[inline]
- #[unstable(feature = "cstr_is_empty", issue = "102444")]
+ #[stable(feature = "cstr_is_empty", since = "1.71.0")]
+ #[rustc_const_stable(feature = "cstr_is_empty", since = "1.71.0")]
pub const fn is_empty(&self) -> bool {
// SAFETY: We know there is at least one byte; for empty strings it
// is the NUL terminator.
- (unsafe { self.inner.get_unchecked(0) }) == &0
+ // FIXME(const-hack): use get_unchecked
+ unsafe { *self.inner.as_ptr() == 0 }
}
/// Converts this C string to a byte slice.
@@ -560,8 +561,7 @@ impl CStr {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cstr_methods", issue = "101719")]
- pub const fn to_bytes(&self) -> &[u8] {
+ pub fn to_bytes(&self) -> &[u8] {
let bytes = self.to_bytes_with_nul();
// SAFETY: to_bytes_with_nul returns slice with length at least 1
unsafe { bytes.get_unchecked(..bytes.len() - 1) }
@@ -612,8 +612,7 @@ impl CStr {
/// assert_eq!(cstr.to_str(), Ok("foo"));
/// ```
#[stable(feature = "cstr_to_str", since = "1.4.0")]
- #[rustc_const_unstable(feature = "const_cstr_methods", issue = "101719")]
- pub const fn to_str(&self) -> Result<&str, str::Utf8Error> {
+ pub fn to_str(&self) -> Result<&str, str::Utf8Error> {
// N.B., when `CStr` is changed to perform the length check in `.to_bytes()`
// instead of in `from_ptr()`, it may be worth considering if this should
// be rewritten to do the UTF-8 check inline with the length calculation
diff --git a/library/core/src/ffi/mod.rs b/library/core/src/ffi/mod.rs
index c4f554c8c..b73abbbac 100644
--- a/library/core/src/ffi/mod.rs
+++ b/library/core/src/ffi/mod.rs
@@ -143,7 +143,10 @@ mod c_char_definition {
target_arch = "powerpc"
)
),
- all(target_os = "fuchsia", target_arch = "aarch64"),
+ all(
+ target_os = "fuchsia",
+ any(target_arch = "aarch64", target_arch = "riscv64")
+ ),
all(target_os = "nto", target_arch = "aarch64"),
target_os = "horizon"
))] {
@@ -199,7 +202,8 @@ mod c_long_definition {
// would be uninhabited and at least dereferencing such pointers would
// be UB.
#[doc = include_str!("c_void.md")]
-#[repr(u8)]
+#[cfg_attr(not(bootstrap), lang = "c_void")]
+#[cfg_attr(not(doc), repr(u8))] // work around https://github.com/rust-lang/rust/issues/90435
#[stable(feature = "core_c_void", since = "1.30.0")]
pub enum c_void {
#[unstable(
@@ -240,7 +244,7 @@ impl fmt::Debug for c_void {
target_os = "uefi",
windows,
))]
-#[repr(transparent)]
+#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
#[unstable(
feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
@@ -292,7 +296,7 @@ impl<'f> fmt::Debug for VaListImpl<'f> {
not(target_os = "uefi"),
not(windows),
))]
-#[repr(C)]
+#[cfg_attr(not(doc), repr(C))] // work around https://github.com/rust-lang/rust/issues/66401
#[derive(Debug)]
#[unstable(
feature = "c_variadic",
@@ -312,7 +316,7 @@ pub struct VaListImpl<'f> {
/// PowerPC ABI implementation of a `va_list`.
#[cfg(all(target_arch = "powerpc", not(target_os = "uefi"), not(windows)))]
-#[repr(C)]
+#[cfg_attr(not(doc), repr(C))] // work around https://github.com/rust-lang/rust/issues/66401
#[derive(Debug)]
#[unstable(
feature = "c_variadic",
@@ -332,7 +336,7 @@ pub struct VaListImpl<'f> {
/// s390x ABI implementation of a `va_list`.
#[cfg(target_arch = "s390x")]
-#[repr(C)]
+#[cfg_attr(not(doc), repr(C))] // work around https://github.com/rust-lang/rust/issues/66401
#[derive(Debug)]
#[unstable(
feature = "c_variadic",
@@ -351,7 +355,7 @@ pub struct VaListImpl<'f> {
/// x86_64 ABI implementation of a `va_list`.
#[cfg(all(target_arch = "x86_64", not(target_os = "uefi"), not(windows)))]
-#[repr(C)]
+#[cfg_attr(not(doc), repr(C))] // work around https://github.com/rust-lang/rust/issues/66401
#[derive(Debug)]
#[unstable(
feature = "c_variadic",
@@ -369,7 +373,7 @@ pub struct VaListImpl<'f> {
}
/// A wrapper for a `va_list`
-#[repr(transparent)]
+#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
#[derive(Debug)]
#[unstable(
feature = "c_variadic",
diff --git a/library/core/src/fmt/builders.rs b/library/core/src/fmt/builders.rs
index 7da49b04a..36f49d51c 100644
--- a/library/core/src/fmt/builders.rs
+++ b/library/core/src/fmt/builders.rs
@@ -60,7 +60,7 @@ impl fmt::Write for PadAdapter<'_, '_> {
/// }
///
/// impl fmt::Debug for Foo {
-/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_struct("Foo")
/// .field("bar", &self.bar)
/// .field("baz", &self.baz)
@@ -109,14 +109,14 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
/// .field("bar", &self.bar) // We add `bar` field.
/// .field("another", &self.another) // We add `another` field.
/// // We even add a field which doesn't exist (because why not?).
- /// .field("not_existing_field", &1)
+ /// .field("nonexistent_field", &1)
/// .finish() // We're good to go!
/// }
/// }
///
/// assert_eq!(
/// format!("{:?}", Bar { bar: 10, another: "Hello World".to_string() }),
- /// "Bar { bar: 10, another: \"Hello World\", not_existing_field: 1 }",
+ /// "Bar { bar: 10, another: \"Hello World\", nonexistent_field: 1 }",
/// );
/// ```
#[stable(feature = "debug_builders", since = "1.2.0")]
@@ -249,7 +249,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
/// struct Foo(i32, String);
///
/// impl fmt::Debug for Foo {
-/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_tuple("Foo")
/// .field(&self.0)
/// .field(&self.1)
@@ -418,7 +418,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
/// struct Foo(Vec<i32>);
///
/// impl fmt::Debug for Foo {
-/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_set().entries(self.0.iter()).finish()
/// }
/// }
@@ -548,7 +548,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
/// struct Foo(Vec<i32>);
///
/// impl fmt::Debug for Foo {
-/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_list().entries(self.0.iter()).finish()
/// }
/// }
@@ -678,7 +678,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
/// struct Foo(Vec<(String, i32)>);
///
/// impl fmt::Debug for Foo {
-/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_map().entries(self.0.iter().map(|&(ref k, ref v)| (k, v))).finish()
/// }
/// }
diff --git a/library/core/src/fmt/float.rs b/library/core/src/fmt/float.rs
index 89d5fac30..3bbf5d877 100644
--- a/library/core/src/fmt/float.rs
+++ b/library/core/src/fmt/float.rs
@@ -45,7 +45,8 @@ where
&mut buf,
&mut parts,
);
- fmt.pad_formatted_parts(&formatted)
+ // SAFETY: `to_exact_fixed_str` and `format_exact` produce only ASCII characters.
+ unsafe { fmt.pad_formatted_parts(&formatted) }
}
// Don't inline this so callers that call both this and the above won't wind
@@ -71,7 +72,8 @@ where
&mut buf,
&mut parts,
);
- fmt.pad_formatted_parts(&formatted)
+ // SAFETY: `to_shortest_str` and `format_shortest` produce only ASCII characters.
+ unsafe { fmt.pad_formatted_parts(&formatted) }
}
fn float_to_decimal_display<T>(fmt: &mut Formatter<'_>, num: &T) -> Result
@@ -116,7 +118,8 @@ where
&mut buf,
&mut parts,
);
- fmt.pad_formatted_parts(&formatted)
+ // SAFETY: `to_exact_exp_str` and `format_exact` produce only ASCII characters.
+ unsafe { fmt.pad_formatted_parts(&formatted) }
}
// Don't inline this so callers that call both this and the above won't wind
@@ -143,7 +146,8 @@ where
&mut buf,
&mut parts,
);
- fmt.pad_formatted_parts(&formatted)
+ // SAFETY: `to_shortest_exp_str` and `format_shortest` produce only ASCII characters.
+ unsafe { fmt.pad_formatted_parts(&formatted) }
}
// Common code of floating point LowerExp and UpperExp.
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs
index fcda097f0..1786b309c 100644
--- a/library/core/src/fmt/mod.rs
+++ b/library/core/src/fmt/mod.rs
@@ -18,6 +18,7 @@ mod float;
#[cfg(no_fp_fmt_parse)]
mod nofloat;
mod num;
+mod rt;
#[stable(feature = "fmt_flags_align", since = "1.28.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Alignment")]
@@ -38,12 +39,6 @@ pub enum Alignment {
#[stable(feature = "debug_builders", since = "1.2.0")]
pub use self::builders::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
-#[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
-#[doc(hidden)]
-pub mod rt {
- pub mod v1;
-}
-
/// The type returned by formatter methods.
///
/// # Examples
@@ -227,7 +222,7 @@ impl<W: Write + ?Sized> Write for &mut W {
pub struct Formatter<'a> {
flags: u32,
fill: char,
- align: rt::v1::Alignment,
+ align: rt::Alignment,
width: Option<usize>,
precision: Option<usize>,
@@ -248,7 +243,7 @@ impl<'a> Formatter<'a> {
Formatter {
flags: 0,
fill: ' ',
- align: rt::v1::Alignment::Unknown,
+ align: rt::Alignment::Unknown,
width: None,
precision: None,
buf,
@@ -256,145 +251,48 @@ impl<'a> Formatter<'a> {
}
}
-// NB. Argument is essentially an optimized partially applied formatting function,
-// equivalent to `exists T.(&T, fn(&T, &mut Formatter<'_>) -> Result`.
-
-extern "C" {
- type Opaque;
-}
-
-/// This struct represents the generic "argument" which is taken by the Xprintf
-/// family of functions. It contains a function to format the given value. At
-/// compile time it is ensured that the function and the value have the correct
-/// types, and then this struct is used to canonicalize arguments to one type.
-#[lang = "format_argument"]
+/// This structure represents a safely precompiled version of a format string
+/// and its arguments. This cannot be generated at runtime because it cannot
+/// safely be done, so no constructors are given and the fields are private
+/// to prevent modification.
+///
+/// The [`format_args!`] macro will safely create an instance of this structure.
+/// The macro validates the format string at compile-time so usage of the
+/// [`write()`] and [`format()`] functions can be safely performed.
+///
+/// You can use the `Arguments<'a>` that [`format_args!`] returns in `Debug`
+/// and `Display` contexts as seen below. The example also shows that `Debug`
+/// and `Display` format to the same thing: the interpolated format string
+/// in `format_args!`.
+///
+/// ```rust
+/// let debug = format!("{:?}", format_args!("{} foo {:?}", 1, 2));
+/// let display = format!("{}", format_args!("{} foo {:?}", 1, 2));
+/// assert_eq!("1 foo 2", display);
+/// assert_eq!(display, debug);
+/// ```
+///
+/// [`format()`]: ../../std/fmt/fn.format.html
+#[lang = "format_arguments"]
+#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Clone)]
-#[allow(missing_debug_implementations)]
-#[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
-#[doc(hidden)]
-pub struct ArgumentV1<'a> {
- value: &'a Opaque,
- formatter: fn(&Opaque, &mut Formatter<'_>) -> Result,
-}
-
-/// This struct represents the unsafety of constructing an `Arguments`.
-/// It exists, rather than an unsafe function, in order to simplify the expansion
-/// of `format_args!(..)` and reduce the scope of the `unsafe` block.
-#[lang = "format_unsafe_arg"]
-#[allow(missing_debug_implementations)]
-#[doc(hidden)]
-#[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
-pub struct UnsafeArg {
- _private: (),
-}
-
-impl UnsafeArg {
- /// See documentation where `UnsafeArg` is required to know when it is safe to
- /// create and use `UnsafeArg`.
- #[doc(hidden)]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
- #[inline(always)]
- pub unsafe fn new() -> Self {
- Self { _private: () }
- }
-}
-
-// This guarantees a single stable value for the function pointer associated with
-// indices/counts in the formatting infrastructure.
-//
-// Note that a function defined as such would not be correct as functions are
-// always tagged unnamed_addr with the current lowering to LLVM IR, so their
-// address is not considered important to LLVM and as such the as_usize cast
-// could have been miscompiled. In practice, we never call as_usize on non-usize
-// containing data (as a matter of static generation of the formatting
-// arguments), so this is merely an additional check.
-//
-// We primarily want to ensure that the function pointer at `USIZE_MARKER` has
-// an address corresponding *only* to functions that also take `&usize` as their
-// first argument. The read_volatile here ensures that we can safely ready out a
-// usize from the passed reference and that this address does not point at a
-// non-usize taking function.
-#[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
-static USIZE_MARKER: fn(&usize, &mut Formatter<'_>) -> Result = |ptr, _| {
- // SAFETY: ptr is a reference
- let _v: usize = unsafe { crate::ptr::read_volatile(ptr) };
- loop {}
-};
-
-macro_rules! arg_new {
- ($f: ident, $t: ident) => {
- #[doc(hidden)]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
- #[inline]
- pub fn $f<'b, T: $t>(x: &'b T) -> ArgumentV1<'_> {
- Self::new(x, $t::fmt)
- }
- };
-}
-
-#[rustc_diagnostic_item = "ArgumentV1Methods"]
-impl<'a> ArgumentV1<'a> {
- #[doc(hidden)]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
- #[inline]
- pub fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter<'_>) -> Result) -> ArgumentV1<'b> {
- // SAFETY: `mem::transmute(x)` is safe because
- // 1. `&'b T` keeps the lifetime it originated with `'b`
- // (so as to not have an unbounded lifetime)
- // 2. `&'b T` and `&'b Opaque` have the same memory layout
- // (when `T` is `Sized`, as it is here)
- // `mem::transmute(f)` is safe since `fn(&T, &mut Formatter<'_>) -> Result`
- // and `fn(&Opaque, &mut Formatter<'_>) -> Result` have the same ABI
- // (as long as `T` is `Sized`)
- unsafe { ArgumentV1 { formatter: mem::transmute(f), value: mem::transmute(x) } }
- }
-
- arg_new!(new_display, Display);
- arg_new!(new_debug, Debug);
- arg_new!(new_octal, Octal);
- arg_new!(new_lower_hex, LowerHex);
- arg_new!(new_upper_hex, UpperHex);
- arg_new!(new_pointer, Pointer);
- arg_new!(new_binary, Binary);
- arg_new!(new_lower_exp, LowerExp);
- arg_new!(new_upper_exp, UpperExp);
+pub struct Arguments<'a> {
+ // Format string pieces to print.
+ pieces: &'a [&'static str],
- #[doc(hidden)]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
- pub fn from_usize(x: &usize) -> ArgumentV1<'_> {
- ArgumentV1::new(x, USIZE_MARKER)
- }
-
- fn as_usize(&self) -> Option<usize> {
- // We are type punning a bit here: USIZE_MARKER only takes an &usize but
- // formatter takes an &Opaque. Rust understandably doesn't think we should compare
- // the function pointers if they don't have the same signature, so we cast to
- // usizes to tell it that we just want to compare addresses.
- if self.formatter as usize == USIZE_MARKER as usize {
- // SAFETY: The `formatter` field is only set to USIZE_MARKER if
- // the value is a usize, so this is safe
- Some(unsafe { *(self.value as *const _ as *const usize) })
- } else {
- None
- }
- }
-}
+ // Placeholder specs, or `None` if all specs are default (as in "{}{}").
+ fmt: Option<&'a [rt::Placeholder]>,
-// flags available in the v1 format of format_args
-#[derive(Copy, Clone)]
-enum FlagV1 {
- SignPlus,
- SignMinus,
- Alternate,
- SignAwareZeroPad,
- DebugLowerHex,
- DebugUpperHex,
+ // Dynamic arguments for interpolation, to be interleaved with string
+ // pieces. (Every argument is preceded by a string piece.)
+ args: &'a [rt::Argument<'a>],
}
+/// Used by the format_args!() macro to create a fmt::Arguments object.
+#[doc(hidden)]
+#[unstable(feature = "fmt_internals", issue = "none")]
impl<'a> Arguments<'a> {
- #[doc(hidden)]
#[inline]
- #[unstable(feature = "fmt_internals", issue = "none")]
#[rustc_const_unstable(feature = "const_fmt_arguments_new", issue = "none")]
pub const fn new_const(pieces: &'a [&'static str]) -> Self {
if pieces.len() > 1 {
@@ -405,23 +303,8 @@ impl<'a> Arguments<'a> {
/// When using the format_args!() macro, this function is used to generate the
/// Arguments structure.
- #[cfg(not(bootstrap))]
- #[doc(hidden)]
#[inline]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
- pub fn new_v1(pieces: &'a [&'static str], args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
- if pieces.len() < args.len() || pieces.len() > args.len() + 1 {
- panic!("invalid args");
- }
- Arguments { pieces, fmt: None, args }
- }
-
- #[cfg(bootstrap)]
- #[doc(hidden)]
- #[inline]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
- #[rustc_const_unstable(feature = "const_fmt_arguments_new", issue = "none")]
- pub const fn new_v1(pieces: &'a [&'static str], args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
+ pub fn new_v1(pieces: &'a [&'static str], args: &'a [rt::Argument<'a>]) -> Arguments<'a> {
if pieces.len() < args.len() || pieces.len() > args.len() + 1 {
panic!("invalid args");
}
@@ -430,21 +313,17 @@ impl<'a> Arguments<'a> {
/// This function is used to specify nonstandard formatting parameters.
///
- /// An `UnsafeArg` is required because the following invariants must be held
+ /// An `rt::UnsafeArg` is required because the following invariants must be held
/// in order for this function to be safe:
/// 1. The `pieces` slice must be at least as long as `fmt`.
- /// 2. Every [`rt::v1::Argument::position`] value within `fmt` must be a
- /// valid index of `args`.
- /// 3. Every [`rt::v1::Count::Param`] within `fmt` must contain a valid index of
- /// `args`.
- #[doc(hidden)]
+ /// 2. Every `rt::Placeholder::position` value within `fmt` must be a valid index of `args`.
+ /// 3. Every `rt::Count::Param` within `fmt` must contain a valid index of `args`.
#[inline]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
pub fn new_v1_formatted(
pieces: &'a [&'static str],
- args: &'a [ArgumentV1<'a>],
- fmt: &'a [rt::v1::Argument],
- _unsafe_arg: UnsafeArg,
+ args: &'a [rt::Argument<'a>],
+ fmt: &'a [rt::Placeholder],
+ _unsafe_arg: rt::UnsafeArg,
) -> Arguments<'a> {
Arguments { pieces, fmt: Some(fmt), args }
}
@@ -453,9 +332,7 @@ impl<'a> Arguments<'a> {
///
/// This is intended to be used for setting initial `String` capacity
/// when using `format!`. Note: this is neither the lower nor upper bound.
- #[doc(hidden)]
#[inline]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
pub fn estimated_capacity(&self) -> usize {
let pieces_length: usize = self.pieces.iter().map(|x| x.len()).sum();
@@ -475,43 +352,6 @@ impl<'a> Arguments<'a> {
}
}
-/// This structure represents a safely precompiled version of a format string
-/// and its arguments. This cannot be generated at runtime because it cannot
-/// safely be done, so no constructors are given and the fields are private
-/// to prevent modification.
-///
-/// The [`format_args!`] macro will safely create an instance of this structure.
-/// The macro validates the format string at compile-time so usage of the
-/// [`write()`] and [`format()`] functions can be safely performed.
-///
-/// You can use the `Arguments<'a>` that [`format_args!`] returns in `Debug`
-/// and `Display` contexts as seen below. The example also shows that `Debug`
-/// and `Display` format to the same thing: the interpolated format string
-/// in `format_args!`.
-///
-/// ```rust
-/// let debug = format!("{:?}", format_args!("{} foo {:?}", 1, 2));
-/// let display = format!("{}", format_args!("{} foo {:?}", 1, 2));
-/// assert_eq!("1 foo 2", display);
-/// assert_eq!(display, debug);
-/// ```
-///
-/// [`format()`]: ../../std/fmt/fn.format.html
-#[lang = "format_arguments"]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[derive(Copy, Clone)]
-pub struct Arguments<'a> {
- // Format string pieces to print.
- pieces: &'a [&'static str],
-
- // Placeholder specs, or `None` if all specs are default (as in "{}{}").
- fmt: Option<&'a [rt::v1::Argument]>,
-
- // Dynamic arguments for interpolation, to be interleaved with string
- // pieces. (Every argument is preceded by a string piece.)
- args: &'a [ArgumentV1<'a>],
-}
-
impl<'a> Arguments<'a> {
/// Get the formatted string, if it has no arguments to be formatted at runtime.
///
@@ -541,7 +381,7 @@ impl<'a> Arguments<'a> {
///
/// fn write_str(_: &str) { /* ... */ }
///
- /// fn write_fmt(args: &Arguments) {
+ /// fn write_fmt(args: &Arguments<'_>) {
/// if let Some(s) = args.as_str() {
/// write_str(s)
/// } else {
@@ -1251,7 +1091,7 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
if !piece.is_empty() {
formatter.buf.write_str(*piece)?;
}
- (arg.formatter)(arg.value, &mut formatter)?;
+ arg.fmt(&mut formatter)?;
idx += 1;
}
}
@@ -1281,15 +1121,15 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
Ok(())
}
-unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::v1::Argument, args: &[ArgumentV1<'_>]) -> Result {
- fmt.fill = arg.format.fill;
- fmt.align = arg.format.align;
- fmt.flags = arg.format.flags;
+unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::Placeholder, args: &[rt::Argument<'_>]) -> Result {
+ fmt.fill = arg.fill;
+ fmt.align = arg.align;
+ fmt.flags = arg.flags;
// SAFETY: arg and args come from the same Arguments,
// which guarantees the indexes are always within bounds.
unsafe {
- fmt.width = getcount(args, &arg.format.width);
- fmt.precision = getcount(args, &arg.format.precision);
+ fmt.width = getcount(args, &arg.width);
+ fmt.precision = getcount(args, &arg.precision);
}
// Extract the correct argument
@@ -1299,14 +1139,14 @@ unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::v1::Argument, args: &[ArgumentV
let value = unsafe { args.get_unchecked(arg.position) };
// Then actually do some printing
- (value.formatter)(value.value, fmt)
+ value.fmt(fmt)
}
-unsafe fn getcount(args: &[ArgumentV1<'_>], cnt: &rt::v1::Count) -> Option<usize> {
+unsafe fn getcount(args: &[rt::Argument<'_>], cnt: &rt::Count) -> Option<usize> {
match *cnt {
- rt::v1::Count::Is(n) => Some(n),
- rt::v1::Count::Implied => None,
- rt::v1::Count::Param(i) => {
+ rt::Count::Is(n) => Some(n),
+ rt::Count::Implied => None,
+ rt::Count::Param(i) => {
debug_assert!(i < args.len());
// SAFETY: cnt and args come from the same Arguments,
// which guarantees this index is always within bounds.
@@ -1388,7 +1228,7 @@ impl<'a> Formatter<'a> {
/// }
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// // We need to remove "-" from the number output.
/// let tmp = self.nb.abs().to_string();
///
@@ -1449,9 +1289,9 @@ impl<'a> Formatter<'a> {
// is zero
Some(min) if self.sign_aware_zero_pad() => {
let old_fill = crate::mem::replace(&mut self.fill, '0');
- let old_align = crate::mem::replace(&mut self.align, rt::v1::Alignment::Right);
+ let old_align = crate::mem::replace(&mut self.align, rt::Alignment::Right);
write_prefix(self, sign, prefix)?;
- let post_padding = self.padding(min - width, rt::v1::Alignment::Right)?;
+ let post_padding = self.padding(min - width, Alignment::Right)?;
self.buf.write_str(buf)?;
post_padding.write(self)?;
self.fill = old_fill;
@@ -1460,7 +1300,7 @@ impl<'a> Formatter<'a> {
}
// Otherwise, the sign and prefix goes after the padding
Some(min) => {
- let post_padding = self.padding(min - width, rt::v1::Alignment::Right)?;
+ let post_padding = self.padding(min - width, Alignment::Right)?;
write_prefix(self, sign, prefix)?;
self.buf.write_str(buf)?;
post_padding.write(self)
@@ -1488,7 +1328,7 @@ impl<'a> Formatter<'a> {
/// struct Foo;
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// formatter.pad("Foo")
/// }
/// }
@@ -1535,7 +1375,7 @@ impl<'a> Formatter<'a> {
// If we're under both the maximum and the minimum width, then fill
// up the minimum width with the specified string + some alignment.
else {
- let align = rt::v1::Alignment::Left;
+ let align = Alignment::Left;
let post_padding = self.padding(width - chars_count, align)?;
self.buf.write_str(s)?;
post_padding.write(self)
@@ -1550,17 +1390,19 @@ impl<'a> Formatter<'a> {
pub(crate) fn padding(
&mut self,
padding: usize,
- default: rt::v1::Alignment,
+ default: Alignment,
) -> result::Result<PostPadding, Error> {
let align = match self.align {
- rt::v1::Alignment::Unknown => default,
- _ => self.align,
+ rt::Alignment::Unknown => default,
+ rt::Alignment::Left => Alignment::Left,
+ rt::Alignment::Right => Alignment::Right,
+ rt::Alignment::Center => Alignment::Center,
};
let (pre_pad, post_pad) = match align {
- rt::v1::Alignment::Left => (0, padding),
- rt::v1::Alignment::Right | rt::v1::Alignment::Unknown => (padding, 0),
- rt::v1::Alignment::Center => (padding / 2, (padding + 1) / 2),
+ Alignment::Left => (0, padding),
+ Alignment::Right => (padding, 0),
+ Alignment::Center => (padding / 2, (padding + 1) / 2),
};
for _ in 0..pre_pad {
@@ -1573,14 +1415,17 @@ impl<'a> Formatter<'a> {
/// Takes the formatted parts and applies the padding.
/// Assumes that the caller already has rendered the parts with required precision,
/// so that `self.precision` can be ignored.
- fn pad_formatted_parts(&mut self, formatted: &numfmt::Formatted<'_>) -> Result {
+ ///
+ /// # Safety
+ ///
+ /// Any `numfmt::Part::Copy` parts in `formatted` must contain valid UTF-8.
+ unsafe fn pad_formatted_parts(&mut self, formatted: &numfmt::Formatted<'_>) -> Result {
if let Some(mut width) = self.width {
// for the sign-aware zero padding, we render the sign first and
// behave as if we had no sign from the beginning.
let mut formatted = formatted.clone();
let old_fill = self.fill;
let old_align = self.align;
- let mut align = old_align;
if self.sign_aware_zero_pad() {
// a sign always goes first
let sign = formatted.sign;
@@ -1589,19 +1434,22 @@ impl<'a> Formatter<'a> {
// remove the sign from the formatted parts
formatted.sign = "";
width = width.saturating_sub(sign.len());
- align = rt::v1::Alignment::Right;
self.fill = '0';
- self.align = rt::v1::Alignment::Right;
+ self.align = rt::Alignment::Right;
}
// remaining parts go through the ordinary padding process.
let len = formatted.len();
let ret = if width <= len {
// no padding
- self.write_formatted_parts(&formatted)
+ // SAFETY: Per the precondition.
+ unsafe { self.write_formatted_parts(&formatted) }
} else {
- let post_padding = self.padding(width - len, align)?;
- self.write_formatted_parts(&formatted)?;
+ let post_padding = self.padding(width - len, Alignment::Right)?;
+ // SAFETY: Per the precondition.
+ unsafe {
+ self.write_formatted_parts(&formatted)?;
+ }
post_padding.write(self)
};
self.fill = old_fill;
@@ -1609,20 +1457,20 @@ impl<'a> Formatter<'a> {
ret
} else {
// this is the common case and we take a shortcut
- self.write_formatted_parts(formatted)
+ // SAFETY: Per the precondition.
+ unsafe { self.write_formatted_parts(formatted) }
}
}
- fn write_formatted_parts(&mut self, formatted: &numfmt::Formatted<'_>) -> Result {
- fn write_bytes(buf: &mut dyn Write, s: &[u8]) -> Result {
+ /// # Safety
+ ///
+ /// Any `numfmt::Part::Copy` parts in `formatted` must contain valid UTF-8.
+ unsafe fn write_formatted_parts(&mut self, formatted: &numfmt::Formatted<'_>) -> Result {
+ unsafe fn write_bytes(buf: &mut dyn Write, s: &[u8]) -> Result {
// SAFETY: This is used for `numfmt::Part::Num` and `numfmt::Part::Copy`.
// It's safe to use for `numfmt::Part::Num` since every char `c` is between
- // `b'0'` and `b'9'`, which means `s` is valid UTF-8.
- // It's also probably safe in practice to use for `numfmt::Part::Copy(buf)`
- // since `buf` should be plain ASCII, but it's possible for someone to pass
- // in a bad value for `buf` into `numfmt::to_shortest_str` since it is a
- // public function.
- // FIXME: Determine whether this could result in UB.
+ // `b'0'` and `b'9'`, which means `s` is valid UTF-8. It's safe to use for
+ // `numfmt::Part::Copy` due to this function's precondition.
buf.write_str(unsafe { str::from_utf8_unchecked(s) })
}
@@ -1649,11 +1497,15 @@ impl<'a> Formatter<'a> {
*c = b'0' + (v % 10) as u8;
v /= 10;
}
- write_bytes(self.buf, &s[..len])?;
+ // SAFETY: Per the precondition.
+ unsafe {
+ write_bytes(self.buf, &s[..len])?;
+ }
}
- numfmt::Part::Copy(buf) => {
+ // SAFETY: Per the precondition.
+ numfmt::Part::Copy(buf) => unsafe {
write_bytes(self.buf, buf)?;
- }
+ },
}
}
Ok(())
@@ -1670,7 +1522,7 @@ impl<'a> Formatter<'a> {
/// struct Foo;
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// formatter.write_str("Foo")
/// // This is equivalent to:
/// // write!(formatter, "Foo")
@@ -1695,7 +1547,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(i32);
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// formatter.write_fmt(format_args!("Foo {}", self.0))
/// }
/// }
@@ -1730,7 +1582,7 @@ impl<'a> Formatter<'a> {
/// struct Foo;
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let c = formatter.fill();
/// if let Some(width) = formatter.width() {
/// for _ in 0..width {
@@ -1758,14 +1610,12 @@ impl<'a> Formatter<'a> {
/// # Examples
///
/// ```
- /// extern crate core;
- ///
/// use std::fmt::{self, Alignment};
///
/// struct Foo;
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let s = if let Some(s) = formatter.align() {
/// match s {
/// Alignment::Left => "left",
@@ -1788,10 +1638,10 @@ impl<'a> Formatter<'a> {
#[stable(feature = "fmt_flags_align", since = "1.28.0")]
pub fn align(&self) -> Option<Alignment> {
match self.align {
- rt::v1::Alignment::Left => Some(Alignment::Left),
- rt::v1::Alignment::Right => Some(Alignment::Right),
- rt::v1::Alignment::Center => Some(Alignment::Center),
- rt::v1::Alignment::Unknown => None,
+ rt::Alignment::Left => Some(Alignment::Left),
+ rt::Alignment::Right => Some(Alignment::Right),
+ rt::Alignment::Center => Some(Alignment::Center),
+ rt::Alignment::Unknown => None,
}
}
@@ -1805,7 +1655,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(i32);
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// if let Some(width) = formatter.width() {
/// // If we received a width, we use it
/// write!(formatter, "{:width$}", format!("Foo({})", self.0), width = width)
@@ -1836,7 +1686,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(f32);
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// if let Some(precision) = formatter.precision() {
/// // If we received a precision, we use it.
/// write!(formatter, "Foo({1:.*})", precision, self.0)
@@ -1866,7 +1716,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(i32);
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// if formatter.sign_plus() {
/// write!(formatter,
/// "Foo({}{})",
@@ -1885,7 +1735,7 @@ impl<'a> Formatter<'a> {
#[must_use]
#[stable(feature = "fmt_flags", since = "1.5.0")]
pub fn sign_plus(&self) -> bool {
- self.flags & (1 << FlagV1::SignPlus as u32) != 0
+ self.flags & (1 << rt::Flag::SignPlus as u32) != 0
}
/// Determines if the `-` flag was specified.
@@ -1898,7 +1748,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(i32);
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// if formatter.sign_minus() {
/// // You want a minus sign? Have one!
/// write!(formatter, "-Foo({})", self.0)
@@ -1914,7 +1764,7 @@ impl<'a> Formatter<'a> {
#[must_use]
#[stable(feature = "fmt_flags", since = "1.5.0")]
pub fn sign_minus(&self) -> bool {
- self.flags & (1 << FlagV1::SignMinus as u32) != 0
+ self.flags & (1 << rt::Flag::SignMinus as u32) != 0
}
/// Determines if the `#` flag was specified.
@@ -1927,7 +1777,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(i32);
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// if formatter.alternate() {
/// write!(formatter, "Foo({})", self.0)
/// } else {
@@ -1942,7 +1792,7 @@ impl<'a> Formatter<'a> {
#[must_use]
#[stable(feature = "fmt_flags", since = "1.5.0")]
pub fn alternate(&self) -> bool {
- self.flags & (1 << FlagV1::Alternate as u32) != 0
+ self.flags & (1 << rt::Flag::Alternate as u32) != 0
}
/// Determines if the `0` flag was specified.
@@ -1955,7 +1805,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(i32);
///
/// impl fmt::Display for Foo {
- /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// assert!(formatter.sign_aware_zero_pad());
/// assert_eq!(formatter.width(), Some(4));
/// // We ignore the formatter's options.
@@ -1968,17 +1818,17 @@ impl<'a> Formatter<'a> {
#[must_use]
#[stable(feature = "fmt_flags", since = "1.5.0")]
pub fn sign_aware_zero_pad(&self) -> bool {
- self.flags & (1 << FlagV1::SignAwareZeroPad as u32) != 0
+ self.flags & (1 << rt::Flag::SignAwareZeroPad as u32) != 0
}
// FIXME: Decide what public API we want for these two flags.
// https://github.com/rust-lang/rust/issues/48584
fn debug_lower_hex(&self) -> bool {
- self.flags & (1 << FlagV1::DebugLowerHex as u32) != 0
+ self.flags & (1 << rt::Flag::DebugLowerHex as u32) != 0
}
fn debug_upper_hex(&self) -> bool {
- self.flags & (1 << FlagV1::DebugUpperHex as u32) != 0
+ self.flags & (1 << rt::Flag::DebugUpperHex as u32) != 0
}
/// Creates a [`DebugStruct`] builder designed to assist with creation of
@@ -1999,7 +1849,7 @@ impl<'a> Formatter<'a> {
/// }
///
/// impl fmt::Debug for Foo {
- /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_struct("Foo")
/// .field("bar", &self.bar)
/// .field("baz", &self.baz)
@@ -2157,7 +2007,7 @@ impl<'a> Formatter<'a> {
/// struct Foo<T>(i32, String, PhantomData<T>);
///
/// impl<T> fmt::Debug for Foo<T> {
- /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_tuple("Foo")
/// .field(&self.0)
/// .field(&self.1)
@@ -2289,7 +2139,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(Vec<i32>);
///
/// impl fmt::Debug for Foo {
- /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_list().entries(self.0.iter()).finish()
/// }
/// }
@@ -2312,7 +2162,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(Vec<i32>);
///
/// impl fmt::Debug for Foo {
- /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_set().entries(self.0.iter()).finish()
/// }
/// }
@@ -2328,14 +2178,14 @@ impl<'a> Formatter<'a> {
/// ```rust
/// use std::fmt;
///
- /// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R));
- /// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V);
+ /// struct Arm<'a, L, R>(&'a (L, R));
+ /// struct Table<'a, K, V>(&'a [(K, V)], V);
///
/// impl<'a, L, R> fmt::Debug for Arm<'a, L, R>
/// where
/// L: 'a + fmt::Debug, R: 'a + fmt::Debug
/// {
- /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// L::fmt(&(self.0).0, fmt)?;
/// fmt.write_str(" => ")?;
/// R::fmt(&(self.0).1, fmt)
@@ -2346,7 +2196,7 @@ impl<'a> Formatter<'a> {
/// where
/// K: 'a + fmt::Debug, V: 'a + fmt::Debug
/// {
- /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_set()
/// .entries(self.0.iter().map(Arm))
/// .entry(&Arm(&(format_args!("_"), &self.1)))
@@ -2370,7 +2220,7 @@ impl<'a> Formatter<'a> {
/// struct Foo(Vec<(String, i32)>);
///
/// impl fmt::Debug for Foo {
- /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_map().entries(self.0.iter().map(|&(ref k, ref v)| (k, v))).finish()
/// }
/// }
@@ -2429,6 +2279,7 @@ fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperEx
#[unstable(feature = "never_type", issue = "35121")]
impl Debug for ! {
+ #[inline]
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
*self
}
@@ -2436,6 +2287,7 @@ impl Debug for ! {
#[unstable(feature = "never_type", issue = "35121")]
impl Display for ! {
+ #[inline]
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
*self
}
@@ -2538,13 +2390,13 @@ pub(crate) fn pointer_fmt_inner(ptr_addr: usize, f: &mut Formatter<'_>) -> Resul
// or not to zero extend, and then unconditionally set it to get the
// prefix.
if f.alternate() {
- f.flags |= 1 << (FlagV1::SignAwareZeroPad as u32);
+ f.flags |= 1 << (rt::Flag::SignAwareZeroPad as u32);
if f.width.is_none() {
f.width = Some((usize::BITS / 4) as usize + 2);
}
}
- f.flags |= 1 << (FlagV1::Alternate as u32);
+ f.flags |= 1 << (rt::Flag::Alternate as u32);
let ret = LowerHex::fmt(&ptr_addr, f);
diff --git a/library/core/src/fmt/num.rs b/library/core/src/fmt/num.rs
index d8365ae9b..4f42f73eb 100644
--- a/library/core/src/fmt/num.rs
+++ b/library/core/src/fmt/num.rs
@@ -52,8 +52,12 @@ impl_int! { i8 i16 i32 i64 i128 isize }
impl_uint! { u8 u16 u32 u64 u128 usize }
/// A type that represents a specific radix
+///
+/// # Safety
+///
+/// `digit` must return an ASCII character.
#[doc(hidden)]
-trait GenericRadix: Sized {
+unsafe trait GenericRadix: Sized {
/// The number of digits.
const BASE: u8;
@@ -129,7 +133,7 @@ struct UpperHex;
macro_rules! radix {
($T:ident, $base:expr, $prefix:expr, $($x:pat => $conv:expr),+) => {
- impl GenericRadix for $T {
+ unsafe impl GenericRadix for $T {
const BASE: u8 = $base;
const PREFIX: &'static str = $prefix;
fn digit(x: u8) -> u8 {
@@ -407,7 +411,7 @@ macro_rules! impl_Exp {
let parts = &[
numfmt::Part::Copy(buf_slice),
numfmt::Part::Zero(added_precision),
- numfmt::Part::Copy(exp_slice)
+ numfmt::Part::Copy(exp_slice),
];
let sign = if !is_nonnegative {
"-"
@@ -416,8 +420,9 @@ macro_rules! impl_Exp {
} else {
""
};
- let formatted = numfmt::Formatted{sign, parts};
- f.pad_formatted_parts(&formatted)
+ let formatted = numfmt::Formatted { sign, parts };
+ // SAFETY: `buf_slice` and `exp_slice` contain only ASCII characters.
+ unsafe { f.pad_formatted_parts(&formatted) }
}
$(
diff --git a/library/core/src/fmt/rt.rs b/library/core/src/fmt/rt.rs
new file mode 100644
index 000000000..d37888c27
--- /dev/null
+++ b/library/core/src/fmt/rt.rs
@@ -0,0 +1,212 @@
+#![allow(missing_debug_implementations)]
+#![unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
+
+//! These are the lang items used by format_args!().
+
+use super::*;
+
+#[lang = "format_placeholder"]
+#[derive(Copy, Clone)]
+pub struct Placeholder {
+ pub position: usize,
+ pub fill: char,
+ pub align: Alignment,
+ pub flags: u32,
+ pub precision: Count,
+ pub width: Count,
+}
+
+impl Placeholder {
+ #[inline(always)]
+ pub const fn new(
+ position: usize,
+ fill: char,
+ align: Alignment,
+ flags: u32,
+ precision: Count,
+ width: Count,
+ ) -> Self {
+ Self { position, fill, align, flags, precision, width }
+ }
+}
+
+#[lang = "format_alignment"]
+#[derive(Copy, Clone, PartialEq, Eq)]
+pub enum Alignment {
+ Left,
+ Right,
+ Center,
+ Unknown,
+}
+
+/// Used by [width](https://doc.rust-lang.org/std/fmt/#width)
+/// and [precision](https://doc.rust-lang.org/std/fmt/#precision) specifiers.
+#[lang = "format_count"]
+#[derive(Copy, Clone)]
+pub enum Count {
+ /// Specified with a literal number, stores the value
+ Is(usize),
+ /// Specified using `$` and `*` syntaxes, stores the index into `args`
+ Param(usize),
+ /// Not specified
+ Implied,
+}
+
+// This needs to match the order of flags in compiler/rustc_ast_lowering/src/format.rs.
+#[derive(Copy, Clone)]
+pub(super) enum Flag {
+ SignPlus,
+ SignMinus,
+ Alternate,
+ SignAwareZeroPad,
+ DebugLowerHex,
+ DebugUpperHex,
+}
+
+/// This struct represents the generic "argument" which is taken by format_args!().
+/// It contains a function to format the given value. At compile time it is ensured that the
+/// function and the value have the correct types, and then this struct is used to canonicalize
+/// arguments to one type.
+///
+/// Argument is essentially an optimized partially applied formatting function,
+/// equivalent to `exists T.(&T, fn(&T, &mut Formatter<'_>) -> Result`.
+#[lang = "format_argument"]
+#[derive(Copy, Clone)]
+pub struct Argument<'a> {
+ value: &'a Opaque,
+ formatter: fn(&Opaque, &mut Formatter<'_>) -> Result,
+}
+
+#[rustc_diagnostic_item = "ArgumentMethods"]
+impl<'a> Argument<'a> {
+ #[inline(always)]
+ fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter<'_>) -> Result) -> Argument<'b> {
+ // SAFETY: `mem::transmute(x)` is safe because
+ // 1. `&'b T` keeps the lifetime it originated with `'b`
+ // (so as to not have an unbounded lifetime)
+ // 2. `&'b T` and `&'b Opaque` have the same memory layout
+ // (when `T` is `Sized`, as it is here)
+ // `mem::transmute(f)` is safe since `fn(&T, &mut Formatter<'_>) -> Result`
+ // and `fn(&Opaque, &mut Formatter<'_>) -> Result` have the same ABI
+ // (as long as `T` is `Sized`)
+ unsafe { Argument { formatter: mem::transmute(f), value: mem::transmute(x) } }
+ }
+
+ #[inline(always)]
+ pub fn new_display<'b, T: Display>(x: &'b T) -> Argument<'_> {
+ Self::new(x, Display::fmt)
+ }
+ #[inline(always)]
+ pub fn new_debug<'b, T: Debug>(x: &'b T) -> Argument<'_> {
+ Self::new(x, Debug::fmt)
+ }
+ #[inline(always)]
+ pub fn new_octal<'b, T: Octal>(x: &'b T) -> Argument<'_> {
+ Self::new(x, Octal::fmt)
+ }
+ #[inline(always)]
+ pub fn new_lower_hex<'b, T: LowerHex>(x: &'b T) -> Argument<'_> {
+ Self::new(x, LowerHex::fmt)
+ }
+ #[inline(always)]
+ pub fn new_upper_hex<'b, T: UpperHex>(x: &'b T) -> Argument<'_> {
+ Self::new(x, UpperHex::fmt)
+ }
+ #[inline(always)]
+ pub fn new_pointer<'b, T: Pointer>(x: &'b T) -> Argument<'_> {
+ Self::new(x, Pointer::fmt)
+ }
+ #[inline(always)]
+ pub fn new_binary<'b, T: Binary>(x: &'b T) -> Argument<'_> {
+ Self::new(x, Binary::fmt)
+ }
+ #[inline(always)]
+ pub fn new_lower_exp<'b, T: LowerExp>(x: &'b T) -> Argument<'_> {
+ Self::new(x, LowerExp::fmt)
+ }
+ #[inline(always)]
+ pub fn new_upper_exp<'b, T: UpperExp>(x: &'b T) -> Argument<'_> {
+ Self::new(x, UpperExp::fmt)
+ }
+ #[inline(always)]
+ pub fn from_usize(x: &usize) -> Argument<'_> {
+ Self::new(x, USIZE_MARKER)
+ }
+
+ #[inline(always)]
+ pub(super) fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+ (self.formatter)(self.value, f)
+ }
+
+ #[inline(always)]
+ pub(super) fn as_usize(&self) -> Option<usize> {
+ // We are type punning a bit here: USIZE_MARKER only takes an &usize but
+ // formatter takes an &Opaque. Rust understandably doesn't think we should compare
+ // the function pointers if they don't have the same signature, so we cast to
+ // usizes to tell it that we just want to compare addresses.
+ if self.formatter as usize == USIZE_MARKER as usize {
+ // SAFETY: The `formatter` field is only set to USIZE_MARKER if
+ // the value is a usize, so this is safe
+ Some(unsafe { *(self.value as *const _ as *const usize) })
+ } else {
+ None
+ }
+ }
+
+ /// Used by `format_args` when all arguments are gone after inlining,
+ /// when using `&[]` would incorrectly allow for a bigger lifetime.
+ ///
+ /// This fails without format argument inlining, and that shouldn't be different
+ /// when the argument is inlined:
+ ///
+ /// ```compile_fail,E0716
+ /// let f = format_args!("{}", "a");
+ /// println!("{f}");
+ /// ```
+ #[inline(always)]
+ pub fn none() -> [Self; 0] {
+ []
+ }
+}
+
+/// This struct represents the unsafety of constructing an `Arguments`.
+/// It exists, rather than an unsafe function, in order to simplify the expansion
+/// of `format_args!(..)` and reduce the scope of the `unsafe` block.
+#[lang = "format_unsafe_arg"]
+pub struct UnsafeArg {
+ _private: (),
+}
+
+impl UnsafeArg {
+ /// See documentation where `UnsafeArg` is required to know when it is safe to
+ /// create and use `UnsafeArg`.
+ #[inline(always)]
+ pub unsafe fn new() -> Self {
+ Self { _private: () }
+ }
+}
+
+extern "C" {
+ type Opaque;
+}
+
+// This guarantees a single stable value for the function pointer associated with
+// indices/counts in the formatting infrastructure.
+//
+// Note that a function defined as such would not be correct as functions are
+// always tagged unnamed_addr with the current lowering to LLVM IR, so their
+// address is not considered important to LLVM and as such the as_usize cast
+// could have been miscompiled. In practice, we never call as_usize on non-usize
+// containing data (as a matter of static generation of the formatting
+// arguments), so this is merely an additional check.
+//
+// We primarily want to ensure that the function pointer at `USIZE_MARKER` has
+// an address corresponding *only* to functions that also take `&usize` as their
+// first argument. The read_volatile here ensures that we can safely ready out a
+// usize from the passed reference and that this address does not point at a
+// non-usize taking function.
+static USIZE_MARKER: fn(&usize, &mut Formatter<'_>) -> Result = |ptr, _| {
+ // SAFETY: ptr is a reference
+ let _v: usize = unsafe { crate::ptr::read_volatile(ptr) };
+ loop {}
+};
diff --git a/library/core/src/fmt/rt/v1.rs b/library/core/src/fmt/rt/v1.rs
deleted file mode 100644
index 6d70796f7..000000000
--- a/library/core/src/fmt/rt/v1.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-//! This is an internal module used by the ifmt! runtime. These structures are
-//! emitted to static arrays to precompile format strings ahead of time.
-//!
-//! These definitions are similar to their `ct` equivalents, but differ in that
-//! these can be statically allocated and are slightly optimized for the runtime
-#![allow(missing_debug_implementations)]
-
-#[lang = "format_placeholder"]
-#[derive(Copy, Clone)]
-// FIXME: Rename this to Placeholder
-pub struct Argument {
- pub position: usize,
- pub format: FormatSpec,
-}
-
-#[derive(Copy, Clone)]
-pub struct FormatSpec {
- pub fill: char,
- pub align: Alignment,
- pub flags: u32,
- pub precision: Count,
- pub width: Count,
-}
-
-impl Argument {
- #[inline(always)]
- pub const fn new(
- position: usize,
- fill: char,
- align: Alignment,
- flags: u32,
- precision: Count,
- width: Count,
- ) -> Self {
- Self { position, format: FormatSpec { fill, align, flags, precision, width } }
- }
-}
-
-/// Possible alignments that can be requested as part of a formatting directive.
-#[lang = "format_alignment"]
-#[derive(Copy, Clone, PartialEq, Eq)]
-pub enum Alignment {
- /// Indication that contents should be left-aligned.
- Left,
- /// Indication that contents should be right-aligned.
- Right,
- /// Indication that contents should be center-aligned.
- Center,
- /// No alignment was requested.
- Unknown,
-}
-
-/// Used by [width](https://doc.rust-lang.org/std/fmt/#width) and [precision](https://doc.rust-lang.org/std/fmt/#precision) specifiers.
-#[lang = "format_count"]
-#[derive(Copy, Clone)]
-pub enum Count {
- /// Specified with a literal number, stores the value
- Is(usize),
- /// Specified using `$` and `*` syntaxes, stores the index into `args`
- Param(usize),
- /// Not specified
- Implied,
-}
diff --git a/library/core/src/future/into_future.rs b/library/core/src/future/into_future.rs
index 649b43387..38c654e76 100644
--- a/library/core/src/future/into_future.rs
+++ b/library/core/src/future/into_future.rs
@@ -99,6 +99,7 @@ use crate::future::Future;
/// }
/// ```
#[stable(feature = "into_future", since = "1.64.0")]
+#[rustc_diagnostic_item = "IntoFuture"]
pub trait IntoFuture {
/// The output that the future will produce on completion.
#[stable(feature = "into_future", since = "1.64.0")]
diff --git a/library/core/src/future/join.rs b/library/core/src/future/join.rs
index 35f0dea06..3f35179dd 100644
--- a/library/core/src/future/join.rs
+++ b/library/core/src/future/join.rs
@@ -4,7 +4,7 @@ use crate::cell::UnsafeCell;
use crate::future::{poll_fn, Future};
use crate::mem;
use crate::pin::Pin;
-use crate::task::{Context, Poll};
+use crate::task::{ready, Context, Poll};
/// Polls multiple futures simultaneously, returning a tuple
/// of all results once complete.
@@ -118,7 +118,7 @@ macro join_internal {
fut
})
};
- // Despite how tempting it may be to `let () = fut.poll(cx).ready()?;`
+ // Despite how tempting it may be to `let () = ready!(fut.poll(cx));`
// doing so would defeat the point of `join!`: to start polling eagerly all
// of the futures, to allow parallelizing the waits.
done &= fut.poll(cx).is_ready();
@@ -180,7 +180,7 @@ impl<F: Future> Future for MaybeDone<F> {
// Do not mix match ergonomics with unsafe.
match *self.as_mut().get_unchecked_mut() {
MaybeDone::Future(ref mut f) => {
- let val = Pin::new_unchecked(f).poll(cx).ready()?;
+ let val = ready!(Pin::new_unchecked(f).poll(cx));
self.set(Self::Done(val));
}
MaybeDone::Done(_) => {}
diff --git a/library/core/src/future/mod.rs b/library/core/src/future/mod.rs
index 04f02d47f..089493d37 100644
--- a/library/core/src/future/mod.rs
+++ b/library/core/src/future/mod.rs
@@ -66,11 +66,3 @@ pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> {
// that fulfills all the requirements for a mutable reference.
unsafe { &mut *cx.0.as_ptr().cast() }
}
-
-#[doc(hidden)]
-#[unstable(feature = "gen_future", issue = "50547")]
-#[inline]
-#[cfg_attr(bootstrap, lang = "identity_future")]
-pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut {
- f
-}
diff --git a/library/core/src/hash/mod.rs b/library/core/src/hash/mod.rs
index 4e7bae7bc..794a57f09 100644
--- a/library/core/src/hash/mod.rs
+++ b/library/core/src/hash/mod.rs
@@ -86,8 +86,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
use crate::fmt;
-use crate::intrinsics::const_eval_select;
-use crate::marker::{self, Destruct};
+use crate::marker;
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
@@ -184,7 +183,6 @@ mod sip;
/// [impl]: ../../std/primitive.str.html#impl-Hash-for-str
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Hash"]
-#[const_trait]
pub trait Hash {
/// Feeds this value into the given [`Hasher`].
///
@@ -199,7 +197,7 @@ pub trait Hash {
/// println!("Hash is {:x}!", hasher.finish());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- fn hash<H: ~const Hasher>(&self, state: &mut H);
+ fn hash<H: Hasher>(&self, state: &mut H);
/// Feeds a slice of this type into the given [`Hasher`].
///
@@ -236,25 +234,13 @@ pub trait Hash {
/// [`hash`]: Hash::hash
/// [`hash_slice`]: Hash::hash_slice
#[stable(feature = "hash_slice", since = "1.3.0")]
- fn hash_slice<H: ~const Hasher>(data: &[Self], state: &mut H)
+ fn hash_slice<H: Hasher>(data: &[Self], state: &mut H)
where
Self: Sized,
{
- //FIXME(const_trait_impl): revert to only a for loop
- fn rt<T: Hash, H: Hasher>(data: &[T], state: &mut H) {
- for piece in data {
- piece.hash(state)
- }
- }
- const fn ct<T: ~const Hash, H: ~const Hasher>(data: &[T], state: &mut H) {
- let mut i = 0;
- while i < data.len() {
- data[i].hash(state);
- i += 1;
- }
+ for piece in data {
+ piece.hash(state)
}
- // SAFETY: same behavior, CT just uses while instead of for
- unsafe { const_eval_select((data, state), ct, rt) };
}
}
@@ -327,7 +313,6 @@ pub use macros::Hash;
/// [`write_u8`]: Hasher::write_u8
/// [`write_u32`]: Hasher::write_u32
#[stable(feature = "rust1", since = "1.0.0")]
-#[const_trait]
pub trait Hasher {
/// Returns the hash value for the values written so far.
///
@@ -573,8 +558,7 @@ pub trait Hasher {
}
#[stable(feature = "indirect_hasher_impl", since = "1.22.0")]
-#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
-impl<H: ~const Hasher + ?Sized> const Hasher for &mut H {
+impl<H: Hasher + ?Sized> Hasher for &mut H {
fn finish(&self) -> u64 {
(**self).finish()
}
@@ -654,7 +638,6 @@ impl<H: ~const Hasher + ?Sized> const Hasher for &mut H {
/// [`build_hasher`]: BuildHasher::build_hasher
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
#[stable(since = "1.7.0", feature = "build_hasher")]
-#[const_trait]
pub trait BuildHasher {
/// Type of the hasher that will be created.
#[stable(since = "1.7.0", feature = "build_hasher")]
@@ -691,8 +674,6 @@ pub trait BuildHasher {
/// # Example
///
/// ```
- /// #![feature(build_hasher_simple_hash_one)]
- ///
/// use std::cmp::{max, min};
/// use std::hash::{BuildHasher, Hash, Hasher};
/// struct OrderAmbivalentPair<T: Ord>(T, T);
@@ -714,11 +695,11 @@ pub trait BuildHasher {
/// bh.hash_one(&OrderAmbivalentPair(2, 10))
/// );
/// ```
- #[unstable(feature = "build_hasher_simple_hash_one", issue = "86161")]
- fn hash_one<T: ~const Hash + ~const Destruct>(&self, x: T) -> u64
+ #[stable(feature = "build_hasher_simple_hash_one", since = "1.71.0")]
+ fn hash_one<T: Hash>(&self, x: T) -> u64
where
Self: Sized,
- Self::Hasher: ~const Hasher + ~const Destruct,
+ Self::Hasher: Hasher,
{
let mut hasher = self.build_hasher();
x.hash(&mut hasher);
@@ -782,8 +763,7 @@ impl<H> fmt::Debug for BuildHasherDefault<H> {
}
#[stable(since = "1.7.0", feature = "build_hasher")]
-#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
-impl<H: ~const Default + Hasher> const BuildHasher for BuildHasherDefault<H> {
+impl<H: Default + Hasher> BuildHasher for BuildHasherDefault<H> {
type Hasher = H;
fn build_hasher(&self) -> H {
@@ -799,8 +779,7 @@ impl<H> Clone for BuildHasherDefault<H> {
}
#[stable(since = "1.7.0", feature = "build_hasher")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<H> const Default for BuildHasherDefault<H> {
+impl<H> Default for BuildHasherDefault<H> {
fn default() -> BuildHasherDefault<H> {
BuildHasherDefault(marker::PhantomData)
}
@@ -825,15 +804,14 @@ mod impls {
macro_rules! impl_write {
($(($ty:ident, $meth:ident),)*) => {$(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl const Hash for $ty {
+ impl Hash for $ty {
#[inline]
- fn hash<H: ~const Hasher>(&self, state: &mut H) {
+ fn hash<H: Hasher>(&self, state: &mut H) {
state.$meth(*self)
}
#[inline]
- fn hash_slice<H: ~const Hasher>(data: &[$ty], state: &mut H) {
+ fn hash_slice<H: Hasher>(data: &[$ty], state: &mut H) {
let newlen = mem::size_of_val(data);
let ptr = data.as_ptr() as *const u8;
// SAFETY: `ptr` is valid and aligned, as this macro is only used
@@ -862,37 +840,33 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl const Hash for bool {
+ impl Hash for bool {
#[inline]
- fn hash<H: ~const Hasher>(&self, state: &mut H) {
+ fn hash<H: Hasher>(&self, state: &mut H) {
state.write_u8(*self as u8)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl const Hash for char {
+ impl Hash for char {
#[inline]
- fn hash<H: ~const Hasher>(&self, state: &mut H) {
+ fn hash<H: Hasher>(&self, state: &mut H) {
state.write_u32(*self as u32)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl const Hash for str {
+ impl Hash for str {
#[inline]
- fn hash<H: ~const Hasher>(&self, state: &mut H) {
+ fn hash<H: Hasher>(&self, state: &mut H) {
state.write_str(self);
}
}
#[stable(feature = "never_hash", since = "1.29.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl const Hash for ! {
+ impl Hash for ! {
#[inline]
- fn hash<H: ~const Hasher>(&self, _: &mut H) {
+ fn hash<H: Hasher>(&self, _: &mut H) {
*self
}
}
@@ -900,10 +874,9 @@ mod impls {
macro_rules! impl_hash_tuple {
() => (
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl const Hash for () {
+ impl Hash for () {
#[inline]
- fn hash<H: ~const Hasher>(&self, _state: &mut H) {}
+ fn hash<H: Hasher>(&self, _state: &mut H) {}
}
);
@@ -911,11 +884,10 @@ mod impls {
maybe_tuple_doc! {
$($name)+ @
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl<$($name: ~const Hash),+> const Hash for ($($name,)+) where last_type!($($name,)+): ?Sized {
+ impl<$($name: Hash),+> Hash for ($($name,)+) where last_type!($($name,)+): ?Sized {
#[allow(non_snake_case)]
#[inline]
- fn hash<S: ~const Hasher>(&self, state: &mut S) {
+ fn hash<S: Hasher>(&self, state: &mut S) {
let ($(ref $name,)+) = *self;
$($name.hash(state);)+
}
@@ -958,29 +930,26 @@ mod impls {
impl_hash_tuple! { T B C D E F G H I J K L }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl<T: ~const Hash> const Hash for [T] {
+ impl<T: Hash> Hash for [T] {
#[inline]
- fn hash<H: ~const Hasher>(&self, state: &mut H) {
+ fn hash<H: Hasher>(&self, state: &mut H) {
state.write_length_prefix(self.len());
Hash::hash_slice(self, state)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl<T: ?Sized + ~const Hash> const Hash for &T {
+ impl<T: ?Sized + Hash> Hash for &T {
#[inline]
- fn hash<H: ~const Hasher>(&self, state: &mut H) {
+ fn hash<H: Hasher>(&self, state: &mut H) {
(**self).hash(state);
}
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
- impl<T: ?Sized + ~const Hash> const Hash for &mut T {
+ impl<T: ?Sized + Hash> Hash for &mut T {
#[inline]
- fn hash<H: ~const Hasher>(&self, state: &mut H) {
+ fn hash<H: Hasher>(&self, state: &mut H) {
(**self).hash(state);
}
}
diff --git a/library/core/src/hash/sip.rs b/library/core/src/hash/sip.rs
index 7f8287bf5..6b9f2e842 100644
--- a/library/core/src/hash/sip.rs
+++ b/library/core/src/hash/sip.rs
@@ -118,7 +118,7 @@ macro_rules! load_int_le {
/// Safety: this performs unchecked indexing of `buf` at `start..start+len`, so
/// that must be in-bounds.
#[inline]
-const unsafe fn u8to64_le(buf: &[u8], start: usize, len: usize) -> u64 {
+unsafe fn u8to64_le(buf: &[u8], start: usize, len: usize) -> u64 {
debug_assert!(len < 8);
let mut i = 0; // current byte index (from LSB) in the output u64
let mut out = 0;
@@ -225,8 +225,7 @@ impl<S: Sip> Hasher<S> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
-impl const super::Hasher for SipHasher {
+impl super::Hasher for SipHasher {
#[inline]
fn write(&mut self, msg: &[u8]) {
self.0.hasher.write(msg)
@@ -244,8 +243,7 @@ impl const super::Hasher for SipHasher {
}
#[unstable(feature = "hashmap_internals", issue = "none")]
-#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
-impl const super::Hasher for SipHasher13 {
+impl super::Hasher for SipHasher13 {
#[inline]
fn write(&mut self, msg: &[u8]) {
self.hasher.write(msg)
@@ -262,7 +260,7 @@ impl const super::Hasher for SipHasher13 {
}
}
-impl<S: ~const Sip> const super::Hasher for Hasher<S> {
+impl<S: Sip> super::Hasher for Hasher<S> {
// Note: no integer hashing methods (`write_u*`, `write_i*`) are defined
// for this type. We could add them, copy the `short_write` implementation
// in librustc_data_structures/sip128.rs, and add `write_u*`/`write_i*`
@@ -342,7 +340,7 @@ impl<S: ~const Sip> const super::Hasher for Hasher<S> {
}
}
-impl<S: Sip> const Clone for Hasher<S> {
+impl<S: Sip> Clone for Hasher<S> {
#[inline]
fn clone(&self) -> Hasher<S> {
Hasher {
@@ -366,7 +364,6 @@ impl<S: Sip> Default for Hasher<S> {
}
#[doc(hidden)]
-#[const_trait]
trait Sip {
fn c_rounds(_: &mut State);
fn d_rounds(_: &mut State);
@@ -375,7 +372,7 @@ trait Sip {
#[derive(Debug, Clone, Default)]
struct Sip13Rounds;
-impl const Sip for Sip13Rounds {
+impl Sip for Sip13Rounds {
#[inline]
fn c_rounds(state: &mut State) {
compress!(state);
@@ -392,7 +389,7 @@ impl const Sip for Sip13Rounds {
#[derive(Debug, Clone, Default)]
struct Sip24Rounds;
-impl const Sip for Sip24Rounds {
+impl Sip for Sip24Rounds {
#[inline]
fn c_rounds(state: &mut State) {
compress!(state);
diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs
index a20556577..75c104ce2 100644
--- a/library/core/src/hint.rs
+++ b/library/core/src/hint.rs
@@ -73,8 +73,8 @@ use crate::intrinsics;
/// ```
///
/// While using `unreachable_unchecked()` is perfectly sound in the following
-/// example, the compiler is able to prove that a division by zero is not
-/// possible. Benchmarking reveals that `unreachable_unchecked()` provides
+/// example, as the compiler is able to prove that a division by zero is not
+/// possible, benchmarking reveals that `unreachable_unchecked()` provides
/// no benefit over using [`unreachable!`], while the latter does not introduce
/// the possibility of Undefined Behavior.
///
@@ -217,17 +217,14 @@ pub fn spin_loop() {
/// Note however, that `black_box` is only (and can only be) provided on a "best-effort" basis. The
/// extent to which it can block optimisations may vary depending upon the platform and code-gen
/// backend used. Programs cannot rely on `black_box` for *correctness*, beyond it behaving as the
-/// identity function.
+/// identity function. As such, it **must not be relied upon to control critical program behavior.**
+/// This _immediately_ precludes any direct use of this function for cryptographic or security
+/// purposes.
///
/// [`std::convert::identity`]: crate::convert::identity
///
/// # When is this useful?
///
-/// First and foremost: `black_box` does _not_ guarantee any exact behavior and, in some cases, may
-/// do nothing at all. As such, it **must not be relied upon to control critical program behavior.**
-/// This _immediately_ precludes any direct use of this function for cryptographic or security
-/// purposes.
-///
/// While not suitable in those mission-critical cases, `black_box`'s functionality can generally be
/// relied upon for benchmarking, and should be used there. It will try to ensure that the
/// compiler doesn't optimize away part of the intended test code based on context. For
diff --git a/library/core/src/internal_macros.rs b/library/core/src/internal_macros.rs
index 5d4c9ba73..5774107f5 100644
--- a/library/core/src/internal_macros.rs
+++ b/library/core/src/internal_macros.rs
@@ -1,23 +1,10 @@
// implements the unary operator "op &T"
// based on "op T" where T is expected to be `Copy`able
macro_rules! forward_ref_unop {
- (impl const $imp:ident, $method:ident for $t:ty) => {
- forward_ref_unop!(impl const $imp, $method for $t,
+ (impl $imp:ident, $method:ident for $t:ty) => {
+ forward_ref_unop!(impl $imp, $method for $t,
#[stable(feature = "rust1", since = "1.0.0")]);
};
- // Equivalent to the non-const version, with the addition of `rustc_const_unstable`
- (impl const $imp:ident, $method:ident for $t:ty, #[$attr:meta]) => {
- #[$attr]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const $imp for &$t {
- type Output = <$t as $imp>::Output;
-
- #[inline]
- fn $method(self) -> <$t as $imp>::Output {
- $imp::$method(*self)
- }
- }
- };
(impl $imp:ident, $method:ident for $t:ty, #[$attr:meta]) => {
#[$attr]
impl $imp for &$t {
@@ -34,45 +21,10 @@ macro_rules! forward_ref_unop {
// implements binary operators "&T op U", "T op &U", "&T op &U"
// based on "T op U" where T and U are expected to be `Copy`able
macro_rules! forward_ref_binop {
- (impl const $imp:ident, $method:ident for $t:ty, $u:ty) => {
- forward_ref_binop!(impl const $imp, $method for $t, $u,
+ (impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
+ forward_ref_binop!(impl $imp, $method for $t, $u,
#[stable(feature = "rust1", since = "1.0.0")]);
};
- // Equivalent to the non-const version, with the addition of `rustc_const_unstable`
- (impl const $imp:ident, $method:ident for $t:ty, $u:ty, #[$attr:meta]) => {
- #[$attr]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl<'a> const $imp<$u> for &'a $t {
- type Output = <$t as $imp<$u>>::Output;
-
- #[inline]
- fn $method(self, other: $u) -> <$t as $imp<$u>>::Output {
- $imp::$method(*self, other)
- }
- }
-
- #[$attr]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const $imp<&$u> for $t {
- type Output = <$t as $imp<$u>>::Output;
-
- #[inline]
- fn $method(self, other: &$u) -> <$t as $imp<$u>>::Output {
- $imp::$method(self, *other)
- }
- }
-
- #[$attr]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const $imp<&$u> for &$t {
- type Output = <$t as $imp<$u>>::Output;
-
- #[inline]
- fn $method(self, other: &$u) -> <$t as $imp<$u>>::Output {
- $imp::$method(*self, *other)
- }
- }
- };
(impl $imp:ident, $method:ident for $t:ty, $u:ty, #[$attr:meta]) => {
#[$attr]
impl<'a> $imp<$u> for &'a $t {
@@ -113,21 +65,6 @@ macro_rules! forward_ref_op_assign {
forward_ref_op_assign!(impl $imp, $method for $t, $u,
#[stable(feature = "op_assign_builtins_by_ref", since = "1.22.0")]);
};
- (impl const $imp:ident, $method:ident for $t:ty, $u:ty) => {
- forward_ref_op_assign!(impl const $imp, $method for $t, $u,
- #[stable(feature = "op_assign_builtins_by_ref", since = "1.22.0")]);
- };
- // Equivalent to the non-const version, with the addition of `rustc_const_unstable`
- (impl const $imp:ident, $method:ident for $t:ty, $u:ty, #[$attr:meta]) => {
- #[$attr]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const $imp<&$u> for $t {
- #[inline]
- fn $method(&mut self, other: &$u) {
- $imp::$method(self, *other);
- }
- }
- };
(impl $imp:ident, $method:ident for $t:ty, $u:ty, #[$attr:meta]) => {
#[$attr]
impl $imp<&$u> for $t {
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index a7c100e1b..f5c5dd29f 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -1187,7 +1187,7 @@ extern "rust-intrinsic" {
/// Below are common applications of `transmute` which can be replaced with safer
/// constructs.
///
- /// Turning raw bytes (`&[u8]`) into `u32`, `f64`, etc.:
+ /// Turning raw bytes (`[u8; SZ]`) into `u32`, `f64`, etc.:
///
/// ```
/// let raw_bytes = [0x78, 0x56, 0x34, 0x12];
@@ -1376,6 +1376,20 @@ extern "rust-intrinsic" {
#[rustc_nounwind]
pub fn transmute<Src, Dst>(src: Src) -> Dst;
+ /// Like [`transmute`], but even less checked at compile-time: rather than
+ /// giving an error for `size_of::<Src>() != size_of::<Dst>()`, it's
+ /// **Undefined Behaviour** at runtime.
+ ///
+ /// Prefer normal `transmute` where possible, for the extra checking, since
+ /// both do exactly the same thing at runtime, if they both compile.
+ ///
+ /// This is not expected to ever be exposed directly to users, rather it
+ /// may eventually be exposed through some more-constrained API.
+ #[cfg(not(bootstrap))]
+ #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
+ #[rustc_nounwind]
+ pub fn transmute_unchecked<Src, Dst>(src: Src) -> Dst;
+
/// Returns `true` if the actual type given as `T` requires drop
/// glue; returns `false` if the actual type provided for `T`
/// implements `Copy`.
@@ -1399,6 +1413,10 @@ extern "rust-intrinsic" {
/// This is implemented as an intrinsic to avoid converting to and from an
/// integer, since the conversion would throw away aliasing information.
///
+ /// This can only be used with `Ptr` as a raw pointer type (`*mut` or `*const`)
+ /// to a `Sized` pointee and with `Delta` as `usize` or `isize`. Any other
+ /// instantiations may arbitrarily misbehave, and that's *not* a compiler bug.
+ ///
/// # Safety
///
/// Both the starting and resulting pointer must be either in bounds or one
@@ -1407,6 +1425,14 @@ extern "rust-intrinsic" {
/// returned value will result in undefined behavior.
///
/// The stabilized version of this intrinsic is [`pointer::offset`].
+ #[cfg(not(bootstrap))]
+ #[must_use = "returns a new pointer rather than modifying its argument"]
+ #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
+ #[rustc_nounwind]
+ pub fn offset<Ptr, Delta>(dst: Ptr, offset: Delta) -> Ptr;
+
+ /// The bootstrap version of this is more restricted.
+ #[cfg(bootstrap)]
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
#[rustc_nounwind]
@@ -1797,14 +1823,12 @@ extern "rust-intrinsic" {
/// with an even least significant digit.
///
/// This intrinsic does not have a stable counterpart.
- #[cfg(not(bootstrap))]
#[rustc_nounwind]
pub fn roundevenf32(x: f32) -> f32;
/// Returns the nearest integer to an `f64`. Rounds half-way cases to the number
/// with an even least significant digit.
///
/// This intrinsic does not have a stable counterpart.
- #[cfg(not(bootstrap))]
#[rustc_nounwind]
pub fn roundevenf64(x: f64) -> f64;
@@ -2233,13 +2257,23 @@ extern "rust-intrinsic" {
/// This is an implementation detail of [`crate::ptr::read`] and should
/// not be used anywhere else. See its comments for why this exists.
///
- /// This intrinsic can *only* be called where the argument is a local without
- /// projections (`read_via_copy(p)`, not `read_via_copy(*p)`) so that it
+ /// This intrinsic can *only* be called where the pointer is a local without
+ /// projections (`read_via_copy(ptr)`, not `read_via_copy(*ptr)`) so that it
/// trivially obeys runtime-MIR rules about derefs in operands.
+ #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
+ #[rustc_nounwind]
+ pub fn read_via_copy<T>(ptr: *const T) -> T;
+
+ /// This is an implementation detail of [`crate::ptr::write`] and should
+ /// not be used anywhere else. See its comments for why this exists.
+ ///
+ /// This intrinsic can *only* be called where the pointer is a local without
+ /// projections (`write_via_move(ptr, x)`, not `write_via_move(*ptr, x)`) so
+ /// that it trivially obeys runtime-MIR rules about derefs in operands.
#[cfg(not(bootstrap))]
- #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
+ #[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
#[rustc_nounwind]
- pub fn read_via_copy<T>(p: *const T) -> T;
+ pub fn write_via_move<T>(ptr: *mut T, value: T);
/// Returns the value of the discriminant for the variant in 'v';
/// if `T` has no discriminant, returns `0`.
@@ -2444,7 +2478,6 @@ extern "rust-intrinsic" {
/// This method creates a pointer to any `Some` value. If the argument is
/// `None`, an invalid within-bounds pointer (that is still acceptable for
/// constructing an empty slice) is returned.
- #[cfg(not(bootstrap))]
#[rustc_nounwind]
pub fn option_payload_ptr<T>(arg: *const Option<T>) -> *const T;
}
@@ -2460,7 +2493,7 @@ extern "rust-intrinsic" {
/// This macro should be called as `assert_unsafe_precondition!([Generics](name: Type) => Expression)`
/// where the names specified will be moved into the macro as captured variables, and defines an item
/// to call `const_eval_select` on. The tokens inside the square brackets are used to denote generics
-/// for the function declaractions and can be omitted if there is no generics.
+/// for the function declarations and can be omitted if there is no generics.
///
/// # Safety
///
@@ -2490,6 +2523,7 @@ macro_rules! assert_unsafe_precondition {
}
}
#[allow(non_snake_case)]
+ #[inline]
const fn comptime$(<$($tt)*>)?($(_:$ty),*) {}
::core::intrinsics::const_eval_select(($($i,)*), comptime, runtime);
@@ -2519,7 +2553,9 @@ pub(crate) fn is_valid_allocation_size<T>(len: usize) -> bool {
pub(crate) fn is_nonoverlapping<T>(src: *const T, dst: *const T, count: usize) -> bool {
let src_usize = src.addr();
let dst_usize = dst.addr();
- let size = mem::size_of::<T>().checked_mul(count).unwrap();
+ let size = mem::size_of::<T>()
+ .checked_mul(count)
+ .expect("is_nonoverlapping: `size_of::<T>() * count` overflows a usize");
let diff = if src_usize > dst_usize { src_usize - dst_usize } else { dst_usize - src_usize };
// If the absolute distance between the ptrs is at least as big as the size of the buffer,
// they do not overlap.
@@ -2717,7 +2753,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
// SAFETY: the safety contract for `copy` must be upheld by the caller.
unsafe {
assert_unsafe_precondition!(
- "ptr::copy requires that both pointer arguments are aligned aligned and non-null",
+ "ptr::copy requires that both pointer arguments are aligned and non-null",
[T](src: *const T, dst: *mut T) =>
is_aligned_and_not_null(src) && is_aligned_and_not_null(dst)
);
@@ -2796,3 +2832,24 @@ pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
write_bytes(dst, val, count)
}
}
+
+/// Polyfill for bootstrap
+#[cfg(bootstrap)]
+pub const unsafe fn transmute_unchecked<Src, Dst>(src: Src) -> Dst {
+ use crate::mem::*;
+ // SAFETY: It's a transmute -- the caller promised it's fine.
+ unsafe { transmute_copy(&ManuallyDrop::new(src)) }
+}
+
+/// Polyfill for bootstrap
+#[cfg(bootstrap)]
+pub const unsafe fn write_via_move<T>(ptr: *mut T, value: T) {
+ use crate::mem::*;
+ // SAFETY: the caller must guarantee that `dst` is valid for writes.
+ // `dst` cannot overlap `src` because the caller has mutable access
+ // to `dst` while `src` is owned by this function.
+ unsafe {
+ copy_nonoverlapping::<T>(&value, ptr, 1);
+ forget(value);
+ }
+}
diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs
index 45498a54b..5944a0de1 100644
--- a/library/core/src/intrinsics/mir.rs
+++ b/library/core/src/intrinsics/mir.rs
@@ -15,7 +15,6 @@
//! ```rust
//! #![feature(core_intrinsics, custom_mir)]
//!
-//! extern crate core;
//! use core::intrinsics::mir::*;
//!
//! #[custom_mir(dialect = "built")]
@@ -65,7 +64,6 @@
//! ```rust
//! #![feature(core_intrinsics, custom_mir)]
//!
-//! extern crate core;
//! use core::intrinsics::mir::*;
//!
//! #[custom_mir(dialect = "built")]
@@ -230,7 +228,7 @@
//!
//! - Operands implicitly convert to `Use` rvalues.
//! - `&`, `&mut`, `addr_of!`, and `addr_of_mut!` all work to create their associated rvalue.
-//! - [`Discriminant`] and [`Len`] have associated functions.
+//! - [`Discriminant`], [`Len`], and [`CopyForDeref`] have associated functions.
//! - Unary and binary operations use their normal Rust syntax - `a * b`, `!c`, etc.
//! - The binary operation `Offset` can be created via [`Offset`].
//! - Checked binary operations are represented by wrapping the associated binop in [`Checked`].
@@ -265,6 +263,7 @@ pub struct BasicBlock;
macro_rules! define {
($name:literal, $( #[ $meta:meta ] )* fn $($sig:tt)*) => {
#[rustc_diagnostic_item = $name]
+ #[inline]
$( #[ $meta ] )*
pub fn $($sig)* { panic!() }
}
@@ -280,6 +279,7 @@ define!("mir_storage_dead", fn StorageDead<T>(local: T));
define!("mir_deinit", fn Deinit<T>(place: T));
define!("mir_checked", fn Checked<T>(binop: T) -> (T, bool));
define!("mir_len", fn Len<T>(place: T) -> usize);
+define!("mir_copy_for_deref", fn CopyForDeref<T>(place: T) -> T);
define!("mir_retag", fn Retag<T>(place: T));
define!("mir_move", fn Move<T>(place: T) -> T);
define!("mir_static", fn Static<T>(s: T) -> &'static T);
@@ -317,7 +317,6 @@ define!(
/// ```rust
/// #![feature(custom_mir, core_intrinsics)]
///
- /// extern crate core;
/// use core::intrinsics::mir::*;
///
/// #[custom_mir(dialect = "built")]
diff --git a/library/core/src/iter/adapters/chain.rs b/library/core/src/iter/adapters/chain.rs
index 75727c3a2..26aa959e6 100644
--- a/library/core/src/iter/adapters/chain.rs
+++ b/library/core/src/iter/adapters/chain.rs
@@ -15,7 +15,7 @@ use crate::ops::Try;
///
/// let a1 = [1, 2, 3];
/// let a2 = [4, 5, 6];
-/// let iter: Chain<Iter<_>, Iter<_>> = a1.iter().chain(a2.iter());
+/// let iter: Chain<Iter<'_, _>, Iter<'_, _>> = a1.iter().chain(a2.iter());
/// ```
#[derive(Clone, Debug)]
#[must_use = "iterators are lazy and do nothing unless consumed"]
diff --git a/library/core/src/iter/adapters/filter.rs b/library/core/src/iter/adapters/filter.rs
index a0afaa326..723657b9e 100644
--- a/library/core/src/iter/adapters/filter.rs
+++ b/library/core/src/iter/adapters/filter.rs
@@ -1,6 +1,9 @@
use crate::fmt;
use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};
use crate::ops::Try;
+use core::array;
+use core::mem::{ManuallyDrop, MaybeUninit};
+use core::ops::ControlFlow;
/// An iterator that filters the elements of `iter` with `predicate`.
///
@@ -57,6 +60,58 @@ where
}
#[inline]
+ fn next_chunk<const N: usize>(
+ &mut self,
+ ) -> Result<[Self::Item; N], array::IntoIter<Self::Item, N>> {
+ let mut array: [MaybeUninit<Self::Item>; N] = MaybeUninit::uninit_array();
+
+ struct Guard<'a, T> {
+ array: &'a mut [MaybeUninit<T>],
+ initialized: usize,
+ }
+
+ impl<T> Drop for Guard<'_, T> {
+ #[inline]
+ fn drop(&mut self) {
+ if const { crate::mem::needs_drop::<T>() } {
+ // SAFETY: self.initialized is always <= N, which also is the length of the array.
+ unsafe {
+ core::ptr::drop_in_place(MaybeUninit::slice_assume_init_mut(
+ self.array.get_unchecked_mut(..self.initialized),
+ ));
+ }
+ }
+ }
+ }
+
+ let mut guard = Guard { array: &mut array, initialized: 0 };
+
+ let result = self.iter.try_for_each(|element| {
+ let idx = guard.initialized;
+ guard.initialized = idx + (self.predicate)(&element) as usize;
+
+ // SAFETY: Loop conditions ensure the index is in bounds.
+ unsafe { guard.array.get_unchecked_mut(idx) }.write(element);
+
+ if guard.initialized < N { ControlFlow::Continue(()) } else { ControlFlow::Break(()) }
+ });
+
+ let guard = ManuallyDrop::new(guard);
+
+ match result {
+ ControlFlow::Break(()) => {
+ // SAFETY: The loop above is only explicitly broken when the array has been fully initialized
+ Ok(unsafe { MaybeUninit::array_assume_init(array) })
+ }
+ ControlFlow::Continue(()) => {
+ let initialized = guard.initialized;
+ // SAFETY: The range is in bounds since the loop breaks when reaching N elements.
+ Err(unsafe { array::IntoIter::new_unchecked(array, 0..initialized) })
+ }
+ }
+ }
+
+ #[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let (_, upper) = self.iter.size_hint();
(0, upper) // can't know a lower bound, due to the predicate
diff --git a/library/core/src/iter/adapters/filter_map.rs b/library/core/src/iter/adapters/filter_map.rs
index 6bdf53f7f..693479977 100644
--- a/library/core/src/iter/adapters/filter_map.rs
+++ b/library/core/src/iter/adapters/filter_map.rs
@@ -1,6 +1,7 @@
-use crate::fmt;
use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};
+use crate::mem::{ManuallyDrop, MaybeUninit};
use crate::ops::{ControlFlow, Try};
+use crate::{array, fmt};
/// An iterator that uses `f` to both filter and map elements from `iter`.
///
@@ -62,6 +63,65 @@ where
}
#[inline]
+ fn next_chunk<const N: usize>(
+ &mut self,
+ ) -> Result<[Self::Item; N], array::IntoIter<Self::Item, N>> {
+ let mut array: [MaybeUninit<Self::Item>; N] = MaybeUninit::uninit_array();
+
+ struct Guard<'a, T> {
+ array: &'a mut [MaybeUninit<T>],
+ initialized: usize,
+ }
+
+ impl<T> Drop for Guard<'_, T> {
+ #[inline]
+ fn drop(&mut self) {
+ if const { crate::mem::needs_drop::<T>() } {
+ // SAFETY: self.initialized is always <= N, which also is the length of the array.
+ unsafe {
+ core::ptr::drop_in_place(MaybeUninit::slice_assume_init_mut(
+ self.array.get_unchecked_mut(..self.initialized),
+ ));
+ }
+ }
+ }
+ }
+
+ let mut guard = Guard { array: &mut array, initialized: 0 };
+
+ let result = self.iter.try_for_each(|element| {
+ let idx = guard.initialized;
+ let val = (self.f)(element);
+ guard.initialized = idx + val.is_some() as usize;
+
+ // SAFETY: Loop conditions ensure the index is in bounds.
+
+ unsafe {
+ let opt_payload_at = core::intrinsics::option_payload_ptr(&val);
+ let dst = guard.array.as_mut_ptr().add(idx);
+ crate::ptr::copy_nonoverlapping(opt_payload_at.cast(), dst, 1);
+ crate::mem::forget(val);
+ };
+
+ if guard.initialized < N { ControlFlow::Continue(()) } else { ControlFlow::Break(()) }
+ });
+
+ let guard = ManuallyDrop::new(guard);
+
+ match result {
+ ControlFlow::Break(()) => {
+ // SAFETY: The loop above is only explicitly broken when the array has been fully initialized
+ Ok(unsafe { MaybeUninit::array_assume_init(array) })
+ }
+ ControlFlow::Continue(()) => {
+ let initialized = guard.initialized;
+ // SAFETY: The range is in bounds since the loop breaks when reaching N elements.
+ Err(unsafe { array::IntoIter::new_unchecked(array, 0..initialized) })
+ }
+ }
+ }
+
+ #[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let (_, upper) = self.iter.size_hint();
(0, upper) // can't know a lower bound, due to the predicate
diff --git a/library/core/src/iter/adapters/flatten.rs b/library/core/src/iter/adapters/flatten.rs
index 2fd8a5c1d..2568aaf34 100644
--- a/library/core/src/iter/adapters/flatten.rs
+++ b/library/core/src/iter/adapters/flatten.rs
@@ -136,26 +136,12 @@ where
}
#[unstable(feature = "trusted_len", issue = "37572")]
-unsafe impl<T, I, F, const N: usize> TrustedLen for FlatMap<I, [T; N], F>
+unsafe impl<I, U, F> TrustedLen for FlatMap<I, U, F>
where
- I: TrustedLen,
- F: FnMut(I::Item) -> [T; N],
-{
-}
-
-#[unstable(feature = "trusted_len", issue = "37572")]
-unsafe impl<'a, T, I, F, const N: usize> TrustedLen for FlatMap<I, &'a [T; N], F>
-where
- I: TrustedLen,
- F: FnMut(I::Item) -> &'a [T; N],
-{
-}
-
-#[unstable(feature = "trusted_len", issue = "37572")]
-unsafe impl<'a, T, I, F, const N: usize> TrustedLen for FlatMap<I, &'a mut [T; N], F>
-where
- I: TrustedLen,
- F: FnMut(I::Item) -> &'a mut [T; N],
+ I: Iterator,
+ U: IntoIterator,
+ F: FnMut(I::Item) -> U,
+ FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: TrustedLen,
{
}
@@ -298,8 +284,8 @@ where
#[unstable(feature = "trusted_len", issue = "37572")]
unsafe impl<I> TrustedLen for Flatten<I>
where
- I: TrustedLen,
- <I as Iterator>::Item: TrustedConstSize,
+ I: Iterator<Item: IntoIterator>,
+ FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>: TrustedLen,
{
}
@@ -324,6 +310,7 @@ where
/// Real logic of both `Flatten` and `FlatMap` which simply delegate to
/// this type.
#[derive(Clone, Debug)]
+#[unstable(feature = "trusted_len", issue = "37572")]
struct FlattenCompat<I, U> {
iter: Fuse<I>,
frontiter: Option<U>,
@@ -477,6 +464,7 @@ where
}
}
+#[unstable(feature = "trusted_len", issue = "37572")]
impl<I, U> Iterator for FlattenCompat<I, U>
where
I: Iterator<Item: IntoIterator<IntoIter = U, Item = U::Item>>,
@@ -591,6 +579,7 @@ where
}
}
+#[unstable(feature = "trusted_len", issue = "37572")]
impl<I, U> DoubleEndedIterator for FlattenCompat<I, U>
where
I: DoubleEndedIterator<Item: IntoIterator<IntoIter = U, Item = U::Item>>,
@@ -660,6 +649,30 @@ where
}
}
+#[unstable(feature = "trusted_len", issue = "37572")]
+unsafe impl<const N: usize, I, T> TrustedLen
+ for FlattenCompat<I, <[T; N] as IntoIterator>::IntoIter>
+where
+ I: TrustedLen<Item = [T; N]>,
+{
+}
+
+#[unstable(feature = "trusted_len", issue = "37572")]
+unsafe impl<'a, const N: usize, I, T> TrustedLen
+ for FlattenCompat<I, <&'a [T; N] as IntoIterator>::IntoIter>
+where
+ I: TrustedLen<Item = &'a [T; N]>,
+{
+}
+
+#[unstable(feature = "trusted_len", issue = "37572")]
+unsafe impl<'a, const N: usize, I, T> TrustedLen
+ for FlattenCompat<I, <&'a mut [T; N] as IntoIterator>::IntoIter>
+where
+ I: TrustedLen<Item = &'a mut [T; N]>,
+{
+}
+
trait ConstSizeIntoIterator: IntoIterator {
// FIXME(#31844): convert to an associated const once specialization supports that
fn size() -> Option<usize>;
@@ -696,19 +709,6 @@ impl<T, const N: usize> ConstSizeIntoIterator for &mut [T; N] {
}
}
-#[doc(hidden)]
-#[unstable(feature = "std_internals", issue = "none")]
-// FIXME(#20400): Instead of this helper trait there should be multiple impl TrustedLen for Flatten<>
-// blocks with different bounds on Iterator::Item but the compiler erroneously considers them overlapping
-pub unsafe trait TrustedConstSize: IntoIterator {}
-
-#[unstable(feature = "std_internals", issue = "none")]
-unsafe impl<T, const N: usize> TrustedConstSize for [T; N] {}
-#[unstable(feature = "std_internals", issue = "none")]
-unsafe impl<T, const N: usize> TrustedConstSize for &'_ [T; N] {}
-#[unstable(feature = "std_internals", issue = "none")]
-unsafe impl<T, const N: usize> TrustedConstSize for &'_ mut [T; N] {}
-
#[inline]
fn and_then_or_clear<T, U>(opt: &mut Option<T>, f: impl FnOnce(&mut T) -> Option<U>) -> Option<U> {
let x = f(opt.as_mut()?);
diff --git a/library/core/src/iter/range.rs b/library/core/src/iter/range.rs
index 37db07429..0171d8981 100644
--- a/library/core/src/iter/range.rs
+++ b/library/core/src/iter/range.rs
@@ -732,12 +732,18 @@ impl<A: Step> Iterator for ops::Range<A> {
}
#[inline]
- fn min(mut self) -> Option<A> {
+ fn min(mut self) -> Option<A>
+ where
+ A: Ord,
+ {
self.next()
}
#[inline]
- fn max(mut self) -> Option<A> {
+ fn max(mut self) -> Option<A>
+ where
+ A: Ord,
+ {
self.next_back()
}
@@ -1158,12 +1164,18 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
}
#[inline]
- fn min(mut self) -> Option<A> {
+ fn min(mut self) -> Option<A>
+ where
+ A: Ord,
+ {
self.next()
}
#[inline]
- fn max(mut self) -> Option<A> {
+ fn max(mut self) -> Option<A>
+ where
+ A: Ord,
+ {
self.next_back()
}
diff --git a/library/core/src/iter/sources/empty.rs b/library/core/src/iter/sources/empty.rs
index 617dfd123..243df015f 100644
--- a/library/core/src/iter/sources/empty.rs
+++ b/library/core/src/iter/sources/empty.rs
@@ -81,8 +81,7 @@ impl<T> Clone for Empty<T> {
// not #[derive] because that adds a Default bound on T,
// which isn't necessary.
#[stable(feature = "iter_empty", since = "1.2.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T> const Default for Empty<T> {
+impl<T> Default for Empty<T> {
fn default() -> Empty<T> {
Empty(marker::PhantomData)
}
diff --git a/library/core/src/iter/traits/collect.rs b/library/core/src/iter/traits/collect.rs
index e099700e3..0675e5635 100644
--- a/library/core/src/iter/traits/collect.rs
+++ b/library/core/src/iter/traits/collect.rs
@@ -95,6 +95,16 @@
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(
on(
+ _Self = "&[{A}]",
+ message = "a slice of type `{Self}` cannot be built since we need to store the elements somewhere",
+ label = "try explicitly collecting into a `Vec<{A}>`",
+ ),
+ on(
+ all(A = "{integer}", any(_Self = "&[{integral}]",)),
+ message = "a slice of type `{Self}` cannot be built since we need to store the elements somewhere",
+ label = "try explicitly collecting into a `Vec<{A}>`",
+ ),
+ on(
_Self = "[{A}]",
message = "a slice of type `{Self}` cannot be built since `{Self}` has no definite size",
label = "try explicitly collecting into a `Vec<{A}>`",
@@ -228,7 +238,6 @@ pub trait FromIterator<A>: Sized {
#[rustc_diagnostic_item = "IntoIterator"]
#[rustc_skip_array_during_method_dispatch]
#[stable(feature = "rust1", since = "1.0.0")]
-#[const_trait]
pub trait IntoIterator {
/// The type of the elements being iterated over.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -264,7 +273,7 @@ pub trait IntoIterator {
#[rustc_const_unstable(feature = "const_intoiterator_identity", issue = "90603")]
#[stable(feature = "rust1", since = "1.0.0")]
-impl<I: Iterator> const IntoIterator for I {
+impl<I: Iterator> IntoIterator for I {
type Item = I::Item;
type IntoIter = I;
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index 028776042..dabfce144 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -70,7 +70,6 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
#[doc(notable_trait)]
#[rustc_diagnostic_item = "Iterator"]
#[must_use = "iterators are lazy and do nothing unless consumed"]
-#[const_trait]
pub trait Iterator {
/// The type of the elements being iterated over.
#[rustc_diagnostic_item = "IteratorItem"]
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 04243544b..6c419eb16 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -107,16 +107,13 @@
#![feature(const_arguments_as_str)]
#![feature(const_array_from_ref)]
#![feature(const_array_into_iter_constructors)]
+#![feature(const_assume)]
#![feature(const_bigint_helper_methods)]
#![feature(const_black_box)]
#![feature(const_caller_location)]
#![feature(const_cell_into_inner)]
#![feature(const_char_from_u32_unchecked)]
-#![feature(const_clone)]
-#![feature(const_cmp)]
-#![feature(const_convert)]
#![feature(const_cstr_methods)]
-#![feature(const_default_impls)]
#![feature(const_discriminant)]
#![feature(const_eval_select)]
#![feature(const_exact_div)]
@@ -131,14 +128,12 @@
#![feature(const_intrinsic_forget)]
#![feature(const_ipv4)]
#![feature(const_ipv6)]
-#![feature(const_is_char_boundary)]
#![feature(const_likely)]
#![feature(const_maybe_uninit_as_mut_ptr)]
#![feature(const_maybe_uninit_assume_init)]
#![feature(const_maybe_uninit_uninit_array)]
#![feature(const_nonnull_new)]
-#![feature(const_num_from_num)]
-#![feature(const_ops)]
+#![feature(const_num_midpoint)]
#![feature(const_option)]
#![feature(const_option_ext)]
#![feature(const_pin)]
@@ -146,22 +141,20 @@
#![feature(const_pointer_is_aligned)]
#![feature(const_ptr_as_ref)]
#![feature(const_ptr_is_null)]
-#![feature(const_ptr_read)]
#![feature(const_ptr_sub_ptr)]
#![feature(const_ptr_write)]
#![feature(const_raw_ptr_comparison)]
#![feature(const_replace)]
-#![feature(const_result_drop)]
#![feature(const_size_of_val)]
#![feature(const_size_of_val_raw)]
#![feature(const_slice_from_raw_parts_mut)]
#![feature(const_slice_from_ref)]
#![feature(const_slice_index)]
+#![feature(const_slice_is_ascii)]
#![feature(const_slice_ptr_len)]
#![feature(const_slice_split_at_mut)]
#![feature(const_str_from_utf8_unchecked_mut)]
#![feature(const_swap)]
-#![feature(const_trait_impl)]
#![feature(const_transmute_copy)]
#![feature(const_try)]
#![feature(const_type_id)]
@@ -171,6 +164,7 @@
#![feature(const_waker)]
#![feature(core_panic)]
#![feature(duration_consts_float)]
+#![feature(internal_impls_macro)]
#![feature(ip)]
#![feature(is_ascii_octdigit)]
#![feature(maybe_uninit_uninit_array)]
@@ -207,9 +201,9 @@
#![feature(const_mut_refs)]
#![feature(const_precise_live_drops)]
#![feature(const_refs_to_cell)]
+#![feature(const_trait_impl)]
#![feature(decl_macro)]
#![feature(deprecated_suggestion)]
-#![feature(derive_const)]
#![feature(doc_cfg)]
#![feature(doc_cfg_hide)]
#![feature(doc_notable_trait)]
@@ -222,6 +216,7 @@
#![feature(intra_doc_pointers)]
#![feature(intrinsics)]
#![feature(lang_items)]
+#![feature(let_chains)]
#![feature(link_llvm_intrinsics)]
#![feature(macro_metavar_expr)]
#![feature(min_specialization)]
@@ -385,6 +380,7 @@ pub mod alloc;
// note: does not need to be public
mod bool;
+mod escape;
mod tuple;
mod unit;
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 7c93c93b4..c4134dbcd 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -498,7 +498,6 @@ macro_rules! r#try {
/// In a `no_std` setup you are responsible for the implementation details of the components.
///
/// ```no_run
-/// # extern crate core;
/// use core::fmt::Write;
///
/// struct Example;
@@ -1428,7 +1427,7 @@ pub(crate) mod builtin {
#[rustc_builtin_macro]
#[macro_export]
#[rustc_diagnostic_item = "assert_macro"]
- #[allow_internal_unstable(core_panic, edition_panic)]
+ #[allow_internal_unstable(core_panic, edition_panic, generic_assert_internals)]
macro_rules! assert {
($cond:expr $(,)?) => {{ /* compiler built-in */ }};
($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
diff --git a/library/core/src/macros/panic.md b/library/core/src/macros/panic.md
index 98fb7e9e4..8b549e187 100644
--- a/library/core/src/macros/panic.md
+++ b/library/core/src/macros/panic.md
@@ -42,7 +42,7 @@ the successful result of some computation, `Ok(T)`, or error types that
represent an anticipated runtime failure mode of that computation, `Err(E)`.
`Result` is used alongside user defined types which represent the various
anticipated runtime failure modes that the associated computation could
-encounter. `Result` must be propagated manually, often with the the help of the
+encounter. `Result` must be propagated manually, often with the help of the
`?` operator and `Try` trait, and they must be reported manually, often with
the help of the `Error` trait.
diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs
index 3cd4f5104..8dab8d1a6 100644
--- a/library/core/src/marker.rs
+++ b/library/core/src/marker.rs
@@ -12,6 +12,50 @@ use crate::fmt::Debug;
use crate::hash::Hash;
use crate::hash::Hasher;
+/// Implements a given marker trait for multiple types at the same time.
+///
+/// The basic syntax looks like this:
+/// ```ignore private macro
+/// marker_impls! { MarkerTrait for u8, i8 }
+/// ```
+/// You can also implement `unsafe` traits
+/// ```ignore private macro
+/// marker_impls! { unsafe MarkerTrait for u8, i8 }
+/// ```
+/// Add attributes to all impls:
+/// ```ignore private macro
+/// marker_impls! {
+/// #[allow(lint)]
+/// #[unstable(feature = "marker_trait", issue = "none")]
+/// MarkerTrait for u8, i8
+/// }
+/// ```
+/// And use generics:
+/// ```ignore private macro
+/// marker_impls! {
+/// MarkerTrait for
+/// u8, i8,
+/// {T: ?Sized} *const T,
+/// {T: ?Sized} *mut T,
+/// {T: MarkerTrait} PhantomData<T>,
+/// u32,
+/// }
+/// ```
+#[unstable(feature = "internal_impls_macro", issue = "none")]
+macro marker_impls {
+ ( $(#[$($meta:tt)*])* $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => {
+ $(#[$($meta)*])* impl< $($($bounds)*)? > $Trait for $T {}
+ marker_impls! { $(#[$($meta)*])* $Trait for $($($rest)*)? }
+ },
+ ( $(#[$($meta:tt)*])* $Trait:ident for ) => {},
+
+ ( $(#[$($meta:tt)*])* unsafe $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => {
+ $(#[$($meta)*])* unsafe impl< $($($bounds)*)? > $Trait for $T {}
+ marker_impls! { $(#[$($meta)*])* unsafe $Trait for $($($rest)*)? }
+ },
+ ( $(#[$($meta:tt)*])* unsafe $Trait:ident for ) => {},
+}
+
/// Types that can be transferred across thread boundaries.
///
/// This trait is automatically implemented when the compiler determines it's
@@ -24,7 +68,7 @@ use crate::hash::Hasher;
/// operations. Its cousin [`sync::Arc`][arc] does use atomic operations (incurring
/// some overhead) and thus is `Send`.
///
-/// See [the Nomicon](../../nomicon/send-and-sync.html) for more details.
+/// See [the Nomicon](../../nomicon/send-and-sync.html) and the [`Sync`] trait for more details.
///
/// [`Rc`]: ../../std/rc/struct.Rc.html
/// [arc]: ../../std/sync/struct.Arc.html
@@ -214,6 +258,20 @@ pub trait StructuralEq {
// Empty.
}
+// FIXME: Remove special cases of these types from the compiler pattern checking code and always check `T: StructuralEq` instead
+marker_impls! {
+ #[unstable(feature = "structural_match", issue = "31434")]
+ StructuralEq for
+ usize, u8, u16, u32, u64, u128,
+ isize, i8, i16, i32, i64, i128,
+ bool,
+ char,
+ str /* Technically requires `[u8]: StructuralEq` */,
+ {T, const N: usize} [T; N],
+ {T} [T],
+ {T: ?Sized} &T,
+}
+
/// Types whose values can be duplicated simply by copying bits.
///
/// By default, variable bindings have 'move semantics.' In other
@@ -401,6 +459,30 @@ pub macro Copy($item:item) {
/* compiler built-in */
}
+// Implementations of `Copy` for primitive types.
+//
+// Implementations that cannot be described in Rust
+// are implemented in `traits::SelectionContext::copy_clone_conditions()`
+// in `rustc_trait_selection`.
+marker_impls! {
+ #[stable(feature = "rust1", since = "1.0.0")]
+ Copy for
+ usize, u8, u16, u32, u64, u128,
+ isize, i8, i16, i32, i64, i128,
+ f32, f64,
+ bool, char,
+ {T: ?Sized} *const T,
+ {T: ?Sized} *mut T,
+
+}
+
+#[unstable(feature = "never_type", issue = "35121")]
+impl Copy for ! {}
+
+/// Shared references can be copied, but mutable references *cannot*!
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<T: ?Sized> Copy for &T {}
+
/// Types for which it is safe to share references between threads.
///
/// This trait is automatically implemented when the compiler determines
@@ -426,6 +508,11 @@ pub macro Copy($item:item) {
/// becomes read-only, as if it were a `& &T`. Hence there is no risk
/// of a data race.
///
+/// A shorter overview of how [`Sync`] and [`Send`] relate to referencing:
+/// * `&T` is [`Send`] if and only if `T` is [`Sync`]
+/// * `&mut T` is [`Send`] if and only if `T` is [`Send`]
+/// * `&T` and `&mut T` are [`Sync`] if and only if `T` is [`Sync`]
+///
/// Types that are not `Sync` are those that have "interior
/// mutability" in a non-thread-safe form, such as [`Cell`][cell]
/// and [`RefCell`][refcell]. These types allow for mutation of
@@ -591,14 +678,14 @@ impl<T: ?Sized> !Sync for *mut T {}
/// use std::marker::PhantomData;
///
/// # #[allow(dead_code)]
-/// struct Slice<'a, T: 'a> {
+/// struct Slice<'a, T> {
/// start: *const T,
/// end: *const T,
/// phantom: PhantomData<&'a T>,
/// }
/// ```
///
-/// This also in turn requires the annotation `T: 'a`, indicating
+/// This also in turn infers the lifetime bound `T: 'a`, indicating
/// that any references in `T` are valid over the lifetime `'a`.
///
/// When initializing a `Slice` you simply provide the value
@@ -607,7 +694,7 @@ impl<T: ?Sized> !Sync for *mut T {}
/// ```
/// # #![allow(dead_code)]
/// # use std::marker::PhantomData;
-/// # struct Slice<'a, T: 'a> {
+/// # struct Slice<'a, T> {
/// # start: *const T,
/// # end: *const T,
/// # phantom: PhantomData<&'a T>,
@@ -669,16 +756,11 @@ impl<T: ?Sized> !Sync for *mut T {}
///
/// ## Ownership and the drop check
///
-/// Adding a field of type `PhantomData<T>` indicates that your
-/// type owns data of type `T`. This in turn implies that when your
-/// type is dropped, it may drop one or more instances of the type
-/// `T`. This has bearing on the Rust compiler's [drop check]
-/// analysis.
+/// The exact interaction of `PhantomData` with drop check **may change in the future**.
///
-/// If your struct does not in fact *own* the data of type `T`, it is
-/// better to use a reference type, like `PhantomData<&'a T>`
-/// (ideally) or `PhantomData<*const T>` (if no lifetime applies), so
-/// as not to indicate ownership.
+/// Currently, adding a field of type `PhantomData<T>` indicates that your type *owns* data of type
+/// `T` in very rare circumstances. This in turn has effects on the Rust compiler's [drop check]
+/// analysis. For the exact rules, see the [drop check] documentation.
///
/// ## Layout
///
@@ -686,7 +768,7 @@ impl<T: ?Sized> !Sync for *mut T {}
/// * `size_of::<PhantomData<T>>() == 0`
/// * `align_of::<PhantomData<T>>() == 1`
///
-/// [drop check]: ../../nomicon/dropck.html
+/// [drop check]: Drop#drop-check
#[lang = "phantom_data"]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct PhantomData<T: ?Sized>;
@@ -732,8 +814,7 @@ impl<T: ?Sized> Clone for PhantomData<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T: ?Sized> const Default for PhantomData<T> {
+impl<T: ?Sized> Default for PhantomData<T> {
fn default() -> Self {
Self
}
@@ -774,11 +855,14 @@ pub trait DiscriminantKind {
pub(crate) unsafe auto trait Freeze {}
impl<T: ?Sized> !Freeze for UnsafeCell<T> {}
-unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
-unsafe impl<T: ?Sized> Freeze for *const T {}
-unsafe impl<T: ?Sized> Freeze for *mut T {}
-unsafe impl<T: ?Sized> Freeze for &T {}
-unsafe impl<T: ?Sized> Freeze for &mut T {}
+marker_impls! {
+ unsafe Freeze for
+ {T: ?Sized} PhantomData<T>,
+ {T: ?Sized} *const T,
+ {T: ?Sized} *mut T,
+ {T: ?Sized} &T,
+ {T: ?Sized} &mut T,
+}
/// Types that can be safely moved after being pinned.
///
@@ -839,17 +923,19 @@ pub struct PhantomPinned;
#[stable(feature = "pin", since = "1.33.0")]
impl !Unpin for PhantomPinned {}
-#[stable(feature = "pin", since = "1.33.0")]
-impl<'a, T: ?Sized + 'a> Unpin for &'a T {}
-
-#[stable(feature = "pin", since = "1.33.0")]
-impl<'a, T: ?Sized + 'a> Unpin for &'a mut T {}
-
-#[stable(feature = "pin_raw", since = "1.38.0")]
-impl<T: ?Sized> Unpin for *const T {}
+marker_impls! {
+ #[stable(feature = "pin", since = "1.33.0")]
+ Unpin for
+ {T: ?Sized} &T,
+ {T: ?Sized} &mut T,
+}
-#[stable(feature = "pin_raw", since = "1.38.0")]
-impl<T: ?Sized> Unpin for *mut T {}
+marker_impls! {
+ #[stable(feature = "pin_raw", since = "1.38.0")]
+ Unpin for
+ {T: ?Sized} *const T,
+ {T: ?Sized} *mut T,
+}
/// A marker for types that can be dropped.
///
@@ -858,8 +944,8 @@ impl<T: ?Sized> Unpin for *mut T {}
#[unstable(feature = "const_trait_impl", issue = "67792")]
#[lang = "destruct"]
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
-#[const_trait]
#[rustc_deny_explicit_impl]
+#[const_trait]
pub trait Destruct {}
/// A marker for tuple types.
@@ -884,43 +970,33 @@ pub trait Tuple {}
)]
pub trait PointerLike {}
-/// Implementations of `Copy` for primitive types.
-///
-/// Implementations that cannot be described in Rust
-/// are implemented in `traits::SelectionContext::copy_clone_conditions()`
-/// in `rustc_trait_selection`.
-mod copy_impls {
-
- use super::Copy;
-
- macro_rules! impl_copy {
- ($($t:ty)*) => {
- $(
- #[stable(feature = "rust1", since = "1.0.0")]
- impl Copy for $t {}
- )*
- }
- }
-
- impl_copy! {
- usize u8 u16 u32 u64 u128
- isize i8 i16 i32 i64 i128
- f32 f64
- bool char
- }
-
- #[unstable(feature = "never_type", issue = "35121")]
- impl Copy for ! {}
-
- #[stable(feature = "rust1", since = "1.0.0")]
- impl<T: ?Sized> Copy for *const T {}
+/// A marker for types which can be used as types of `const` generic parameters.
+#[cfg_attr(not(bootstrap), lang = "const_param_ty")]
+#[unstable(feature = "adt_const_params", issue = "95174")]
+#[rustc_on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
+pub trait ConstParamTy: StructuralEq {}
- #[stable(feature = "rust1", since = "1.0.0")]
- impl<T: ?Sized> Copy for *mut T {}
+/// Derive macro generating an impl of the trait `ConstParamTy`.
+#[rustc_builtin_macro]
+#[unstable(feature = "adt_const_params", issue = "95174")]
+#[cfg(not(bootstrap))]
+pub macro ConstParamTy($item:item) {
+ /* compiler built-in */
+}
- /// Shared references can be copied, but mutable references *cannot*!
- #[stable(feature = "rust1", since = "1.0.0")]
- impl<T: ?Sized> Copy for &T {}
+// FIXME(generic_const_parameter_types): handle `ty::FnDef`/`ty::Closure`
+// FIXME(generic_const_parameter_types): handle `ty::Tuple`
+marker_impls! {
+ #[unstable(feature = "adt_const_params", issue = "95174")]
+ ConstParamTy for
+ usize, u8, u16, u32, u64, u128,
+ isize, i8, i16, i32, i64, i128,
+ bool,
+ char,
+ str /* Technically requires `[u8]: ConstParamTy` */,
+ {T: ConstParamTy, const N: usize} [T; N],
+ {T: ConstParamTy} [T],
+ {T: ?Sized + ConstParamTy} &T,
}
/// A common trait implemented by all function pointers.
@@ -930,7 +1006,6 @@ mod copy_impls {
reason = "internal trait for implementing various traits for all function pointers"
)]
#[lang = "fn_ptr_trait"]
-#[cfg(not(bootstrap))]
#[rustc_deny_explicit_impl]
pub trait FnPtr: Copy + Clone {
/// Returns the address of the function pointer.
diff --git a/library/core/src/mem/manually_drop.rs b/library/core/src/mem/manually_drop.rs
index 3d719afe4..5f3d66e37 100644
--- a/library/core/src/mem/manually_drop.rs
+++ b/library/core/src/mem/manually_drop.rs
@@ -146,8 +146,7 @@ impl<T: ?Sized> ManuallyDrop<T> {
}
#[stable(feature = "manually_drop", since = "1.20.0")]
-#[rustc_const_unstable(feature = "const_deref", issue = "88955")]
-impl<T: ?Sized> const Deref for ManuallyDrop<T> {
+impl<T: ?Sized> Deref for ManuallyDrop<T> {
type Target = T;
#[inline(always)]
fn deref(&self) -> &T {
@@ -156,8 +155,7 @@ impl<T: ?Sized> const Deref for ManuallyDrop<T> {
}
#[stable(feature = "manually_drop", since = "1.20.0")]
-#[rustc_const_unstable(feature = "const_deref", issue = "88955")]
-impl<T: ?Sized> const DerefMut for ManuallyDrop<T> {
+impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
#[inline(always)]
fn deref_mut(&mut self) -> &mut T {
&mut self.value
diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs
index 9c6d48675..d09a24b4b 100644
--- a/library/core/src/mem/maybe_uninit.rs
+++ b/library/core/src/mem/maybe_uninit.rs
@@ -945,14 +945,10 @@ impl<T> MaybeUninit<T> {
// * `MaybeUninit<T>` and T are guaranteed to have the same layout
// * `MaybeUninit` does not drop, so there are no double-frees
// And thus the conversion is safe
- let ret = unsafe {
+ unsafe {
intrinsics::assert_inhabited::<[T; N]>();
- (&array as *const _ as *const [T; N]).read()
- };
-
- // FIXME: required to avoid `~const Destruct` bound
- super::forget(array);
- ret
+ intrinsics::transmute_unchecked(array)
+ }
}
/// Assuming all the elements are initialized, get a slice to them.
@@ -1291,7 +1287,7 @@ impl<T, const N: usize> MaybeUninit<[T; N]> {
#[inline]
pub const fn transpose(self) -> [MaybeUninit<T>; N] {
// SAFETY: T and MaybeUninit<T> have the same layout
- unsafe { super::transmute_copy(&ManuallyDrop::new(self)) }
+ unsafe { intrinsics::transmute_unchecked(self) }
}
}
@@ -1311,6 +1307,6 @@ impl<T, const N: usize> [MaybeUninit<T>; N] {
#[inline]
pub const fn transpose(self) -> MaybeUninit<[T; N]> {
// SAFETY: T and MaybeUninit<T> have the same layout
- unsafe { super::transmute_copy(&ManuallyDrop::new(self)) }
+ unsafe { intrinsics::transmute_unchecked(self) }
}
}
diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs
index a67df7ed5..afbfd6d36 100644
--- a/library/core/src/mem/mod.rs
+++ b/library/core/src/mem/mod.rs
@@ -170,7 +170,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
///
/// The following table gives the size for primitives.
///
-/// Type | size_of::\<Type>()
+/// Type | `size_of::<Type>()`
/// ---- | ---------------
/// () | 0
/// bool | 1
@@ -190,8 +190,8 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
///
/// Furthermore, `usize` and `isize` have the same size.
///
-/// The types `*const T`, `&T`, `Box<T>`, `Option<&T>`, and `Option<Box<T>>` all have
-/// the same size. If `T` is Sized, all of those types have the same size as `usize`.
+/// The types [`*const T`], `&T`, [`Box<T>`], [`Option<&T>`], and `Option<Box<T>>` all have
+/// the same size. If `T` is `Sized`, all of those types have the same size as `usize`.
///
/// The mutability of a pointer does not change its size. As such, `&T` and `&mut T`
/// have the same size. Likewise for `*const T` and `*mut T`.
@@ -203,7 +203,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
///
/// ## Size of Structs
///
-/// For `structs`, the size is determined by the following algorithm.
+/// For `struct`s, the size is determined by the following algorithm.
///
/// For each field in the struct ordered by declaration order:
///
@@ -299,6 +299,10 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
/// ```
///
/// [alignment]: align_of
+/// [`*const T`]: primitive@pointer
+/// [`Box<T>`]: ../../std/boxed/struct.Box.html
+/// [`Option<&T>`]: crate::option::Option
+///
#[inline(always)]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
@@ -311,7 +315,7 @@ pub const fn size_of<T>() -> usize {
/// Returns the size of the pointed-to value in bytes.
///
-/// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
+/// This is usually the same as [`size_of::<T>()`]. However, when `T` *has* no
/// statically-known size, e.g., a slice [`[T]`][slice] or a [trait object],
/// then `size_of_val` can be used to get the dynamically-known size.
///
@@ -328,6 +332,8 @@ pub const fn size_of<T>() -> usize {
/// let y: &[u8] = &x;
/// assert_eq!(13, mem::size_of_val(y));
/// ```
+///
+/// [`size_of::<T>()`]: size_of
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
@@ -340,7 +346,7 @@ pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
/// Returns the size of the pointed-to value in bytes.
///
-/// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
+/// This is usually the same as [`size_of::<T>()`]. However, when `T` *has* no
/// statically-known size, e.g., a slice [`[T]`][slice] or a [trait object],
/// then `size_of_val_raw` can be used to get the dynamically-known size.
///
@@ -363,6 +369,7 @@ pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
/// [`size_of_val`] on a reference to a type with an extern type tail.
/// - otherwise, it is conservatively not allowed to call this function.
///
+/// [`size_of::<T>()`]: size_of
/// [trait object]: ../../book/ch17-02-trait-objects.html
/// [extern type]: ../../unstable-book/language-features/extern-types.html
///
@@ -961,6 +968,7 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T {
/// Integers and other types implementing [`Copy`] are unaffected by `drop`.
///
/// ```
+/// # #![cfg_attr(not(bootstrap), allow(dropping_copy_types))]
/// #[derive(Copy, Clone)]
/// struct Foo(u8);
///
@@ -1272,3 +1280,45 @@ pub trait SizedTypeProperties: Sized {
#[doc(hidden)]
#[unstable(feature = "sized_type_properties", issue = "none")]
impl<T> SizedTypeProperties for T {}
+
+/// Expands to the offset in bytes of a field from the beginning of the given type.
+///
+/// Only structs, unions and tuples are supported.
+///
+/// Nested field accesses may be used, but not array indexes like in `C`'s `offsetof`.
+///
+/// Note that the output of this macro is not stable, except for `#[repr(C)]` types.
+///
+/// # Examples
+///
+/// ```
+/// #![feature(offset_of)]
+///
+/// use std::mem;
+/// #[repr(C)]
+/// struct FieldStruct {
+/// first: u8,
+/// second: u16,
+/// third: u8
+/// }
+///
+/// assert_eq!(mem::offset_of!(FieldStruct, first), 0);
+/// assert_eq!(mem::offset_of!(FieldStruct, second), 2);
+/// assert_eq!(mem::offset_of!(FieldStruct, third), 4);
+///
+/// #[repr(C)]
+/// struct NestedA {
+/// b: NestedB
+/// }
+///
+/// #[repr(C)]
+/// struct NestedB(u8);
+///
+/// assert_eq!(mem::offset_of!(NestedA, b.0), 0);
+/// ```
+#[cfg(not(bootstrap))]
+#[unstable(feature = "offset_of", issue = "106655")]
+#[allow_internal_unstable(builtin_syntax)]
+pub macro offset_of($Container:ty, $($fields:tt).+ $(,)?) {
+ builtin # offset_of($Container, $($fields).+)
+}
diff --git a/library/core/src/mem/transmutability.rs b/library/core/src/mem/transmutability.rs
index b53a330fa..87ae30619 100644
--- a/library/core/src/mem/transmutability.rs
+++ b/library/core/src/mem/transmutability.rs
@@ -81,8 +81,7 @@ impl Assume {
// FIXME(jswrenn): This const op is not actually usable. Why?
// https://github.com/rust-lang/rust/pull/100726#issuecomment-1219928926
#[unstable(feature = "transmutability", issue = "99571")]
-#[rustc_const_unstable(feature = "transmutability", issue = "99571")]
-impl const core::ops::Add for Assume {
+impl core::ops::Add for Assume {
type Output = Assume;
fn add(self, other_assumptions: Assume) -> Assume {
@@ -93,8 +92,7 @@ impl const core::ops::Add for Assume {
// FIXME(jswrenn): This const op is not actually usable. Why?
// https://github.com/rust-lang/rust/pull/100726#issuecomment-1219928926
#[unstable(feature = "transmutability", issue = "99571")]
-#[rustc_const_unstable(feature = "transmutability", issue = "99571")]
-impl const core::ops::Sub for Assume {
+impl core::ops::Sub for Assume {
type Output = Assume;
fn sub(self, other_assumptions: Assume) -> Assume {
diff --git a/library/core/src/net/socket_addr.rs b/library/core/src/net/socket_addr.rs
index 2d48e2715..8396aecf9 100644
--- a/library/core/src/net/socket_addr.rs
+++ b/library/core/src/net/socket_addr.rs
@@ -122,6 +122,7 @@ impl SocketAddr {
#[stable(feature = "ip_addr", since = "1.7.0")]
#[must_use]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn new(ip: IpAddr, port: u16) -> SocketAddr {
match ip {
IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
@@ -142,6 +143,7 @@ impl SocketAddr {
#[must_use]
#[stable(feature = "ip_addr", since = "1.7.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn ip(&self) -> IpAddr {
match *self {
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
@@ -161,6 +163,7 @@ impl SocketAddr {
/// assert_eq!(socket.ip(), IpAddr::V4(Ipv4Addr::new(10, 10, 0, 1)));
/// ```
#[stable(feature = "sockaddr_setters", since = "1.9.0")]
+ #[inline]
pub fn set_ip(&mut self, new_ip: IpAddr) {
// `match (*self, new_ip)` would have us mutate a copy of self only to throw it away.
match (self, new_ip) {
@@ -183,6 +186,7 @@ impl SocketAddr {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn port(&self) -> u16 {
match *self {
SocketAddr::V4(ref a) => a.port(),
@@ -202,6 +206,7 @@ impl SocketAddr {
/// assert_eq!(socket.port(), 1025);
/// ```
#[stable(feature = "sockaddr_setters", since = "1.9.0")]
+ #[inline]
pub fn set_port(&mut self, new_port: u16) {
match *self {
SocketAddr::V4(ref mut a) => a.set_port(new_port),
@@ -227,6 +232,7 @@ impl SocketAddr {
#[must_use]
#[stable(feature = "sockaddr_checker", since = "1.16.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn is_ipv4(&self) -> bool {
matches!(*self, SocketAddr::V4(_))
}
@@ -249,6 +255,7 @@ impl SocketAddr {
#[must_use]
#[stable(feature = "sockaddr_checker", since = "1.16.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn is_ipv6(&self) -> bool {
matches!(*self, SocketAddr::V6(_))
}
@@ -269,6 +276,7 @@ impl SocketAddrV4 {
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4 {
SocketAddrV4 { ip, port }
}
@@ -286,6 +294,7 @@ impl SocketAddrV4 {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn ip(&self) -> &Ipv4Addr {
&self.ip
}
@@ -302,6 +311,7 @@ impl SocketAddrV4 {
/// assert_eq!(socket.ip(), &Ipv4Addr::new(192, 168, 0, 1));
/// ```
#[stable(feature = "sockaddr_setters", since = "1.9.0")]
+ #[inline]
pub fn set_ip(&mut self, new_ip: Ipv4Addr) {
self.ip = new_ip;
}
@@ -319,6 +329,7 @@ impl SocketAddrV4 {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn port(&self) -> u16 {
self.port
}
@@ -335,6 +346,7 @@ impl SocketAddrV4 {
/// assert_eq!(socket.port(), 4242);
/// ```
#[stable(feature = "sockaddr_setters", since = "1.9.0")]
+ #[inline]
pub fn set_port(&mut self, new_port: u16) {
self.port = new_port;
}
@@ -360,6 +372,7 @@ impl SocketAddrV6 {
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn new(ip: Ipv6Addr, port: u16, flowinfo: u32, scope_id: u32) -> SocketAddrV6 {
SocketAddrV6 { ip, port, flowinfo, scope_id }
}
@@ -377,6 +390,7 @@ impl SocketAddrV6 {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn ip(&self) -> &Ipv6Addr {
&self.ip
}
@@ -393,6 +407,7 @@ impl SocketAddrV6 {
/// assert_eq!(socket.ip(), &Ipv6Addr::new(76, 45, 0, 0, 0, 0, 0, 0));
/// ```
#[stable(feature = "sockaddr_setters", since = "1.9.0")]
+ #[inline]
pub fn set_ip(&mut self, new_ip: Ipv6Addr) {
self.ip = new_ip;
}
@@ -410,6 +425,7 @@ impl SocketAddrV6 {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn port(&self) -> u16 {
self.port
}
@@ -426,6 +442,7 @@ impl SocketAddrV6 {
/// assert_eq!(socket.port(), 4242);
/// ```
#[stable(feature = "sockaddr_setters", since = "1.9.0")]
+ #[inline]
pub fn set_port(&mut self, new_port: u16) {
self.port = new_port;
}
@@ -453,6 +470,7 @@ impl SocketAddrV6 {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn flowinfo(&self) -> u32 {
self.flowinfo
}
@@ -471,6 +489,7 @@ impl SocketAddrV6 {
/// assert_eq!(socket.flowinfo(), 56);
/// ```
#[stable(feature = "sockaddr_setters", since = "1.9.0")]
+ #[inline]
pub fn set_flowinfo(&mut self, new_flowinfo: u32) {
self.flowinfo = new_flowinfo;
}
@@ -493,6 +512,7 @@ impl SocketAddrV6 {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+ #[inline]
pub const fn scope_id(&self) -> u32 {
self.scope_id
}
@@ -511,6 +531,7 @@ impl SocketAddrV6 {
/// assert_eq!(socket.scope_id(), 42);
/// ```
#[stable(feature = "sockaddr_setters", since = "1.9.0")]
+ #[inline]
pub fn set_scope_id(&mut self, new_scope_id: u32) {
self.scope_id = new_scope_id;
}
@@ -519,6 +540,7 @@ impl SocketAddrV6 {
#[stable(feature = "ip_from_ip", since = "1.16.0")]
impl From<SocketAddrV4> for SocketAddr {
/// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`].
+ #[inline]
fn from(sock4: SocketAddrV4) -> SocketAddr {
SocketAddr::V4(sock4)
}
@@ -527,6 +549,7 @@ impl From<SocketAddrV4> for SocketAddr {
#[stable(feature = "ip_from_ip", since = "1.16.0")]
impl From<SocketAddrV6> for SocketAddr {
/// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
+ #[inline]
fn from(sock6: SocketAddrV6) -> SocketAddr {
SocketAddr::V6(sock6)
}
@@ -624,6 +647,7 @@ impl fmt::Debug for SocketAddrV6 {
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
impl PartialOrd for SocketAddrV4 {
+ #[inline]
fn partial_cmp(&self, other: &SocketAddrV4) -> Option<Ordering> {
Some(self.cmp(other))
}
@@ -631,6 +655,7 @@ impl PartialOrd for SocketAddrV4 {
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
impl PartialOrd for SocketAddrV6 {
+ #[inline]
fn partial_cmp(&self, other: &SocketAddrV6) -> Option<Ordering> {
Some(self.cmp(other))
}
@@ -638,6 +663,7 @@ impl PartialOrd for SocketAddrV6 {
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
impl Ord for SocketAddrV4 {
+ #[inline]
fn cmp(&self, other: &SocketAddrV4) -> Ordering {
self.ip().cmp(other.ip()).then(self.port().cmp(&other.port()))
}
@@ -645,6 +671,7 @@ impl Ord for SocketAddrV4 {
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
impl Ord for SocketAddrV6 {
+ #[inline]
fn cmp(&self, other: &SocketAddrV6) -> Ordering {
self.ip().cmp(other.ip()).then(self.port().cmp(&other.port()))
}
diff --git a/library/core/src/num/error.rs b/library/core/src/num/error.rs
index 1bae4efe7..14e99578a 100644
--- a/library/core/src/num/error.rs
+++ b/library/core/src/num/error.rs
@@ -26,15 +26,15 @@ impl Error for TryFromIntError {
}
#[stable(feature = "try_from", since = "1.34.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl const From<Infallible> for TryFromIntError {
+impl From<Infallible> for TryFromIntError {
fn from(x: Infallible) -> TryFromIntError {
match x {}
}
}
#[unstable(feature = "never_type", issue = "35121")]
-impl const From<!> for TryFromIntError {
+impl From<!> for TryFromIntError {
+ #[inline]
fn from(never: !) -> TryFromIntError {
// Match rather than coerce to make sure that code like
// `From<Infallible> for TryFromIntError` above will keep working
diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs
index 1c6819b54..4a035ad61 100644
--- a/library/core/src/num/f32.rs
+++ b/library/core/src/num/f32.rs
@@ -940,6 +940,42 @@ impl f32 {
}
}
+ /// Calculates the middle point of `self` and `rhs`.
+ ///
+ /// This returns NaN when *either* argument is NaN or if a combination of
+ /// +inf and -inf is provided as arguments.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(num_midpoint)]
+ /// assert_eq!(1f32.midpoint(4.0), 2.5);
+ /// assert_eq!((-5.5f32).midpoint(8.0), 1.25);
+ /// ```
+ #[unstable(feature = "num_midpoint", issue = "110840")]
+ pub fn midpoint(self, other: f32) -> f32 {
+ const LO: f32 = f32::MIN_POSITIVE * 2.;
+ const HI: f32 = f32::MAX / 2.;
+
+ let (a, b) = (self, other);
+ let abs_a = a.abs_private();
+ let abs_b = b.abs_private();
+
+ if abs_a <= HI && abs_b <= HI {
+ // Overflow is impossible
+ (a + b) / 2.
+ } else if abs_a < LO {
+ // Not safe to halve a
+ a + (b / 2.)
+ } else if abs_b < LO {
+ // Not safe to halve b
+ (a / 2.) + b
+ } else {
+ // Not safe to halve a and b
+ (a / 2.) + (b / 2.)
+ }
+ }
+
/// Rounds toward zero and converts to any primitive integer type,
/// assuming that the value is finite and fits in that type.
///
diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs
index 1e7387217..3aafc435f 100644
--- a/library/core/src/num/f64.rs
+++ b/library/core/src/num/f64.rs
@@ -951,6 +951,42 @@ impl f64 {
}
}
+ /// Calculates the middle point of `self` and `rhs`.
+ ///
+ /// This returns NaN when *either* argument is NaN or if a combination of
+ /// +inf and -inf is provided as arguments.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(num_midpoint)]
+ /// assert_eq!(1f64.midpoint(4.0), 2.5);
+ /// assert_eq!((-5.5f64).midpoint(8.0), 1.25);
+ /// ```
+ #[unstable(feature = "num_midpoint", issue = "110840")]
+ pub fn midpoint(self, other: f64) -> f64 {
+ const LO: f64 = f64::MIN_POSITIVE * 2.;
+ const HI: f64 = f64::MAX / 2.;
+
+ let (a, b) = (self, other);
+ let abs_a = a.abs_private();
+ let abs_b = b.abs_private();
+
+ if abs_a <= HI && abs_b <= HI {
+ // Overflow is impossible
+ (a + b) / 2.
+ } else if abs_a < LO {
+ // Not safe to halve a
+ a + (b / 2.)
+ } else if abs_b < LO {
+ // Not safe to halve b
+ (a / 2.) + b
+ } else {
+ // Not safe to halve a and b
+ (a / 2.) + (b / 2.)
+ }
+ }
+
/// Rounds toward zero and converts to any primitive integer type,
/// assuming that the value is finite and fits in that type.
///
diff --git a/library/core/src/num/flt2dec/strategy/grisu.rs b/library/core/src/num/flt2dec/strategy/grisu.rs
index ed3e0edaf..b9f0d114c 100644
--- a/library/core/src/num/flt2dec/strategy/grisu.rs
+++ b/library/core/src/num/flt2dec/strategy/grisu.rs
@@ -487,6 +487,22 @@ pub fn format_exact_opt<'a>(
let vint = (v.f >> e) as u32;
let vfrac = v.f & ((1 << e) - 1);
+ let requested_digits = buf.len();
+
+ const POW10_UP_TO_9: [u32; 10] =
+ [1, 10, 100, 1000, 10_000, 100_000, 1_000_000, 10_000_000, 100_000_000, 1_000_000_000];
+
+ // We deviate from the original algorithm here and do some early checks to determine if we can satisfy requested_digits.
+ // If we determine that we can't, we exit early and avoid most of the heavy lifting that the algorithm otherwise does.
+ //
+ // When vfrac is zero, we can easily determine if vint can satisfy requested digits:
+ // If requested_digits >= 11, vint is not able to exhaust the count by itself since 10^(11 -1) > u32 max value >= vint.
+ // If vint < 10^(requested_digits - 1), vint cannot exhaust the count.
+ // Otherwise, vint might be able to exhaust the count and we need to execute the rest of the code.
+ if (vfrac == 0) && ((requested_digits >= 11) || (vint < POW10_UP_TO_9[requested_digits - 1])) {
+ return None;
+ }
+
// both old `v` and new `v` (scaled by `10^-k`) has an error of < 1 ulp (Theorem 5.1).
// as we don't know the error is positive or negative, we use two approximations
// spaced equally and have the maximal error of 2 ulps (same to the shortest case).
diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs
index aec15212d..1199d09b5 100644
--- a/library/core/src/num/int_macros.rs
+++ b/library/core/src/num/int_macros.rs
@@ -785,7 +785,7 @@ macro_rules! int_impl {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shl`.
// Any legal shift amount is losslessly representable in the self type.
- unsafe { intrinsics::unchecked_shl(self, rhs.try_into().ok().unwrap_unchecked()) }
+ unsafe { intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) }
}
/// Checked shift right. Computes `self >> rhs`, returning `None` if `rhs` is
@@ -833,7 +833,7 @@ macro_rules! int_impl {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shr`.
// Any legal shift amount is losslessly representable in the self type.
- unsafe { intrinsics::unchecked_shr(self, rhs.try_into().ok().unwrap_unchecked()) }
+ unsafe { intrinsics::unchecked_shr(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) }
}
/// Checked absolute value. Computes `self.abs()`, returning `None` if
@@ -2332,6 +2332,44 @@ macro_rules! int_impl {
}
}
+ /// Calculates the middle point of `self` and `rhs`.
+ ///
+ /// `midpoint(a, b)` is `(a + b) >> 1` as if it were performed in a
+ /// sufficiently-large signed integral type. This implies that the result is
+ /// always rounded towards negative infinity and that no overflow will ever occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(num_midpoint)]
+ #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
+ #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(-1), -1);")]
+ #[doc = concat!("assert_eq!((-1", stringify!($SelfT), ").midpoint(0), -1);")]
+ /// ```
+ #[unstable(feature = "num_midpoint", issue = "110840")]
+ #[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
+ #[rustc_allow_const_fn_unstable(const_num_midpoint)]
+ #[must_use = "this returns the result of the operation, \
+ without modifying the original"]
+ #[inline]
+ pub const fn midpoint(self, rhs: Self) -> Self {
+ const U: $UnsignedT = <$SelfT>::MIN.unsigned_abs();
+
+ // Map an $SelfT to an $UnsignedT
+ // ex: i8 [-128; 127] to [0; 255]
+ const fn map(a: $SelfT) -> $UnsignedT {
+ (a as $UnsignedT) ^ U
+ }
+
+ // Map an $UnsignedT to an $SelfT
+ // ex: u8 [0; 255] to [-128; 127]
+ const fn demap(a: $UnsignedT) -> $SelfT {
+ (a ^ U) as $SelfT
+ }
+
+ demap(<$UnsignedT>::midpoint(map(self), map(rhs)))
+ }
+
/// Returns the logarithm of the number with respect to an arbitrary base,
/// rounded down.
///
@@ -2603,13 +2641,16 @@ macro_rules! int_impl {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
- #[rustc_allow_const_fn_unstable(const_cmp)]
pub const fn signum(self) -> Self {
// Picking the right way to phrase this is complicated
// (<https://graphics.stanford.edu/~seander/bithacks.html#CopyIntegerSign>)
// so delegate it to `Ord` which is already producing -1/0/+1
// exactly like we need and can be the place to deal with the complexity.
- self.cmp(&0) as _
+
+ // FIXME(const-hack): replace with cmp
+ if self < 0 { -1 }
+ else if self == 0 { 0 }
+ else { 1 }
}
/// Returns `true` if `self` is positive and `false` if the number is zero or
diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs
index 9b812bbfc..c9baa09f4 100644
--- a/library/core/src/num/mod.rs
+++ b/library/core/src/num/mod.rs
@@ -95,6 +95,57 @@ depending on the target pointer size.
};
}
+macro_rules! midpoint_impl {
+ ($SelfT:ty, unsigned) => {
+ /// Calculates the middle point of `self` and `rhs`.
+ ///
+ /// `midpoint(a, b)` is `(a + b) >> 1` as if it were performed in a
+ /// sufficiently-large signed integral type. This implies that the result is
+ /// always rounded towards negative infinity and that no overflow will ever occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(num_midpoint)]
+ #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
+ #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".midpoint(4), 2);")]
+ /// ```
+ #[unstable(feature = "num_midpoint", issue = "110840")]
+ #[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
+ #[must_use = "this returns the result of the operation, \
+ without modifying the original"]
+ #[inline]
+ pub const fn midpoint(self, rhs: $SelfT) -> $SelfT {
+ // Use the well known branchless algorthim from Hacker's Delight to compute
+ // `(a + b) / 2` without overflowing: `((a ^ b) >> 1) + (a & b)`.
+ ((self ^ rhs) >> 1) + (self & rhs)
+ }
+ };
+ ($SelfT:ty, $WideT:ty, unsigned) => {
+ /// Calculates the middle point of `self` and `rhs`.
+ ///
+ /// `midpoint(a, b)` is `(a + b) >> 1` as if it were performed in a
+ /// sufficiently-large signed integral type. This implies that the result is
+ /// always rounded towards negative infinity and that no overflow will ever occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(num_midpoint)]
+ #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
+ #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".midpoint(4), 2);")]
+ /// ```
+ #[unstable(feature = "num_midpoint", issue = "110840")]
+ #[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
+ #[must_use = "this returns the result of the operation, \
+ without modifying the original"]
+ #[inline]
+ pub const fn midpoint(self, rhs: $SelfT) -> $SelfT {
+ ((self as $WideT + rhs as $WideT) / 2) as $SelfT
+ }
+ };
+}
+
macro_rules! widening_impl {
($SelfT:ty, $WideT:ty, $BITS:literal, unsigned) => {
/// Calculates the complete product `self * rhs` without the possibility to overflow.
@@ -225,6 +276,23 @@ macro_rules! widening_impl {
};
}
+macro_rules! conv_rhs_for_unchecked_shift {
+ ($SelfT:ty, $x:expr) => {{
+ #[inline]
+ fn conv(x: u32) -> $SelfT {
+ // FIXME(const-hack) replace with `.try_into().ok().unwrap_unchecked()`.
+ // SAFETY: Any legal shift amount must be losslessly representable in the self type.
+ unsafe { x.try_into().ok().unwrap_unchecked() }
+ }
+ #[inline]
+ const fn const_conv(x: u32) -> $SelfT {
+ x as _
+ }
+
+ intrinsics::const_eval_select(($x,), const_conv, conv)
+ }};
+}
+
impl i8 {
int_impl! {
Self = i8,
@@ -438,6 +506,7 @@ impl u8 {
bound_condition = "",
}
widening_impl! { u8, u16, 8, unsigned }
+ midpoint_impl! { u8, u16, unsigned }
/// Checks if the value is within the ASCII range.
///
@@ -455,7 +524,16 @@ impl u8 {
#[rustc_const_stable(feature = "const_u8_is_ascii", since = "1.43.0")]
#[inline]
pub const fn is_ascii(&self) -> bool {
- *self & 128 == 0
+ *self <= 127
+ }
+
+ /// If the value of this byte is within the ASCII range, returns it as an
+ /// [ASCII character](ascii::Char). Otherwise, returns `None`.
+ #[must_use]
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[inline]
+ pub const fn as_ascii(&self) -> Option<ascii::Char> {
+ ascii::Char::from_u8(*self)
}
/// Makes a copy of the value in its ASCII upper case equivalent.
@@ -1040,6 +1118,7 @@ impl u16 {
bound_condition = "",
}
widening_impl! { u16, u32, 16, unsigned }
+ midpoint_impl! { u16, u32, unsigned }
/// Checks if the value is a Unicode surrogate code point, which are disallowed values for [`char`].
///
@@ -1088,6 +1167,7 @@ impl u32 {
bound_condition = "",
}
widening_impl! { u32, u64, 32, unsigned }
+ midpoint_impl! { u32, u64, unsigned }
}
impl u64 {
@@ -1111,6 +1191,7 @@ impl u64 {
bound_condition = "",
}
widening_impl! { u64, u128, 64, unsigned }
+ midpoint_impl! { u64, u128, unsigned }
}
impl u128 {
@@ -1135,6 +1216,7 @@ impl u128 {
from_xe_bytes_doc = "",
bound_condition = "",
}
+ midpoint_impl! { u128, unsigned }
}
#[cfg(target_pointer_width = "16")]
@@ -1159,6 +1241,7 @@ impl usize {
bound_condition = " on 16-bit targets",
}
widening_impl! { usize, u32, 16, unsigned }
+ midpoint_impl! { usize, u32, unsigned }
}
#[cfg(target_pointer_width = "32")]
@@ -1183,6 +1266,7 @@ impl usize {
bound_condition = " on 32-bit targets",
}
widening_impl! { usize, u64, 32, unsigned }
+ midpoint_impl! { usize, u64, unsigned }
}
#[cfg(target_pointer_width = "64")]
@@ -1207,6 +1291,7 @@ impl usize {
bound_condition = " on 64-bit targets",
}
widening_impl! { usize, u128, 64, unsigned }
+ midpoint_impl! { usize, u128, unsigned }
}
impl usize {
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs
index 49d23abee..7f06e170a 100644
--- a/library/core/src/num/nonzero.rs
+++ b/library/core/src/num/nonzero.rs
@@ -1,7 +1,7 @@
//! Definitions of integer that is known not to equal zero.
use crate::fmt;
-use crate::ops::{BitOr, BitOrAssign, Div, Rem};
+use crate::ops::{BitOr, BitOrAssign, Div, Neg, Rem};
use crate::str::FromStr;
use super::from_str_radix;
@@ -96,8 +96,7 @@ macro_rules! nonzero_integers {
}
#[stable(feature = "from_nonzero", since = "1.31.0")]
- #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
- impl const From<$Ty> for $Int {
+ impl From<$Ty> for $Int {
#[doc = concat!("Converts a `", stringify!($Ty), "` into an `", stringify!($Int), "`")]
#[inline]
fn from(nonzero: $Ty) -> Self {
@@ -106,8 +105,7 @@ macro_rules! nonzero_integers {
}
#[stable(feature = "nonzero_bitor", since = "1.45.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOr for $Ty {
+ impl BitOr for $Ty {
type Output = Self;
#[inline]
fn bitor(self, rhs: Self) -> Self::Output {
@@ -118,8 +116,7 @@ macro_rules! nonzero_integers {
}
#[stable(feature = "nonzero_bitor", since = "1.45.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOr<$Int> for $Ty {
+ impl BitOr<$Int> for $Ty {
type Output = Self;
#[inline]
fn bitor(self, rhs: $Int) -> Self::Output {
@@ -131,8 +128,7 @@ macro_rules! nonzero_integers {
}
#[stable(feature = "nonzero_bitor", since = "1.45.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOr<$Ty> for $Int {
+ impl BitOr<$Ty> for $Int {
type Output = $Ty;
#[inline]
fn bitor(self, rhs: $Ty) -> Self::Output {
@@ -144,8 +140,7 @@ macro_rules! nonzero_integers {
}
#[stable(feature = "nonzero_bitor", since = "1.45.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOrAssign for $Ty {
+ impl BitOrAssign for $Ty {
#[inline]
fn bitor_assign(&mut self, rhs: Self) {
*self = *self | rhs;
@@ -153,8 +148,7 @@ macro_rules! nonzero_integers {
}
#[stable(feature = "nonzero_bitor", since = "1.45.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOrAssign<$Int> for $Ty {
+ impl BitOrAssign<$Int> for $Ty {
#[inline]
fn bitor_assign(&mut self, rhs: $Int) {
*self = *self | rhs;
@@ -276,8 +270,7 @@ macro_rules! nonzero_integers_div {
( $( $Ty: ident($Int: ty); )+ ) => {
$(
#[stable(feature = "nonzero_div", since = "1.51.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Div<$Ty> for $Int {
+ impl Div<$Ty> for $Int {
type Output = $Int;
/// This operation rounds towards zero,
/// truncating any fractional part of the exact result, and cannot panic.
@@ -290,8 +283,7 @@ macro_rules! nonzero_integers_div {
}
#[stable(feature = "nonzero_div", since = "1.51.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Rem<$Ty> for $Int {
+ impl Rem<$Ty> for $Int {
type Output = $Int;
/// This operation satisfies `n % d == n - (n / d) * d`, and cannot panic.
#[inline]
@@ -501,6 +493,43 @@ macro_rules! nonzero_unsigned_operations {
pub const fn ilog10(self) -> u32 {
super::int_log10::$Int(self.0)
}
+
+ /// Calculates the middle point of `self` and `rhs`.
+ ///
+ /// `midpoint(a, b)` is `(a + b) >> 1` as if it were performed in a
+ /// sufficiently-large signed integral type. This implies that the result is
+ /// always rounded towards negative infinity and that no overflow will ever occur.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(num_midpoint)]
+ #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
+ ///
+ /// # fn main() { test().unwrap(); }
+ /// # fn test() -> Option<()> {
+ #[doc = concat!("let one = ", stringify!($Ty), "::new(1)?;")]
+ #[doc = concat!("let two = ", stringify!($Ty), "::new(2)?;")]
+ #[doc = concat!("let four = ", stringify!($Ty), "::new(4)?;")]
+ ///
+ /// assert_eq!(one.midpoint(four), two);
+ /// assert_eq!(four.midpoint(one), two);
+ /// # Some(())
+ /// # }
+ /// ```
+ #[unstable(feature = "num_midpoint", issue = "110840")]
+ #[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
+ #[rustc_allow_const_fn_unstable(const_num_midpoint)]
+ #[must_use = "this returns the result of the operation, \
+ without modifying the original"]
+ #[inline]
+ pub const fn midpoint(self, rhs: Self) -> Self {
+ // SAFETY: The only way to get `0` with midpoint is to have two opposite or
+ // near opposite numbers: (-5, 5), (0, 1), (0, 0) which is impossible because
+ // of the unsignedness of this number and also because $Ty is guaranteed to
+ // never being 0.
+ unsafe { $Ty::new_unchecked(self.get().midpoint(rhs.get())) }
+ }
}
)+
}
@@ -672,8 +701,7 @@ macro_rules! nonzero_signed_operations {
/// assert_eq!(pos, pos.wrapping_abs());
/// assert_eq!(pos, neg.wrapping_abs());
/// assert_eq!(min, min.wrapping_abs());
- /// # // FIXME: add once Neg is implemented?
- /// # // assert_eq!(max, (-max).wrapping_abs());
+ /// assert_eq!(max, (-max).wrapping_abs());
/// # Some(())
/// # }
/// ```
@@ -722,14 +750,37 @@ macro_rules! nonzero_signed_operations {
unsafe { $Uty::new_unchecked(self.get().unsigned_abs()) }
}
+ /// Returns `true` if `self` is positive and `false` if the
+ /// number is negative.
+ ///
+ /// # Example
+ ///
+ /// ```
+ #[doc = concat!("# use std::num::", stringify!($Ty), ";")]
+ /// # fn main() { test().unwrap(); }
+ /// # fn test() -> Option<()> {
+ #[doc = concat!("let pos_five = ", stringify!($Ty), "::new(5)?;")]
+ #[doc = concat!("let neg_five = ", stringify!($Ty), "::new(-5)?;")]
+ ///
+ /// assert!(pos_five.is_positive());
+ /// assert!(!neg_five.is_positive());
+ /// # Some(())
+ /// # }
+ /// ```
+ #[must_use]
+ #[inline]
+ #[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
+ #[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
+ pub const fn is_positive(self) -> bool {
+ self.get().is_positive()
+ }
+
/// Returns `true` if `self` is negative and `false` if the
/// number is positive.
///
/// # Example
///
/// ```
- /// #![feature(nonzero_negation_ops)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
@@ -743,7 +794,8 @@ macro_rules! nonzero_signed_operations {
/// ```
#[must_use]
#[inline]
- #[unstable(feature = "nonzero_negation_ops", issue = "102443")]
+ #[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
+ #[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn is_negative(self) -> bool {
self.get().is_negative()
}
@@ -753,8 +805,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
- /// #![feature(nonzero_negation_ops)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
@@ -769,7 +819,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
- #[unstable(feature = "nonzero_negation_ops", issue = "102443")]
+ #[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
+ #[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn checked_neg(self) -> Option<$Ty> {
if let Some(result) = self.get().checked_neg() {
// SAFETY: negation of nonzero cannot yield zero values.
@@ -786,8 +837,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
- /// #![feature(nonzero_negation_ops)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
@@ -802,7 +851,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
- #[unstable(feature = "nonzero_negation_ops", issue = "102443")]
+ #[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
+ #[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn overflowing_neg(self) -> ($Ty, bool) {
let (result, overflow) = self.get().overflowing_neg();
// SAFETY: negation of nonzero cannot yield zero values.
@@ -815,8 +865,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
- /// #![feature(nonzero_negation_ops)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
@@ -836,7 +884,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
- #[unstable(feature = "nonzero_negation_ops", issue = "102443")]
+ #[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
+ #[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn saturating_neg(self) -> $Ty {
if let Some(result) = self.checked_neg() {
return result;
@@ -853,8 +902,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
- /// #![feature(nonzero_negation_ops)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
@@ -869,13 +916,28 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
- #[unstable(feature = "nonzero_negation_ops", issue = "102443")]
+ #[stable(feature = "nonzero_negation_ops", since = "1.71.0")]
+ #[rustc_const_stable(feature = "nonzero_negation_ops", since = "1.71.0")]
pub const fn wrapping_neg(self) -> $Ty {
let result = self.get().wrapping_neg();
// SAFETY: negation of nonzero cannot yield zero values.
unsafe { $Ty::new_unchecked(result) }
}
}
+
+ #[stable(feature = "signed_nonzero_neg", since = "1.71.0")]
+ impl Neg for $Ty {
+ type Output = $Ty;
+
+ #[inline]
+ fn neg(self) -> $Ty {
+ // SAFETY: negation of nonzero cannot yield zero values.
+ unsafe { $Ty::new_unchecked(self.get().neg()) }
+ }
+ }
+
+ forward_ref_unop! { impl Neg, neg for $Ty,
+ #[stable(feature = "signed_nonzero_neg", since = "1.71.0")] }
)+
}
}
diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs
index 114deeea3..6f6b6dbb8 100644
--- a/library/core/src/num/uint_macros.rs
+++ b/library/core/src/num/uint_macros.rs
@@ -939,7 +939,7 @@ macro_rules! uint_impl {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shl`.
// Any legal shift amount is losslessly representable in the self type.
- unsafe { intrinsics::unchecked_shl(self, rhs.try_into().ok().unwrap_unchecked()) }
+ unsafe { intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) }
}
/// Checked shift right. Computes `self >> rhs`, returning `None`
@@ -987,7 +987,7 @@ macro_rules! uint_impl {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shr`.
// Any legal shift amount is losslessly representable in the self type.
- unsafe { intrinsics::unchecked_shr(self, rhs.try_into().ok().unwrap_unchecked()) }
+ unsafe { intrinsics::unchecked_shr(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) }
}
/// Checked exponentiation. Computes `self.pow(exp)`, returning `None` if
diff --git a/library/core/src/num/wrapping.rs b/library/core/src/num/wrapping.rs
index 5353d900e..ed354a2e5 100644
--- a/library/core/src/num/wrapping.rs
+++ b/library/core/src/num/wrapping.rs
@@ -87,8 +87,7 @@ impl<T: fmt::UpperHex> fmt::UpperHex for Wrapping<T> {
macro_rules! sh_impl_signed {
($t:ident, $f:ident) => {
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Shl<$f> for Wrapping<$t> {
+ impl Shl<$f> for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -100,22 +99,20 @@ macro_rules! sh_impl_signed {
}
}
}
- forward_ref_binop! { impl const Shl, shl for Wrapping<$t>, $f,
+ forward_ref_binop! { impl Shl, shl for Wrapping<$t>, $f,
#[stable(feature = "wrapping_ref_ops", since = "1.39.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const ShlAssign<$f> for Wrapping<$t> {
+ impl ShlAssign<$f> for Wrapping<$t> {
#[inline]
fn shl_assign(&mut self, other: $f) {
*self = *self << other;
}
}
- forward_ref_op_assign! { impl const ShlAssign, shl_assign for Wrapping<$t>, $f }
+ forward_ref_op_assign! { impl ShlAssign, shl_assign for Wrapping<$t>, $f }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Shr<$f> for Wrapping<$t> {
+ impl Shr<$f> for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -127,26 +124,24 @@ macro_rules! sh_impl_signed {
}
}
}
- forward_ref_binop! { impl const Shr, shr for Wrapping<$t>, $f,
+ forward_ref_binop! { impl Shr, shr for Wrapping<$t>, $f,
#[stable(feature = "wrapping_ref_ops", since = "1.39.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const ShrAssign<$f> for Wrapping<$t> {
+ impl ShrAssign<$f> for Wrapping<$t> {
#[inline]
fn shr_assign(&mut self, other: $f) {
*self = *self >> other;
}
}
- forward_ref_op_assign! { impl const ShrAssign, shr_assign for Wrapping<$t>, $f }
+ forward_ref_op_assign! { impl ShrAssign, shr_assign for Wrapping<$t>, $f }
};
}
macro_rules! sh_impl_unsigned {
($t:ident, $f:ident) => {
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Shl<$f> for Wrapping<$t> {
+ impl Shl<$f> for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -154,22 +149,20 @@ macro_rules! sh_impl_unsigned {
Wrapping(self.0.wrapping_shl((other & self::shift_max::$t as $f) as u32))
}
}
- forward_ref_binop! { impl const Shl, shl for Wrapping<$t>, $f,
+ forward_ref_binop! { impl Shl, shl for Wrapping<$t>, $f,
#[stable(feature = "wrapping_ref_ops", since = "1.39.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const ShlAssign<$f> for Wrapping<$t> {
+ impl ShlAssign<$f> for Wrapping<$t> {
#[inline]
fn shl_assign(&mut self, other: $f) {
*self = *self << other;
}
}
- forward_ref_op_assign! { impl const ShlAssign, shl_assign for Wrapping<$t>, $f }
+ forward_ref_op_assign! { impl ShlAssign, shl_assign for Wrapping<$t>, $f }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Shr<$f> for Wrapping<$t> {
+ impl Shr<$f> for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -177,18 +170,17 @@ macro_rules! sh_impl_unsigned {
Wrapping(self.0.wrapping_shr((other & self::shift_max::$t as $f) as u32))
}
}
- forward_ref_binop! { impl const Shr, shr for Wrapping<$t>, $f,
+ forward_ref_binop! { impl Shr, shr for Wrapping<$t>, $f,
#[stable(feature = "wrapping_ref_ops", since = "1.39.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const ShrAssign<$f> for Wrapping<$t> {
+ impl ShrAssign<$f> for Wrapping<$t> {
#[inline]
fn shr_assign(&mut self, other: $f) {
*self = *self >> other;
}
}
- forward_ref_op_assign! { impl const ShrAssign, shr_assign for Wrapping<$t>, $f }
+ forward_ref_op_assign! { impl ShrAssign, shr_assign for Wrapping<$t>, $f }
};
}
@@ -217,8 +209,7 @@ sh_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
macro_rules! wrapping_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Add for Wrapping<$t> {
+ impl Add for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -226,32 +217,29 @@ macro_rules! wrapping_impl {
Wrapping(self.0.wrapping_add(other.0))
}
}
- forward_ref_binop! { impl const Add, add for Wrapping<$t>, Wrapping<$t>,
+ forward_ref_binop! { impl Add, add for Wrapping<$t>, Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const AddAssign for Wrapping<$t> {
+ impl AddAssign for Wrapping<$t> {
#[inline]
fn add_assign(&mut self, other: Wrapping<$t>) {
*self = *self + other;
}
}
- forward_ref_op_assign! { impl const AddAssign, add_assign for Wrapping<$t>, Wrapping<$t> }
+ forward_ref_op_assign! { impl AddAssign, add_assign for Wrapping<$t>, Wrapping<$t> }
#[stable(feature = "wrapping_int_assign_impl", since = "1.60.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const AddAssign<$t> for Wrapping<$t> {
+ impl AddAssign<$t> for Wrapping<$t> {
#[inline]
fn add_assign(&mut self, other: $t) {
*self = *self + Wrapping(other);
}
}
- forward_ref_op_assign! { impl const AddAssign, add_assign for Wrapping<$t>, $t }
+ forward_ref_op_assign! { impl AddAssign, add_assign for Wrapping<$t>, $t }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Sub for Wrapping<$t> {
+ impl Sub for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -259,32 +247,29 @@ macro_rules! wrapping_impl {
Wrapping(self.0.wrapping_sub(other.0))
}
}
- forward_ref_binop! { impl const Sub, sub for Wrapping<$t>, Wrapping<$t>,
+ forward_ref_binop! { impl Sub, sub for Wrapping<$t>, Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const SubAssign for Wrapping<$t> {
+ impl SubAssign for Wrapping<$t> {
#[inline]
fn sub_assign(&mut self, other: Wrapping<$t>) {
*self = *self - other;
}
}
- forward_ref_op_assign! { impl const SubAssign, sub_assign for Wrapping<$t>, Wrapping<$t> }
+ forward_ref_op_assign! { impl SubAssign, sub_assign for Wrapping<$t>, Wrapping<$t> }
#[stable(feature = "wrapping_int_assign_impl", since = "1.60.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const SubAssign<$t> for Wrapping<$t> {
+ impl SubAssign<$t> for Wrapping<$t> {
#[inline]
fn sub_assign(&mut self, other: $t) {
*self = *self - Wrapping(other);
}
}
- forward_ref_op_assign! { impl const SubAssign, sub_assign for Wrapping<$t>, $t }
+ forward_ref_op_assign! { impl SubAssign, sub_assign for Wrapping<$t>, $t }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Mul for Wrapping<$t> {
+ impl Mul for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -296,28 +281,25 @@ macro_rules! wrapping_impl {
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const MulAssign for Wrapping<$t> {
+ impl MulAssign for Wrapping<$t> {
#[inline]
fn mul_assign(&mut self, other: Wrapping<$t>) {
*self = *self * other;
}
}
- forward_ref_op_assign! { impl const MulAssign, mul_assign for Wrapping<$t>, Wrapping<$t> }
+ forward_ref_op_assign! { impl MulAssign, mul_assign for Wrapping<$t>, Wrapping<$t> }
#[stable(feature = "wrapping_int_assign_impl", since = "1.60.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const MulAssign<$t> for Wrapping<$t> {
+ impl MulAssign<$t> for Wrapping<$t> {
#[inline]
fn mul_assign(&mut self, other: $t) {
*self = *self * Wrapping(other);
}
}
- forward_ref_op_assign! { impl const MulAssign, mul_assign for Wrapping<$t>, $t }
+ forward_ref_op_assign! { impl MulAssign, mul_assign for Wrapping<$t>, $t }
#[stable(feature = "wrapping_div", since = "1.3.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Div for Wrapping<$t> {
+ impl Div for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -325,32 +307,29 @@ macro_rules! wrapping_impl {
Wrapping(self.0.wrapping_div(other.0))
}
}
- forward_ref_binop! { impl const Div, div for Wrapping<$t>, Wrapping<$t>,
+ forward_ref_binop! { impl Div, div for Wrapping<$t>, Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const DivAssign for Wrapping<$t> {
+ impl DivAssign for Wrapping<$t> {
#[inline]
fn div_assign(&mut self, other: Wrapping<$t>) {
*self = *self / other;
}
}
- forward_ref_op_assign! { impl const DivAssign, div_assign for Wrapping<$t>, Wrapping<$t> }
+ forward_ref_op_assign! { impl DivAssign, div_assign for Wrapping<$t>, Wrapping<$t> }
#[stable(feature = "wrapping_int_assign_impl", since = "1.60.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const DivAssign<$t> for Wrapping<$t> {
+ impl DivAssign<$t> for Wrapping<$t> {
#[inline]
fn div_assign(&mut self, other: $t) {
*self = *self / Wrapping(other);
}
}
- forward_ref_op_assign! { impl const DivAssign, div_assign for Wrapping<$t>, $t }
+ forward_ref_op_assign! { impl DivAssign, div_assign for Wrapping<$t>, $t }
#[stable(feature = "wrapping_impls", since = "1.7.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Rem for Wrapping<$t> {
+ impl Rem for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -358,32 +337,29 @@ macro_rules! wrapping_impl {
Wrapping(self.0.wrapping_rem(other.0))
}
}
- forward_ref_binop! { impl const Rem, rem for Wrapping<$t>, Wrapping<$t>,
+ forward_ref_binop! { impl Rem, rem for Wrapping<$t>, Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const RemAssign for Wrapping<$t> {
+ impl RemAssign for Wrapping<$t> {
#[inline]
fn rem_assign(&mut self, other: Wrapping<$t>) {
*self = *self % other;
}
}
- forward_ref_op_assign! { impl const RemAssign, rem_assign for Wrapping<$t>, Wrapping<$t> }
+ forward_ref_op_assign! { impl RemAssign, rem_assign for Wrapping<$t>, Wrapping<$t> }
#[stable(feature = "wrapping_int_assign_impl", since = "1.60.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const RemAssign<$t> for Wrapping<$t> {
+ impl RemAssign<$t> for Wrapping<$t> {
#[inline]
fn rem_assign(&mut self, other: $t) {
*self = *self % Wrapping(other);
}
}
- forward_ref_op_assign! { impl const RemAssign, rem_assign for Wrapping<$t>, $t }
+ forward_ref_op_assign! { impl RemAssign, rem_assign for Wrapping<$t>, $t }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Not for Wrapping<$t> {
+ impl Not for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -391,12 +367,11 @@ macro_rules! wrapping_impl {
Wrapping(!self.0)
}
}
- forward_ref_unop! { impl const Not, not for Wrapping<$t>,
+ forward_ref_unop! { impl Not, not for Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitXor for Wrapping<$t> {
+ impl BitXor for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -404,32 +379,29 @@ macro_rules! wrapping_impl {
Wrapping(self.0 ^ other.0)
}
}
- forward_ref_binop! { impl const BitXor, bitxor for Wrapping<$t>, Wrapping<$t>,
+ forward_ref_binop! { impl BitXor, bitxor for Wrapping<$t>, Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitXorAssign for Wrapping<$t> {
+ impl BitXorAssign for Wrapping<$t> {
#[inline]
fn bitxor_assign(&mut self, other: Wrapping<$t>) {
*self = *self ^ other;
}
}
- forward_ref_op_assign! { impl const BitXorAssign, bitxor_assign for Wrapping<$t>, Wrapping<$t> }
+ forward_ref_op_assign! { impl BitXorAssign, bitxor_assign for Wrapping<$t>, Wrapping<$t> }
#[stable(feature = "wrapping_int_assign_impl", since = "1.60.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitXorAssign<$t> for Wrapping<$t> {
+ impl BitXorAssign<$t> for Wrapping<$t> {
#[inline]
fn bitxor_assign(&mut self, other: $t) {
*self = *self ^ Wrapping(other);
}
}
- forward_ref_op_assign! { impl const BitXorAssign, bitxor_assign for Wrapping<$t>, $t }
+ forward_ref_op_assign! { impl BitXorAssign, bitxor_assign for Wrapping<$t>, $t }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOr for Wrapping<$t> {
+ impl BitOr for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -437,32 +409,29 @@ macro_rules! wrapping_impl {
Wrapping(self.0 | other.0)
}
}
- forward_ref_binop! { impl const BitOr, bitor for Wrapping<$t>, Wrapping<$t>,
+ forward_ref_binop! { impl BitOr, bitor for Wrapping<$t>, Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOrAssign for Wrapping<$t> {
+ impl BitOrAssign for Wrapping<$t> {
#[inline]
fn bitor_assign(&mut self, other: Wrapping<$t>) {
*self = *self | other;
}
}
- forward_ref_op_assign! { impl const BitOrAssign, bitor_assign for Wrapping<$t>, Wrapping<$t> }
+ forward_ref_op_assign! { impl BitOrAssign, bitor_assign for Wrapping<$t>, Wrapping<$t> }
#[stable(feature = "wrapping_int_assign_impl", since = "1.60.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOrAssign<$t> for Wrapping<$t> {
+ impl BitOrAssign<$t> for Wrapping<$t> {
#[inline]
fn bitor_assign(&mut self, other: $t) {
*self = *self | Wrapping(other);
}
}
- forward_ref_op_assign! { impl const BitOrAssign, bitor_assign for Wrapping<$t>, $t }
+ forward_ref_op_assign! { impl BitOrAssign, bitor_assign for Wrapping<$t>, $t }
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitAnd for Wrapping<$t> {
+ impl BitAnd for Wrapping<$t> {
type Output = Wrapping<$t>;
#[inline]
@@ -470,39 +439,36 @@ macro_rules! wrapping_impl {
Wrapping(self.0 & other.0)
}
}
- forward_ref_binop! { impl const BitAnd, bitand for Wrapping<$t>, Wrapping<$t>,
+ forward_ref_binop! { impl BitAnd, bitand for Wrapping<$t>, Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitAndAssign for Wrapping<$t> {
+ impl BitAndAssign for Wrapping<$t> {
#[inline]
fn bitand_assign(&mut self, other: Wrapping<$t>) {
*self = *self & other;
}
}
- forward_ref_op_assign! { impl const BitAndAssign, bitand_assign for Wrapping<$t>, Wrapping<$t> }
+ forward_ref_op_assign! { impl BitAndAssign, bitand_assign for Wrapping<$t>, Wrapping<$t> }
#[stable(feature = "wrapping_int_assign_impl", since = "1.60.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitAndAssign<$t> for Wrapping<$t> {
+ impl BitAndAssign<$t> for Wrapping<$t> {
#[inline]
fn bitand_assign(&mut self, other: $t) {
*self = *self & Wrapping(other);
}
}
- forward_ref_op_assign! { impl const BitAndAssign, bitand_assign for Wrapping<$t>, $t }
+ forward_ref_op_assign! { impl BitAndAssign, bitand_assign for Wrapping<$t>, $t }
#[stable(feature = "wrapping_neg", since = "1.10.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Neg for Wrapping<$t> {
+ impl Neg for Wrapping<$t> {
type Output = Self;
#[inline]
fn neg(self) -> Self {
Wrapping(0) - self
}
}
- forward_ref_unop! { impl const Neg, neg for Wrapping<$t>,
+ forward_ref_unop! { impl Neg, neg for Wrapping<$t>,
#[stable(feature = "wrapping_ref", since = "1.14.0")] }
)*)
diff --git a/library/core/src/ops/arith.rs b/library/core/src/ops/arith.rs
index 0c7ee9630..840c8cd2f 100644
--- a/library/core/src/ops/arith.rs
+++ b/library/core/src/ops/arith.rs
@@ -73,7 +73,6 @@
append_const_msg
)]
#[doc(alias = "+")]
-#[const_trait]
pub trait Add<Rhs = Self> {
/// The resulting type after applying the `+` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -95,8 +94,7 @@ pub trait Add<Rhs = Self> {
macro_rules! add_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Add for $t {
+ impl Add for $t {
type Output = $t;
#[inline]
@@ -104,7 +102,7 @@ macro_rules! add_impl {
fn add(self, other: $t) -> $t { self + other }
}
- forward_ref_binop! { impl const Add, add for $t, $t }
+ forward_ref_binop! { impl Add, add for $t, $t }
)*)
}
@@ -183,7 +181,6 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
append_const_msg
)]
#[doc(alias = "-")]
-#[const_trait]
pub trait Sub<Rhs = Self> {
/// The resulting type after applying the `-` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -205,8 +202,7 @@ pub trait Sub<Rhs = Self> {
macro_rules! sub_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Sub for $t {
+ impl Sub for $t {
type Output = $t;
#[inline]
@@ -214,7 +210,7 @@ macro_rules! sub_impl {
fn sub(self, other: $t) -> $t { self - other }
}
- forward_ref_binop! { impl const Sub, sub for $t, $t }
+ forward_ref_binop! { impl Sub, sub for $t, $t }
)*)
}
@@ -314,7 +310,6 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
label = "no implementation for `{Self} * {Rhs}`"
)]
#[doc(alias = "*")]
-#[const_trait]
pub trait Mul<Rhs = Self> {
/// The resulting type after applying the `*` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -336,8 +331,7 @@ pub trait Mul<Rhs = Self> {
macro_rules! mul_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Mul for $t {
+ impl Mul for $t {
type Output = $t;
#[inline]
@@ -345,7 +339,7 @@ macro_rules! mul_impl {
fn mul(self, other: $t) -> $t { self * other }
}
- forward_ref_binop! { impl const Mul, mul for $t, $t }
+ forward_ref_binop! { impl Mul, mul for $t, $t }
)*)
}
@@ -449,7 +443,6 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
label = "no implementation for `{Self} / {Rhs}`"
)]
#[doc(alias = "/")]
-#[const_trait]
pub trait Div<Rhs = Self> {
/// The resulting type after applying the `/` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -477,15 +470,14 @@ macro_rules! div_impl_integer {
///
#[doc = $panic]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Div for $t {
+ impl Div for $t {
type Output = $t;
#[inline]
fn div(self, other: $t) -> $t { self / other }
}
- forward_ref_binop! { impl const Div, div for $t, $t }
+ forward_ref_binop! { impl Div, div for $t, $t }
)*)*)
}
@@ -497,15 +489,14 @@ div_impl_integer! {
macro_rules! div_impl_float {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Div for $t {
+ impl Div for $t {
type Output = $t;
#[inline]
fn div(self, other: $t) -> $t { self / other }
}
- forward_ref_binop! { impl const Div, div for $t, $t }
+ forward_ref_binop! { impl Div, div for $t, $t }
)*)
}
@@ -526,7 +517,7 @@ div_impl_float! { f32 f64 }
/// use std::ops::Rem;
///
/// #[derive(PartialEq, Debug)]
-/// struct SplitSlice<'a, T: 'a> {
+/// struct SplitSlice<'a, T> {
/// slice: &'a [T],
/// }
///
@@ -553,7 +544,6 @@ div_impl_float! { f32 f64 }
label = "no implementation for `{Self} % {Rhs}`"
)]
#[doc(alias = "%")]
-#[const_trait]
pub trait Rem<Rhs = Self> {
/// The resulting type after applying the `%` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -581,15 +571,14 @@ macro_rules! rem_impl_integer {
///
#[doc = $panic]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Rem for $t {
+ impl Rem for $t {
type Output = $t;
#[inline]
fn rem(self, other: $t) -> $t { self % other }
}
- forward_ref_binop! { impl const Rem, rem for $t, $t }
+ forward_ref_binop! { impl Rem, rem for $t, $t }
)*)*)
}
@@ -616,15 +605,14 @@ macro_rules! rem_impl_float {
/// assert_eq!(x % y, remainder);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Rem for $t {
+ impl Rem for $t {
type Output = $t;
#[inline]
fn rem(self, other: $t) -> $t { self % other }
}
- forward_ref_binop! { impl const Rem, rem for $t, $t }
+ forward_ref_binop! { impl Rem, rem for $t, $t }
)*)
}
@@ -669,7 +657,6 @@ rem_impl_float! { f32 f64 }
#[lang = "neg"]
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(alias = "-")]
-#[const_trait]
pub trait Neg {
/// The resulting type after applying the `-` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -692,8 +679,7 @@ pub trait Neg {
macro_rules! neg_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Neg for $t {
+ impl Neg for $t {
type Output = $t;
#[inline]
@@ -701,7 +687,7 @@ macro_rules! neg_impl {
fn neg(self) -> $t { -self }
}
- forward_ref_unop! { impl const Neg, neg for $t }
+ forward_ref_unop! { impl Neg, neg for $t }
)*)
}
@@ -744,7 +730,6 @@ neg_impl! { isize i8 i16 i32 i64 i128 f32 f64 }
)]
#[doc(alias = "+")]
#[doc(alias = "+=")]
-#[const_trait]
pub trait AddAssign<Rhs = Self> {
/// Performs the `+=` operation.
///
@@ -762,14 +747,13 @@ pub trait AddAssign<Rhs = Self> {
macro_rules! add_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const AddAssign for $t {
+ impl AddAssign for $t {
#[inline]
#[rustc_inherit_overflow_checks]
fn add_assign(&mut self, other: $t) { *self += other }
}
- forward_ref_op_assign! { impl const AddAssign, add_assign for $t, $t }
+ forward_ref_op_assign! { impl AddAssign, add_assign for $t, $t }
)+)
}
@@ -812,7 +796,6 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
)]
#[doc(alias = "-")]
#[doc(alias = "-=")]
-#[const_trait]
pub trait SubAssign<Rhs = Self> {
/// Performs the `-=` operation.
///
@@ -830,14 +813,13 @@ pub trait SubAssign<Rhs = Self> {
macro_rules! sub_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const SubAssign for $t {
+ impl SubAssign for $t {
#[inline]
#[rustc_inherit_overflow_checks]
fn sub_assign(&mut self, other: $t) { *self -= other }
}
- forward_ref_op_assign! { impl const SubAssign, sub_assign for $t, $t }
+ forward_ref_op_assign! { impl SubAssign, sub_assign for $t, $t }
)+)
}
@@ -871,7 +853,6 @@ sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
)]
#[doc(alias = "*")]
#[doc(alias = "*=")]
-#[const_trait]
pub trait MulAssign<Rhs = Self> {
/// Performs the `*=` operation.
///
@@ -889,14 +870,13 @@ pub trait MulAssign<Rhs = Self> {
macro_rules! mul_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const MulAssign for $t {
+ impl MulAssign for $t {
#[inline]
#[rustc_inherit_overflow_checks]
fn mul_assign(&mut self, other: $t) { *self *= other }
}
- forward_ref_op_assign! { impl const MulAssign, mul_assign for $t, $t }
+ forward_ref_op_assign! { impl MulAssign, mul_assign for $t, $t }
)+)
}
@@ -930,7 +910,6 @@ mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
)]
#[doc(alias = "/")]
#[doc(alias = "/=")]
-#[const_trait]
pub trait DivAssign<Rhs = Self> {
/// Performs the `/=` operation.
///
@@ -948,13 +927,12 @@ pub trait DivAssign<Rhs = Self> {
macro_rules! div_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const DivAssign for $t {
+ impl DivAssign for $t {
#[inline]
fn div_assign(&mut self, other: $t) { *self /= other }
}
- forward_ref_op_assign! { impl const DivAssign, div_assign for $t, $t }
+ forward_ref_op_assign! { impl DivAssign, div_assign for $t, $t }
)+)
}
@@ -992,7 +970,6 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
)]
#[doc(alias = "%")]
#[doc(alias = "%=")]
-#[const_trait]
pub trait RemAssign<Rhs = Self> {
/// Performs the `%=` operation.
///
@@ -1010,13 +987,12 @@ pub trait RemAssign<Rhs = Self> {
macro_rules! rem_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const RemAssign for $t {
+ impl RemAssign for $t {
#[inline]
fn rem_assign(&mut self, other: $t) { *self %= other }
}
- forward_ref_op_assign! { impl const RemAssign, rem_assign for $t, $t }
+ forward_ref_op_assign! { impl RemAssign, rem_assign for $t, $t }
)+)
}
diff --git a/library/core/src/ops/bit.rs b/library/core/src/ops/bit.rs
index 327009801..c70f4a3da 100644
--- a/library/core/src/ops/bit.rs
+++ b/library/core/src/ops/bit.rs
@@ -31,7 +31,6 @@
#[lang = "not"]
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(alias = "!")]
-#[const_trait]
pub trait Not {
/// The resulting type after applying the `!` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -55,23 +54,21 @@ pub trait Not {
macro_rules! not_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Not for $t {
+ impl Not for $t {
type Output = $t;
#[inline]
fn not(self) -> $t { !self }
}
- forward_ref_unop! { impl const Not, not for $t }
+ forward_ref_unop! { impl Not, not for $t }
)*)
}
not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[stable(feature = "not_never", since = "1.60.0")]
-#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
-impl const Not for ! {
+impl Not for ! {
type Output = !;
#[inline]
@@ -144,7 +141,6 @@ impl const Not for ! {
message = "no implementation for `{Self} & {Rhs}`",
label = "no implementation for `{Self} & {Rhs}`"
)]
-#[const_trait]
pub trait BitAnd<Rhs = Self> {
/// The resulting type after applying the `&` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -168,15 +164,14 @@ pub trait BitAnd<Rhs = Self> {
macro_rules! bitand_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitAnd for $t {
+ impl BitAnd for $t {
type Output = $t;
#[inline]
fn bitand(self, rhs: $t) -> $t { self & rhs }
}
- forward_ref_binop! { impl const BitAnd, bitand for $t, $t }
+ forward_ref_binop! { impl BitAnd, bitand for $t, $t }
)*)
}
@@ -246,7 +241,6 @@ bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
message = "no implementation for `{Self} | {Rhs}`",
label = "no implementation for `{Self} | {Rhs}`"
)]
-#[const_trait]
pub trait BitOr<Rhs = Self> {
/// The resulting type after applying the `|` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -270,15 +264,14 @@ pub trait BitOr<Rhs = Self> {
macro_rules! bitor_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOr for $t {
+ impl BitOr for $t {
type Output = $t;
#[inline]
fn bitor(self, rhs: $t) -> $t { self | rhs }
}
- forward_ref_binop! { impl const BitOr, bitor for $t, $t }
+ forward_ref_binop! { impl BitOr, bitor for $t, $t }
)*)
}
@@ -348,7 +341,6 @@ bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
message = "no implementation for `{Self} ^ {Rhs}`",
label = "no implementation for `{Self} ^ {Rhs}`"
)]
-#[const_trait]
pub trait BitXor<Rhs = Self> {
/// The resulting type after applying the `^` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -372,15 +364,14 @@ pub trait BitXor<Rhs = Self> {
macro_rules! bitxor_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitXor for $t {
+ impl BitXor for $t {
type Output = $t;
#[inline]
fn bitxor(self, other: $t) -> $t { self ^ other }
}
- forward_ref_binop! { impl const BitXor, bitxor for $t, $t }
+ forward_ref_binop! { impl BitXor, bitxor for $t, $t }
)*)
}
@@ -449,7 +440,6 @@ bitxor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
message = "no implementation for `{Self} << {Rhs}`",
label = "no implementation for `{Self} << {Rhs}`"
)]
-#[const_trait]
pub trait Shl<Rhs = Self> {
/// The resulting type after applying the `<<` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -471,8 +461,7 @@ pub trait Shl<Rhs = Self> {
macro_rules! shl_impl {
($t:ty, $f:ty) => {
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Shl<$f> for $t {
+ impl Shl<$f> for $t {
type Output = $t;
#[inline]
@@ -482,7 +471,7 @@ macro_rules! shl_impl {
}
}
- forward_ref_binop! { impl const Shl, shl for $t, $f }
+ forward_ref_binop! { impl Shl, shl for $t, $f }
};
}
@@ -569,7 +558,6 @@ shl_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
message = "no implementation for `{Self} >> {Rhs}`",
label = "no implementation for `{Self} >> {Rhs}`"
)]
-#[const_trait]
pub trait Shr<Rhs = Self> {
/// The resulting type after applying the `>>` operator.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -591,8 +579,7 @@ pub trait Shr<Rhs = Self> {
macro_rules! shr_impl {
($t:ty, $f:ty) => {
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const Shr<$f> for $t {
+ impl Shr<$f> for $t {
type Output = $t;
#[inline]
@@ -602,7 +589,7 @@ macro_rules! shr_impl {
}
}
- forward_ref_binop! { impl const Shr, shr for $t, $f }
+ forward_ref_binop! { impl Shr, shr for $t, $f }
};
}
@@ -698,7 +685,6 @@ shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
message = "no implementation for `{Self} &= {Rhs}`",
label = "no implementation for `{Self} &= {Rhs}`"
)]
-#[const_trait]
pub trait BitAndAssign<Rhs = Self> {
/// Performs the `&=` operation.
///
@@ -728,13 +714,12 @@ pub trait BitAndAssign<Rhs = Self> {
macro_rules! bitand_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitAndAssign for $t {
+ impl BitAndAssign for $t {
#[inline]
fn bitand_assign(&mut self, other: $t) { *self &= other }
}
- forward_ref_op_assign! { impl const BitAndAssign, bitand_assign for $t, $t }
+ forward_ref_op_assign! { impl BitAndAssign, bitand_assign for $t, $t }
)+)
}
@@ -771,7 +756,6 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
message = "no implementation for `{Self} |= {Rhs}`",
label = "no implementation for `{Self} |= {Rhs}`"
)]
-#[const_trait]
pub trait BitOrAssign<Rhs = Self> {
/// Performs the `|=` operation.
///
@@ -801,13 +785,12 @@ pub trait BitOrAssign<Rhs = Self> {
macro_rules! bitor_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitOrAssign for $t {
+ impl BitOrAssign for $t {
#[inline]
fn bitor_assign(&mut self, other: $t) { *self |= other }
}
- forward_ref_op_assign! { impl const BitOrAssign, bitor_assign for $t, $t }
+ forward_ref_op_assign! { impl BitOrAssign, bitor_assign for $t, $t }
)+)
}
@@ -844,7 +827,6 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
message = "no implementation for `{Self} ^= {Rhs}`",
label = "no implementation for `{Self} ^= {Rhs}`"
)]
-#[const_trait]
pub trait BitXorAssign<Rhs = Self> {
/// Performs the `^=` operation.
///
@@ -874,13 +856,12 @@ pub trait BitXorAssign<Rhs = Self> {
macro_rules! bitxor_assign_impl {
($($t:ty)+) => ($(
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const BitXorAssign for $t {
+ impl BitXorAssign for $t {
#[inline]
fn bitxor_assign(&mut self, other: $t) { *self ^= other }
}
- forward_ref_op_assign! { impl const BitXorAssign, bitxor_assign for $t, $t }
+ forward_ref_op_assign! { impl BitXorAssign, bitxor_assign for $t, $t }
)+)
}
@@ -915,7 +896,6 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
message = "no implementation for `{Self} <<= {Rhs}`",
label = "no implementation for `{Self} <<= {Rhs}`"
)]
-#[const_trait]
pub trait ShlAssign<Rhs = Self> {
/// Performs the `<<=` operation.
///
@@ -937,8 +917,7 @@ pub trait ShlAssign<Rhs = Self> {
macro_rules! shl_assign_impl {
($t:ty, $f:ty) => {
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const ShlAssign<$f> for $t {
+ impl ShlAssign<$f> for $t {
#[inline]
#[rustc_inherit_overflow_checks]
fn shl_assign(&mut self, other: $f) {
@@ -946,7 +925,7 @@ macro_rules! shl_assign_impl {
}
}
- forward_ref_op_assign! { impl const ShlAssign, shl_assign for $t, $f }
+ forward_ref_op_assign! { impl ShlAssign, shl_assign for $t, $f }
};
}
@@ -999,7 +978,6 @@ shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
message = "no implementation for `{Self} >>= {Rhs}`",
label = "no implementation for `{Self} >>= {Rhs}`"
)]
-#[const_trait]
pub trait ShrAssign<Rhs = Self> {
/// Performs the `>>=` operation.
///
@@ -1021,8 +999,7 @@ pub trait ShrAssign<Rhs = Self> {
macro_rules! shr_assign_impl {
($t:ty, $f:ty) => {
#[stable(feature = "op_assign_traits", since = "1.8.0")]
- #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
- impl const ShrAssign<$f> for $t {
+ impl ShrAssign<$f> for $t {
#[inline]
#[rustc_inherit_overflow_checks]
fn shr_assign(&mut self, other: $f) {
@@ -1030,7 +1007,7 @@ macro_rules! shr_assign_impl {
}
}
- forward_ref_op_assign! { impl const ShrAssign, shr_assign for $t, $f }
+ forward_ref_op_assign! { impl ShrAssign, shr_assign for $t, $f }
};
}
diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs
index 117706fb4..e10c438ef 100644
--- a/library/core/src/ops/control_flow.rs
+++ b/library/core/src/ops/control_flow.rs
@@ -97,8 +97,7 @@ pub enum ControlFlow<B, C = ()> {
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<B, C> const ops::Try for ControlFlow<B, C> {
+impl<B, C> ops::Try for ControlFlow<B, C> {
type Output = C;
type Residual = ControlFlow<B, convert::Infallible>;
@@ -117,8 +116,7 @@ impl<B, C> const ops::Try for ControlFlow<B, C> {
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<B, C> const ops::FromResidual for ControlFlow<B, C> {
+impl<B, C> ops::FromResidual for ControlFlow<B, C> {
#[inline]
fn from_residual(residual: ControlFlow<B, convert::Infallible>) -> Self {
match residual {
@@ -128,8 +126,7 @@ impl<B, C> const ops::FromResidual for ControlFlow<B, C> {
}
#[unstable(feature = "try_trait_v2_residual", issue = "91285")]
-#[rustc_const_unstable(feature = "const_try", issue = "74935")]
-impl<B, C> const ops::Residual<C> for ControlFlow<B, convert::Infallible> {
+impl<B, C> ops::Residual<C> for ControlFlow<B, convert::Infallible> {
type TryType = ControlFlow<B, C>;
}
diff --git a/library/core/src/ops/deref.rs b/library/core/src/ops/deref.rs
index c67867f44..08c35b6da 100644
--- a/library/core/src/ops/deref.rs
+++ b/library/core/src/ops/deref.rs
@@ -61,7 +61,6 @@
#[doc(alias = "&*")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Deref"]
-#[const_trait]
pub trait Deref {
/// The resulting type after dereferencing.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -77,8 +76,7 @@ pub trait Deref {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_deref", issue = "88955")]
-impl<T: ?Sized> const Deref for &T {
+impl<T: ?Sized> Deref for &T {
type Target = T;
#[rustc_diagnostic_item = "noop_method_deref"]
@@ -91,8 +89,7 @@ impl<T: ?Sized> const Deref for &T {
impl<T: ?Sized> !DerefMut for &T {}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_deref", issue = "88955")]
-impl<T: ?Sized> const Deref for &mut T {
+impl<T: ?Sized> Deref for &mut T {
type Target = T;
fn deref(&self) -> &T {
@@ -170,7 +167,6 @@ impl<T: ?Sized> const Deref for &mut T {
#[lang = "deref_mut"]
#[doc(alias = "*")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[const_trait]
pub trait DerefMut: Deref {
/// Mutably dereferences the value.
#[stable(feature = "rust1", since = "1.0.0")]
diff --git a/library/core/src/ops/drop.rs b/library/core/src/ops/drop.rs
index a2c3d978c..9ebf426be 100644
--- a/library/core/src/ops/drop.rs
+++ b/library/core/src/ops/drop.rs
@@ -132,6 +132,74 @@
/// are `Copy` get implicitly duplicated by the compiler, making it very
/// hard to predict when, and how often destructors will be executed. As such,
/// these types cannot have destructors.
+///
+/// ## Drop check
+///
+/// Dropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly
+/// dropped as some variable of this type goes out of scope, the borrow checker needs to ensure that
+/// calling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to
+/// recursively drop all the fields of `T`. For example, it is crucial that code like the following
+/// is being rejected:
+///
+/// ```compile_fail,E0597
+/// use std::cell::Cell;
+///
+/// struct S<'a>(Cell<Option<&'a S<'a>>>, Box<i32>);
+/// impl Drop for S<'_> {
+/// fn drop(&mut self) {
+/// if let Some(r) = self.0.get() {
+/// // Print the contents of the `Box` in `r`.
+/// println!("{}", r.1);
+/// }
+/// }
+/// }
+///
+/// fn main() {
+/// // Set up two `S` that point to each other.
+/// let s1 = S(Cell::new(None), Box::new(42));
+/// let s2 = S(Cell::new(Some(&s1)), Box::new(42));
+/// s1.0.set(Some(&s2));
+/// // Now they both get dropped. But whichever is the 2nd one
+/// // to be dropped will access the `Box` in the first one,
+/// // which is a use-after-free!
+/// }
+/// ```
+///
+/// The Nomicon discusses the need for [drop check in more detail][drop check].
+///
+/// To reject such code, the "drop check" analysis determines which types and lifetimes need to
+/// still be live when `T` gets dropped. The exact details of this analysis are not yet
+/// stably guaranteed and **subject to change**. Currently, the analysis works as follows:
+/// - If `T` has no drop glue, then trivially nothing is required to be live. This is the case if
+/// neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]
+/// and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.
+/// - If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,
+/// recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of
+/// owned types is determined by recursively traversing `T`:
+/// - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of
+/// length 0).
+/// - Stop at reference and raw pointer types as well as function pointers and function items;
+/// they do not own anything.
+/// - Stop at non-composite types (type parameters that remain generic in the current context and
+/// base types such as integers and `bool`); these types are owned.
+/// - When hitting an ADT with `impl Drop`, stop there; this type is owned.
+/// - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,
+/// consider all fields of all variants.)
+/// - Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`
+/// must be live.
+///
+/// In the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,
+/// and hence the example is rejected. If we remove the `impl Drop`, the liveness requirement
+/// disappears and the example is accepted.
+///
+/// There exists an unstable way for a type to opt-out of the last clause; this is called "drop
+/// check eyepatch" or `may_dangle`. For more details on this nightly-only feature, see the
+/// [discussion in the Nomicon][nomicon].
+///
+/// [`ManuallyDrop`]: crate::mem::ManuallyDrop
+/// [`PhantomData`]: crate::marker::PhantomData
+/// [drop check]: ../../nomicon/dropck.html
+/// [nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle
#[lang = "drop"]
#[stable(feature = "rust1", since = "1.0.0")]
#[const_trait]
diff --git a/library/core/src/ops/function.rs b/library/core/src/ops/function.rs
index b7e1aee9d..67c8245f0 100644
--- a/library/core/src/ops/function.rs
+++ b/library/core/src/ops/function.rs
@@ -254,10 +254,9 @@ mod impls {
use crate::marker::Tuple;
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
- impl<A: Tuple, F: ?Sized> const Fn<A> for &F
+ impl<A: Tuple, F: ?Sized> Fn<A> for &F
where
- F: ~const Fn<A>,
+ F: Fn<A>,
{
extern "rust-call" fn call(&self, args: A) -> F::Output {
(**self).call(args)
@@ -265,10 +264,9 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
- impl<A: Tuple, F: ?Sized> const FnMut<A> for &F
+ impl<A: Tuple, F: ?Sized> FnMut<A> for &F
where
- F: ~const Fn<A>,
+ F: Fn<A>,
{
extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output {
(**self).call(args)
@@ -276,10 +274,9 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
- impl<A: Tuple, F: ?Sized> const FnOnce<A> for &F
+ impl<A: Tuple, F: ?Sized> FnOnce<A> for &F
where
- F: ~const Fn<A>,
+ F: Fn<A>,
{
type Output = F::Output;
@@ -289,10 +286,9 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
- impl<A: Tuple, F: ?Sized> const FnMut<A> for &mut F
+ impl<A: Tuple, F: ?Sized> FnMut<A> for &mut F
where
- F: ~const FnMut<A>,
+ F: FnMut<A>,
{
extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output {
(*self).call_mut(args)
@@ -300,10 +296,9 @@ mod impls {
}
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
- impl<A: Tuple, F: ?Sized> const FnOnce<A> for &mut F
+ impl<A: Tuple, F: ?Sized> FnOnce<A> for &mut F
where
- F: ~const FnMut<A>,
+ F: FnMut<A>,
{
type Output = F::Output;
extern "rust-call" fn call_once(self, args: A) -> F::Output {
diff --git a/library/core/src/ops/index.rs b/library/core/src/ops/index.rs
index 228efb0bc..1f1784ec9 100644
--- a/library/core/src/ops/index.rs
+++ b/library/core/src/ops/index.rs
@@ -55,10 +55,10 @@
#[doc(alias = "]")]
#[doc(alias = "[")]
#[doc(alias = "[]")]
-#[const_trait]
pub trait Index<Idx: ?Sized> {
/// The returned type after indexing.
#[stable(feature = "rust1", since = "1.0.0")]
+ #[rustc_diagnostic_item = "IndexOutput"]
type Output: ?Sized;
/// Performs the indexing (`container[index]`) operation.
@@ -164,8 +164,7 @@ see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#ind
#[doc(alias = "[")]
#[doc(alias = "]")]
#[doc(alias = "[]")]
-#[const_trait]
-pub trait IndexMut<Idx: ?Sized>: ~const Index<Idx> {
+pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
/// Performs the mutable indexing (`container[index]`) operation.
///
/// # Panics
diff --git a/library/core/src/ops/range.rs b/library/core/src/ops/range.rs
index b8ab26564..ba5e6ddc7 100644
--- a/library/core/src/ops/range.rs
+++ b/library/core/src/ops/range.rs
@@ -96,7 +96,7 @@ impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
}
}
-impl<Idx: ~const PartialOrd<Idx>> Range<Idx> {
+impl<Idx: PartialOrd<Idx>> Range<Idx> {
/// Returns `true` if `item` is contained in the range.
///
/// # Examples
@@ -116,11 +116,10 @@ impl<Idx: ~const PartialOrd<Idx>> Range<Idx> {
/// assert!(!(f32::NAN..1.0).contains(&0.5));
/// ```
#[stable(feature = "range_contains", since = "1.35.0")]
- #[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
- pub const fn contains<U>(&self, item: &U) -> bool
+ pub fn contains<U>(&self, item: &U) -> bool
where
- Idx: ~const PartialOrd<U>,
- U: ?Sized + ~const PartialOrd<Idx>,
+ Idx: PartialOrd<U>,
+ U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
@@ -143,8 +142,7 @@ impl<Idx: ~const PartialOrd<Idx>> Range<Idx> {
/// assert!( (f32::NAN..5.0).is_empty());
/// ```
#[stable(feature = "range_is_empty", since = "1.47.0")]
- #[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
- pub const fn is_empty(&self) -> bool {
+ pub fn is_empty(&self) -> bool {
!(self.start < self.end)
}
}
@@ -201,7 +199,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
}
}
-impl<Idx: ~const PartialOrd<Idx>> RangeFrom<Idx> {
+impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
/// Returns `true` if `item` is contained in the range.
///
/// # Examples
@@ -216,11 +214,10 @@ impl<Idx: ~const PartialOrd<Idx>> RangeFrom<Idx> {
/// assert!(!(f32::NAN..).contains(&0.5));
/// ```
#[stable(feature = "range_contains", since = "1.35.0")]
- #[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
- pub const fn contains<U>(&self, item: &U) -> bool
+ pub fn contains<U>(&self, item: &U) -> bool
where
- Idx: ~const PartialOrd<U>,
- U: ?Sized + ~const PartialOrd<Idx>,
+ Idx: PartialOrd<U>,
+ U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
@@ -283,7 +280,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeTo<Idx> {
}
}
-impl<Idx: ~const PartialOrd<Idx>> RangeTo<Idx> {
+impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
/// Returns `true` if `item` is contained in the range.
///
/// # Examples
@@ -298,11 +295,10 @@ impl<Idx: ~const PartialOrd<Idx>> RangeTo<Idx> {
/// assert!(!(..f32::NAN).contains(&0.5));
/// ```
#[stable(feature = "range_contains", since = "1.35.0")]
- #[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
- pub const fn contains<U>(&self, item: &U) -> bool
+ pub fn contains<U>(&self, item: &U) -> bool
where
- Idx: ~const PartialOrd<U>,
- U: ?Sized + ~const PartialOrd<Idx>,
+ Idx: PartialOrd<U>,
+ U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
@@ -474,7 +470,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeInclusive<Idx> {
}
}
-impl<Idx: ~const PartialOrd<Idx>> RangeInclusive<Idx> {
+impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
/// Returns `true` if `item` is contained in the range.
///
/// # Examples
@@ -505,11 +501,10 @@ impl<Idx: ~const PartialOrd<Idx>> RangeInclusive<Idx> {
/// assert!(!r.contains(&3) && !r.contains(&5));
/// ```
#[stable(feature = "range_contains", since = "1.35.0")]
- #[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
- pub const fn contains<U>(&self, item: &U) -> bool
+ pub fn contains<U>(&self, item: &U) -> bool
where
- Idx: ~const PartialOrd<U>,
- U: ?Sized + ~const PartialOrd<Idx>,
+ Idx: PartialOrd<U>,
+ U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
@@ -541,9 +536,8 @@ impl<Idx: ~const PartialOrd<Idx>> RangeInclusive<Idx> {
/// assert!(r.is_empty());
/// ```
#[stable(feature = "range_is_empty", since = "1.47.0")]
- #[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
#[inline]
- pub const fn is_empty(&self) -> bool {
+ pub fn is_empty(&self) -> bool {
self.exhausted || !(self.start <= self.end)
}
}
@@ -605,7 +599,7 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeToInclusive<Idx> {
}
}
-impl<Idx: ~const PartialOrd<Idx>> RangeToInclusive<Idx> {
+impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
/// Returns `true` if `item` is contained in the range.
///
/// # Examples
@@ -620,11 +614,10 @@ impl<Idx: ~const PartialOrd<Idx>> RangeToInclusive<Idx> {
/// assert!(!(..=f32::NAN).contains(&0.5));
/// ```
#[stable(feature = "range_contains", since = "1.35.0")]
- #[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
- pub const fn contains<U>(&self, item: &U) -> bool
+ pub fn contains<U>(&self, item: &U) -> bool
where
- Idx: ~const PartialOrd<U>,
- U: ?Sized + ~const PartialOrd<Idx>,
+ Idx: PartialOrd<U>,
+ U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
@@ -765,7 +758,6 @@ impl<T: Clone> Bound<&T> {
/// `RangeBounds` is implemented by Rust's built-in range types, produced
/// by range syntax like `..`, `a..`, `..b`, `..=c`, `d..e`, or `f..=g`.
#[stable(feature = "collections_range", since = "1.28.0")]
-#[const_trait]
pub trait RangeBounds<T: ?Sized> {
/// Start index bound.
///
@@ -818,8 +810,8 @@ pub trait RangeBounds<T: ?Sized> {
#[stable(feature = "range_contains", since = "1.35.0")]
fn contains<U>(&self, item: &U) -> bool
where
- T: ~const PartialOrd<U>,
- U: ?Sized + ~const PartialOrd<T>,
+ T: PartialOrd<U>,
+ U: ?Sized + PartialOrd<T>,
{
(match self.start_bound() {
Included(start) => start <= item,
@@ -836,8 +828,7 @@ pub trait RangeBounds<T: ?Sized> {
use self::Bound::{Excluded, Included, Unbounded};
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T: ?Sized> const RangeBounds<T> for RangeFull {
+impl<T: ?Sized> RangeBounds<T> for RangeFull {
fn start_bound(&self) -> Bound<&T> {
Unbounded
}
@@ -847,8 +838,7 @@ impl<T: ?Sized> const RangeBounds<T> for RangeFull {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for RangeFrom<T> {
+impl<T> RangeBounds<T> for RangeFrom<T> {
fn start_bound(&self) -> Bound<&T> {
Included(&self.start)
}
@@ -858,8 +848,7 @@ impl<T> const RangeBounds<T> for RangeFrom<T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for RangeTo<T> {
+impl<T> RangeBounds<T> for RangeTo<T> {
fn start_bound(&self) -> Bound<&T> {
Unbounded
}
@@ -869,8 +858,7 @@ impl<T> const RangeBounds<T> for RangeTo<T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for Range<T> {
+impl<T> RangeBounds<T> for Range<T> {
fn start_bound(&self) -> Bound<&T> {
Included(&self.start)
}
@@ -880,8 +868,7 @@ impl<T> const RangeBounds<T> for Range<T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for RangeInclusive<T> {
+impl<T> RangeBounds<T> for RangeInclusive<T> {
fn start_bound(&self) -> Bound<&T> {
Included(&self.start)
}
@@ -897,8 +884,7 @@ impl<T> const RangeBounds<T> for RangeInclusive<T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for RangeToInclusive<T> {
+impl<T> RangeBounds<T> for RangeToInclusive<T> {
fn start_bound(&self) -> Bound<&T> {
Unbounded
}
@@ -908,8 +894,7 @@ impl<T> const RangeBounds<T> for RangeToInclusive<T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for (Bound<T>, Bound<T>) {
+impl<T> RangeBounds<T> for (Bound<T>, Bound<T>) {
fn start_bound(&self) -> Bound<&T> {
match *self {
(Included(ref start), _) => Included(start),
@@ -928,8 +913,7 @@ impl<T> const RangeBounds<T> for (Bound<T>, Bound<T>) {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<'a, T: ?Sized + 'a> const RangeBounds<T> for (Bound<&'a T>, Bound<&'a T>) {
+impl<'a, T: ?Sized + 'a> RangeBounds<T> for (Bound<&'a T>, Bound<&'a T>) {
fn start_bound(&self) -> Bound<&T> {
self.0
}
@@ -940,8 +924,7 @@ impl<'a, T: ?Sized + 'a> const RangeBounds<T> for (Bound<&'a T>, Bound<&'a T>) {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for RangeFrom<&T> {
+impl<T> RangeBounds<T> for RangeFrom<&T> {
fn start_bound(&self) -> Bound<&T> {
Included(self.start)
}
@@ -951,8 +934,7 @@ impl<T> const RangeBounds<T> for RangeFrom<&T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for RangeTo<&T> {
+impl<T> RangeBounds<T> for RangeTo<&T> {
fn start_bound(&self) -> Bound<&T> {
Unbounded
}
@@ -962,8 +944,7 @@ impl<T> const RangeBounds<T> for RangeTo<&T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for Range<&T> {
+impl<T> RangeBounds<T> for Range<&T> {
fn start_bound(&self) -> Bound<&T> {
Included(self.start)
}
@@ -973,8 +954,7 @@ impl<T> const RangeBounds<T> for Range<&T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for RangeInclusive<&T> {
+impl<T> RangeBounds<T> for RangeInclusive<&T> {
fn start_bound(&self) -> Bound<&T> {
Included(self.start)
}
@@ -984,8 +964,7 @@ impl<T> const RangeBounds<T> for RangeInclusive<&T> {
}
#[stable(feature = "collections_range", since = "1.28.0")]
-#[rustc_const_unstable(feature = "const_range_bounds", issue = "108082")]
-impl<T> const RangeBounds<T> for RangeToInclusive<&T> {
+impl<T> RangeBounds<T> for RangeToInclusive<&T> {
fn start_bound(&self) -> Bound<&T> {
Unbounded
}
diff --git a/library/core/src/ops/try_trait.rs b/library/core/src/ops/try_trait.rs
index c254803fb..b4f69d0b2 100644
--- a/library/core/src/ops/try_trait.rs
+++ b/library/core/src/ops/try_trait.rs
@@ -128,8 +128,7 @@ use crate::ops::ControlFlow;
)]
#[doc(alias = "?")]
#[lang = "Try"]
-#[const_trait]
-pub trait Try: ~const FromResidual {
+pub trait Try: FromResidual {
/// The type of the value produced by `?` when *not* short-circuiting.
#[unstable(feature = "try_trait_v2", issue = "84277")]
type Output;
@@ -305,7 +304,6 @@ pub trait Try: ~const FromResidual {
)]
#[rustc_diagnostic_item = "FromResidual"]
#[unstable(feature = "try_trait_v2", issue = "84277")]
-#[const_trait]
pub trait FromResidual<R = <Self as Try>::Residual> {
/// Constructs the type from a compatible `Residual` type.
///
@@ -358,11 +356,10 @@ where
/// and in the other direction,
/// `<Result<Infallible, E> as Residual<T>>::TryType = Result<T, E>`.
#[unstable(feature = "try_trait_v2_residual", issue = "91285")]
-#[const_trait]
pub trait Residual<O> {
/// The "return" type of this meta-function.
#[unstable(feature = "try_trait_v2_residual", issue = "91285")]
- type TryType: ~const Try<Output = O, Residual = Self>;
+ type TryType: Try<Output = O, Residual = Self>;
}
#[unstable(feature = "pub_crate_should_not_need_unstable_attr", issue = "none")]
@@ -389,16 +386,14 @@ impl<T> NeverShortCircuit<T> {
}
#[inline]
- pub fn wrap_mut_2<A, B>(
- mut f: impl ~const FnMut(A, B) -> T,
- ) -> impl ~const FnMut(A, B) -> Self {
- const move |a, b| NeverShortCircuit(f(a, b))
+ pub fn wrap_mut_2<A, B>(mut f: impl FnMut(A, B) -> T) -> impl FnMut(A, B) -> Self {
+ move |a, b| NeverShortCircuit(f(a, b))
}
}
pub(crate) enum NeverShortCircuitResidual {}
-impl<T> const Try for NeverShortCircuit<T> {
+impl<T> Try for NeverShortCircuit<T> {
type Output = T;
type Residual = NeverShortCircuitResidual;
@@ -413,14 +408,14 @@ impl<T> const Try for NeverShortCircuit<T> {
}
}
-impl<T> const FromResidual for NeverShortCircuit<T> {
+impl<T> FromResidual for NeverShortCircuit<T> {
#[inline]
fn from_residual(never: NeverShortCircuitResidual) -> Self {
match never {}
}
}
-impl<T> const Residual<T> for NeverShortCircuitResidual {
+impl<T> Residual<T> for NeverShortCircuitResidual {
type TryType = NeverShortCircuit<T>;
}
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 6f7bc6ed2..ec1ef3cf4 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -547,7 +547,6 @@
#![stable(feature = "rust1", since = "1.0.0")]
use crate::iter::{self, FromIterator, FusedIterator, TrustedLen};
-use crate::marker::Destruct;
use crate::panicking::{panic, panic_str};
use crate::pin::Pin;
use crate::{
@@ -559,7 +558,7 @@ use crate::{
/// The `Option` type. See [the module level documentation](self) for more.
#[derive(Copy, PartialOrd, Eq, Ord, Debug, Hash)]
#[rustc_diagnostic_item = "Option"]
-#[cfg_attr(not(bootstrap), lang = "Option")]
+#[lang = "Option"]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Option<T> {
/// No value.
@@ -766,13 +765,6 @@ impl<T> Option<T> {
#[must_use]
#[unstable(feature = "option_as_slice", issue = "108545")]
pub fn as_slice(&self) -> &[T] {
- #[cfg(bootstrap)]
- match self {
- Some(value) => slice::from_ref(value),
- None => &[],
- }
-
- #[cfg(not(bootstrap))]
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
// to the payload, with a length of 1, so this is equivalent to
// `slice::from_ref`, and thus is safe.
@@ -833,13 +825,6 @@ impl<T> Option<T> {
#[must_use]
#[unstable(feature = "option_as_slice", issue = "108545")]
pub fn as_mut_slice(&mut self) -> &mut [T] {
- #[cfg(bootstrap)]
- match self {
- Some(value) => slice::from_mut(value),
- None => &mut [],
- }
-
- #[cfg(not(bootstrap))]
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
// to the payload, with a length of 1, so this is equivalent to
// `slice::from_mut`, and thus is safe.
@@ -967,11 +952,7 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn unwrap_or(self, default: T) -> T
- where
- T: ~const Destruct,
- {
+ pub fn unwrap_or(self, default: T) -> T {
match self {
Some(x) => x,
None => default,
@@ -989,11 +970,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn unwrap_or_else<F>(self, f: F) -> T
+ pub fn unwrap_or_else<F>(self, f: F) -> T
where
- F: ~const FnOnce() -> T,
- F: ~const Destruct,
+ F: FnOnce() -> T,
{
match self {
Some(x) => x,
@@ -1022,14 +1001,13 @@ impl<T> Option<T> {
/// [`FromStr`]: crate::str::FromStr
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn unwrap_or_default(self) -> T
+ pub fn unwrap_or_default(self) -> T
where
- T: ~const Default,
+ T: Default,
{
match self {
Some(x) => x,
- None => Default::default(),
+ None => T::default(),
}
}
@@ -1089,11 +1067,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn map<U, F>(self, f: F) -> Option<U>
+ pub fn map<U, F>(self, f: F) -> Option<U>
where
- F: ~const FnOnce(T) -> U,
- F: ~const Destruct,
+ F: FnOnce(T) -> U,
{
match self {
Some(x) => Some(f(x)),
@@ -1118,11 +1094,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[unstable(feature = "result_option_inspect", issue = "91345")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn inspect<F>(self, f: F) -> Self
+ pub fn inspect<F>(self, f: F) -> Self
where
- F: ~const FnOnce(&T),
- F: ~const Destruct,
+ F: FnOnce(&T),
{
if let Some(ref x) = self {
f(x);
@@ -1151,12 +1125,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn map_or<U, F>(self, default: U, f: F) -> U
+ pub fn map_or<U, F>(self, default: U, f: F) -> U
where
- F: ~const FnOnce(T) -> U,
- F: ~const Destruct,
- U: ~const Destruct,
+ F: FnOnce(T) -> U,
{
match self {
Some(t) => f(t),
@@ -1180,13 +1151,10 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn map_or_else<U, D, F>(self, default: D, f: F) -> U
+ pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
where
- D: ~const FnOnce() -> U,
- D: ~const Destruct,
- F: ~const FnOnce(T) -> U,
- F: ~const Destruct,
+ D: FnOnce() -> U,
+ F: FnOnce(T) -> U,
{
match self {
Some(t) => f(t),
@@ -1217,11 +1185,7 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn ok_or<E>(self, err: E) -> Result<T, E>
- where
- E: ~const Destruct,
- {
+ pub fn ok_or<E>(self, err: E) -> Result<T, E> {
match self {
Some(v) => Ok(v),
None => Err(err),
@@ -1246,11 +1210,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
+ pub fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
where
- F: ~const FnOnce() -> E,
- F: ~const Destruct,
+ F: FnOnce() -> E,
{
match self {
Some(v) => Ok(v),
@@ -1274,10 +1236,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "option_deref", since = "1.40.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn as_deref(&self) -> Option<&T::Target>
+ pub fn as_deref(&self) -> Option<&T::Target>
where
- T: ~const Deref,
+ T: Deref,
{
match self.as_ref() {
Some(t) => Some(t.deref()),
@@ -1301,10 +1262,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "option_deref", since = "1.40.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>
+ pub fn as_deref_mut(&mut self) -> Option<&mut T::Target>
where
- T: ~const DerefMut,
+ T: DerefMut,
{
match self.as_mut() {
Some(t) => Some(t.deref_mut()),
@@ -1388,12 +1348,7 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn and<U>(self, optb: Option<U>) -> Option<U>
- where
- T: ~const Destruct,
- U: ~const Destruct,
- {
+ pub fn and<U>(self, optb: Option<U>) -> Option<U> {
match self {
Some(_) => optb,
None => None,
@@ -1430,11 +1385,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn and_then<U, F>(self, f: F) -> Option<U>
+ pub fn and_then<U, F>(self, f: F) -> Option<U>
where
- F: ~const FnOnce(T) -> Option<U>,
- F: ~const Destruct,
+ F: FnOnce(T) -> Option<U>,
{
match self {
Some(x) => f(x),
@@ -1468,12 +1421,9 @@ impl<T> Option<T> {
/// [`Some(t)`]: Some
#[inline]
#[stable(feature = "option_filter", since = "1.27.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn filter<P>(self, predicate: P) -> Self
+ pub fn filter<P>(self, predicate: P) -> Self
where
- T: ~const Destruct,
- P: ~const FnOnce(&T) -> bool,
- P: ~const Destruct,
+ P: FnOnce(&T) -> bool,
{
if let Some(x) = self {
if predicate(&x) {
@@ -1512,11 +1462,7 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn or(self, optb: Option<T>) -> Option<T>
- where
- T: ~const Destruct,
- {
+ pub fn or(self, optb: Option<T>) -> Option<T> {
match self {
Some(x) => Some(x),
None => optb,
@@ -1538,11 +1484,9 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn or_else<F>(self, f: F) -> Option<T>
+ pub fn or_else<F>(self, f: F) -> Option<T>
where
- F: ~const FnOnce() -> Option<T>,
- F: ~const Destruct,
+ F: FnOnce() -> Option<T>,
{
match self {
Some(x) => Some(x),
@@ -1573,11 +1517,7 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "option_xor", since = "1.37.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn xor(self, optb: Option<T>) -> Option<T>
- where
- T: ~const Destruct,
- {
+ pub fn xor(self, optb: Option<T>) -> Option<T> {
match (self, optb) {
(Some(a), None) => Some(a),
(None, Some(b)) => Some(b),
@@ -1611,11 +1551,7 @@ impl<T> Option<T> {
#[must_use = "if you intended to set a value, consider assignment instead"]
#[inline]
#[stable(feature = "option_insert", since = "1.53.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn insert(&mut self, value: T) -> &mut T
- where
- T: ~const Destruct,
- {
+ pub fn insert(&mut self, value: T) -> &mut T {
*self = Some(value);
// SAFETY: the code above just filled the option
@@ -1644,11 +1580,7 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "option_entry", since = "1.20.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn get_or_insert(&mut self, value: T) -> &mut T
- where
- T: ~const Destruct,
- {
+ pub fn get_or_insert(&mut self, value: T) -> &mut T {
if let None = *self {
*self = Some(value);
}
@@ -1679,16 +1611,11 @@ impl<T> Option<T> {
/// ```
#[inline]
#[unstable(feature = "option_get_or_insert_default", issue = "82901")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn get_or_insert_default(&mut self) -> &mut T
+ pub fn get_or_insert_default(&mut self) -> &mut T
where
- T: ~const Default,
+ T: Default,
{
- const fn default<T: ~const Default>() -> T {
- T::default()
- }
-
- self.get_or_insert_with(default)
+ self.get_or_insert_with(T::default)
}
/// Inserts a value computed from `f` into the option if it is [`None`],
@@ -1710,16 +1637,12 @@ impl<T> Option<T> {
/// ```
#[inline]
#[stable(feature = "option_entry", since = "1.20.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn get_or_insert_with<F>(&mut self, f: F) -> &mut T
+ pub fn get_or_insert_with<F>(&mut self, f: F) -> &mut T
where
- F: ~const FnOnce() -> T,
- F: ~const Destruct,
+ F: FnOnce() -> T,
{
- if let None = *self {
- // the compiler isn't smart enough to know that we are not dropping a `T`
- // here and wants us to ensure `T` can be dropped at compile time.
- mem::forget(mem::replace(self, Some(f())))
+ if let None = self {
+ *self = Some(f());
}
// SAFETY: a `None` variant for `self` would have been replaced by a `Some`
@@ -1794,12 +1717,7 @@ impl<T> Option<T> {
/// assert_eq!(x.zip(z), None);
/// ```
#[stable(feature = "option_zip_option", since = "1.46.0")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn zip<U>(self, other: Option<U>) -> Option<(T, U)>
- where
- T: ~const Destruct,
- U: ~const Destruct,
- {
+ pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)> {
match (self, other) {
(Some(a), Some(b)) => Some((a, b)),
_ => None,
@@ -1835,13 +1753,9 @@ impl<T> Option<T> {
/// assert_eq!(x.zip_with(None, Point::new), None);
/// ```
#[unstable(feature = "option_zip", issue = "70086")]
- #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
- pub const fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>
+ pub fn zip_with<U, F, R>(self, other: Option<U>, f: F) -> Option<R>
where
- F: ~const FnOnce(T, U) -> R,
- F: ~const Destruct,
- T: ~const Destruct,
- U: ~const Destruct,
+ F: FnOnce(T, U) -> R,
{
match (self, other) {
(Some(a), Some(b)) => Some(f(a, b)),
@@ -1867,12 +1781,7 @@ impl<T, U> Option<(T, U)> {
/// ```
#[inline]
#[stable(feature = "unzip_option", since = "1.66.0")]
- #[rustc_const_unstable(feature = "const_option", issue = "67441")]
- pub const fn unzip(self) -> (Option<T>, Option<U>)
- where
- T: ~const Destruct,
- U: ~const Destruct,
- {
+ pub fn unzip(self) -> (Option<T>, Option<U>) {
match self {
Some((a, b)) => (Some(a), Some(b)),
None => (None, None),
@@ -1922,10 +1831,9 @@ impl<T> Option<&T> {
/// ```
#[must_use = "`self` will be dropped if the result is not used"]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_option_cloned", issue = "91582")]
- pub const fn cloned(self) -> Option<T>
+ pub fn cloned(self) -> Option<T>
where
- T: ~const Clone,
+ T: Clone,
{
match self {
Some(t) => Some(t.clone()),
@@ -1974,10 +1882,9 @@ impl<T> Option<&mut T> {
/// ```
#[must_use = "`self` will be dropped if the result is not used"]
#[stable(since = "1.26.0", feature = "option_ref_mut_cloned")]
- #[rustc_const_unstable(feature = "const_option_cloned", issue = "91582")]
- pub const fn cloned(self) -> Option<T>
+ pub fn cloned(self) -> Option<T>
where
- T: ~const Clone,
+ T: Clone,
{
match self {
Some(t) => Some(t.clone()),
@@ -2030,10 +1937,9 @@ const fn expect_failed(msg: &str) -> ! {
/////////////////////////////////////////////////////////////////////////////
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_clone", issue = "91805")]
-impl<T> const Clone for Option<T>
+impl<T> Clone for Option<T>
where
- T: ~const Clone + ~const Destruct,
+ T: Clone,
{
#[inline]
fn clone(&self) -> Self {
@@ -2053,8 +1959,7 @@ where
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T> const Default for Option<T> {
+impl<T> Default for Option<T> {
/// Returns [`None`][Option::None].
///
/// # Examples
@@ -2114,8 +2019,7 @@ impl<'a, T> IntoIterator for &'a mut Option<T> {
}
#[stable(since = "1.12.0", feature = "option_from")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<T> for Option<T> {
+impl<T> From<T> for Option<T> {
/// Moves `val` into a new [`Some`].
///
/// # Examples
@@ -2131,8 +2035,7 @@ impl<T> const From<T> for Option<T> {
}
#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<'a, T> const From<&'a Option<T>> for Option<&'a T> {
+impl<'a, T> From<&'a Option<T>> for Option<&'a T> {
/// Converts from `&Option<T>` to `Option<&T>`.
///
/// # Examples
@@ -2159,8 +2062,7 @@ impl<'a, T> const From<&'a Option<T>> for Option<&'a T> {
}
#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<'a, T> const From<&'a mut Option<T>> for Option<&'a mut T> {
+impl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T> {
/// Converts from `&mut Option<T>` to `Option<&mut T>`
///
/// # Examples
@@ -2507,8 +2409,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const ops::Try for Option<T> {
+impl<T> ops::Try for Option<T> {
type Output = T;
type Residual = Option<convert::Infallible>;
@@ -2527,8 +2428,7 @@ impl<T> const ops::Try for Option<T> {
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const ops::FromResidual for Option<T> {
+impl<T> ops::FromResidual for Option<T> {
#[inline]
fn from_residual(residual: Option<convert::Infallible>) -> Self {
match residual {
@@ -2546,8 +2446,7 @@ impl<T> ops::FromResidual<ops::Yeet<()>> for Option<T> {
}
#[unstable(feature = "try_trait_v2_residual", issue = "91285")]
-#[rustc_const_unstable(feature = "const_try", issue = "74935")]
-impl<T> const ops::Residual<T> for Option<convert::Infallible> {
+impl<T> ops::Residual<T> for Option<convert::Infallible> {
type TryType = Option<T>;
}
diff --git a/library/core/src/panic.rs b/library/core/src/panic.rs
index 8338a5d7e..20be60d35 100644
--- a/library/core/src/panic.rs
+++ b/library/core/src/panic.rs
@@ -28,16 +28,18 @@ pub macro panic_2015 {
$crate::panicking::panic($msg)
),
// Use `panic_str` instead of `panic_display::<&str>` for non_fmt_panic lint.
- ($msg:expr $(,)?) => (
- $crate::panicking::panic_str($msg)
- ),
+ ($msg:expr $(,)?) => ({
+ $crate::panicking::panic_str($msg);
+ }),
// Special-case the single-argument case for const_panic.
- ("{}", $arg:expr $(,)?) => (
- $crate::panicking::panic_display(&$arg)
- ),
- ($fmt:expr, $($arg:tt)+) => (
- $crate::panicking::panic_fmt($crate::const_format_args!($fmt, $($arg)+))
- ),
+ ("{}", $arg:expr $(,)?) => ({
+ $crate::panicking::panic_display(&$arg);
+ }),
+ ($fmt:expr, $($arg:tt)+) => ({
+ // Semicolon to prevent temporaries inside the formatting machinery from
+ // being considered alive in the caller after the panic_fmt call.
+ $crate::panicking::panic_fmt($crate::const_format_args!($fmt, $($arg)+));
+ }),
}
#[doc(hidden)]
@@ -50,12 +52,14 @@ pub macro panic_2021 {
$crate::panicking::panic("explicit panic")
),
// Special-case the single-argument case for const_panic.
- ("{}", $arg:expr $(,)?) => (
- $crate::panicking::panic_display(&$arg)
- ),
- ($($t:tt)+) => (
- $crate::panicking::panic_fmt($crate::const_format_args!($($t)+))
- ),
+ ("{}", $arg:expr $(,)?) => ({
+ $crate::panicking::panic_display(&$arg);
+ }),
+ ($($t:tt)+) => ({
+ // Semicolon to prevent temporaries inside the formatting machinery from
+ // being considered alive in the caller after the panic_fmt call.
+ $crate::panicking::panic_fmt($crate::const_format_args!($($t)+));
+ }),
}
#[doc(hidden)]
@@ -69,9 +73,9 @@ pub macro unreachable_2015 {
),
// Use of `unreachable_display` for non_fmt_panic lint.
// NOTE: the message ("internal error ...") is embedded directly in unreachable_display
- ($msg:expr $(,)?) => (
- $crate::panicking::unreachable_display(&$msg)
- ),
+ ($msg:expr $(,)?) => ({
+ $crate::panicking::unreachable_display(&$msg);
+ }),
($fmt:expr, $($arg:tt)*) => (
$crate::panic!($crate::concat!("internal error: entered unreachable code: ", $fmt), $($arg)*)
),
diff --git a/library/core/src/panic/panic_info.rs b/library/core/src/panic/panic_info.rs
index 06fbe083c..5576adde8 100644
--- a/library/core/src/panic/panic_info.rs
+++ b/library/core/src/panic/panic_info.rs
@@ -134,7 +134,7 @@ impl<'a> PanicInfo<'a> {
/// whose ABI does not support unwinding.
///
/// It is safe for a panic handler to unwind even when this function returns
- /// true, however this will simply cause the panic handler to be called
+ /// false, however this will simply cause the panic handler to be called
/// again.
#[must_use]
#[unstable(feature = "panic_can_unwind", issue = "92988")]
diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs
index efeb726ab..81be3fb22 100644
--- a/library/core/src/panicking.rs
+++ b/library/core/src/panicking.rs
@@ -165,7 +165,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
#[cold]
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
#[track_caller]
-#[cfg_attr(not(bootstrap), lang = "panic_misaligned_pointer_dereference")] // needed by codegen for panic on misaligned pointer deref
+#[lang = "panic_misaligned_pointer_dereference"] // needed by codegen for panic on misaligned pointer deref
fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! {
if cfg!(feature = "panic_immediate_abort") {
super::intrinsics::abort()
diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs
index c4b89a630..6b319b435 100644
--- a/library/core/src/pin.rs
+++ b/library/core/src/pin.rs
@@ -393,6 +393,8 @@ use crate::ops::{CoerceUnsized, Deref, DerefMut, DispatchFromDyn, Receiver};
/// value in place, preventing the value referenced by that pointer from being moved
/// unless it implements [`Unpin`].
///
+/// `Pin<P>` is guaranteed to have the same memory layout and ABI as `P`.
+///
/// *See the [`pin` module] documentation for an explanation of pinning.*
///
/// [`pin` module]: self
diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs
index 3df990e5d..8266e8990 100644
--- a/library/core/src/primitive_docs.rs
+++ b/library/core/src/primitive_docs.rs
@@ -1,8 +1,7 @@
// `library/{std,core}/src/primitive_docs.rs` should have the same contents.
// These are different files so that relative links work properly without
// having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same.
-#[cfg_attr(bootstrap, doc(primitive = "bool"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "bool")]
+#[rustc_doc_primitive = "bool"]
#[doc(alias = "true")]
#[doc(alias = "false")]
/// The boolean type.
@@ -64,8 +63,7 @@
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_bool {}
-#[cfg_attr(bootstrap, doc(primitive = "never"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "never")]
+#[rustc_doc_primitive = "never"]
#[doc(alias = "!")]
//
/// The `!` type, also called "never".
@@ -276,8 +274,7 @@ mod prim_bool {}
#[unstable(feature = "never_type", issue = "35121")]
mod prim_never {}
-#[cfg_attr(bootstrap, doc(primitive = "char"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "char")]
+#[rustc_doc_primitive = "char"]
#[allow(rustdoc::invalid_rust_codeblocks)]
/// A character type.
///
@@ -401,8 +398,7 @@ mod prim_never {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_char {}
-#[cfg_attr(bootstrap, doc(primitive = "unit"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "unit")]
+#[rustc_doc_primitive = "unit"]
#[doc(alias = "(")]
#[doc(alias = ")")]
#[doc(alias = "()")]
@@ -464,8 +460,7 @@ impl Copy for () {
// empty
}
-#[cfg_attr(bootstrap, doc(primitive = "pointer"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "pointer")]
+#[rustc_doc_primitive = "pointer"]
#[doc(alias = "ptr")]
#[doc(alias = "*")]
#[doc(alias = "*const")]
@@ -555,6 +550,7 @@ impl Copy for () {
///
/// ```
/// # #![feature(rustc_private)]
+/// #[allow(unused_extern_crates)]
/// extern crate libc;
///
/// use std::mem;
@@ -581,8 +577,7 @@ impl Copy for () {
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_pointer {}
-#[cfg_attr(bootstrap, doc(primitive = "array"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "array")]
+#[rustc_doc_primitive = "array"]
#[doc(alias = "[]")]
#[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases
#[doc(alias = "[T; N]")]
@@ -616,6 +611,9 @@ mod prim_pointer {}
/// if the element type allows it. As a stopgap, trait implementations are
/// statically generated up to size 32.
///
+/// Arrays of sizes from 1 to 12 (inclusive) implement [`From<Tuple>`], where `Tuple`
+/// is a homogenous [prim@tuple] of appropriate length.
+///
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
/// an array. Indeed, this provides most of the API for working with arrays.
///
@@ -678,6 +676,13 @@ mod prim_pointer {}
/// move_away(roa);
/// ```
///
+/// Arrays can be created from homogenous tuples of appropriate length:
+///
+/// ```
+/// let tuple: (u32, u32, u32) = (1, 2, 3);
+/// let array: [u32; 3] = tuple.into();
+/// ```
+///
/// # Editions
///
/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
@@ -780,11 +785,11 @@ mod prim_pointer {}
/// [`Borrow`]: borrow::Borrow
/// [`BorrowMut`]: borrow::BorrowMut
/// [slice pattern]: ../reference/patterns.html#slice-patterns
+/// [`From<Tuple>`]: convert::From
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_array {}
-#[cfg_attr(bootstrap, doc(primitive = "slice"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "slice")]
+#[rustc_doc_primitive = "slice"]
#[doc(alias = "[")]
#[doc(alias = "]")]
#[doc(alias = "[]")]
@@ -876,8 +881,7 @@ mod prim_array {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_slice {}
-#[cfg_attr(bootstrap, doc(primitive = "str"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "str")]
+#[rustc_doc_primitive = "str"]
/// String slices.
///
/// *[See also the `std::str` module](crate::str).*
@@ -944,8 +948,7 @@ mod prim_slice {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_str {}
-#[cfg_attr(bootstrap, doc(primitive = "tuple"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "tuple")]
+#[rustc_doc_primitive = "tuple"]
#[doc(alias = "(")]
#[doc(alias = ")")]
#[doc(alias = "()")]
@@ -1009,7 +1012,9 @@ mod prim_str {}
/// * [`Debug`]
/// * [`Default`]
/// * [`Hash`]
+/// * [`From<[T; N]>`][from]
///
+/// [from]: convert::From
/// [`Debug`]: fmt::Debug
/// [`Hash`]: hash::Hash
///
@@ -1060,6 +1065,13 @@ mod prim_str {}
/// assert_eq!(y, 5);
/// ```
///
+/// Homogenous tuples can be created from arrays of appropriate length:
+///
+/// ```
+/// let array: [u32; 3] = [1, 2, 3];
+/// let tuple: (u32, u32, u32) = array.into();
+/// ```
+///
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_tuple {}
@@ -1088,8 +1100,7 @@ impl<T: Copy> Copy for (T,) {
// empty
}
-#[cfg_attr(bootstrap, doc(primitive = "f32"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f32")]
+#[rustc_doc_primitive = "f32"]
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
///
/// This type can represent a wide range of decimal numbers, like `3.5`, `27`,
@@ -1155,8 +1166,7 @@ impl<T: Copy> Copy for (T,) {
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_f32 {}
-#[cfg_attr(bootstrap, doc(primitive = "f64"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f64")]
+#[rustc_doc_primitive = "f64"]
/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008).
///
/// This type is very similar to [`f32`], but has increased
@@ -1171,78 +1181,67 @@ mod prim_f32 {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_f64 {}
-#[cfg_attr(bootstrap, doc(primitive = "i8"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i8")]
+#[rustc_doc_primitive = "i8"]
//
/// The 8-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i8 {}
-#[cfg_attr(bootstrap, doc(primitive = "i16"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i16")]
+#[rustc_doc_primitive = "i16"]
//
/// The 16-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i16 {}
-#[cfg_attr(bootstrap, doc(primitive = "i32"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i32")]
+#[rustc_doc_primitive = "i32"]
//
/// The 32-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i32 {}
-#[cfg_attr(bootstrap, doc(primitive = "i64"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i64")]
+#[rustc_doc_primitive = "i64"]
//
/// The 64-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i64 {}
-#[cfg_attr(bootstrap, doc(primitive = "i128"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i128")]
+#[rustc_doc_primitive = "i128"]
//
/// The 128-bit signed integer type.
#[stable(feature = "i128", since = "1.26.0")]
mod prim_i128 {}
-#[cfg_attr(bootstrap, doc(primitive = "u8"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u8")]
+#[rustc_doc_primitive = "u8"]
//
/// The 8-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_u8 {}
-#[cfg_attr(bootstrap, doc(primitive = "u16"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u16")]
+#[rustc_doc_primitive = "u16"]
//
/// The 16-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_u16 {}
-#[cfg_attr(bootstrap, doc(primitive = "u32"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u32")]
+#[rustc_doc_primitive = "u32"]
//
/// The 32-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_u32 {}
-#[cfg_attr(bootstrap, doc(primitive = "u64"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u64")]
+#[rustc_doc_primitive = "u64"]
//
/// The 64-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_u64 {}
-#[cfg_attr(bootstrap, doc(primitive = "u128"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u128")]
+#[rustc_doc_primitive = "u128"]
//
/// The 128-bit unsigned integer type.
#[stable(feature = "i128", since = "1.26.0")]
mod prim_u128 {}
-#[cfg_attr(bootstrap, doc(primitive = "isize"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "isize")]
+#[rustc_doc_primitive = "isize"]
//
/// The pointer-sized signed integer type.
///
@@ -1252,8 +1251,7 @@ mod prim_u128 {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_isize {}
-#[cfg_attr(bootstrap, doc(primitive = "usize"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "usize")]
+#[rustc_doc_primitive = "usize"]
//
/// The pointer-sized unsigned integer type.
///
@@ -1263,8 +1261,7 @@ mod prim_isize {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_usize {}
-#[cfg_attr(bootstrap, doc(primitive = "reference"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "reference")]
+#[rustc_doc_primitive = "reference"]
#[doc(alias = "&")]
#[doc(alias = "&mut")]
//
@@ -1396,8 +1393,7 @@ mod prim_usize {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_ref {}
-#[cfg_attr(bootstrap, doc(primitive = "fn"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "fn")]
+#[rustc_doc_primitive = "fn"]
//
/// Function pointers, like `fn(usize) -> bool`.
///
diff --git a/library/core/src/ptr/alignment.rs b/library/core/src/ptr/alignment.rs
index efe6d4183..bbf7199ff 100644
--- a/library/core/src/ptr/alignment.rs
+++ b/library/core/src/ptr/alignment.rs
@@ -9,8 +9,7 @@ use crate::{cmp, fmt, hash, mem, num};
/// Note that particularly large alignments, while representable in this type,
/// are likely not to be supported by actual allocators and linkers.
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
-#[derive(Copy, Clone, Eq)]
-#[derive_const(PartialEq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
#[repr(transparent)]
pub struct Alignment(AlignmentEnum);
@@ -170,7 +169,7 @@ impl From<Alignment> for usize {
#[rustc_const_unstable(feature = "const_alloc_layout", issue = "67521")]
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
-impl const cmp::Ord for Alignment {
+impl cmp::Ord for Alignment {
#[inline]
fn cmp(&self, other: &Self) -> cmp::Ordering {
self.as_nonzero().get().cmp(&other.as_nonzero().get())
@@ -179,7 +178,7 @@ impl const cmp::Ord for Alignment {
#[rustc_const_unstable(feature = "const_alloc_layout", issue = "67521")]
#[unstable(feature = "ptr_alignment_type", issue = "102070")]
-impl const cmp::PartialOrd for Alignment {
+impl cmp::PartialOrd for Alignment {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
Some(self.cmp(other))
@@ -201,8 +200,7 @@ type AlignmentEnum = AlignmentEnum32;
#[cfg(target_pointer_width = "64")]
type AlignmentEnum = AlignmentEnum64;
-#[derive(Copy, Clone, Eq)]
-#[derive_const(PartialEq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
#[repr(u16)]
enum AlignmentEnum16 {
_Align1Shl0 = 1 << 0,
@@ -223,8 +221,7 @@ enum AlignmentEnum16 {
_Align1Shl15 = 1 << 15,
}
-#[derive(Copy, Clone, Eq)]
-#[derive_const(PartialEq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
#[repr(u32)]
enum AlignmentEnum32 {
_Align1Shl0 = 1 << 0,
@@ -261,8 +258,7 @@ enum AlignmentEnum32 {
_Align1Shl31 = 1 << 31,
}
-#[derive(Copy, Clone, Eq)]
-#[derive_const(PartialEq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
#[repr(u64)]
enum AlignmentEnum64 {
_Align1Shl0 = 1 << 0,
diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs
index 839afc57f..6e1e862d3 100644
--- a/library/core/src/ptr/const_ptr.rs
+++ b/library/core/src/ptr/const_ptr.rs
@@ -132,8 +132,8 @@ impl<T: ?Sized> *const T {
/// ```
#[unstable(feature = "ptr_to_from_bits", issue = "91126")]
#[deprecated(
- since = "1.67",
- note = "replaced by the `exposed_addr` method, or update your code \
+ since = "1.67.0",
+ note = "replaced by the `expose_addr` method, or update your code \
to follow the strict provenance rules using its APIs"
)]
#[inline(always)]
@@ -161,7 +161,7 @@ impl<T: ?Sized> *const T {
/// ```
#[unstable(feature = "ptr_to_from_bits", issue = "91126")]
#[deprecated(
- since = "1.67",
+ since = "1.67.0",
note = "replaced by the `ptr::from_exposed_addr` function, or update \
your code to follow the strict provenance rules using its APIs"
)]
@@ -264,7 +264,7 @@ impl<T: ?Sized> *const T {
let dest_addr = addr as isize;
let offset = dest_addr.wrapping_sub(self_addr);
- // This is the canonical desugarring of this operation
+ // This is the canonical desugaring of this operation
self.wrapping_byte_offset(offset)
}
@@ -916,8 +916,16 @@ impl<T: ?Sized> *const T {
where
T: Sized,
{
+ #[cfg(bootstrap)]
// SAFETY: the caller must uphold the safety contract for `offset`.
- unsafe { self.offset(count as isize) }
+ unsafe {
+ self.offset(count as isize)
+ }
+ #[cfg(not(bootstrap))]
+ // SAFETY: the caller must uphold the safety contract for `offset`.
+ unsafe {
+ intrinsics::offset(self, count)
+ }
}
/// Calculates the offset from a pointer in bytes (convenience for `.byte_offset(count as isize)`).
@@ -1187,7 +1195,7 @@ impl<T: ?Sized> *const T {
///
/// [`ptr::read`]: crate::ptr::read()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
+ #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[inline]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read(self) -> T
@@ -1228,7 +1236,7 @@ impl<T: ?Sized> *const T {
///
/// [`ptr::read_unaligned`]: crate::ptr::read_unaligned()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
+ #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[inline]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read_unaligned(self) -> T
@@ -1650,11 +1658,10 @@ impl<T> *const [T] {
/// }
/// ```
#[unstable(feature = "slice_ptr_get", issue = "74265")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
- pub const unsafe fn get_unchecked<I>(self, index: I) -> *const I::Output
+ pub unsafe fn get_unchecked<I>(self, index: I) -> *const I::Output
where
- I: ~const SliceIndex<[T]>,
+ I: SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
unsafe { index.get_unchecked(self) }
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs
index 818f1a919..d0cb2f715 100644
--- a/library/core/src/ptr/mod.rs
+++ b/library/core/src/ptr/mod.rs
@@ -374,6 +374,7 @@ use crate::hash;
use crate::intrinsics::{
self, assert_unsafe_precondition, is_aligned_and_not_null, is_nonoverlapping,
};
+use crate::marker::FnPtr;
use crate::mem::{self, MaybeUninit};
@@ -440,10 +441,18 @@ mod mut_ptr;
///
/// * `to_drop` must be [valid] for both reads and writes.
///
-/// * `to_drop` must be properly aligned.
+/// * `to_drop` must be properly aligned, even if `T` has size 0.
///
-/// * The value `to_drop` points to must be valid for dropping, which may mean it must uphold
-/// additional invariants - this is type-dependent.
+/// * `to_drop` must be nonnull, even if `T` has size 0.
+///
+/// * The value `to_drop` points to must be valid for dropping, which may mean
+/// it must uphold additional invariants. These invariants depend on the type
+/// of the value being dropped. For instance, when dropping a Box, the box's
+/// pointer to the heap must be valid.
+///
+/// * While `drop_in_place` is executing, the only way to access parts of
+/// `to_drop` is through the `&mut self` references supplied to the
+/// `Drop::drop` methods that `drop_in_place` invokes.
///
/// Additionally, if `T` is not [`Copy`], using the pointed-to value after
/// calling `drop_in_place` can cause undefined behavior. Note that `*to_drop =
@@ -451,8 +460,6 @@ mod mut_ptr;
/// again. [`write()`] can be used to overwrite data without causing it to be
/// dropped.
///
-/// Note that even if `T` has size `0`, the pointer must be non-null and properly aligned.
-///
/// [valid]: self#safety
///
/// # Examples
@@ -1132,7 +1139,8 @@ pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
/// [valid]: self#safety
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
+#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
+#[rustc_allow_const_fn_unstable(const_mut_refs, const_maybe_uninit_as_mut_ptr)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read<T>(src: *const T) -> T {
// It would be semantically correct to implement this via `copy_nonoverlapping`
@@ -1167,26 +1175,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
"ptr::read requires that the pointer argument is aligned and non-null",
[T](src: *const T) => is_aligned_and_not_null(src)
);
-
- #[cfg(bootstrap)]
- {
- // We are calling the intrinsics directly to avoid function calls in the
- // generated code as `intrinsics::copy_nonoverlapping` is a wrapper function.
- extern "rust-intrinsic" {
- #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
- fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
- }
-
- // `src` cannot overlap `tmp` because `tmp` was just allocated on
- // the stack as a separate allocated object.
- let mut tmp = MaybeUninit::<T>::uninit();
- copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
- tmp.assume_init()
- }
- #[cfg(not(bootstrap))]
- {
- crate::intrinsics::read_via_copy(src)
- }
+ crate::intrinsics::read_via_copy(src)
}
}
@@ -1267,7 +1256,8 @@ pub const unsafe fn read<T>(src: *const T) -> T {
/// ```
#[inline]
#[stable(feature = "ptr_unaligned", since = "1.17.0")]
-#[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
+#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
+#[rustc_allow_const_fn_unstable(const_mut_refs, const_maybe_uninit_as_mut_ptr)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
let mut tmp = MaybeUninit::<T>::uninit();
@@ -1367,13 +1357,13 @@ pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn write<T>(dst: *mut T, src: T) {
- // We are calling the intrinsics directly to avoid function calls in the generated code
- // as `intrinsics::copy_nonoverlapping` is a wrapper function.
- extern "rust-intrinsic" {
- #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
- #[rustc_nounwind]
- fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
- }
+ // Semantically, it would be fine for this to be implemented as a
+ // `copy_nonoverlapping` and appropriate drop suppression of `src`.
+
+ // However, implementing via that currently produces more MIR than is ideal.
+ // Using an intrinsic keeps it down to just the simple `*dst = move src` in
+ // MIR (11 statements shorter, at the time of writing), and also allows
+ // `src` to stay an SSA value in codegen_ssa, rather than a memory one.
// SAFETY: the caller must guarantee that `dst` is valid for writes.
// `dst` cannot overlap `src` because the caller has mutable access
@@ -1383,8 +1373,7 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
"ptr::write requires that the pointer argument is aligned and non-null",
[T](dst: *mut T) => is_aligned_and_not_null(dst)
);
- copy_nonoverlapping(&src as *const T, dst, 1);
- intrinsics::forget(src);
+ intrinsics::write_via_move(dst, src)
}
}
@@ -1651,8 +1640,8 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
// FIXME(#75598): Direct use of these intrinsics improves codegen significantly at opt-level <=
// 1, where the method versions of these operations are not inlined.
use intrinsics::{
- cttz_nonzero, exact_div, mul_with_overflow, unchecked_rem, unchecked_shl, unchecked_shr,
- unchecked_sub, wrapping_add, wrapping_mul, wrapping_sub,
+ assume, cttz_nonzero, exact_div, mul_with_overflow, unchecked_rem, unchecked_shl,
+ unchecked_shr, unchecked_sub, wrapping_add, wrapping_mul, wrapping_sub,
};
/// Calculate multiplicative modular inverse of `x` modulo `m`.
@@ -1743,12 +1732,18 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
// in a branch-free way and then bitwise-OR it with whatever result the `-p mod a`
// computation produces.
+ let aligned_address = wrapping_add(addr, a_minus_one) & wrapping_sub(0, a);
+ let byte_offset = wrapping_sub(aligned_address, addr);
+ // FIXME: Remove the assume after <https://github.com/llvm/llvm-project/issues/62502>
+ // SAFETY: Masking by `-a` can only affect the low bits, and thus cannot have reduced
+ // the value by more than `a-1`, so even though the intermediate values might have
+ // wrapped, the byte_offset is always in `[0, a)`.
+ unsafe { assume(byte_offset < a) };
+
// SAFETY: `stride == 0` case has been handled by the special case above.
let addr_mod_stride = unsafe { unchecked_rem(addr, stride) };
return if addr_mod_stride == 0 {
- let aligned_address = wrapping_add(addr, a_minus_one) & wrapping_sub(0, a);
- let byte_offset = wrapping_sub(aligned_address, addr);
// SAFETY: `stride` is non-zero. This is guaranteed to divide exactly as well, because
// addr has been verified to be aligned to the original type’s alignment requirements.
unsafe { exact_div(byte_offset, stride) }
@@ -1764,7 +1759,12 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
// miracles, given the situations this case has to deal with.
// SAFETY: a is power-of-two hence non-zero. stride == 0 case is handled above.
- let gcdpow = unsafe { cttz_nonzero(stride).min(cttz_nonzero(a)) };
+ // FIXME(const-hack) replace with min
+ let gcdpow = unsafe {
+ let x = cttz_nonzero(stride);
+ let y = cttz_nonzero(a);
+ if x < y { x } else { y }
+ };
// SAFETY: gcdpow has an upper-bound that’s at most the number of bits in a usize.
let gcd = unsafe { unchecked_shl(1usize, gcdpow) };
// SAFETY: gcd is always greater or equal to 1.
@@ -1892,205 +1892,52 @@ pub fn hash<T: ?Sized, S: hash::Hasher>(hashee: *const T, into: &mut S) {
hashee.hash(into);
}
-#[cfg(bootstrap)]
-mod old_fn_ptr_impl {
- use super::*;
- // If this is a unary fn pointer, it adds a doc comment.
- // Otherwise, it hides the docs entirely.
- macro_rules! maybe_fnptr_doc {
- (@ #[$meta:meta] $item:item) => {
- #[doc(hidden)]
- #[$meta]
- $item
- };
- ($a:ident @ #[$meta:meta] $item:item) => {
- #[doc(fake_variadic)]
- #[doc = "This trait is implemented for function pointers with up to twelve arguments."]
- #[$meta]
- $item
- };
- ($a:ident $($rest_a:ident)+ @ #[$meta:meta] $item:item) => {
- #[doc(hidden)]
- #[$meta]
- $item
- };
- }
-
- // FIXME(strict_provenance_magic): function pointers have buggy codegen that
- // necessitates casting to a usize to get the backend to do the right thing.
- // for now I will break AVR to silence *a billion* lints. We should probably
- // have a proper "opaque function pointer type" to handle this kind of thing.
-
- // Impls for function pointers
- macro_rules! fnptr_impls_safety_abi {
- ($FnTy: ty, $($Arg: ident),*) => {
- fnptr_impls_safety_abi! { #[stable(feature = "fnptr_impls", since = "1.4.0")] $FnTy, $($Arg),* }
- };
- (@c_unwind $FnTy: ty, $($Arg: ident),*) => {
- fnptr_impls_safety_abi! { #[unstable(feature = "c_unwind", issue = "74990")] $FnTy, $($Arg),* }
- };
- (#[$meta:meta] $FnTy: ty, $($Arg: ident),*) => {
- maybe_fnptr_doc! {
- $($Arg)* @
- #[$meta]
- impl<Ret, $($Arg),*> PartialEq for $FnTy {
- #[inline]
- fn eq(&self, other: &Self) -> bool {
- *self as usize == *other as usize
- }
- }
- }
-
- maybe_fnptr_doc! {
- $($Arg)* @
- #[$meta]
- impl<Ret, $($Arg),*> Eq for $FnTy {}
- }
-
- maybe_fnptr_doc! {
- $($Arg)* @
- #[$meta]
- impl<Ret, $($Arg),*> PartialOrd for $FnTy {
- #[inline]
- fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
- (*self as usize).partial_cmp(&(*other as usize))
- }
- }
- }
-
- maybe_fnptr_doc! {
- $($Arg)* @
- #[$meta]
- impl<Ret, $($Arg),*> Ord for $FnTy {
- #[inline]
- fn cmp(&self, other: &Self) -> Ordering {
- (*self as usize).cmp(&(*other as usize))
- }
- }
- }
-
- maybe_fnptr_doc! {
- $($Arg)* @
- #[$meta]
- impl<Ret, $($Arg),*> hash::Hash for $FnTy {
- fn hash<HH: hash::Hasher>(&self, state: &mut HH) {
- state.write_usize(*self as usize)
- }
- }
- }
-
- maybe_fnptr_doc! {
- $($Arg)* @
- #[$meta]
- impl<Ret, $($Arg),*> fmt::Pointer for $FnTy {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- fmt::pointer_fmt_inner(*self as usize, f)
- }
- }
- }
-
- maybe_fnptr_doc! {
- $($Arg)* @
- #[$meta]
- impl<Ret, $($Arg),*> fmt::Debug for $FnTy {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- fmt::pointer_fmt_inner(*self as usize, f)
- }
- }
- }
- }
- }
-
- macro_rules! fnptr_impls_args {
- ($($Arg: ident),+) => {
- fnptr_impls_safety_abi! { extern "Rust" fn($($Arg),+) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { extern "C" fn($($Arg),+) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { extern "C" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn($($Arg),+) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { unsafe extern "Rust" fn($($Arg),+) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),+) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn($($Arg),+) -> Ret, $($Arg),+ }
- fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
- };
- () => {
- // No variadic functions with 0 parameters
- fnptr_impls_safety_abi! { extern "Rust" fn() -> Ret, }
- fnptr_impls_safety_abi! { extern "C" fn() -> Ret, }
- fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn() -> Ret, }
- fnptr_impls_safety_abi! { unsafe extern "Rust" fn() -> Ret, }
- fnptr_impls_safety_abi! { unsafe extern "C" fn() -> Ret, }
- fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn() -> Ret, }
- };
+#[stable(feature = "fnptr_impls", since = "1.4.0")]
+impl<F: FnPtr> PartialEq for F {
+ #[inline]
+ fn eq(&self, other: &Self) -> bool {
+ self.addr() == other.addr()
}
-
- fnptr_impls_args! {}
- fnptr_impls_args! { T }
- fnptr_impls_args! { A, B }
- fnptr_impls_args! { A, B, C }
- fnptr_impls_args! { A, B, C, D }
- fnptr_impls_args! { A, B, C, D, E }
- fnptr_impls_args! { A, B, C, D, E, F }
- fnptr_impls_args! { A, B, C, D, E, F, G }
- fnptr_impls_args! { A, B, C, D, E, F, G, H }
- fnptr_impls_args! { A, B, C, D, E, F, G, H, I }
- fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J }
- fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J, K }
- fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J, K, L }
}
+#[stable(feature = "fnptr_impls", since = "1.4.0")]
+impl<F: FnPtr> Eq for F {}
-#[cfg(not(bootstrap))]
-mod new_fn_ptr_impl {
- use super::*;
- use crate::marker::FnPtr;
-
- #[stable(feature = "fnptr_impls", since = "1.4.0")]
- impl<F: FnPtr> PartialEq for F {
- #[inline]
- fn eq(&self, other: &Self) -> bool {
- self.addr() == other.addr()
- }
- }
- #[stable(feature = "fnptr_impls", since = "1.4.0")]
- impl<F: FnPtr> Eq for F {}
-
- #[stable(feature = "fnptr_impls", since = "1.4.0")]
- impl<F: FnPtr> PartialOrd for F {
- #[inline]
- fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
- self.addr().partial_cmp(&other.addr())
- }
+#[stable(feature = "fnptr_impls", since = "1.4.0")]
+impl<F: FnPtr> PartialOrd for F {
+ #[inline]
+ fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+ self.addr().partial_cmp(&other.addr())
}
- #[stable(feature = "fnptr_impls", since = "1.4.0")]
- impl<F: FnPtr> Ord for F {
- #[inline]
- fn cmp(&self, other: &Self) -> Ordering {
- self.addr().cmp(&other.addr())
- }
+}
+#[stable(feature = "fnptr_impls", since = "1.4.0")]
+impl<F: FnPtr> Ord for F {
+ #[inline]
+ fn cmp(&self, other: &Self) -> Ordering {
+ self.addr().cmp(&other.addr())
}
+}
- #[stable(feature = "fnptr_impls", since = "1.4.0")]
- impl<F: FnPtr> hash::Hash for F {
- fn hash<HH: hash::Hasher>(&self, state: &mut HH) {
- state.write_usize(self.addr() as _)
- }
+#[stable(feature = "fnptr_impls", since = "1.4.0")]
+impl<F: FnPtr> hash::Hash for F {
+ fn hash<HH: hash::Hasher>(&self, state: &mut HH) {
+ state.write_usize(self.addr() as _)
}
+}
- #[stable(feature = "fnptr_impls", since = "1.4.0")]
- impl<F: FnPtr> fmt::Pointer for F {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- fmt::pointer_fmt_inner(self.addr() as _, f)
- }
+#[stable(feature = "fnptr_impls", since = "1.4.0")]
+impl<F: FnPtr> fmt::Pointer for F {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fmt::pointer_fmt_inner(self.addr() as _, f)
}
+}
- #[stable(feature = "fnptr_impls", since = "1.4.0")]
- impl<F: FnPtr> fmt::Debug for F {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- fmt::pointer_fmt_inner(self.addr() as _, f)
- }
+#[stable(feature = "fnptr_impls", since = "1.4.0")]
+impl<F: FnPtr> fmt::Debug for F {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fmt::pointer_fmt_inner(self.addr() as _, f)
}
}
+
/// Create a `const` raw pointer to a place, without creating an intermediate reference.
///
/// Creating a reference with `&`/`&mut` is only allowed if the pointer is properly aligned
@@ -2121,7 +1968,7 @@ mod new_fn_ptr_impl {
/// assert_eq!(unsafe { raw_f2.read_unaligned() }, 2);
/// ```
///
-/// See [`addr_of_mut`] for how to create a pointer to unininitialized data.
+/// See [`addr_of_mut`] for how to create a pointer to uninitialized data.
/// Doing that with `addr_of` would not make much sense since one could only
/// read the data, and that would be Undefined Behavior.
#[stable(feature = "raw_ref_macros", since = "1.51.0")]
diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs
index ece5244e9..2fe5164c3 100644
--- a/library/core/src/ptr/mut_ptr.rs
+++ b/library/core/src/ptr/mut_ptr.rs
@@ -138,8 +138,8 @@ impl<T: ?Sized> *mut T {
/// ```
#[unstable(feature = "ptr_to_from_bits", issue = "91126")]
#[deprecated(
- since = "1.67",
- note = "replaced by the `exposed_addr` method, or update your code \
+ since = "1.67.0",
+ note = "replaced by the `expose_addr` method, or update your code \
to follow the strict provenance rules using its APIs"
)]
#[inline(always)]
@@ -167,7 +167,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[unstable(feature = "ptr_to_from_bits", issue = "91126")]
#[deprecated(
- since = "1.67",
+ since = "1.67.0",
note = "replaced by the `ptr::from_exposed_addr_mut` function, or \
update your code to follow the strict provenance rules using its APIs"
)]
@@ -270,7 +270,7 @@ impl<T: ?Sized> *mut T {
let dest_addr = addr as isize;
let offset = dest_addr.wrapping_sub(self_addr);
- // This is the canonical desugarring of this operation
+ // This is the canonical desugaring of this operation
self.wrapping_byte_offset(offset)
}
@@ -473,10 +473,20 @@ impl<T: ?Sized> *mut T {
where
T: Sized,
{
+ #[cfg(bootstrap)]
// SAFETY: the caller must uphold the safety contract for `offset`.
// The obtained pointer is valid for writes since the caller must
// guarantee that it points to the same allocated object as `self`.
- unsafe { intrinsics::offset(self, count) as *mut T }
+ unsafe {
+ intrinsics::offset(self, count) as *mut T
+ }
+ #[cfg(not(bootstrap))]
+ // SAFETY: the caller must uphold the safety contract for `offset`.
+ // The obtained pointer is valid for writes since the caller must
+ // guarantee that it points to the same allocated object as `self`.
+ unsafe {
+ intrinsics::offset(self, count)
+ }
}
/// Calculates the offset from a pointer in bytes.
@@ -1016,8 +1026,16 @@ impl<T: ?Sized> *mut T {
where
T: Sized,
{
+ #[cfg(bootstrap)]
+ // SAFETY: the caller must uphold the safety contract for `offset`.
+ unsafe {
+ self.offset(count as isize)
+ }
+ #[cfg(not(bootstrap))]
// SAFETY: the caller must uphold the safety contract for `offset`.
- unsafe { self.offset(count as isize) }
+ unsafe {
+ intrinsics::offset(self, count)
+ }
}
/// Calculates the offset from a pointer in bytes (convenience for `.byte_offset(count as isize)`).
@@ -1287,7 +1305,7 @@ impl<T: ?Sized> *mut T {
///
/// [`ptr::read`]: crate::ptr::read()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
+ #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read(self) -> T
@@ -1328,7 +1346,7 @@ impl<T: ?Sized> *mut T {
///
/// [`ptr::read_unaligned`]: crate::ptr::read_unaligned()
#[stable(feature = "pointer_methods", since = "1.26.0")]
- #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
+ #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn read_unaligned(self) -> T
@@ -2036,11 +2054,10 @@ impl<T> *mut [T] {
/// }
/// ```
#[unstable(feature = "slice_ptr_get", issue = "74265")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline(always)]
- pub const unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output
+ pub unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output
where
- I: ~const SliceIndex<[T]>,
+ I: SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
unsafe { index.get_unchecked_mut(self) }
diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs
index 13f56c0ce..b492d2f07 100644
--- a/library/core/src/ptr/non_null.rs
+++ b/library/core/src/ptr/non_null.rs
@@ -449,6 +449,19 @@ impl<T: ?Sized> NonNull<T> {
// SAFETY: `self` is a `NonNull` pointer which is necessarily non-null
unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) }
}
+
+ /// See [`pointer::add`] for semantics and safety requirements.
+ #[inline]
+ pub(crate) const unsafe fn add(self, delta: usize) -> Self
+ where
+ T: Sized,
+ {
+ // SAFETY: We require that the delta stays in-bounds of the object, and
+ // thus it cannot become null, as that would require wrapping the
+ // address space, which no legal objects are allowed to do.
+ // And the caller promised the `delta` is sound to add.
+ unsafe { NonNull { pointer: self.pointer.add(delta) } }
+ }
}
impl<T> NonNull<[T]> {
@@ -676,11 +689,10 @@ impl<T> NonNull<[T]> {
/// }
/// ```
#[unstable(feature = "slice_ptr_get", issue = "74265")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
- pub const unsafe fn get_unchecked_mut<I>(self, index: I) -> NonNull<I::Output>
+ pub unsafe fn get_unchecked_mut<I>(self, index: I) -> NonNull<I::Output>
where
- I: ~const SliceIndex<[T]>,
+ I: SliceIndex<[T]>,
{
// SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds.
// As a consequence, the resulting pointer cannot be null.
@@ -689,8 +701,7 @@ impl<T> NonNull<[T]> {
}
#[stable(feature = "nonnull", since = "1.25.0")]
-#[rustc_const_unstable(feature = "const_clone", issue = "91805")]
-impl<T: ?Sized> const Clone for NonNull<T> {
+impl<T: ?Sized> Clone for NonNull<T> {
#[inline(always)]
fn clone(&self) -> Self {
*self
@@ -756,8 +767,7 @@ impl<T: ?Sized> hash::Hash for NonNull<T> {
}
#[unstable(feature = "ptr_internals", issue = "none")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T: ?Sized> const From<Unique<T>> for NonNull<T> {
+impl<T: ?Sized> From<Unique<T>> for NonNull<T> {
#[inline]
fn from(unique: Unique<T>) -> Self {
// SAFETY: A Unique pointer cannot be null, so the conditions for
@@ -767,8 +777,7 @@ impl<T: ?Sized> const From<Unique<T>> for NonNull<T> {
}
#[stable(feature = "nonnull", since = "1.25.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T: ?Sized> const From<&mut T> for NonNull<T> {
+impl<T: ?Sized> From<&mut T> for NonNull<T> {
/// Converts a `&mut T` to a `NonNull<T>`.
///
/// This conversion is safe and infallible since references cannot be null.
@@ -780,8 +789,7 @@ impl<T: ?Sized> const From<&mut T> for NonNull<T> {
}
#[stable(feature = "nonnull", since = "1.25.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T: ?Sized> const From<&T> for NonNull<T> {
+impl<T: ?Sized> From<&T> for NonNull<T> {
/// Converts a `&T` to a `NonNull<T>`.
///
/// This conversion is safe and infallible since references cannot be null.
diff --git a/library/core/src/ptr/unique.rs b/library/core/src/ptr/unique.rs
index 64616142b..a853f15ed 100644
--- a/library/core/src/ptr/unique.rs
+++ b/library/core/src/ptr/unique.rs
@@ -70,7 +70,8 @@ impl<T: Sized> Unique<T> {
#[must_use]
#[inline]
pub const fn dangling() -> Self {
- Self::from(NonNull::dangling())
+ // FIXME(const-hack) replace with `From`
+ Unique { pointer: NonNull::dangling(), _marker: PhantomData }
}
}
@@ -134,13 +135,14 @@ impl<T: ?Sized> Unique<T> {
#[must_use = "`self` will be dropped if the result is not used"]
#[inline]
pub const fn cast<U>(self) -> Unique<U> {
- Unique::from(self.pointer.cast())
+ // FIXME(const-hack): replace with `From`
+ // SAFETY: is `NonNull`
+ unsafe { Unique::new_unchecked(self.pointer.cast().as_ptr()) }
}
}
#[unstable(feature = "ptr_internals", issue = "none")]
-#[rustc_const_unstable(feature = "const_clone", issue = "91805")]
-impl<T: ?Sized> const Clone for Unique<T> {
+impl<T: ?Sized> Clone for Unique<T> {
#[inline]
fn clone(&self) -> Self {
*self
@@ -171,7 +173,7 @@ impl<T: ?Sized> fmt::Pointer for Unique<T> {
}
#[unstable(feature = "ptr_internals", issue = "none")]
-impl<T: ?Sized> const From<&mut T> for Unique<T> {
+impl<T: ?Sized> From<&mut T> for Unique<T> {
/// Converts a `&mut T` to a `Unique<T>`.
///
/// This conversion is infallible since references cannot be null.
@@ -182,7 +184,7 @@ impl<T: ?Sized> const From<&mut T> for Unique<T> {
}
#[unstable(feature = "ptr_internals", issue = "none")]
-impl<T: ?Sized> const From<NonNull<T>> for Unique<T> {
+impl<T: ?Sized> From<NonNull<T>> for Unique<T> {
/// Converts a `NonNull<T>` to a `Unique<T>`.
///
/// This conversion is infallible since `NonNull` cannot be null.
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index c48230fb8..1ee270f4c 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -489,7 +489,6 @@
#![stable(feature = "rust1", since = "1.0.0")]
use crate::iter::{self, FromIterator, FusedIterator, TrustedLen};
-use crate::marker::Destruct;
use crate::ops::{self, ControlFlow, Deref, DerefMut};
use crate::{convert, fmt, hint};
@@ -629,16 +628,10 @@ impl<T, E> Result<T, E> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_result_drop", issue = "92384")]
- pub const fn ok(self) -> Option<T>
- where
- E: ~const Destruct,
- {
+ pub fn ok(self) -> Option<T> {
match self {
Ok(x) => Some(x),
- // FIXME: ~const Drop doesn't quite work right yet
- #[allow(unused_variables)]
- Err(x) => None,
+ Err(_) => None,
}
}
@@ -658,15 +651,9 @@ impl<T, E> Result<T, E> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_result_drop", issue = "92384")]
- pub const fn err(self) -> Option<E>
- where
- T: ~const Destruct,
- {
+ pub fn err(self) -> Option<E> {
match self {
- // FIXME: ~const Drop doesn't quite work right yet
- #[allow(unused_variables)]
- Ok(x) => None,
+ Ok(_) => None,
Err(x) => Some(x),
}
}
@@ -1287,18 +1274,10 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.and(y), Ok("different result type"));
/// ```
#[inline]
- #[rustc_const_unstable(feature = "const_result_drop", issue = "92384")]
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn and<U>(self, res: Result<U, E>) -> Result<U, E>
- where
- T: ~const Destruct,
- U: ~const Destruct,
- E: ~const Destruct,
- {
+ pub fn and<U>(self, res: Result<U, E>) -> Result<U, E> {
match self {
- // FIXME: ~const Drop doesn't quite work right yet
- #[allow(unused_variables)]
- Ok(x) => res,
+ Ok(_) => res,
Err(e) => Err(e),
}
}
@@ -1370,19 +1349,11 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.or(y), Ok(2));
/// ```
#[inline]
- #[rustc_const_unstable(feature = "const_result_drop", issue = "92384")]
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn or<F>(self, res: Result<T, F>) -> Result<T, F>
- where
- T: ~const Destruct,
- E: ~const Destruct,
- F: ~const Destruct,
- {
+ pub fn or<F>(self, res: Result<T, F>) -> Result<T, F> {
match self {
Ok(v) => Ok(v),
- // FIXME: ~const Drop doesn't quite work right yet
- #[allow(unused_variables)]
- Err(e) => res,
+ Err(_) => res,
}
}
@@ -1430,18 +1401,11 @@ impl<T, E> Result<T, E> {
/// assert_eq!(x.unwrap_or(default), default);
/// ```
#[inline]
- #[rustc_const_unstable(feature = "const_result_drop", issue = "92384")]
#[stable(feature = "rust1", since = "1.0.0")]
- pub const fn unwrap_or(self, default: T) -> T
- where
- T: ~const Destruct,
- E: ~const Destruct,
- {
+ pub fn unwrap_or(self, default: T) -> T {
match self {
Ok(t) => t,
- // FIXME: ~const Drop doesn't quite work right yet
- #[allow(unused_variables)]
- Err(e) => default,
+ Err(_) => default,
}
}
@@ -1704,11 +1668,10 @@ fn unwrap_failed<T>(_msg: &str, _error: &T) -> ! {
/////////////////////////////////////////////////////////////////////////////
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_clone", issue = "91805")]
-impl<T, E> const Clone for Result<T, E>
+impl<T, E> Clone for Result<T, E>
where
- T: ~const Clone + ~const Destruct,
- E: ~const Clone + ~const Destruct,
+ T: Clone,
+ E: Clone,
{
#[inline]
fn clone(&self) -> Self {
@@ -1971,8 +1934,7 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T, E> const ops::Try for Result<T, E> {
+impl<T, E> ops::Try for Result<T, E> {
type Output = T;
type Residual = Result<convert::Infallible, E>;
@@ -1991,10 +1953,7 @@ impl<T, E> const ops::Try for Result<T, E> {
}
#[unstable(feature = "try_trait_v2", issue = "84277")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T, E, F: ~const From<E>> const ops::FromResidual<Result<convert::Infallible, E>>
- for Result<T, F>
-{
+impl<T, E, F: From<E>> ops::FromResidual<Result<convert::Infallible, E>> for Result<T, F> {
#[inline]
#[track_caller]
fn from_residual(residual: Result<convert::Infallible, E>) -> Self {
@@ -2013,7 +1972,6 @@ impl<T, E, F: From<E>> ops::FromResidual<ops::Yeet<E>> for Result<T, F> {
}
#[unstable(feature = "try_trait_v2_residual", issue = "91285")]
-#[rustc_const_unstable(feature = "const_try", issue = "74935")]
-impl<T, E> const ops::Residual<T> for Result<convert::Infallible, E> {
+impl<T, E> ops::Residual<T> for Result<convert::Infallible, E> {
type TryType = Result<T, E>;
}
diff --git a/library/core/src/slice/ascii.rs b/library/core/src/slice/ascii.rs
index 5e5399acc..f3311f76a 100644
--- a/library/core/src/slice/ascii.rs
+++ b/library/core/src/slice/ascii.rs
@@ -10,12 +10,43 @@ use crate::ops;
impl [u8] {
/// Checks if all bytes in this slice are within the ASCII range.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
+ #[rustc_const_unstable(feature = "const_slice_is_ascii", issue = "111090")]
#[must_use]
#[inline]
- pub fn is_ascii(&self) -> bool {
+ pub const fn is_ascii(&self) -> bool {
is_ascii(self)
}
+ /// If this slice [`is_ascii`](Self::is_ascii), returns it as a slice of
+ /// [ASCII characters](`ascii::Char`), otherwise returns `None`.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[must_use]
+ #[inline]
+ pub const fn as_ascii(&self) -> Option<&[ascii::Char]> {
+ if self.is_ascii() {
+ // SAFETY: Just checked that it's ASCII
+ Some(unsafe { self.as_ascii_unchecked() })
+ } else {
+ None
+ }
+ }
+
+ /// Converts this slice of bytes into a slice of ASCII characters,
+ /// without checking whether they're valid.
+ ///
+ /// # Safety
+ ///
+ /// Every byte in the slice must be in `0..=127`, or else this is UB.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[must_use]
+ #[inline]
+ pub const unsafe fn as_ascii_unchecked(&self) -> &[ascii::Char] {
+ let byte_ptr: *const [u8] = self;
+ let ascii_ptr = byte_ptr as *const [ascii::Char];
+ // SAFETY: The caller promised all the bytes are ASCII
+ unsafe { &*ascii_ptr }
+ }
+
/// Checks that two slices are an ASCII case-insensitive match.
///
/// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`,
@@ -232,11 +263,29 @@ impl<'a> fmt::Debug for EscapeAscii<'a> {
/// Returns `true` if any byte in the word `v` is nonascii (>= 128). Snarfed
/// from `../str/mod.rs`, which does something similar for utf8 validation.
#[inline]
-fn contains_nonascii(v: usize) -> bool {
+const fn contains_nonascii(v: usize) -> bool {
const NONASCII_MASK: usize = usize::repeat_u8(0x80);
(NONASCII_MASK & v) != 0
}
+/// ASCII test *without* the chunk-at-a-time optimizations.
+///
+/// This is carefully structured to produce nice small code -- it's smaller in
+/// `-O` than what the "obvious" ways produces under `-C opt-level=s`. If you
+/// touch it, be sure to run (and update if needed) the assembly test.
+#[unstable(feature = "str_internals", issue = "none")]
+#[doc(hidden)]
+#[inline]
+pub const fn is_ascii_simple(mut bytes: &[u8]) -> bool {
+ while let [rest @ .., last] = bytes {
+ if !last.is_ascii() {
+ break;
+ }
+ bytes = rest;
+ }
+ bytes.is_empty()
+}
+
/// Optimized ASCII test that will use usize-at-a-time operations instead of
/// byte-at-a-time operations (when possible).
///
@@ -250,7 +299,7 @@ fn contains_nonascii(v: usize) -> bool {
/// If any of these loads produces something for which `contains_nonascii`
/// (above) returns true, then we know the answer is false.
#[inline]
-fn is_ascii(s: &[u8]) -> bool {
+const fn is_ascii(s: &[u8]) -> bool {
const USIZE_SIZE: usize = mem::size_of::<usize>();
let len = s.len();
@@ -262,7 +311,7 @@ fn is_ascii(s: &[u8]) -> bool {
// We also do this for architectures where `size_of::<usize>()` isn't
// sufficient alignment for `usize`, because it's a weird edge case.
if len < USIZE_SIZE || len < align_offset || USIZE_SIZE < mem::align_of::<usize>() {
- return s.iter().all(|b| b.is_ascii());
+ return is_ascii_simple(s);
}
// We always read the first word unaligned, which means `align_offset` is
@@ -291,18 +340,26 @@ fn is_ascii(s: &[u8]) -> bool {
// Paranoia check about alignment, since we're about to do a bunch of
// unaligned loads. In practice this should be impossible barring a bug in
// `align_offset` though.
- debug_assert_eq!(word_ptr.addr() % mem::align_of::<usize>(), 0);
+ // While this method is allowed to spuriously fail in CTFE, if it doesn't
+ // have alignment information it should have given a `usize::MAX` for
+ // `align_offset` earlier, sending things through the scalar path instead of
+ // this one, so this check should pass if it's reachable.
+ debug_assert!(word_ptr.is_aligned_to(mem::align_of::<usize>()));
// Read subsequent words until the last aligned word, excluding the last
// aligned word by itself to be done in tail check later, to ensure that
// tail is always one `usize` at most to extra branch `byte_pos == len`.
while byte_pos < len - USIZE_SIZE {
- debug_assert!(
- // Sanity check that the read is in bounds
- (word_ptr.addr() + USIZE_SIZE) <= start.addr().wrapping_add(len) &&
- // And that our assumptions about `byte_pos` hold.
- (word_ptr.addr() - start.addr()) == byte_pos
- );
+ // Sanity check that the read is in bounds
+ debug_assert!(byte_pos + USIZE_SIZE <= len);
+ // And that our assumptions about `byte_pos` hold.
+ debug_assert!(matches!(
+ word_ptr.cast::<u8>().guaranteed_eq(start.wrapping_add(byte_pos)),
+ // These are from the same allocation, so will hopefully always be
+ // known to match even in CTFE, but if it refuses to compare them
+ // that's ok since it's just a debug check anyway.
+ None | Some(true),
+ ));
// SAFETY: We know `word_ptr` is properly aligned (because of
// `align_offset`), and we know that we have enough bytes between `word_ptr` and the end
diff --git a/library/core/src/slice/index.rs b/library/core/src/slice/index.rs
index 353935324..6ef9f9c95 100644
--- a/library/core/src/slice/index.rs
+++ b/library/core/src/slice/index.rs
@@ -7,10 +7,9 @@ use crate::ops;
use crate::ptr;
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-impl<T, I> const ops::Index<I> for [T]
+impl<T, I> ops::Index<I> for [T]
where
- I: ~const SliceIndex<[T]>,
+ I: SliceIndex<[T]>,
{
type Output = I::Output;
@@ -21,10 +20,9 @@ where
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-impl<T, I> const ops::IndexMut<I> for [T]
+impl<T, I> ops::IndexMut<I> for [T]
where
- I: ~const SliceIndex<[T]>,
+ I: SliceIndex<[T]>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut I::Output {
@@ -162,7 +160,6 @@ mod private_slice_index {
message = "the type `{T}` cannot be indexed by `{Self}`",
label = "slice indices are of type `usize` or ranges of `usize`"
)]
-#[const_trait]
pub unsafe trait SliceIndex<T: ?Sized>: private_slice_index::Sealed {
/// The output type returned by methods.
#[stable(feature = "slice_get_slice", since = "1.28.0")]
@@ -211,7 +208,7 @@ pub unsafe trait SliceIndex<T: ?Sized>: private_slice_index::Sealed {
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl<T> const SliceIndex<[T]> for usize {
+unsafe impl<T> SliceIndex<[T]> for usize {
type Output = T;
#[inline]
@@ -271,7 +268,7 @@ unsafe impl<T> const SliceIndex<[T]> for usize {
/// Because `IndexRange` guarantees `start <= end`, fewer checks are needed here
/// than there are for a general `Range<usize>` (which might be `100..3`).
#[rustc_const_unstable(feature = "const_index_range_slice_index", issue = "none")]
-unsafe impl<T> const SliceIndex<[T]> for ops::IndexRange {
+unsafe impl<T> SliceIndex<[T]> for ops::IndexRange {
type Output = [T];
#[inline]
@@ -347,7 +344,7 @@ unsafe impl<T> const SliceIndex<[T]> for ops::IndexRange {
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl<T> const SliceIndex<[T]> for ops::Range<usize> {
+unsafe impl<T> SliceIndex<[T]> for ops::Range<usize> {
type Output = [T];
#[inline]
@@ -428,7 +425,7 @@ unsafe impl<T> const SliceIndex<[T]> for ops::Range<usize> {
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl<T> const SliceIndex<[T]> for ops::RangeTo<usize> {
+unsafe impl<T> SliceIndex<[T]> for ops::RangeTo<usize> {
type Output = [T];
#[inline]
@@ -466,7 +463,7 @@ unsafe impl<T> const SliceIndex<[T]> for ops::RangeTo<usize> {
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl<T> const SliceIndex<[T]> for ops::RangeFrom<usize> {
+unsafe impl<T> SliceIndex<[T]> for ops::RangeFrom<usize> {
type Output = [T];
#[inline]
@@ -512,7 +509,7 @@ unsafe impl<T> const SliceIndex<[T]> for ops::RangeFrom<usize> {
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl<T> const SliceIndex<[T]> for ops::RangeFull {
+unsafe impl<T> SliceIndex<[T]> for ops::RangeFull {
type Output = [T];
#[inline]
@@ -548,7 +545,7 @@ unsafe impl<T> const SliceIndex<[T]> for ops::RangeFull {
#[stable(feature = "inclusive_range", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl<T> const SliceIndex<[T]> for ops::RangeInclusive<usize> {
+unsafe impl<T> SliceIndex<[T]> for ops::RangeInclusive<usize> {
type Output = [T];
#[inline]
@@ -592,7 +589,7 @@ unsafe impl<T> const SliceIndex<[T]> for ops::RangeInclusive<usize> {
#[stable(feature = "inclusive_range", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl<T> const SliceIndex<[T]> for ops::RangeToInclusive<usize> {
+unsafe impl<T> SliceIndex<[T]> for ops::RangeToInclusive<usize> {
type Output = [T];
#[inline]
diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs
index 88b84bd13..5369fe0a9 100644
--- a/library/core/src/slice/iter.rs
+++ b/library/core/src/slice/iter.rs
@@ -13,7 +13,7 @@ use crate::iter::{
use crate::marker::{PhantomData, Send, Sized, Sync};
use crate::mem::{self, SizedTypeProperties};
use crate::num::NonZeroUsize;
-use crate::ptr::NonNull;
+use crate::ptr::{invalid, invalid_mut, NonNull};
use super::{from_raw_parts, from_raw_parts_mut};
@@ -60,10 +60,15 @@ impl<'a, T> IntoIterator for &'a mut [T] {
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Iter<'a, T: 'a> {
+ /// The pointer to the next element to return, or the past-the-end location
+ /// if the iterator is empty.
+ ///
+ /// This address will be used for all ZST elements, never changed.
ptr: NonNull<T>,
- end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
- // ptr == end is a quick test for the Iterator being empty, that works
- // for both ZST and non-ZST.
+ /// For non-ZSTs, the non-null pointer to the past-the-end element.
+ ///
+ /// For ZSTs, this is `ptr::invalid(len)`.
+ end: *const T,
_marker: PhantomData<&'a T>,
}
@@ -85,10 +90,7 @@ impl<'a, T> Iter<'a, T> {
let ptr = slice.as_ptr();
// SAFETY: Similar to `IterMut::new`.
unsafe {
- assume(!ptr.is_null());
-
- let end =
- if T::IS_ZST { ptr.wrapping_byte_add(slice.len()) } else { ptr.add(slice.len()) };
+ let end = if T::IS_ZST { invalid(slice.len()) } else { ptr.add(slice.len()) };
Self { ptr: NonNull::new_unchecked(ptr as *mut T), end, _marker: PhantomData }
}
@@ -179,10 +181,15 @@ impl<T> AsRef<[T]> for Iter<'_, T> {
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct IterMut<'a, T: 'a> {
+ /// The pointer to the next element to return, or the past-the-end location
+ /// if the iterator is empty.
+ ///
+ /// This address will be used for all ZST elements, never changed.
ptr: NonNull<T>,
- end: *mut T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
- // ptr == end is a quick test for the Iterator being empty, that works
- // for both ZST and non-ZST.
+ /// For non-ZSTs, the non-null pointer to the past-the-end element.
+ ///
+ /// For ZSTs, this is `ptr::invalid_mut(len)`.
+ end: *mut T,
_marker: PhantomData<&'a mut T>,
}
@@ -219,10 +226,7 @@ impl<'a, T> IterMut<'a, T> {
// See the `next_unchecked!` and `is_empty!` macros as well as the
// `post_inc_start` method for more information.
unsafe {
- assume(!ptr.is_null());
-
- let end =
- if T::IS_ZST { ptr.wrapping_byte_add(slice.len()) } else { ptr.add(slice.len()) };
+ let end = if T::IS_ZST { invalid_mut(slice.len()) } else { ptr.add(slice.len()) };
Self { ptr: NonNull::new_unchecked(ptr), end, _marker: PhantomData }
}
@@ -685,7 +689,7 @@ where
None
} else {
self.finished = true;
- Some(mem::replace(&mut self.v, &mut []))
+ Some(mem::take(&mut self.v))
}
}
}
@@ -749,7 +753,7 @@ where
match idx_opt {
None => self.finish(),
Some(idx) => {
- let tmp = mem::replace(&mut self.v, &mut []);
+ let tmp = mem::take(&mut self.v);
let (head, tail) = tmp.split_at_mut(idx);
self.v = head;
Some(&mut tail[1..])
@@ -830,7 +834,7 @@ where
if idx == self.v.len() {
self.finished = true;
}
- let tmp = mem::replace(&mut self.v, &mut []);
+ let tmp = mem::take(&mut self.v);
let (head, tail) = tmp.split_at_mut(idx);
self.v = tail;
Some(head)
@@ -876,7 +880,7 @@ where
if idx == 0 {
self.finished = true;
}
- let tmp = mem::replace(&mut self.v, &mut []);
+ let tmp = mem::take(&mut self.v);
let (head, tail) = tmp.split_at_mut(idx);
self.v = head;
Some(tail)
diff --git a/library/core/src/slice/iter/macros.rs b/library/core/src/slice/iter/macros.rs
index 392752f2a..3462c0e02 100644
--- a/library/core/src/slice/iter/macros.rs
+++ b/library/core/src/slice/iter/macros.rs
@@ -1,11 +1,30 @@
//! Macros used by iterators of slice.
+// Shrinks the iterator when T is a ZST, setting the length to `new_len`.
+// `new_len` must not exceed `self.len()`.
+macro_rules! zst_set_len {
+ ($self: ident, $new_len: expr) => {{
+ #![allow(unused_unsafe)] // we're sometimes used within an unsafe block
+
+ // SAFETY: same as `invalid(_mut)`, but the macro doesn't know
+ // which versions of that function to call, so open-code it.
+ $self.end = unsafe { mem::transmute::<usize, _>($new_len) };
+ }};
+}
+
+// Shrinks the iterator when T is a ZST, reducing the length by `n`.
+// `n` must not exceed `self.len()`.
+macro_rules! zst_shrink {
+ ($self: ident, $n: ident) => {
+ let new_len = $self.end.addr() - $n;
+ zst_set_len!($self, new_len);
+ };
+}
+
// Inlining is_empty and len makes a huge performance difference
macro_rules! is_empty {
- // The way we encode the length of a ZST iterator, this works both for ZST
- // and non-ZST.
($self: ident) => {
- $self.ptr.as_ptr() as *const T == $self.end
+ if T::IS_ZST { $self.end.addr() == 0 } else { $self.ptr.as_ptr() as *const _ == $self.end }
};
}
@@ -13,16 +32,13 @@ macro_rules! len {
($self: ident) => {{
#![allow(unused_unsafe)] // we're sometimes used within an unsafe block
- let start = $self.ptr;
if T::IS_ZST {
- // This _cannot_ use `ptr_sub` because we depend on wrapping
- // to represent the length of long ZST slice iterators.
- $self.end.addr().wrapping_sub(start.as_ptr().addr())
+ $self.end.addr()
} else {
// To get rid of some bounds checks (see `position`), we use ptr_sub instead of
// offset_from (Tested by `codegen/slice-position-bounds-check`.)
// SAFETY: by the type invariant pointers are aligned and `start <= end`
- unsafe { $self.end.sub_ptr(start.as_ptr()) }
+ unsafe { $self.end.sub_ptr($self.ptr.as_ptr()) }
}
}};
}
@@ -50,14 +66,6 @@ macro_rules! iterator {
($self: ident) => {& $( $mut_ )? *$self.pre_dec_end(1)}
}
- // Shrinks the iterator when T is a ZST, by moving the end of the iterator
- // backwards by `n`. `n` must not exceed `self.len()`.
- macro_rules! zst_shrink {
- ($self: ident, $n: ident) => {
- $self.end = $self.end.wrapping_byte_sub($n);
- }
- }
-
impl<'a, T> $name<'a, T> {
// Helper function for creating a slice from the iterator.
#[inline(always)]
@@ -73,16 +81,15 @@ macro_rules! iterator {
// Unsafe because the offset must not exceed `self.len()`.
#[inline(always)]
unsafe fn post_inc_start(&mut self, offset: usize) -> * $raw_mut T {
- if mem::size_of::<T>() == 0 {
+ let old = self.ptr;
+ if T::IS_ZST {
zst_shrink!(self, offset);
- self.ptr.as_ptr()
} else {
- let old = self.ptr.as_ptr();
// SAFETY: the caller guarantees that `offset` doesn't exceed `self.len()`,
// so this new pointer is inside `self` and thus guaranteed to be non-null.
- self.ptr = unsafe { NonNull::new_unchecked(self.ptr.as_ptr().add(offset)) };
- old
+ self.ptr = unsafe { self.ptr.add(offset) };
}
+ old.as_ptr()
}
// Helper function for moving the end of the iterator backwards by `offset` elements,
@@ -124,12 +131,10 @@ macro_rules! iterator {
fn next(&mut self) -> Option<$elem> {
// could be implemented with slices, but this avoids bounds checks
- // SAFETY: `assume` calls are safe since a slice's start pointer
- // must be non-null, and slices over non-ZSTs must also have a
- // non-null end pointer. The call to `next_unchecked!` is safe
- // since we check if the iterator is empty first.
+ // SAFETY: `assume` call is safe because slices over non-ZSTs must
+ // have a non-null end pointer. The call to `next_unchecked!` is
+ // safe since we check if the iterator is empty first.
unsafe {
- assume(!self.ptr.as_ptr().is_null());
if !<T>::IS_ZST {
assume(!self.end.is_null());
}
@@ -157,9 +162,7 @@ macro_rules! iterator {
if n >= len!(self) {
// This iterator is now empty.
if T::IS_ZST {
- // We have to do it this way as `ptr` may never be 0, but `end`
- // could be (due to wrapping).
- self.end = self.ptr.as_ptr();
+ zst_set_len!(self, 0);
} else {
// SAFETY: end can't be 0 if T isn't ZST because ptr isn't 0 and end >= ptr
unsafe {
@@ -339,12 +342,10 @@ macro_rules! iterator {
fn next_back(&mut self) -> Option<$elem> {
// could be implemented with slices, but this avoids bounds checks
- // SAFETY: `assume` calls are safe since a slice's start pointer must be non-null,
- // and slices over non-ZSTs must also have a non-null end pointer.
- // The call to `next_back_unchecked!` is safe since we check if the iterator is
- // empty first.
+ // SAFETY: `assume` call is safe because slices over non-ZSTs must
+ // have a non-null end pointer. The call to `next_back_unchecked!`
+ // is safe since we check if the iterator is empty first.
unsafe {
- assume(!self.ptr.as_ptr().is_null());
if !<T>::IS_ZST {
assume(!self.end.is_null());
}
@@ -360,7 +361,11 @@ macro_rules! iterator {
fn nth_back(&mut self, n: usize) -> Option<$elem> {
if n >= len!(self) {
// This iterator is now empty.
- self.end = self.ptr.as_ptr();
+ if T::IS_ZST {
+ zst_set_len!(self, 0);
+ } else {
+ self.end = self.ptr.as_ptr();
+ }
return None;
}
// SAFETY: We are in bounds. `pre_dec_end` does the right thing even for ZSTs.
diff --git a/library/core/src/slice/memchr.rs b/library/core/src/slice/memchr.rs
index 98c8349eb..3a8b59d72 100644
--- a/library/core/src/slice/memchr.rs
+++ b/library/core/src/slice/memchr.rs
@@ -1,7 +1,6 @@
// Original implementation taken from rust-memchr.
// Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
-use crate::cmp;
use crate::mem;
const LO_USIZE: usize = usize::repeat_u8(0x01);
@@ -83,8 +82,12 @@ const fn memchr_aligned(x: u8, text: &[u8]) -> Option<usize> {
let mut offset = ptr.align_offset(USIZE_BYTES);
if offset > 0 {
- offset = cmp::min(offset, len);
- if let Some(index) = memchr_naive(x, &text[..offset]) {
+ // FIXME(const-hack, fee1-dead): replace with min
+ offset = if offset < len { offset } else { len };
+ // FIXME(const-hack, fee1-dead): replace with range slicing
+ // SAFETY: offset is within bounds
+ let slice = unsafe { super::from_raw_parts(text.as_ptr(), offset) };
+ if let Some(index) = memchr_naive(x, slice) {
return Some(index);
}
}
@@ -110,7 +113,10 @@ const fn memchr_aligned(x: u8, text: &[u8]) -> Option<usize> {
// Find the byte after the point the body loop stopped.
// FIXME(const-hack): Use `?` instead.
- if let Some(i) = memchr_naive(x, &text[offset..]) { Some(offset + i) } else { None }
+ // FIXME(const-hack, fee1-dead): use range slicing
+ // SAFETY: offset is within bounds
+ let slice = unsafe { super::from_raw_parts(text.as_ptr().add(offset), text.len() - offset) };
+ if let Some(i) = memchr_naive(x, slice) { Some(offset + i) } else { None }
}
/// Returns the last index matching the byte `x` in `text`.
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
index f541808a6..ea0181e35 100644
--- a/library/core/src/slice/mod.rs
+++ b/library/core/src/slice/mod.rs
@@ -42,8 +42,13 @@ mod index;
mod iter;
mod raw;
mod rotate;
+mod select;
mod specialize;
+#[unstable(feature = "str_internals", issue = "none")]
+#[doc(hidden)]
+pub use ascii::is_ascii_simple;
+
#[stable(feature = "rust1", since = "1.0.0")]
pub use iter::{Chunks, ChunksMut, Windows};
#[stable(feature = "rust1", since = "1.0.0")]
@@ -315,6 +320,264 @@ impl<T> [T] {
if let [.., last] = self { Some(last) } else { None }
}
+ /// Returns the first `N` elements of the slice, or `None` if it has fewer than `N` elements.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(slice_first_last_chunk)]
+ ///
+ /// let u = [10, 40, 30];
+ /// assert_eq!(Some(&[10, 40]), u.first_chunk::<2>());
+ ///
+ /// let v: &[i32] = &[10];
+ /// assert_eq!(None, v.first_chunk::<2>());
+ ///
+ /// let w: &[i32] = &[];
+ /// assert_eq!(Some(&[]), w.first_chunk::<0>());
+ /// ```
+ #[unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[rustc_const_unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[inline]
+ pub const fn first_chunk<const N: usize>(&self) -> Option<&[T; N]> {
+ if self.len() < N {
+ None
+ } else {
+ // SAFETY: We explicitly check for the correct number of elements,
+ // and do not let the reference outlive the slice.
+ Some(unsafe { &*(self.as_ptr() as *const [T; N]) })
+ }
+ }
+
+ /// Returns a mutable reference to the first `N` elements of the slice,
+ /// or `None` if it has fewer than `N` elements.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(slice_first_last_chunk)]
+ ///
+ /// let x = &mut [0, 1, 2];
+ ///
+ /// if let Some(first) = x.first_chunk_mut::<2>() {
+ /// first[0] = 5;
+ /// first[1] = 4;
+ /// }
+ /// assert_eq!(x, &[5, 4, 2]);
+ /// ```
+ #[unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[rustc_const_unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[inline]
+ pub const fn first_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]> {
+ if self.len() < N {
+ None
+ } else {
+ // SAFETY: We explicitly check for the correct number of elements,
+ // do not let the reference outlive the slice,
+ // and require exclusive access to the entire slice to mutate the chunk.
+ Some(unsafe { &mut *(self.as_mut_ptr() as *mut [T; N]) })
+ }
+ }
+
+ /// Returns the first `N` elements of the slice and the remainder,
+ /// or `None` if it has fewer than `N` elements.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(slice_first_last_chunk)]
+ ///
+ /// let x = &[0, 1, 2];
+ ///
+ /// if let Some((first, elements)) = x.split_first_chunk::<2>() {
+ /// assert_eq!(first, &[0, 1]);
+ /// assert_eq!(elements, &[2]);
+ /// }
+ /// ```
+ #[unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[rustc_const_unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[inline]
+ pub const fn split_first_chunk<const N: usize>(&self) -> Option<(&[T; N], &[T])> {
+ if self.len() < N {
+ None
+ } else {
+ // SAFETY: We manually verified the bounds of the split.
+ let (first, tail) = unsafe { self.split_at_unchecked(N) };
+
+ // SAFETY: We explicitly check for the correct number of elements,
+ // and do not let the references outlive the slice.
+ Some((unsafe { &*(first.as_ptr() as *const [T; N]) }, tail))
+ }
+ }
+
+ /// Returns a mutable reference to the first `N` elements of the slice and the remainder,
+ /// or `None` if it has fewer than `N` elements.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(slice_first_last_chunk)]
+ ///
+ /// let x = &mut [0, 1, 2];
+ ///
+ /// if let Some((first, elements)) = x.split_first_chunk_mut::<2>() {
+ /// first[0] = 3;
+ /// first[1] = 4;
+ /// elements[0] = 5;
+ /// }
+ /// assert_eq!(x, &[3, 4, 5]);
+ /// ```
+ #[unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[rustc_const_unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[inline]
+ pub const fn split_first_chunk_mut<const N: usize>(
+ &mut self,
+ ) -> Option<(&mut [T; N], &mut [T])> {
+ if self.len() < N {
+ None
+ } else {
+ // SAFETY: We manually verified the bounds of the split.
+ let (first, tail) = unsafe { self.split_at_mut_unchecked(N) };
+
+ // SAFETY: We explicitly check for the correct number of elements,
+ // do not let the reference outlive the slice,
+ // and enforce exclusive mutability of the chunk by the split.
+ Some((unsafe { &mut *(first.as_mut_ptr() as *mut [T; N]) }, tail))
+ }
+ }
+
+ /// Returns the last `N` elements of the slice and the remainder,
+ /// or `None` if it has fewer than `N` elements.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(slice_first_last_chunk)]
+ ///
+ /// let x = &[0, 1, 2];
+ ///
+ /// if let Some((last, elements)) = x.split_last_chunk::<2>() {
+ /// assert_eq!(last, &[1, 2]);
+ /// assert_eq!(elements, &[0]);
+ /// }
+ /// ```
+ #[unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[rustc_const_unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[inline]
+ pub const fn split_last_chunk<const N: usize>(&self) -> Option<(&[T; N], &[T])> {
+ if self.len() < N {
+ None
+ } else {
+ // SAFETY: We manually verified the bounds of the split.
+ let (init, last) = unsafe { self.split_at_unchecked(self.len() - N) };
+
+ // SAFETY: We explicitly check for the correct number of elements,
+ // and do not let the references outlive the slice.
+ Some((unsafe { &*(last.as_ptr() as *const [T; N]) }, init))
+ }
+ }
+
+ /// Returns the last and all the rest of the elements of the slice, or `None` if it is empty.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(slice_first_last_chunk)]
+ ///
+ /// let x = &mut [0, 1, 2];
+ ///
+ /// if let Some((last, elements)) = x.split_last_chunk_mut::<2>() {
+ /// last[0] = 3;
+ /// last[1] = 4;
+ /// elements[0] = 5;
+ /// }
+ /// assert_eq!(x, &[5, 3, 4]);
+ /// ```
+ #[unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[rustc_const_unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[inline]
+ pub const fn split_last_chunk_mut<const N: usize>(
+ &mut self,
+ ) -> Option<(&mut [T; N], &mut [T])> {
+ if self.len() < N {
+ None
+ } else {
+ // SAFETY: We manually verified the bounds of the split.
+ let (init, last) = unsafe { self.split_at_mut_unchecked(self.len() - N) };
+
+ // SAFETY: We explicitly check for the correct number of elements,
+ // do not let the reference outlive the slice,
+ // and enforce exclusive mutability of the chunk by the split.
+ Some((unsafe { &mut *(last.as_mut_ptr() as *mut [T; N]) }, init))
+ }
+ }
+
+ /// Returns the last element of the slice, or `None` if it is empty.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(slice_first_last_chunk)]
+ ///
+ /// let u = [10, 40, 30];
+ /// assert_eq!(Some(&[40, 30]), u.last_chunk::<2>());
+ ///
+ /// let v: &[i32] = &[10];
+ /// assert_eq!(None, v.last_chunk::<2>());
+ ///
+ /// let w: &[i32] = &[];
+ /// assert_eq!(Some(&[]), w.last_chunk::<0>());
+ /// ```
+ #[unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[rustc_const_unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[inline]
+ pub const fn last_chunk<const N: usize>(&self) -> Option<&[T; N]> {
+ if self.len() < N {
+ None
+ } else {
+ // SAFETY: We manually verified the bounds of the slice.
+ // FIXME: Without const traits, we need this instead of `get_unchecked`.
+ let last = unsafe { self.split_at_unchecked(self.len() - N).1 };
+
+ // SAFETY: We explicitly check for the correct number of elements,
+ // and do not let the references outlive the slice.
+ Some(unsafe { &*(last.as_ptr() as *const [T; N]) })
+ }
+ }
+
+ /// Returns a mutable pointer to the last item in the slice.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(slice_first_last_chunk)]
+ ///
+ /// let x = &mut [0, 1, 2];
+ ///
+ /// if let Some(last) = x.last_chunk_mut::<2>() {
+ /// last[0] = 10;
+ /// last[1] = 20;
+ /// }
+ /// assert_eq!(x, &[0, 10, 20]);
+ /// ```
+ #[unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[rustc_const_unstable(feature = "slice_first_last_chunk", issue = "111774")]
+ #[inline]
+ pub const fn last_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]> {
+ if self.len() < N {
+ None
+ } else {
+ // SAFETY: We manually verified the bounds of the slice.
+ // FIXME: Without const traits, we need this instead of `get_unchecked`.
+ let last = unsafe { self.split_at_mut_unchecked(self.len() - N).1 };
+
+ // SAFETY: We explicitly check for the correct number of elements,
+ // do not let the reference outlive the slice,
+ // and require exclusive access to the entire slice to mutate the chunk.
+ Some(unsafe { &mut *(last.as_mut_ptr() as *mut [T; N]) })
+ }
+ }
+
/// Returns a reference to an element or subslice depending on the type of
/// index.
///
@@ -333,12 +596,11 @@ impl<T> [T] {
/// assert_eq!(None, v.get(0..4));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
#[must_use]
- pub const fn get<I>(&self, index: I) -> Option<&I::Output>
+ pub fn get<I>(&self, index: I) -> Option<&I::Output>
where
- I: ~const SliceIndex<Self>,
+ I: SliceIndex<Self>,
{
index.get(self)
}
@@ -359,12 +621,11 @@ impl<T> [T] {
/// assert_eq!(x, &[0, 42, 2]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
#[must_use]
- pub const fn get_mut<I>(&mut self, index: I) -> Option<&mut I::Output>
+ pub fn get_mut<I>(&mut self, index: I) -> Option<&mut I::Output>
where
- I: ~const SliceIndex<Self>,
+ I: SliceIndex<Self>,
{
index.get_mut(self)
}
@@ -392,12 +653,11 @@ impl<T> [T] {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
#[must_use]
- pub const unsafe fn get_unchecked<I>(&self, index: I) -> &I::Output
+ pub unsafe fn get_unchecked<I>(&self, index: I) -> &I::Output
where
- I: ~const SliceIndex<Self>,
+ I: SliceIndex<Self>,
{
// SAFETY: the caller must uphold most of the safety requirements for `get_unchecked`;
// the slice is dereferenceable because `self` is a safe reference.
@@ -430,12 +690,11 @@ impl<T> [T] {
/// assert_eq!(x, &[1, 13, 4]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
#[must_use]
- pub const unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output
+ pub unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output
where
- I: ~const SliceIndex<Self>,
+ I: SliceIndex<Self>,
{
// SAFETY: the caller must uphold the safety requirements for `get_unchecked_mut`;
// the slice is dereferenceable because `self` is a safe reference.
@@ -678,9 +937,8 @@ impl<T> [T] {
/// assert!(v == [3, 2, 1]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_reverse", issue = "100784")]
#[inline]
- pub const fn reverse(&mut self) {
+ pub fn reverse(&mut self) {
let half_len = self.len() / 2;
let Range { start, end } = self.as_mut_ptr_range();
@@ -703,7 +961,7 @@ impl<T> [T] {
revswap(front_half, back_half, half_len);
#[inline]
- const fn revswap<T>(a: &mut [T], b: &mut [T], n: usize) {
+ fn revswap<T>(a: &mut [T], b: &mut [T], n: usize) {
debug_assert!(a.len() == n);
debug_assert!(b.len() == n);
@@ -996,7 +1254,7 @@ impl<T> [T] {
#[unstable(feature = "slice_as_chunks", issue = "74985")]
#[inline]
#[must_use]
- pub unsafe fn as_chunks_unchecked<const N: usize>(&self) -> &[[T; N]] {
+ pub const unsafe fn as_chunks_unchecked<const N: usize>(&self) -> &[[T; N]] {
let this = self;
// SAFETY: Caller must guarantee that `N` is nonzero and exactly divides the slice length
let new_len = unsafe {
@@ -1044,7 +1302,7 @@ impl<T> [T] {
#[inline]
#[track_caller]
#[must_use]
- pub fn as_chunks<const N: usize>(&self) -> (&[[T; N]], &[T]) {
+ pub const fn as_chunks<const N: usize>(&self) -> (&[[T; N]], &[T]) {
assert!(N != 0, "chunk size must be non-zero");
let len = self.len() / N;
let (multiple_of_n, remainder) = self.split_at(len * N);
@@ -1076,7 +1334,7 @@ impl<T> [T] {
#[inline]
#[track_caller]
#[must_use]
- pub fn as_rchunks<const N: usize>(&self) -> (&[T], &[[T; N]]) {
+ pub const fn as_rchunks<const N: usize>(&self) -> (&[T], &[[T; N]]) {
assert!(N != 0, "chunk size must be non-zero");
let len = self.len() / N;
let (remainder, multiple_of_n) = self.split_at(self.len() - len * N);
@@ -1153,7 +1411,7 @@ impl<T> [T] {
#[unstable(feature = "slice_as_chunks", issue = "74985")]
#[inline]
#[must_use]
- pub unsafe fn as_chunks_unchecked_mut<const N: usize>(&mut self) -> &mut [[T; N]] {
+ pub const unsafe fn as_chunks_unchecked_mut<const N: usize>(&mut self) -> &mut [[T; N]] {
let this = &*self;
// SAFETY: Caller must guarantee that `N` is nonzero and exactly divides the slice length
let new_len = unsafe {
@@ -1196,7 +1454,7 @@ impl<T> [T] {
#[inline]
#[track_caller]
#[must_use]
- pub fn as_chunks_mut<const N: usize>(&mut self) -> (&mut [[T; N]], &mut [T]) {
+ pub const fn as_chunks_mut<const N: usize>(&mut self) -> (&mut [[T; N]], &mut [T]) {
assert!(N != 0, "chunk size must be non-zero");
let len = self.len() / N;
let (multiple_of_n, remainder) = self.split_at_mut(len * N);
@@ -1234,7 +1492,7 @@ impl<T> [T] {
#[inline]
#[track_caller]
#[must_use]
- pub fn as_rchunks_mut<const N: usize>(&mut self) -> (&mut [T], &mut [[T; N]]) {
+ pub const fn as_rchunks_mut<const N: usize>(&mut self) -> (&mut [T], &mut [[T; N]]) {
assert!(N != 0, "chunk size must be non-zero");
let len = self.len() / N;
let (remainder, multiple_of_n) = self.split_at_mut(self.len() - len * N);
@@ -1596,7 +1854,8 @@ impl<T> [T] {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_slice_split_at_not_mut", issue = "101158")]
+ #[rustc_const_stable(feature = "const_slice_split_at_not_mut", since = "1.71.0")]
+ #[rustc_allow_const_fn_unstable(slice_split_at_unchecked)]
#[inline]
#[track_caller]
#[must_use]
@@ -2746,8 +3005,9 @@ impl<T> [T] {
///
/// # Current implementation
///
- /// The current algorithm is based on the quickselect portion of the same quicksort algorithm
- /// used for [`sort_unstable`].
+ /// The current algorithm is an introselect implementation based on Pattern Defeating Quicksort, which is also
+ /// the basis for [`sort_unstable`]. The fallback algorithm is Median of Medians using Tukey's Ninther for
+ /// pivot selection, which guarantees linear runtime for all inputs.
///
/// [`sort_unstable`]: slice::sort_unstable
///
@@ -2776,7 +3036,7 @@ impl<T> [T] {
where
T: Ord,
{
- sort::partition_at_index(self, index, T::lt)
+ select::partition_at_index(self, index, T::lt)
}
/// Reorder the slice with a comparator function such that the element at `index` is at its
@@ -2797,8 +3057,9 @@ impl<T> [T] {
///
/// # Current implementation
///
- /// The current algorithm is based on the quickselect portion of the same quicksort algorithm
- /// used for [`sort_unstable`].
+ /// The current algorithm is an introselect implementation based on Pattern Defeating Quicksort, which is also
+ /// the basis for [`sort_unstable`]. The fallback algorithm is Median of Medians using Tukey's Ninther for
+ /// pivot selection, which guarantees linear runtime for all inputs.
///
/// [`sort_unstable`]: slice::sort_unstable
///
@@ -2831,7 +3092,7 @@ impl<T> [T] {
where
F: FnMut(&T, &T) -> Ordering,
{
- sort::partition_at_index(self, index, |a: &T, b: &T| compare(a, b) == Less)
+ select::partition_at_index(self, index, |a: &T, b: &T| compare(a, b) == Less)
}
/// Reorder the slice with a key extraction function such that the element at `index` is at its
@@ -2887,7 +3148,7 @@ impl<T> [T] {
F: FnMut(&T) -> K,
K: Ord,
{
- sort::partition_at_index(self, index, |a: &T, b: &T| f(a).lt(&f(b)))
+ select::partition_at_index(self, index, |a: &T, b: &T| f(a).lt(&f(b)))
}
/// Moves all consecutive repeated elements to the end of the slice according to the
@@ -3479,44 +3740,13 @@ impl<T> [T] {
// Ts = size_of::<U> / gcd(size_of::<T>, size_of::<U>)
//
// Luckily since all this is constant-evaluated... performance here matters not!
- #[inline]
- fn gcd(a: usize, b: usize) -> usize {
- use crate::intrinsics;
- // iterative stein’s algorithm
- // We should still make this `const fn` (and revert to recursive algorithm if we do)
- // because relying on llvm to consteval all this is… well, it makes me uncomfortable.
-
- // SAFETY: `a` and `b` are checked to be non-zero values.
- let (ctz_a, mut ctz_b) = unsafe {
- if a == 0 {
- return b;
- }
- if b == 0 {
- return a;
- }
- (intrinsics::cttz_nonzero(a), intrinsics::cttz_nonzero(b))
- };
- let k = ctz_a.min(ctz_b);
- let mut a = a >> ctz_a;
- let mut b = b;
- loop {
- // remove all factors of 2 from b
- b >>= ctz_b;
- if a > b {
- mem::swap(&mut a, &mut b);
- }
- b = b - a;
- // SAFETY: `b` is checked to be non-zero.
- unsafe {
- if b == 0 {
- break;
- }
- ctz_b = intrinsics::cttz_nonzero(b);
- }
- }
- a << k
+ const fn gcd(a: usize, b: usize) -> usize {
+ if b == 0 { a } else { gcd(b, a % b) }
}
- let gcd: usize = gcd(mem::size_of::<T>(), mem::size_of::<U>());
+
+ // Explicitly wrap the function call in a const block so it gets
+ // constant-evaluated even in debug mode.
+ let gcd: usize = const { gcd(mem::size_of::<T>(), mem::size_of::<U>()) };
let ts: usize = mem::size_of::<U>() / gcd;
let us: usize = mem::size_of::<T>() / gcd;
@@ -4262,7 +4492,7 @@ impl<T, const N: usize> [[T; N]] {
/// assert!(empty_slice_of_arrays.flatten().is_empty());
/// ```
#[unstable(feature = "slice_flatten", issue = "95629")]
- pub fn flatten(&self) -> &[T] {
+ pub const fn flatten(&self) -> &[T] {
let len = if T::IS_ZST {
self.len().checked_mul(N).expect("slice len overflow")
} else {
@@ -4404,8 +4634,7 @@ where
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T> const Default for &[T] {
+impl<T> Default for &[T] {
/// Creates an empty slice.
fn default() -> Self {
&[]
@@ -4413,8 +4642,7 @@ impl<T> const Default for &[T] {
}
#[stable(feature = "mut_slice_default", since = "1.5.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T> const Default for &mut [T] {
+impl<T> Default for &mut [T] {
/// Creates a mutable empty slice.
fn default() -> Self {
&mut []
@@ -4458,7 +4686,7 @@ impl<T, const N: usize> SlicePattern for [T; N] {
/// This will do `binomial(N + 1, 2) = N * (N + 1) / 2 = 0, 1, 3, 6, 10, ..`
/// comparison operations.
fn get_many_check_valid<const N: usize>(indices: &[usize; N], len: usize) -> bool {
- // NB: The optimzer should inline the loops into a sequence
+ // NB: The optimizer should inline the loops into a sequence
// of instructions without additional branching.
let mut valid = true;
for (i, &idx) in indices.iter().enumerate() {
diff --git a/library/core/src/slice/select.rs b/library/core/src/slice/select.rs
new file mode 100644
index 000000000..ffc193578
--- /dev/null
+++ b/library/core/src/slice/select.rs
@@ -0,0 +1,302 @@
+//! Slice selection
+//!
+//! This module contains the implementation for `slice::select_nth_unstable`.
+//! It uses an introselect algorithm based on Orson Peters' pattern-defeating quicksort,
+//! published at: <https://github.com/orlp/pdqsort>
+//!
+//! The fallback algorithm used for introselect is Median of Medians using Tukey's Ninther
+//! for pivot selection. Using this as a fallback ensures O(n) worst case running time with
+//! better performance than one would get using heapsort as fallback.
+
+use crate::cmp;
+use crate::mem::{self, SizedTypeProperties};
+use crate::slice::sort::{
+ break_patterns, choose_pivot, insertion_sort_shift_left, partition, partition_equal,
+};
+
+// For slices of up to this length it's probably faster to simply sort them.
+// Defined at the module scope because it's used in multiple functions.
+const MAX_INSERTION: usize = 10;
+
+fn partition_at_index_loop<'a, T, F>(
+ mut v: &'a mut [T],
+ mut index: usize,
+ is_less: &mut F,
+ mut pred: Option<&'a T>,
+) where
+ F: FnMut(&T, &T) -> bool,
+{
+ // Limit the amount of iterations and fall back to fast deterministic selection
+ // to ensure O(n) worst case running time. This limit needs to be constant, because
+ // using `ilog2(len)` like in `sort` would result in O(n log n) time complexity.
+ // The exact value of the limit is chosen somewhat arbitrarily, but for most inputs bad pivot
+ // selections should be relatively rare, so the limit usually shouldn't be reached
+ // anyways.
+ let mut limit = 16;
+
+ // True if the last partitioning was reasonably balanced.
+ let mut was_balanced = true;
+
+ loop {
+ if v.len() <= MAX_INSERTION {
+ if v.len() > 1 {
+ insertion_sort_shift_left(v, 1, is_less);
+ }
+ return;
+ }
+
+ if limit == 0 {
+ median_of_medians(v, is_less, index);
+ return;
+ }
+
+ // If the last partitioning was imbalanced, try breaking patterns in the slice by shuffling
+ // some elements around. Hopefully we'll choose a better pivot this time.
+ if !was_balanced {
+ break_patterns(v);
+ limit -= 1;
+ }
+
+ // Choose a pivot
+ let (pivot, _) = choose_pivot(v, is_less);
+
+ // If the chosen pivot is equal to the predecessor, then it's the smallest element in the
+ // slice. Partition the slice into elements equal to and elements greater than the pivot.
+ // This case is usually hit when the slice contains many duplicate elements.
+ if let Some(p) = pred {
+ if !is_less(p, &v[pivot]) {
+ let mid = partition_equal(v, pivot, is_less);
+
+ // If we've passed our index, then we're good.
+ if mid > index {
+ return;
+ }
+
+ // Otherwise, continue sorting elements greater than the pivot.
+ v = &mut v[mid..];
+ index = index - mid;
+ pred = None;
+ continue;
+ }
+ }
+
+ let (mid, _) = partition(v, pivot, is_less);
+ was_balanced = cmp::min(mid, v.len() - mid) >= v.len() / 8;
+
+ // Split the slice into `left`, `pivot`, and `right`.
+ let (left, right) = v.split_at_mut(mid);
+ let (pivot, right) = right.split_at_mut(1);
+ let pivot = &pivot[0];
+
+ if mid < index {
+ v = right;
+ index = index - mid - 1;
+ pred = Some(pivot);
+ } else if mid > index {
+ v = left;
+ } else {
+ // If mid == index, then we're done, since partition() guaranteed that all elements
+ // after mid are greater than or equal to mid.
+ return;
+ }
+ }
+}
+
+/// Helper function that returns the index of the minimum element in the slice using the given
+/// comparator function
+fn min_index<T, F: FnMut(&T, &T) -> bool>(slice: &[T], is_less: &mut F) -> Option<usize> {
+ slice
+ .iter()
+ .enumerate()
+ .reduce(|acc, t| if is_less(t.1, acc.1) { t } else { acc })
+ .map(|(i, _)| i)
+}
+
+/// Helper function that returns the index of the maximum element in the slice using the given
+/// comparator function
+fn max_index<T, F: FnMut(&T, &T) -> bool>(slice: &[T], is_less: &mut F) -> Option<usize> {
+ slice
+ .iter()
+ .enumerate()
+ .reduce(|acc, t| if is_less(acc.1, t.1) { t } else { acc })
+ .map(|(i, _)| i)
+}
+
+/// Reorder the slice such that the element at `index` is at its final sorted position.
+pub fn partition_at_index<T, F>(
+ v: &mut [T],
+ index: usize,
+ mut is_less: F,
+) -> (&mut [T], &mut T, &mut [T])
+where
+ F: FnMut(&T, &T) -> bool,
+{
+ if index >= v.len() {
+ panic!("partition_at_index index {} greater than length of slice {}", index, v.len());
+ }
+
+ if T::IS_ZST {
+ // Sorting has no meaningful behavior on zero-sized types. Do nothing.
+ } else if index == v.len() - 1 {
+ // Find max element and place it in the last position of the array. We're free to use
+ // `unwrap()` here because we know v must not be empty.
+ let max_idx = max_index(v, &mut is_less).unwrap();
+ v.swap(max_idx, index);
+ } else if index == 0 {
+ // Find min element and place it in the first position of the array. We're free to use
+ // `unwrap()` here because we know v must not be empty.
+ let min_idx = min_index(v, &mut is_less).unwrap();
+ v.swap(min_idx, index);
+ } else {
+ partition_at_index_loop(v, index, &mut is_less, None);
+ }
+
+ let (left, right) = v.split_at_mut(index);
+ let (pivot, right) = right.split_at_mut(1);
+ let pivot = &mut pivot[0];
+ (left, pivot, right)
+}
+
+/// Selection algorithm to select the k-th element from the slice in guaranteed O(n) time.
+/// This is essentially a quickselect that uses Tukey's Ninther for pivot selection
+fn median_of_medians<T, F: FnMut(&T, &T) -> bool>(mut v: &mut [T], is_less: &mut F, mut k: usize) {
+ // Since this function isn't public, it should never be called with an out-of-bounds index.
+ debug_assert!(k < v.len());
+
+ // If T is as ZST, `partition_at_index` will already return early.
+ debug_assert!(!T::IS_ZST);
+
+ // We now know that `k < v.len() <= isize::MAX`
+ loop {
+ if v.len() <= MAX_INSERTION {
+ if v.len() > 1 {
+ insertion_sort_shift_left(v, 1, is_less);
+ }
+ return;
+ }
+
+ // `median_of_{minima,maxima}` can't handle the extreme cases of the first/last element,
+ // so we catch them here and just do a linear search.
+ if k == v.len() - 1 {
+ // Find max element and place it in the last position of the array. We're free to use
+ // `unwrap()` here because we know v must not be empty.
+ let max_idx = max_index(v, is_less).unwrap();
+ v.swap(max_idx, k);
+ return;
+ } else if k == 0 {
+ // Find min element and place it in the first position of the array. We're free to use
+ // `unwrap()` here because we know v must not be empty.
+ let min_idx = min_index(v, is_less).unwrap();
+ v.swap(min_idx, k);
+ return;
+ }
+
+ let p = median_of_ninthers(v, is_less);
+
+ if p == k {
+ return;
+ } else if p > k {
+ v = &mut v[..p];
+ } else {
+ // Since `p < k < v.len()`, `p + 1` doesn't overflow and is
+ // a valid index into the slice.
+ v = &mut v[p + 1..];
+ k -= p + 1;
+ }
+ }
+}
+
+// Optimized for when `k` lies somewhere in the middle of the slice. Selects a pivot
+// as close as possible to the median of the slice. For more details on how the algorithm
+// operates, refer to the paper <https://drops.dagstuhl.de/opus/volltexte/2017/7612/pdf/LIPIcs-SEA-2017-24.pdf>.
+fn median_of_ninthers<T, F: FnMut(&T, &T) -> bool>(v: &mut [T], is_less: &mut F) -> usize {
+ // use `saturating_mul` so the multiplication doesn't overflow on 16-bit platforms.
+ let frac = if v.len() <= 1024 {
+ v.len() / 12
+ } else if v.len() <= 128_usize.saturating_mul(1024) {
+ v.len() / 64
+ } else {
+ v.len() / 1024
+ };
+
+ let pivot = frac / 2;
+ let lo = v.len() / 2 - pivot;
+ let hi = frac + lo;
+ let gap = (v.len() - 9 * frac) / 4;
+ let mut a = lo - 4 * frac - gap;
+ let mut b = hi + gap;
+ for i in lo..hi {
+ ninther(v, is_less, a, i - frac, b, a + 1, i, b + 1, a + 2, i + frac, b + 2);
+ a += 3;
+ b += 3;
+ }
+
+ median_of_medians(&mut v[lo..lo + frac], is_less, pivot);
+ partition(v, lo + pivot, is_less).0
+}
+
+/// Moves around the 9 elements at the indices a..i, such that
+/// `v[d]` contains the median of the 9 elements and the other
+/// elements are partitioned around it.
+fn ninther<T, F: FnMut(&T, &T) -> bool>(
+ v: &mut [T],
+ is_less: &mut F,
+ a: usize,
+ mut b: usize,
+ c: usize,
+ mut d: usize,
+ e: usize,
+ mut f: usize,
+ g: usize,
+ mut h: usize,
+ i: usize,
+) {
+ b = median_idx(v, is_less, a, b, c);
+ h = median_idx(v, is_less, g, h, i);
+ if is_less(&v[h], &v[b]) {
+ mem::swap(&mut b, &mut h);
+ }
+ if is_less(&v[f], &v[d]) {
+ mem::swap(&mut d, &mut f);
+ }
+ if is_less(&v[e], &v[d]) {
+ // do nothing
+ } else if is_less(&v[f], &v[e]) {
+ d = f;
+ } else {
+ if is_less(&v[e], &v[b]) {
+ v.swap(e, b);
+ } else if is_less(&v[h], &v[e]) {
+ v.swap(e, h);
+ }
+ return;
+ }
+ if is_less(&v[d], &v[b]) {
+ d = b;
+ } else if is_less(&v[h], &v[d]) {
+ d = h;
+ }
+
+ v.swap(d, e);
+}
+
+/// returns the index pointing to the median of the 3
+/// elements `v[a]`, `v[b]` and `v[c]`
+fn median_idx<T, F: FnMut(&T, &T) -> bool>(
+ v: &[T],
+ is_less: &mut F,
+ mut a: usize,
+ b: usize,
+ mut c: usize,
+) -> usize {
+ if is_less(&v[c], &v[a]) {
+ mem::swap(&mut a, &mut c);
+ }
+ if is_less(&v[c], &v[b]) {
+ return c;
+ }
+ if is_less(&v[b], &v[a]) {
+ return a;
+ }
+ b
+}
diff --git a/library/core/src/slice/sort.rs b/library/core/src/slice/sort.rs
index 07fd96f92..db76d2625 100644
--- a/library/core/src/slice/sort.rs
+++ b/library/core/src/slice/sort.rs
@@ -145,7 +145,7 @@ where
/// Never inline this function to avoid code bloat. It still optimizes nicely and has practically no
/// performance impact. Even improving performance in some cases.
#[inline(never)]
-fn insertion_sort_shift_left<T, F>(v: &mut [T], offset: usize, is_less: &mut F)
+pub(super) fn insertion_sort_shift_left<T, F>(v: &mut [T], offset: usize, is_less: &mut F)
where
F: FnMut(&T, &T) -> bool,
{
@@ -557,7 +557,7 @@ where
///
/// 1. Number of elements smaller than `v[pivot]`.
/// 2. True if `v` was already partitioned.
-fn partition<T, F>(v: &mut [T], pivot: usize, is_less: &mut F) -> (usize, bool)
+pub(super) fn partition<T, F>(v: &mut [T], pivot: usize, is_less: &mut F) -> (usize, bool)
where
F: FnMut(&T, &T) -> bool,
{
@@ -612,7 +612,7 @@ where
///
/// Returns the number of elements equal to the pivot. It is assumed that `v` does not contain
/// elements smaller than the pivot.
-fn partition_equal<T, F>(v: &mut [T], pivot: usize, is_less: &mut F) -> usize
+pub(super) fn partition_equal<T, F>(v: &mut [T], pivot: usize, is_less: &mut F) -> usize
where
F: FnMut(&T, &T) -> bool,
{
@@ -670,7 +670,7 @@ where
/// Scatters some elements around in an attempt to break patterns that might cause imbalanced
/// partitions in quicksort.
#[cold]
-fn break_patterns<T>(v: &mut [T]) {
+pub(super) fn break_patterns<T>(v: &mut [T]) {
let len = v.len();
if len >= 8 {
let mut seed = len;
@@ -719,7 +719,7 @@ fn break_patterns<T>(v: &mut [T]) {
/// Chooses a pivot in `v` and returns the index and `true` if the slice is likely already sorted.
///
/// Elements in `v` might be reordered in the process.
-fn choose_pivot<T, F>(v: &mut [T], is_less: &mut F) -> (usize, bool)
+pub(super) fn choose_pivot<T, F>(v: &mut [T], is_less: &mut F) -> (usize, bool)
where
F: FnMut(&T, &T) -> bool,
{
@@ -897,138 +897,6 @@ where
recurse(v, &mut is_less, None, limit);
}
-fn partition_at_index_loop<'a, T, F>(
- mut v: &'a mut [T],
- mut index: usize,
- is_less: &mut F,
- mut pred: Option<&'a T>,
-) where
- F: FnMut(&T, &T) -> bool,
-{
- // Limit the amount of iterations and fall back to heapsort, similarly to `slice::sort_unstable`.
- // This lowers the worst case running time from O(n^2) to O(n log n).
- // FIXME: Investigate whether it would be better to use something like Median of Medians
- // or Fast Deterministic Selection to guarantee O(n) worst case.
- let mut limit = usize::BITS - v.len().leading_zeros();
-
- // True if the last partitioning was reasonably balanced.
- let mut was_balanced = true;
-
- loop {
- let len = v.len();
-
- // For slices of up to this length it's probably faster to simply sort them.
- const MAX_INSERTION: usize = 10;
- if len <= MAX_INSERTION {
- if len >= 2 {
- insertion_sort_shift_left(v, 1, is_less);
- }
- return;
- }
-
- if limit == 0 {
- heapsort(v, is_less);
- return;
- }
-
- // If the last partitioning was imbalanced, try breaking patterns in the slice by shuffling
- // some elements around. Hopefully we'll choose a better pivot this time.
- if !was_balanced {
- break_patterns(v);
- limit -= 1;
- }
-
- // Choose a pivot
- let (pivot, _) = choose_pivot(v, is_less);
-
- // If the chosen pivot is equal to the predecessor, then it's the smallest element in the
- // slice. Partition the slice into elements equal to and elements greater than the pivot.
- // This case is usually hit when the slice contains many duplicate elements.
- if let Some(p) = pred {
- if !is_less(p, &v[pivot]) {
- let mid = partition_equal(v, pivot, is_less);
-
- // If we've passed our index, then we're good.
- if mid > index {
- return;
- }
-
- // Otherwise, continue sorting elements greater than the pivot.
- v = &mut v[mid..];
- index = index - mid;
- pred = None;
- continue;
- }
- }
-
- let (mid, _) = partition(v, pivot, is_less);
- was_balanced = cmp::min(mid, len - mid) >= len / 8;
-
- // Split the slice into `left`, `pivot`, and `right`.
- let (left, right) = v.split_at_mut(mid);
- let (pivot, right) = right.split_at_mut(1);
- let pivot = &pivot[0];
-
- if mid < index {
- v = right;
- index = index - mid - 1;
- pred = Some(pivot);
- } else if mid > index {
- v = left;
- } else {
- // If mid == index, then we're done, since partition() guaranteed that all elements
- // after mid are greater than or equal to mid.
- return;
- }
- }
-}
-
-/// Reorder the slice such that the element at `index` is at its final sorted position.
-pub fn partition_at_index<T, F>(
- v: &mut [T],
- index: usize,
- mut is_less: F,
-) -> (&mut [T], &mut T, &mut [T])
-where
- F: FnMut(&T, &T) -> bool,
-{
- use cmp::Ordering::Greater;
- use cmp::Ordering::Less;
-
- if index >= v.len() {
- panic!("partition_at_index index {} greater than length of slice {}", index, v.len());
- }
-
- if T::IS_ZST {
- // Sorting has no meaningful behavior on zero-sized types. Do nothing.
- } else if index == v.len() - 1 {
- // Find max element and place it in the last position of the array. We're free to use
- // `unwrap()` here because we know v must not be empty.
- let (max_index, _) = v
- .iter()
- .enumerate()
- .max_by(|&(_, x), &(_, y)| if is_less(x, y) { Less } else { Greater })
- .unwrap();
- v.swap(max_index, index);
- } else if index == 0 {
- // Find min element and place it in the first position of the array. We're free to use
- // `unwrap()` here because we know v must not be empty.
- let (min_index, _) = v
- .iter()
- .enumerate()
- .min_by(|&(_, x), &(_, y)| if is_less(x, y) { Less } else { Greater })
- .unwrap();
- v.swap(min_index, index);
- } else {
- partition_at_index_loop(v, index, &mut is_less, None);
- }
-
- let (left, right) = v.split_at_mut(index);
- let (pivot, right) = right.split_at_mut(1);
- let pivot = &mut pivot[0];
- (left, pivot, right)
-}
-
/// Merges non-decreasing runs `v[..mid]` and `v[mid..]` using `buf` as temporary storage, and
/// stores the result into `v[..]`.
///
@@ -1085,12 +953,12 @@ where
// SAFETY: left and right must be valid and part of v same for out.
unsafe {
- let to_copy = if is_less(&*right, &**left) {
- get_and_increment(&mut right)
- } else {
- get_and_increment(left)
- };
- ptr::copy_nonoverlapping(to_copy, get_and_increment(out), 1);
+ let is_l = is_less(&*right, &**left);
+ let to_copy = if is_l { right } else { *left };
+ ptr::copy_nonoverlapping(to_copy, *out, 1);
+ *out = out.add(1);
+ right = right.add(is_l as usize);
+ *left = left.add(!is_l as usize);
}
}
} else {
@@ -1113,32 +981,18 @@ where
// SAFETY: left and right must be valid and part of v same for out.
unsafe {
- let to_copy = if is_less(&*right.sub(1), &*left.sub(1)) {
- decrement_and_get(left)
- } else {
- decrement_and_get(right)
- };
- ptr::copy_nonoverlapping(to_copy, decrement_and_get(&mut out), 1);
+ let is_l = is_less(&*right.sub(1), &*left.sub(1));
+ *left = left.sub(is_l as usize);
+ *right = right.sub(!is_l as usize);
+ let to_copy = if is_l { *left } else { *right };
+ out = out.sub(1);
+ ptr::copy_nonoverlapping(to_copy, out, 1);
}
}
}
// Finally, `hole` gets dropped. If the shorter run was not fully consumed, whatever remains of
// it will now be copied into the hole in `v`.
- unsafe fn get_and_increment<T>(ptr: &mut *mut T) -> *mut T {
- let old = *ptr;
-
- // SAFETY: ptr.add(1) must still be a valid pointer and part of `v`.
- *ptr = unsafe { ptr.add(1) };
- old
- }
-
- unsafe fn decrement_and_get<T>(ptr: &mut *mut T) -> *mut T {
- // SAFETY: ptr.sub(1) must still be a valid pointer and part of `v`.
- *ptr = unsafe { ptr.sub(1) };
- *ptr
- }
-
// When dropped, copies the range `start..end` into `dest..`.
struct MergeHole<T> {
start: *mut T,
@@ -1456,7 +1310,6 @@ pub struct TimSortRun {
/// Takes a range as denoted by start and end, that is already sorted and extends it to the right if
/// necessary with sorts optimized for smaller ranges such as insertion sort.
-#[cfg(not(no_global_oom_handling))]
fn provide_sorted_batch<T, F>(v: &mut [T], start: usize, mut end: usize, is_less: &mut F) -> usize
where
F: FnMut(&T, &T) -> bool,
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs
index 041694299..ef05b25fd 100644
--- a/library/core/src/str/mod.rs
+++ b/library/core/src/str/mod.rs
@@ -16,6 +16,7 @@ mod validations;
use self::pattern::Pattern;
use self::pattern::{DoubleEndedSearcher, ReverseSearcher, Searcher};
+use crate::ascii;
use crate::char::{self, EscapeDebugExtArgs};
use crate::mem;
use crate::slice::{self, SliceIndex};
@@ -206,9 +207,8 @@ impl str {
/// ```
#[must_use]
#[stable(feature = "is_char_boundary", since = "1.9.0")]
- #[rustc_const_unstable(feature = "const_is_char_boundary", issue = "none")]
#[inline]
- pub const fn is_char_boundary(&self, index: usize) -> bool {
+ pub fn is_char_boundary(&self, index: usize) -> bool {
// 0 is always ok.
// Test for 0 explicitly so that it can optimize out the check
// easily and skip reading string data for that case.
@@ -436,9 +436,8 @@ impl str {
/// assert!(v.get(..42).is_none());
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
- pub const fn get<I: ~const SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
+ pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
i.get(self)
}
@@ -469,9 +468,8 @@ impl str {
/// assert_eq!("HEllo", v);
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
- pub const fn get_mut<I: ~const SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
+ pub fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
i.get_mut(self)
}
@@ -502,9 +500,8 @@ impl str {
/// }
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
- pub const unsafe fn get_unchecked<I: ~const SliceIndex<str>>(&self, i: I) -> &I::Output {
+ pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
// SAFETY: the caller must uphold the safety contract for `get_unchecked`;
// the slice is dereferenceable because `self` is a safe reference.
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
@@ -538,12 +535,8 @@ impl str {
/// }
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
- #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
#[inline]
- pub const unsafe fn get_unchecked_mut<I: ~const SliceIndex<str>>(
- &mut self,
- i: I,
- ) -> &mut I::Output {
+ pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
// SAFETY: the caller must uphold the safety contract for `get_unchecked_mut`;
// the slice is dereferenceable because `self` is a safe reference.
// The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is.
@@ -2365,15 +2358,26 @@ impl str {
/// assert!(!non_ascii.is_ascii());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
+ #[rustc_const_unstable(feature = "const_slice_is_ascii", issue = "111090")]
#[must_use]
#[inline]
- pub fn is_ascii(&self) -> bool {
+ pub const fn is_ascii(&self) -> bool {
// We can treat each byte as character here: all multibyte characters
// start with a byte that is not in the ASCII range, so we will stop
// there already.
self.as_bytes().is_ascii()
}
+ /// If this string slice [`is_ascii`](Self::is_ascii), returns it as a slice
+ /// of [ASCII characters](`ascii::Char`), otherwise returns `None`.
+ #[unstable(feature = "ascii_char", issue = "110998")]
+ #[must_use]
+ #[inline]
+ pub const fn as_ascii(&self) -> Option<&[ascii::Char]> {
+ // Like in `is_ascii`, we can work on the bytes directly.
+ self.as_bytes().as_ascii()
+ }
+
/// Checks that two strings are an ASCII case-insensitive match.
///
/// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`,
@@ -2582,8 +2586,7 @@ impl AsRef<[u8]> for str {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl const Default for &str {
+impl Default for &str {
/// Creates an empty str
#[inline]
fn default() -> Self {
diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs
index e3a464a1c..91ee2903a 100644
--- a/library/core/src/str/pattern.rs
+++ b/library/core/src/str/pattern.rs
@@ -791,8 +791,8 @@ pub struct CharArrayRefSearcher<'a, 'b, const N: usize>(
/// # Examples
///
/// ```
-/// assert_eq!("Hello world".find(['l', 'l']), Some(2));
-/// assert_eq!("Hello world".find(['l', 'l']), Some(2));
+/// assert_eq!("Hello world".find(['o', 'l']), Some(2));
+/// assert_eq!("Hello world".find(['h', 'w']), Some(6));
/// ```
impl<'a, const N: usize> Pattern<'a> for [char; N] {
pattern_methods!(CharArraySearcher<'a, N>, MultiCharEqPattern, CharArraySearcher);
@@ -811,8 +811,8 @@ unsafe impl<'a, const N: usize> ReverseSearcher<'a> for CharArraySearcher<'a, N>
/// # Examples
///
/// ```
-/// assert_eq!("Hello world".find(&['l', 'l']), Some(2));
-/// assert_eq!("Hello world".find(&['l', 'l']), Some(2));
+/// assert_eq!("Hello world".find(&['o', 'l']), Some(2));
+/// assert_eq!("Hello world".find(&['h', 'w']), Some(6));
/// ```
impl<'a, 'b, const N: usize> Pattern<'a> for &'b [char; N] {
pattern_methods!(CharArrayRefSearcher<'a, 'b, N>, MultiCharEqPattern, CharArrayRefSearcher);
diff --git a/library/core/src/str/traits.rs b/library/core/src/str/traits.rs
index 41c097b55..1d52335f2 100644
--- a/library/core/src/str/traits.rs
+++ b/library/core/src/str/traits.rs
@@ -50,10 +50,9 @@ impl PartialOrd for str {
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-impl<I> const ops::Index<I> for str
+impl<I> ops::Index<I> for str
where
- I: ~const SliceIndex<str>,
+ I: SliceIndex<str>,
{
type Output = I::Output;
@@ -64,10 +63,9 @@ where
}
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-impl<I> const ops::IndexMut<I> for str
+impl<I> ops::IndexMut<I> for str
where
- I: ~const SliceIndex<str>,
+ I: SliceIndex<str>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut I::Output {
@@ -96,7 +94,7 @@ const fn str_index_overflow_fail() -> ! {
/// Equivalent to `&self[0 .. len]` or `&mut self[0 .. len]`.
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl const SliceIndex<str> for ops::RangeFull {
+unsafe impl SliceIndex<str> for ops::RangeFull {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@@ -161,7 +159,7 @@ unsafe impl const SliceIndex<str> for ops::RangeFull {
/// ```
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl const SliceIndex<str> for ops::Range<usize> {
+unsafe impl SliceIndex<str> for ops::Range<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@@ -271,7 +269,7 @@ unsafe impl const SliceIndex<str> for ops::Range<usize> {
/// character (as defined by `is_char_boundary`), or if `end > len`.
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl const SliceIndex<str> for ops::RangeTo<usize> {
+unsafe impl SliceIndex<str> for ops::RangeTo<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@@ -340,7 +338,7 @@ unsafe impl const SliceIndex<str> for ops::RangeTo<usize> {
/// a character (as defined by `is_char_boundary`), or if `begin > len`.
#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl const SliceIndex<str> for ops::RangeFrom<usize> {
+unsafe impl SliceIndex<str> for ops::RangeFrom<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@@ -412,7 +410,7 @@ unsafe impl const SliceIndex<str> for ops::RangeFrom<usize> {
/// byte offset or equal to `len`), if `begin > end`, or if `end >= len`.
#[stable(feature = "inclusive_range", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl const SliceIndex<str> for ops::RangeInclusive<usize> {
+unsafe impl SliceIndex<str> for ops::RangeInclusive<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
@@ -464,7 +462,7 @@ unsafe impl const SliceIndex<str> for ops::RangeInclusive<usize> {
/// `is_char_boundary`, or equal to `len`), or if `end >= len`.
#[stable(feature = "inclusive_range", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
-unsafe impl const SliceIndex<str> for ops::RangeToInclusive<usize> {
+unsafe impl SliceIndex<str> for ops::RangeToInclusive<usize> {
type Output = str;
#[inline]
fn get(self, slice: &str) -> Option<&Self::Output> {
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
index f1ed68d72..236b7f423 100644
--- a/library/core/src/sync/atomic.rs
+++ b/library/core/src/sync/atomic.rs
@@ -147,8 +147,7 @@ pub struct AtomicBool {
#[cfg(target_has_atomic_load_store = "8")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl const Default for AtomicBool {
+impl Default for AtomicBool {
/// Creates an `AtomicBool` initialized to `false`.
#[inline]
fn default() -> Self {
@@ -179,8 +178,7 @@ pub struct AtomicPtr<T> {
#[cfg(target_has_atomic_load_store = "ptr")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T> const Default for AtomicPtr<T> {
+impl<T> Default for AtomicPtr<T> {
/// Creates a null `AtomicPtr<T>`.
fn default() -> AtomicPtr<T> {
AtomicPtr::new(crate::ptr::null_mut())
@@ -1916,8 +1914,7 @@ impl<T> AtomicPtr<T> {
#[cfg(target_has_atomic_load_store = "8")]
#[stable(feature = "atomic_bool_from", since = "1.24.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl const From<bool> for AtomicBool {
+impl From<bool> for AtomicBool {
/// Converts a `bool` into an `AtomicBool`.
///
/// # Examples
@@ -1935,8 +1932,7 @@ impl const From<bool> for AtomicBool {
#[cfg(target_has_atomic_load_store = "ptr")]
#[stable(feature = "atomic_from", since = "1.23.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<*mut T> for AtomicPtr<T> {
+impl<T> From<*mut T> for AtomicPtr<T> {
/// Converts a `*mut T` into an `AtomicPtr<T>`.
#[inline]
fn from(p: *mut T) -> Self {
@@ -2002,8 +1998,7 @@ macro_rules! atomic_int {
pub const $atomic_init: $atomic_type = $atomic_type::new(0);
#[$stable]
- #[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
- impl const Default for $atomic_type {
+ impl Default for $atomic_type {
#[inline]
fn default() -> Self {
Self::new(Default::default())
@@ -2011,8 +2006,7 @@ macro_rules! atomic_int {
}
#[$stable_from]
- #[rustc_const_unstable(feature = "const_num_from_num", issue = "87852")]
- impl const From<$int_type> for $atomic_type {
+ impl From<$int_type> for $atomic_type {
#[doc = concat!("Converts an `", stringify!($int_type), "` into an `", stringify!($atomic_type), "`.")]
#[inline]
fn from(v: $int_type) -> Self { Self::new(v) }
diff --git a/library/core/src/task/mod.rs b/library/core/src/task/mod.rs
index c5f89b9a2..3f0080e38 100644
--- a/library/core/src/task/mod.rs
+++ b/library/core/src/task/mod.rs
@@ -13,5 +13,3 @@ pub use self::wake::{Context, RawWaker, RawWakerVTable, Waker};
mod ready;
#[stable(feature = "ready_macro", since = "1.64.0")]
pub use ready::ready;
-#[unstable(feature = "poll_ready", issue = "89780")]
-pub use ready::Ready;
diff --git a/library/core/src/task/poll.rs b/library/core/src/task/poll.rs
index af5bf441b..0a0f702f6 100644
--- a/library/core/src/task/poll.rs
+++ b/library/core/src/task/poll.rs
@@ -3,7 +3,6 @@
use crate::convert;
use crate::ops::{self, ControlFlow};
use crate::result::Result;
-use crate::task::Ready;
/// Indicates whether a value is available or if the current task has been
/// scheduled to receive a wakeup instead.
@@ -95,38 +94,6 @@ impl<T> Poll<T> {
pub const fn is_pending(&self) -> bool {
!self.is_ready()
}
-
- /// Extracts the successful type of a [`Poll<T>`].
- ///
- /// When combined with the `?` operator, this function will
- /// propagate any [`Poll::Pending`] values to the caller, and
- /// extract the `T` from [`Poll::Ready`].
- ///
- /// # Examples
- ///
- /// ```rust
- /// #![feature(poll_ready)]
- ///
- /// use std::task::{Context, Poll};
- /// use std::future::{self, Future};
- /// use std::pin::Pin;
- ///
- /// pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
- /// let mut fut = future::ready(42);
- /// let fut = Pin::new(&mut fut);
- ///
- /// let num = fut.poll(cx).ready()?;
- /// # drop(num);
- /// // ... use num
- ///
- /// Poll::Ready(())
- /// }
- /// ```
- #[inline]
- #[unstable(feature = "poll_ready", issue = "89780")]
- pub fn ready(self) -> Ready<T> {
- Ready(self)
- }
}
impl<T, E> Poll<Result<T, E>> {
@@ -247,8 +214,7 @@ impl<T, E> Poll<Option<Result<T, E>>> {
}
#[stable(feature = "futures_api", since = "1.36.0")]
-#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
-impl<T> const From<T> for Poll<T> {
+impl<T> From<T> for Poll<T> {
/// Moves the value into a [`Poll::Ready`] to make a `Poll<T>`.
///
/// # Example
diff --git a/library/core/src/task/ready.rs b/library/core/src/task/ready.rs
index b1daf545f..495d72fd1 100644
--- a/library/core/src/task/ready.rs
+++ b/library/core/src/task/ready.rs
@@ -1,8 +1,3 @@
-use core::convert;
-use core::fmt;
-use core::ops::{ControlFlow, FromResidual, Try};
-use core::task::Poll;
-
/// Extracts the successful type of a [`Poll<T>`].
///
/// This macro bakes in propagation of [`Pending`] signals by returning early.
@@ -22,7 +17,7 @@ use core::task::Poll;
/// let fut = Pin::new(&mut fut);
///
/// let num = ready!(fut.poll(cx));
-/// # drop(num);
+/// # let _ = num;
/// // ... use num
///
/// Poll::Ready(())
@@ -44,7 +39,7 @@ use core::task::Poll;
/// Poll::Ready(t) => t,
/// Poll::Pending => return Poll::Pending,
/// };
-/// # drop(num);
+/// # let _ = num; // to silence unused warning
/// # // ... use num
/// #
/// # Poll::Ready(())
@@ -60,55 +55,3 @@ pub macro ready($e:expr) {
}
}
}
-
-/// Extracts the successful type of a [`Poll<T>`].
-///
-/// See [`Poll::ready`] for details.
-#[unstable(feature = "poll_ready", issue = "89780")]
-pub struct Ready<T>(pub(crate) Poll<T>);
-
-#[unstable(feature = "poll_ready", issue = "89780")]
-impl<T> Try for Ready<T> {
- type Output = T;
- type Residual = Ready<convert::Infallible>;
-
- #[inline]
- fn from_output(output: Self::Output) -> Self {
- Ready(Poll::Ready(output))
- }
-
- #[inline]
- fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {
- match self.0 {
- Poll::Ready(v) => ControlFlow::Continue(v),
- Poll::Pending => ControlFlow::Break(Ready(Poll::Pending)),
- }
- }
-}
-
-#[unstable(feature = "poll_ready", issue = "89780")]
-impl<T> FromResidual for Ready<T> {
- #[inline]
- fn from_residual(residual: Ready<convert::Infallible>) -> Self {
- match residual.0 {
- Poll::Pending => Ready(Poll::Pending),
- }
- }
-}
-
-#[unstable(feature = "poll_ready", issue = "89780")]
-impl<T> FromResidual<Ready<convert::Infallible>> for Poll<T> {
- #[inline]
- fn from_residual(residual: Ready<convert::Infallible>) -> Self {
- match residual.0 {
- Poll::Pending => Poll::Pending,
- }
- }
-}
-
-#[unstable(feature = "poll_ready", issue = "89780")]
-impl<T> fmt::Debug for Ready<T> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_tuple("Ready").finish()
- }
-}
diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs
index 808825326..7043ab5ff 100644
--- a/library/core/src/task/wake.rs
+++ b/library/core/src/task/wake.rs
@@ -232,7 +232,7 @@ impl fmt::Debug for Context<'_> {
///
/// [`Future::poll()`]: core::future::Future::poll
/// [`Poll::Pending`]: core::task::Poll::Pending
-#[repr(transparent)]
+#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/66401
#[stable(feature = "futures_api", since = "1.36.0")]
pub struct Waker {
waker: RawWaker,
diff --git a/library/core/src/time.rs b/library/core/src/time.rs
index ba1cb6efa..b08d5782a 100644
--- a/library/core/src/time.rs
+++ b/library/core/src/time.rs
@@ -735,8 +735,7 @@ impl Duration {
#[stable(feature = "duration_float", since = "1.38.0")]
#[must_use]
#[inline]
- #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
- pub const fn from_secs_f64(secs: f64) -> Duration {
+ pub fn from_secs_f64(secs: f64) -> Duration {
match Duration::try_from_secs_f64(secs) {
Ok(v) => v,
Err(e) => panic!("{}", e.description()),
@@ -773,8 +772,7 @@ impl Duration {
#[stable(feature = "duration_float", since = "1.38.0")]
#[must_use]
#[inline]
- #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
- pub const fn from_secs_f32(secs: f32) -> Duration {
+ pub fn from_secs_f32(secs: f32) -> Duration {
match Duration::try_from_secs_f32(secs) {
Ok(v) => v,
Err(e) => panic!("{}", e.description()),
@@ -798,8 +796,7 @@ impl Duration {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
- pub const fn mul_f64(self, rhs: f64) -> Duration {
+ pub fn mul_f64(self, rhs: f64) -> Duration {
Duration::from_secs_f64(rhs * self.as_secs_f64())
}
@@ -820,8 +817,7 @@ impl Duration {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
- pub const fn mul_f32(self, rhs: f32) -> Duration {
+ pub fn mul_f32(self, rhs: f32) -> Duration {
Duration::from_secs_f32(rhs * self.as_secs_f32())
}
@@ -842,8 +838,7 @@ impl Duration {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
- pub const fn div_f64(self, rhs: f64) -> Duration {
+ pub fn div_f64(self, rhs: f64) -> Duration {
Duration::from_secs_f64(self.as_secs_f64() / rhs)
}
@@ -866,8 +861,7 @@ impl Duration {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
- pub const fn div_f32(self, rhs: f32) -> Duration {
+ pub fn div_f32(self, rhs: f32) -> Duration {
Duration::from_secs_f32(self.as_secs_f32() / rhs)
}
@@ -1178,7 +1172,7 @@ impl fmt::Debug for Duration {
emit_without_padding(f)
} else {
// We need to add padding. Use the `Formatter::padding` helper function.
- let default_align = crate::fmt::rt::v1::Alignment::Left;
+ let default_align = fmt::Alignment::Left;
let post_padding = f.padding(requested_w - actual_w, default_align)?;
emit_without_padding(f)?;
post_padding.write(f)
@@ -1402,9 +1396,8 @@ impl Duration {
/// assert_eq!(res, Ok(Duration::new(1, 2_929_688)));
/// ```
#[stable(feature = "duration_checked_float", since = "1.66.0")]
- #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
#[inline]
- pub const fn try_from_secs_f32(secs: f32) -> Result<Duration, TryFromFloatSecsError> {
+ pub fn try_from_secs_f32(secs: f32) -> Result<Duration, TryFromFloatSecsError> {
try_from_secs!(
secs = secs,
mantissa_bits = 23,
@@ -1479,9 +1472,8 @@ impl Duration {
/// assert_eq!(res, Ok(Duration::new(1, 2_929_688)));
/// ```
#[stable(feature = "duration_checked_float", since = "1.66.0")]
- #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
#[inline]
- pub const fn try_from_secs_f64(secs: f64) -> Result<Duration, TryFromFloatSecsError> {
+ pub fn try_from_secs_f64(secs: f64) -> Result<Duration, TryFromFloatSecsError> {
try_from_secs!(
secs = secs,
mantissa_bits = 52,
diff --git a/library/core/src/tuple.rs b/library/core/src/tuple.rs
index 0620e7173..a1388dfee 100644
--- a/library/core/src/tuple.rs
+++ b/library/core/src/tuple.rs
@@ -1,7 +1,6 @@
// See src/libstd/primitive_docs.rs for documentation.
use crate::cmp::Ordering::{self, *};
-use crate::mem::transmute;
// Recursive macro for implementing n-ary tuple functions and operations
//
@@ -22,8 +21,7 @@ macro_rules! tuple_impls {
maybe_tuple_doc! {
$($T)+ @
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl<$($T: ~const PartialEq),+> const PartialEq for ($($T,)+)
+ impl<$($T: PartialEq),+> PartialEq for ($($T,)+)
where
last_type!($($T,)+): ?Sized
{
@@ -50,8 +48,7 @@ macro_rules! tuple_impls {
maybe_tuple_doc! {
$($T)+ @
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl<$($T: ~const PartialOrd + ~const PartialEq),+> const PartialOrd for ($($T,)+)
+ impl<$($T: PartialOrd),+> PartialOrd for ($($T,)+)
where
last_type!($($T,)+): ?Sized
{
@@ -81,8 +78,7 @@ macro_rules! tuple_impls {
maybe_tuple_doc! {
$($T)+ @
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
- impl<$($T: ~const Ord),+> const Ord for ($($T,)+)
+ impl<$($T: Ord),+> Ord for ($($T,)+)
where
last_type!($($T,)+): ?Sized
{
@@ -96,14 +92,33 @@ macro_rules! tuple_impls {
maybe_tuple_doc! {
$($T)+ @
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
- impl<$($T: ~const Default),+> const Default for ($($T,)+) {
+ impl<$($T: Default),+> Default for ($($T,)+) {
#[inline]
fn default() -> ($($T,)+) {
($({ let x: $T = Default::default(); x},)+)
}
}
}
+
+ #[stable(feature = "array_tuple_conv", since = "1.71.0")]
+ impl<T> From<[T; ${count(T)}]> for ($(${ignore(T)} T,)+) {
+ #[inline]
+ #[allow(non_snake_case)]
+ fn from(array: [T; ${count(T)}]) -> Self {
+ let [$($T,)+] = array;
+ ($($T,)+)
+ }
+ }
+
+ #[stable(feature = "array_tuple_conv", since = "1.71.0")]
+ impl<T> From<($(${ignore(T)} T,)+)> for [T; ${count(T)}] {
+ #[inline]
+ #[allow(non_snake_case)]
+ fn from(tuple: ($(${ignore(T)} T,)+)) -> Self {
+ let ($($T,)+) = tuple;
+ [$($T,)+]
+ }
+ }
}
}
@@ -126,16 +141,13 @@ macro_rules! maybe_tuple_doc {
#[inline]
const fn ordering_is_some(c: Option<Ordering>, x: Ordering) -> bool {
// FIXME: Just use `==` once that's const-stable on `Option`s.
- // This isn't using `match` because that optimizes worse due to
- // making a two-step check (`Some` *then* the inner value).
-
- // SAFETY: There's no public guarantee for `Option<Ordering>`,
- // but we're core so we know that it's definitely a byte.
- unsafe {
- let c: i8 = transmute(c);
- let x: i8 = transmute(Some(x));
- c == x
- }
+ // This is mapping `None` to 2 and then doing the comparison afterwards
+ // because it optimizes better (`None::<Ordering>` is represented as 2).
+ x as i8
+ == match c {
+ Some(c) => c as i8,
+ None => 2,
+ }
}
// Constructs an expression that performs a lexical ordering using method `$rel`.
diff --git a/library/core/tests/asserting.rs b/library/core/tests/asserting.rs
index 4b626ba6f..1d9670886 100644
--- a/library/core/tests/asserting.rs
+++ b/library/core/tests/asserting.rs
@@ -24,7 +24,7 @@ struct NoCopyNoDebug;
struct NoDebug;
test!(
- capture_with_non_copyable_and_non_debugabble_elem_has_correct_params,
+ capture_with_non_copyable_and_non_debuggable_elem_has_correct_params,
NoCopyNoDebug,
None,
"N/A"
@@ -32,6 +32,6 @@ test!(
test!(capture_with_non_copyable_elem_has_correct_params, NoCopy, None, "N/A");
-test!(capture_with_non_debugabble_elem_has_correct_params, NoDebug, None, "N/A");
+test!(capture_with_non_debuggable_elem_has_correct_params, NoDebug, None, "N/A");
-test!(capture_with_copyable_and_debugabble_elem_has_correct_params, 1i32, Some(1i32), "1");
+test!(capture_with_copyable_and_debuggable_elem_has_correct_params, 1i32, Some(1i32), "1");
diff --git a/library/core/tests/atomic.rs b/library/core/tests/atomic.rs
index 94b031060..a67a842d3 100644
--- a/library/core/tests/atomic.rs
+++ b/library/core/tests/atomic.rs
@@ -306,9 +306,11 @@ fn atomic_compare_exchange() {
ATOMIC.compare_exchange_weak(0, 1, SeqCst, SeqCst).ok();
}
+/* FIXME(#110395)
#[test]
fn atomic_const_from() {
const _ATOMIC_U8: AtomicU8 = AtomicU8::from(1);
const _ATOMIC_BOOL: AtomicBool = AtomicBool::from(true);
const _ATOMIC_PTR: AtomicPtr<u32> = AtomicPtr::from(core::ptr::null_mut());
}
+*/
diff --git a/library/core/tests/bool.rs b/library/core/tests/bool.rs
index 4819ce911..47f645991 100644
--- a/library/core/tests/bool.rs
+++ b/library/core/tests/bool.rs
@@ -89,6 +89,7 @@ fn test_bool_to_option() {
assert_eq!(false.then(|| 0), None);
assert_eq!(true.then(|| 0), Some(0));
+ /* FIXME(#110395)
const fn zero() -> i32 {
0
}
@@ -102,4 +103,5 @@ fn test_bool_to_option() {
assert_eq!(B, Some(0));
assert_eq!(C, None);
assert_eq!(D, Some(0));
+ */
}
diff --git a/library/core/tests/cell.rs b/library/core/tests/cell.rs
index 7b77b2134..e084f8679 100644
--- a/library/core/tests/cell.rs
+++ b/library/core/tests/cell.rs
@@ -468,6 +468,7 @@ fn const_cells() {
const CELL: Cell<i32> = Cell::new(3);
const _: i32 = CELL.into_inner();
+/* FIXME(#110395)
const UNSAFE_CELL_FROM: UnsafeCell<i32> = UnsafeCell::from(3);
const _: i32 = UNSAFE_CELL.into_inner();
@@ -476,4 +477,5 @@ fn const_cells() {
const CELL_FROM: Cell<i32> = Cell::from(3);
const _: i32 = CELL.into_inner();
+*/
}
diff --git a/library/core/tests/char.rs b/library/core/tests/char.rs
index ac0b2ca16..85ba51c92 100644
--- a/library/core/tests/char.rs
+++ b/library/core/tests/char.rs
@@ -21,6 +21,7 @@ fn test_convert() {
assert!(char::try_from(0xFFFF_FFFF_u32).is_err());
}
+/* FIXME(#110395)
#[test]
const fn test_convert_const() {
assert!(u32::from('a') == 0x61);
@@ -30,6 +31,7 @@ const fn test_convert_const() {
assert!(char::from(b'a') == 'a');
assert!(char::from(b'\xFF') == '\u{FF}');
}
+*/
#[test]
fn test_from_str() {
diff --git a/library/core/tests/clone.rs b/library/core/tests/clone.rs
index 33ca9f2c6..aafe5ced2 100644
--- a/library/core/tests/clone.rs
+++ b/library/core/tests/clone.rs
@@ -1,4 +1,5 @@
#[test]
+#[cfg_attr(not(bootstrap), allow(suspicious_double_ref_op))]
fn test_borrowed_clone() {
let x = 5;
let y: &i32 = &x;
diff --git a/library/core/tests/cmp.rs b/library/core/tests/cmp.rs
index 8d0e59d5a..72fdd490d 100644
--- a/library/core/tests/cmp.rs
+++ b/library/core/tests/cmp.rs
@@ -217,18 +217,19 @@ fn cmp_default() {
assert_eq!(Fool(false), Fool(true));
}
+/* FIXME(#110395)
mod const_cmp {
use super::*;
struct S(i32);
- impl const PartialEq for S {
+ impl PartialEq for S {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
- impl const PartialOrd for S {
+ impl PartialOrd for S {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
let ret = match (self.0, other.0) {
(a, b) if a > b => Ordering::Greater,
@@ -248,3 +249,4 @@ mod const_cmp {
const _: () = assert!(S(0) < S(1));
const _: () = assert!(S(1) > S(0));
}
+*/
diff --git a/library/core/tests/convert.rs b/library/core/tests/convert.rs
index f1048f4cf..f76dd2778 100644
--- a/library/core/tests/convert.rs
+++ b/library/core/tests/convert.rs
@@ -1,3 +1,4 @@
+/* FIXME(#110395)
#[test]
fn convert() {
const fn from(x: i32) -> i32 {
@@ -14,3 +15,4 @@ fn convert() {
const BAR: Vec<String> = into(Vec::new());
assert_eq!(BAR, Vec::<String>::new());
}
+*/
diff --git a/library/core/tests/hash/mod.rs b/library/core/tests/hash/mod.rs
index 267245f05..033bd1ed6 100644
--- a/library/core/tests/hash/mod.rs
+++ b/library/core/tests/hash/mod.rs
@@ -9,13 +9,13 @@ struct MyHasher {
hash: u64,
}
-impl const Default for MyHasher {
+impl Default for MyHasher {
fn default() -> MyHasher {
MyHasher { hash: 0 }
}
}
-impl const Hasher for MyHasher {
+impl Hasher for MyHasher {
fn write(&mut self, buf: &[u8]) {
// FIXME(const_trait_impl): change to for loop
let mut i = 0;
@@ -35,13 +35,14 @@ impl const Hasher for MyHasher {
#[test]
fn test_writer_hasher() {
- const fn hash<T: ~const Hash>(t: &T) -> u64 {
+ // FIXME(#110395)
+ /* const */ fn hash<T: Hash>(t: &T) -> u64 {
let mut s = MyHasher { hash: 0 };
t.hash(&mut s);
s.finish()
}
- const {
+ /* const {
// FIXME(fee1-dead): assert_eq
assert!(hash(&()) == 0);
assert!(hash(&5_u8) == 5);
@@ -52,7 +53,7 @@ fn test_writer_hasher() {
let s: &str = "a";
assert!(hash(&s) == 97 + 0xFF);
- };
+ }; */
assert_eq!(hash(&()), 0);
@@ -113,7 +114,7 @@ struct CustomHasher {
output: u64,
}
-impl const Hasher for CustomHasher {
+impl Hasher for CustomHasher {
fn finish(&self) -> u64 {
self.output
}
@@ -125,21 +126,22 @@ impl const Hasher for CustomHasher {
}
}
-impl const Default for CustomHasher {
+impl Default for CustomHasher {
fn default() -> CustomHasher {
CustomHasher { output: 0 }
}
}
-impl const Hash for Custom {
- fn hash<H: ~const Hasher>(&self, state: &mut H) {
+impl Hash for Custom {
+ fn hash<H: Hasher>(&self, state: &mut H) {
state.write_u64(self.hash);
}
}
#[test]
fn test_custom_state() {
- const fn hash<T: ~const Hash>(t: &T) -> u64 {
+ // FIXME(#110395)
+ /* const */ fn hash<T: Hash>(t: &T) -> u64 {
let mut c = CustomHasher { output: 0 };
t.hash(&mut c);
c.finish()
@@ -147,7 +149,7 @@ fn test_custom_state() {
assert_eq!(hash(&Custom { hash: 5 }), 5);
- const { assert!(hash(&Custom { hash: 6 }) == 6) };
+ // const { assert!(hash(&Custom { hash: 6 }) == 6) };
}
// FIXME: Instantiated functions with i128 in the signature is not supported in Emscripten.
diff --git a/library/core/tests/hash/sip.rs b/library/core/tests/hash/sip.rs
index 3abf6efcf..0a67c485c 100644
--- a/library/core/tests/hash/sip.rs
+++ b/library/core/tests/hash/sip.rs
@@ -23,12 +23,13 @@ fn hash<T: Hash>(x: &T) -> u64 {
hash_with(SipHasher::new(), x)
}
+/* FIXME(#110395)
#[test]
const fn test_const_sip() {
let val1 = 0x45;
let val2 = 0xfeed;
- const fn const_hash<T: ~const Hash>(x: &T) -> u64 {
+ const fn const_hash<T: Hash>(x: &T) -> u64 {
let mut st = SipHasher::new();
x.hash(&mut st);
st.finish()
@@ -36,6 +37,7 @@ const fn test_const_sip() {
assert!(const_hash(&(val1)) != const_hash(&(val2)));
}
+*/
#[test]
#[allow(unused_must_use)]
diff --git a/library/core/tests/lazy.rs b/library/core/tests/lazy.rs
index c7c3c479b..7f7f1f005 100644
--- a/library/core/tests/lazy.rs
+++ b/library/core/tests/lazy.rs
@@ -10,7 +10,7 @@ fn once_cell() {
c.get_or_init(|| 92);
assert_eq!(c.get(), Some(&92));
- c.get_or_init(|| panic!("Kabom!"));
+ c.get_or_init(|| panic!("Kaboom!"));
assert_eq!(c.get(), Some(&92));
}
@@ -46,11 +46,13 @@ fn unsync_once_cell_drop_empty() {
drop(x);
}
+/* FIXME(#110395)
#[test]
const fn once_cell_const() {
let _once_cell: OnceCell<u32> = OnceCell::new();
let _once_cell: OnceCell<u32> = OnceCell::from(32);
}
+*/
#[test]
fn clone() {
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index 6cdafa411..3933e3289 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -8,20 +8,16 @@
#![feature(const_assume)]
#![feature(const_align_of_val_raw)]
#![feature(const_black_box)]
-#![feature(const_bool_to_option)]
#![feature(const_caller_location)]
#![feature(const_cell_into_inner)]
-#![feature(const_convert)]
#![feature(const_hash)]
#![feature(const_heap)]
#![feature(const_maybe_uninit_as_mut_ptr)]
#![feature(const_maybe_uninit_assume_init_read)]
#![feature(const_nonnull_new)]
-#![feature(const_num_from_num)]
#![feature(const_pointer_byte_offsets)]
#![feature(const_pointer_is_aligned)]
#![feature(const_ptr_as_ref)]
-#![feature(const_ptr_read)]
#![feature(const_ptr_write)]
#![feature(const_trait_impl)]
#![feature(const_likely)]
@@ -57,6 +53,7 @@
#![feature(maybe_uninit_uninit_array_transpose)]
#![feature(min_specialization)]
#![feature(numfmt)]
+#![feature(num_midpoint)]
#![feature(step_trait)]
#![feature(str_internals)]
#![feature(std_internals)]
@@ -112,6 +109,7 @@
#![feature(utf8_chunks)]
#![feature(is_ascii_octdigit)]
#![feature(get_many_mut)]
+#![cfg_attr(not(bootstrap), feature(offset_of))]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(fuzzy_provenance_casts)]
diff --git a/library/core/tests/mem.rs b/library/core/tests/mem.rs
index f7740a114..aee9c89b5 100644
--- a/library/core/tests/mem.rs
+++ b/library/core/tests/mem.rs
@@ -364,3 +364,213 @@ fn const_maybe_uninit() {
assert_eq!(FIELD_BY_FIELD, Foo { x: 1, y: 2 });
}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn offset_of() {
+ #[repr(C)]
+ struct Foo {
+ x: u8,
+ y: u16,
+ z: Bar,
+ }
+
+ #[repr(C)]
+ struct Bar(u8, u8);
+
+ assert_eq!(offset_of!(Foo, x), 0);
+ assert_eq!(offset_of!(Foo, y), 2);
+ assert_eq!(offset_of!(Foo, z.0), 4);
+ assert_eq!(offset_of!(Foo, z.1), 5);
+
+ // Layout of tuples is unstable
+ assert!(offset_of!((u8, u16), 0) <= size_of::<(u8, u16)>() - 1);
+ assert!(offset_of!((u8, u16), 1) <= size_of::<(u8, u16)>() - 2);
+
+ #[repr(C)]
+ struct Generic<T> {
+ x: u8,
+ y: u32,
+ z: T
+ }
+
+ trait Trait {}
+
+ // Ensure that this type of generics works
+ fn offs_of_z<T>() -> usize {
+ offset_of!(Generic<T>, z)
+ }
+
+ assert_eq!(offset_of!(Generic<u8>, z), 8);
+ assert_eq!(offs_of_z::<u8>(), 8);
+
+ // Ensure that it works with the implicit lifetime in `Box<dyn Trait + '_>`.
+ assert_eq!(offset_of!(Generic<Box<dyn Trait>>, z), 8);
+}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn offset_of_union() {
+ #[repr(C)]
+ union Foo {
+ x: u8,
+ y: u16,
+ z: Bar,
+ }
+
+ #[repr(C)]
+ #[derive(Copy, Clone)]
+ struct Bar(u8, u8);
+
+ assert_eq!(offset_of!(Foo, x), 0);
+ assert_eq!(offset_of!(Foo, y), 0);
+ assert_eq!(offset_of!(Foo, z.0), 0);
+ assert_eq!(offset_of!(Foo, z.1), 1);
+}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn offset_of_dst() {
+ #[repr(C)]
+ struct Alpha {
+ x: u8,
+ y: u16,
+ z: [u8],
+ }
+
+ trait Trait {}
+
+ #[repr(C)]
+ struct Beta {
+ x: u8,
+ y: u16,
+ z: dyn Trait,
+ }
+
+ extern "C" {
+ type Extern;
+ }
+
+ #[repr(C)]
+ struct Gamma {
+ x: u8,
+ y: u16,
+ z: Extern,
+ }
+
+ assert_eq!(offset_of!(Alpha, x), 0);
+ assert_eq!(offset_of!(Alpha, y), 2);
+
+ assert_eq!(offset_of!(Beta, x), 0);
+ assert_eq!(offset_of!(Beta, y), 2);
+
+ assert_eq!(offset_of!(Gamma, x), 0);
+ assert_eq!(offset_of!(Gamma, y), 2);
+}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn offset_of_packed() {
+ #[repr(C, packed)]
+ struct Foo {
+ x: u8,
+ y: u16,
+ }
+
+ assert_eq!(offset_of!(Foo, x), 0);
+ assert_eq!(offset_of!(Foo, y), 1);
+}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn offset_of_projection() {
+ #[repr(C)]
+ struct Foo {
+ x: u8,
+ y: u16,
+ }
+
+ trait Projector {
+ type Type;
+ }
+
+ impl Projector for () {
+ type Type = Foo;
+ }
+
+ assert_eq!(offset_of!(<() as Projector>::Type, x), 0);
+ assert_eq!(offset_of!(<() as Projector>::Type, y), 2);
+}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn offset_of_alias() {
+ #[repr(C)]
+ struct Foo {
+ x: u8,
+ y: u16,
+ }
+
+ type Bar = Foo;
+
+ assert_eq!(offset_of!(Bar, x), 0);
+ assert_eq!(offset_of!(Bar, y), 2);
+}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn const_offset_of() {
+ #[repr(C)]
+ struct Foo {
+ x: u8,
+ y: u16,
+ }
+
+ const X_OFFSET: usize = offset_of!(Foo, x);
+ const Y_OFFSET: usize = offset_of!(Foo, y);
+
+ assert_eq!(X_OFFSET, 0);
+ assert_eq!(Y_OFFSET, 2);
+}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn offset_of_without_const_promotion() {
+ #[repr(C)]
+ struct Foo<SuppressConstPromotion> {
+ x: u8,
+ y: u16,
+ _scp: SuppressConstPromotion,
+ }
+
+ // Normally, offset_of is always const promoted.
+ // The generic parameter prevents this from happening.
+ // This is needed to test the codegen impl of offset_of
+ fn inner<SuppressConstPromotion>() {
+ assert_eq!(offset_of!(Foo<SuppressConstPromotion>, x), 0);
+ assert_eq!(offset_of!(Foo<SuppressConstPromotion>, y), 2);
+ }
+
+ inner::<()>();
+}
+
+#[test]
+#[cfg(not(bootstrap))]
+fn offset_of_addr() {
+ #[repr(C)]
+ struct Foo {
+ x: u8,
+ y: u16,
+ z: Bar,
+ }
+
+ #[repr(C)]
+ struct Bar(u8, u8);
+
+ let base = Foo { x: 0, y: 0, z: Bar(0, 0) };
+
+ assert_eq!(ptr::addr_of!(base).addr() + offset_of!(Foo, x), ptr::addr_of!(base.x).addr());
+ assert_eq!(ptr::addr_of!(base).addr() + offset_of!(Foo, y), ptr::addr_of!(base.y).addr());
+ assert_eq!(ptr::addr_of!(base).addr() + offset_of!(Foo, z.0), ptr::addr_of!(base.z.0).addr());
+ assert_eq!(ptr::addr_of!(base).addr() + offset_of!(Foo, z.1), ptr::addr_of!(base.z.1).addr());
+}
diff --git a/library/core/tests/nonzero.rs b/library/core/tests/nonzero.rs
index a0ca919a8..007f84425 100644
--- a/library/core/tests/nonzero.rs
+++ b/library/core/tests/nonzero.rs
@@ -215,11 +215,13 @@ fn nonzero_const() {
const ONE: Option<NonZeroU8> = NonZeroU8::new(1);
assert!(ONE.is_some());
+ /* FIXME(#110395)
const FROM_NONZERO_U8: u8 = u8::from(NONZERO_U8);
assert_eq!(FROM_NONZERO_U8, 5);
const NONZERO_CONVERT: NonZeroU32 = NonZeroU32::from(NONZERO_U8);
assert_eq!(NONZERO_CONVERT.get(), 5);
+ */
}
#[test]
@@ -334,3 +336,21 @@ fn test_nonzero_uint_rem() {
let x: u32 = 42u32 % nz;
assert_eq!(x, 2u32);
}
+
+#[test]
+fn test_signed_nonzero_neg() {
+ assert_eq!((-NonZeroI8::new(1).unwrap()).get(), -1);
+ assert_eq!((-NonZeroI8::new(-1).unwrap()).get(), 1);
+
+ assert_eq!((-NonZeroI16::new(1).unwrap()).get(), -1);
+ assert_eq!((-NonZeroI16::new(-1).unwrap()).get(), 1);
+
+ assert_eq!((-NonZeroI32::new(1).unwrap()).get(), -1);
+ assert_eq!((-NonZeroI32::new(-1).unwrap()).get(), 1);
+
+ assert_eq!((-NonZeroI64::new(1).unwrap()).get(), -1);
+ assert_eq!((-NonZeroI64::new(-1).unwrap()).get(), 1);
+
+ assert_eq!((-NonZeroI128::new(1).unwrap()).get(), -1);
+ assert_eq!((-NonZeroI128::new(-1).unwrap()).get(), 1);
+}
diff --git a/library/core/tests/num/const_from.rs b/library/core/tests/num/const_from.rs
index aca18ef39..fa58e7718 100644
--- a/library/core/tests/num/const_from.rs
+++ b/library/core/tests/num/const_from.rs
@@ -1,3 +1,4 @@
+/* FIXME(#110395)
#[test]
fn from() {
use core::convert::TryFrom;
@@ -23,3 +24,4 @@ fn from() {
const I16_FROM_U16: Result<i16, TryFromIntError> = i16::try_from(1u16);
assert_eq!(I16_FROM_U16, Ok(1i16));
}
+*/
diff --git a/library/core/tests/num/ieee754.rs b/library/core/tests/num/ieee754.rs
index f6e5dfc98..48ab75b6f 100644
--- a/library/core/tests/num/ieee754.rs
+++ b/library/core/tests/num/ieee754.rs
@@ -39,7 +39,6 @@ macro_rules! assert_biteq {
// ToString uses the default fmt::Display impl without special concerns, and bypasses other parts
// of the formatting infrastructure, which makes it ideal for testing here.
-#[allow(unused_macros)]
macro_rules! roundtrip {
($f:expr => $t:ty) => {
($f).to_string().parse::<$t>().unwrap()
diff --git a/library/core/tests/num/int_macros.rs b/library/core/tests/num/int_macros.rs
index 18c55e43a..439bbe669 100644
--- a/library/core/tests/num/int_macros.rs
+++ b/library/core/tests/num/int_macros.rs
@@ -364,6 +364,32 @@ macro_rules! int_module {
assert_eq!((0 as $T).borrowing_sub($T::MIN, false), ($T::MIN, true));
assert_eq!((0 as $T).borrowing_sub($T::MIN, true), ($T::MAX, false));
}
+
+ #[test]
+ fn test_midpoint() {
+ assert_eq!(<$T>::midpoint(1, 3), 2);
+ assert_eq!(<$T>::midpoint(3, 1), 2);
+
+ assert_eq!(<$T>::midpoint(0, 0), 0);
+ assert_eq!(<$T>::midpoint(0, 2), 1);
+ assert_eq!(<$T>::midpoint(2, 0), 1);
+ assert_eq!(<$T>::midpoint(2, 2), 2);
+
+ assert_eq!(<$T>::midpoint(1, 4), 2);
+ assert_eq!(<$T>::midpoint(4, 1), 2);
+ assert_eq!(<$T>::midpoint(3, 4), 3);
+ assert_eq!(<$T>::midpoint(4, 3), 3);
+
+ assert_eq!(<$T>::midpoint(<$T>::MIN, <$T>::MAX), -1);
+ assert_eq!(<$T>::midpoint(<$T>::MAX, <$T>::MIN), -1);
+ assert_eq!(<$T>::midpoint(<$T>::MIN, <$T>::MIN), <$T>::MIN);
+ assert_eq!(<$T>::midpoint(<$T>::MAX, <$T>::MAX), <$T>::MAX);
+
+ assert_eq!(<$T>::midpoint(<$T>::MIN, 6), <$T>::MIN / 2 + 3);
+ assert_eq!(<$T>::midpoint(6, <$T>::MIN), <$T>::MIN / 2 + 3);
+ assert_eq!(<$T>::midpoint(<$T>::MAX, 6), <$T>::MAX / 2 + 3);
+ assert_eq!(<$T>::midpoint(6, <$T>::MAX), <$T>::MAX / 2 + 3);
+ }
}
};
}
diff --git a/library/core/tests/num/mod.rs b/library/core/tests/num/mod.rs
index c79e909e4..3f3659ba8 100644
--- a/library/core/tests/num/mod.rs
+++ b/library/core/tests/num/mod.rs
@@ -170,7 +170,7 @@ fn test_can_not_overflow() {
for base in 2..=36 {
let num = (<$t>::MAX as u128) + 1;
- // Calcutate the string length for the smallest overflowing number:
+ // Calculate the string length for the smallest overflowing number:
let max_len_string = format_radix(num, base as u128);
// Ensure that string length is deemed to potentially overflow:
assert!(can_overflow::<$t>(base, &max_len_string));
@@ -724,7 +724,7 @@ assume_usize_width! {
}
macro_rules! test_float {
- ($modname: ident, $fty: ty, $inf: expr, $neginf: expr, $nan: expr) => {
+ ($modname: ident, $fty: ty, $inf: expr, $neginf: expr, $nan: expr, $min: expr, $max: expr, $min_pos: expr) => {
mod $modname {
#[test]
fn min() {
@@ -845,6 +845,38 @@ macro_rules! test_float {
assert!(($nan as $fty).maximum($nan).is_nan());
}
#[test]
+ fn midpoint() {
+ assert_eq!((0.5 as $fty).midpoint(0.5), 0.5);
+ assert_eq!((0.5 as $fty).midpoint(2.5), 1.5);
+ assert_eq!((3.0 as $fty).midpoint(4.0), 3.5);
+ assert_eq!((-3.0 as $fty).midpoint(4.0), 0.5);
+ assert_eq!((3.0 as $fty).midpoint(-4.0), -0.5);
+ assert_eq!((-3.0 as $fty).midpoint(-4.0), -3.5);
+ assert_eq!((0.0 as $fty).midpoint(0.0), 0.0);
+ assert_eq!((-0.0 as $fty).midpoint(-0.0), -0.0);
+ assert_eq!((-5.0 as $fty).midpoint(5.0), 0.0);
+ assert_eq!(($max as $fty).midpoint($min), 0.0);
+ assert_eq!(($min as $fty).midpoint($max), -0.0);
+ assert_eq!(($max as $fty).midpoint($min_pos), $max / 2.);
+ assert_eq!((-$max as $fty).midpoint($min_pos), -$max / 2.);
+ assert_eq!(($max as $fty).midpoint(-$min_pos), $max / 2.);
+ assert_eq!((-$max as $fty).midpoint(-$min_pos), -$max / 2.);
+ assert_eq!(($min_pos as $fty).midpoint($max), $max / 2.);
+ assert_eq!(($min_pos as $fty).midpoint(-$max), -$max / 2.);
+ assert_eq!((-$min_pos as $fty).midpoint($max), $max / 2.);
+ assert_eq!((-$min_pos as $fty).midpoint(-$max), -$max / 2.);
+ assert_eq!(($max as $fty).midpoint($max), $max);
+ assert_eq!(($min_pos as $fty).midpoint($min_pos), $min_pos);
+ assert_eq!((-$min_pos as $fty).midpoint(-$min_pos), -$min_pos);
+ assert_eq!(($max as $fty).midpoint(5.0), $max / 2.0 + 2.5);
+ assert_eq!(($max as $fty).midpoint(-5.0), $max / 2.0 - 2.5);
+ assert_eq!(($inf as $fty).midpoint($inf), $inf);
+ assert_eq!(($neginf as $fty).midpoint($neginf), $neginf);
+ assert!(($nan as $fty).midpoint(1.0).is_nan());
+ assert!((1.0 as $fty).midpoint($nan).is_nan());
+ assert!(($nan as $fty).midpoint($nan).is_nan());
+ }
+ #[test]
fn rem_euclid() {
let a: $fty = 42.0;
assert!($inf.rem_euclid(a).is_nan());
@@ -867,5 +899,23 @@ macro_rules! test_float {
};
}
-test_float!(f32, f32, f32::INFINITY, f32::NEG_INFINITY, f32::NAN);
-test_float!(f64, f64, f64::INFINITY, f64::NEG_INFINITY, f64::NAN);
+test_float!(
+ f32,
+ f32,
+ f32::INFINITY,
+ f32::NEG_INFINITY,
+ f32::NAN,
+ f32::MIN,
+ f32::MAX,
+ f32::MIN_POSITIVE
+);
+test_float!(
+ f64,
+ f64,
+ f64::INFINITY,
+ f64::NEG_INFINITY,
+ f64::NAN,
+ f64::MIN,
+ f64::MAX,
+ f64::MIN_POSITIVE
+);
diff --git a/library/core/tests/num/uint_macros.rs b/library/core/tests/num/uint_macros.rs
index 15ae9f232..7d6203db0 100644
--- a/library/core/tests/num/uint_macros.rs
+++ b/library/core/tests/num/uint_macros.rs
@@ -252,6 +252,32 @@ macro_rules! uint_module {
assert_eq!($T::MAX.borrowing_sub(0, true), ($T::MAX - 1, false));
assert_eq!($T::MAX.borrowing_sub($T::MAX, true), ($T::MAX, true));
}
+
+ #[test]
+ fn test_midpoint() {
+ assert_eq!(<$T>::midpoint(1, 3), 2);
+ assert_eq!(<$T>::midpoint(3, 1), 2);
+
+ assert_eq!(<$T>::midpoint(0, 0), 0);
+ assert_eq!(<$T>::midpoint(0, 2), 1);
+ assert_eq!(<$T>::midpoint(2, 0), 1);
+ assert_eq!(<$T>::midpoint(2, 2), 2);
+
+ assert_eq!(<$T>::midpoint(1, 4), 2);
+ assert_eq!(<$T>::midpoint(4, 1), 2);
+ assert_eq!(<$T>::midpoint(3, 4), 3);
+ assert_eq!(<$T>::midpoint(4, 3), 3);
+
+ assert_eq!(<$T>::midpoint(<$T>::MIN, <$T>::MAX), (<$T>::MAX - <$T>::MIN) / 2);
+ assert_eq!(<$T>::midpoint(<$T>::MAX, <$T>::MIN), (<$T>::MAX - <$T>::MIN) / 2);
+ assert_eq!(<$T>::midpoint(<$T>::MIN, <$T>::MIN), <$T>::MIN);
+ assert_eq!(<$T>::midpoint(<$T>::MAX, <$T>::MAX), <$T>::MAX);
+
+ assert_eq!(<$T>::midpoint(<$T>::MIN, 6), <$T>::MIN / 2 + 3);
+ assert_eq!(<$T>::midpoint(6, <$T>::MIN), <$T>::MIN / 2 + 3);
+ assert_eq!(<$T>::midpoint(<$T>::MAX, 6), (<$T>::MAX - <$T>::MIN) / 2 + 3);
+ assert_eq!(<$T>::midpoint(6, <$T>::MAX), (<$T>::MAX - <$T>::MIN) / 2 + 3);
+ }
}
};
}
diff --git a/library/core/tests/option.rs b/library/core/tests/option.rs
index dca6321cf..5defeb50d 100644
--- a/library/core/tests/option.rs
+++ b/library/core/tests/option.rs
@@ -88,6 +88,7 @@ fn test_and() {
assert_eq!(x.and(Some(2)), None);
assert_eq!(x.and(None::<isize>), None);
+ /* FIXME(#110395)
const FOO: Option<isize> = Some(1);
const A: Option<isize> = FOO.and(Some(2));
const B: Option<isize> = FOO.and(None);
@@ -99,6 +100,7 @@ fn test_and() {
const D: Option<isize> = BAR.and(None);
assert_eq!(C, None);
assert_eq!(D, None);
+ */
}
#[test]
@@ -119,6 +121,7 @@ fn test_and_then() {
assert_eq!(x.and_then(plus_one), None);
assert_eq!(x.and_then(none), None);
+ /* FIXME(#110395)
const FOO: Option<isize> = Some(1);
const A: Option<isize> = FOO.and_then(plus_one);
const B: Option<isize> = FOO.and_then(none);
@@ -130,6 +133,7 @@ fn test_and_then() {
const D: Option<isize> = BAR.and_then(none);
assert_eq!(C, None);
assert_eq!(D, None);
+ */
}
#[test]
@@ -142,6 +146,7 @@ fn test_or() {
assert_eq!(x.or(Some(2)), Some(2));
assert_eq!(x.or(None), None);
+ /* FIXME(#110395)
const FOO: Option<isize> = Some(1);
const A: Option<isize> = FOO.or(Some(2));
const B: Option<isize> = FOO.or(None);
@@ -153,6 +158,7 @@ fn test_or() {
const D: Option<isize> = BAR.or(None);
assert_eq!(C, Some(2));
assert_eq!(D, None);
+ */
}
#[test]
@@ -173,6 +179,7 @@ fn test_or_else() {
assert_eq!(x.or_else(two), Some(2));
assert_eq!(x.or_else(none), None);
+/* FIXME(#110395)
const FOO: Option<isize> = Some(1);
const A: Option<isize> = FOO.or_else(two);
const B: Option<isize> = FOO.or_else(none);
@@ -184,6 +191,7 @@ fn test_or_else() {
const D: Option<isize> = BAR.or_else(none);
assert_eq!(C, Some(2));
assert_eq!(D, None);
+*/
}
#[test]
@@ -215,10 +223,12 @@ fn test_unwrap_or() {
let x: Option<isize> = None;
assert_eq!(x.unwrap_or(2), 2);
+ /* FIXME(#110395)
const A: isize = Some(1).unwrap_or(2);
const B: isize = None.unwrap_or(2);
assert_eq!(A, 1);
assert_eq!(B, 2);
+ */
}
#[test]
@@ -233,10 +243,12 @@ fn test_unwrap_or_else() {
let x: Option<isize> = None;
assert_eq!(x.unwrap_or_else(two), 2);
+ /* FIXME(#110395)
const A: isize = Some(1).unwrap_or_else(two);
const B: isize = None.unwrap_or_else(two);
assert_eq!(A, 1);
assert_eq!(B, 2);
+ */
}
#[test]
@@ -439,14 +451,15 @@ fn option_const() {
const OPTION: Option<usize> = Some(32);
assert_eq!(OPTION, Some(32));
- const OPTION_FROM: Option<usize> = Option::from(32);
- assert_eq!(OPTION_FROM, Some(32));
+ // FIXME(#110395)
+ // const OPTION_FROM: Option<usize> = Option::from(32);
+ // assert_eq!(OPTION_FROM, Some(32));
const REF: Option<&usize> = OPTION.as_ref();
assert_eq!(REF, Some(&32));
- const REF_FROM: Option<&usize> = Option::from(&OPTION);
- assert_eq!(REF_FROM, Some(&32));
+ // const REF_FROM: Option<&usize> = Option::from(&OPTION);
+ // assert_eq!(REF_FROM, Some(&32));
const IS_SOME: bool = OPTION.is_some();
assert!(IS_SOME);
@@ -474,7 +487,7 @@ const fn option_const_mut() {
None => unreachable!(),
}
}
-
+/* FIXME(const-hack)
{
let as_mut: Option<&mut usize> = Option::from(&mut option);
match as_mut {
@@ -482,6 +495,7 @@ const fn option_const_mut() {
None => unreachable!(),
}
}
+*/
}
#[test]
diff --git a/library/core/tests/time.rs b/library/core/tests/time.rs
index 2975c81f8..872611937 100644
--- a/library/core/tests/time.rs
+++ b/library/core/tests/time.rs
@@ -425,14 +425,16 @@ fn duration_const() {
const SECONDS_F32: f32 = Duration::SECOND.as_secs_f32();
assert_eq!(SECONDS_F32, 1.0);
- const FROM_SECONDS_F32: Duration = Duration::from_secs_f32(1.0);
- assert_eq!(FROM_SECONDS_F32, Duration::SECOND);
+ // FIXME(#110395)
+ // const FROM_SECONDS_F32: Duration = Duration::from_secs_f32(1.0);
+ // assert_eq!(FROM_SECONDS_F32, Duration::SECOND);
const SECONDS_F64: f64 = Duration::SECOND.as_secs_f64();
assert_eq!(SECONDS_F64, 1.0);
- const FROM_SECONDS_F64: Duration = Duration::from_secs_f64(1.0);
- assert_eq!(FROM_SECONDS_F64, Duration::SECOND);
+ // FIXME(#110395)
+ // const FROM_SECONDS_F64: Duration = Duration::from_secs_f64(1.0);
+ // assert_eq!(FROM_SECONDS_F64, Duration::SECOND);
const MILLIS: u128 = Duration::SECOND.as_millis();
assert_eq!(MILLIS, 1_000);
@@ -463,6 +465,7 @@ fn duration_const() {
const CHECKED_MUL: Option<Duration> = Duration::SECOND.checked_mul(1);
assert_eq!(CHECKED_MUL, Some(Duration::SECOND));
+/* FIXME(#110395)
const MUL_F32: Duration = Duration::SECOND.mul_f32(1.0);
assert_eq!(MUL_F32, Duration::SECOND);
@@ -477,6 +480,7 @@ fn duration_const() {
const DIV_F64: Duration = Duration::SECOND.div_f64(1.0);
assert_eq!(DIV_F64, Duration::SECOND);
+*/
const DIV_DURATION_F32: f32 = Duration::SECOND.div_duration_f32(Duration::SECOND);
assert_eq!(DIV_DURATION_F32, 1.0);
diff --git a/library/panic_unwind/src/emcc.rs b/library/panic_unwind/src/emcc.rs
index c6d423085..af18e1933 100644
--- a/library/panic_unwind/src/emcc.rs
+++ b/library/panic_unwind/src/emcc.rs
@@ -47,7 +47,7 @@ static EXCEPTION_TYPE_INFO: TypeInfo = TypeInfo {
name: b"rust_panic\0".as_ptr(),
};
-// NOTE(nbdd0121): The `canary` field will be part of stable ABI after `c_unwind` stabilization.
+// NOTE(nbdd0121): The `canary` field is part of stable ABI.
#[repr(C)]
struct Exception {
// See `gcc.rs` on why this is present. We already have a static here so just use it.
diff --git a/library/panic_unwind/src/gcc.rs b/library/panic_unwind/src/gcc.rs
index 0b7a873a6..08858dd92 100644
--- a/library/panic_unwind/src/gcc.rs
+++ b/library/panic_unwind/src/gcc.rs
@@ -48,8 +48,8 @@ use unwind as uw;
static CANARY: u8 = 0;
// NOTE(nbdd0121)
-// Once `c_unwind` feature is stabilized, there will be ABI stability requirement
-// on this struct. The first two field must be `_Unwind_Exception` and `canary`,
+// There is an ABI stability requirement on this struct.
+// The first two field must be `_Unwind_Exception` and `canary`,
// as it may be accessed by a different version of the std with a different compiler.
#[repr(C)]
struct Exception {
diff --git a/library/panic_unwind/src/seh.rs b/library/panic_unwind/src/seh.rs
index 651115a82..99db00e54 100644
--- a/library/panic_unwind/src/seh.rs
+++ b/library/panic_unwind/src/seh.rs
@@ -52,7 +52,7 @@ use core::mem::{self, ManuallyDrop};
use core::ptr;
use libc::{c_int, c_uint, c_void};
-// NOTE(nbdd0121): The `canary` field will be part of stable ABI after `c_unwind` stabilization.
+// NOTE(nbdd0121): The `canary` field is part of stable ABI.
#[repr(C)]
struct Exception {
// See `gcc.rs` on why this is present. We already have a static here so just use it.
diff --git a/library/portable-simd/.github/workflows/ci.yml b/library/portable-simd/.github/workflows/ci.yml
index d50dfa1be..acd47a3da 100644
--- a/library/portable-simd/.github/workflows/ci.yml
+++ b/library/portable-simd/.github/workflows/ci.yml
@@ -241,6 +241,10 @@ jobs:
- "--features std"
- "--features generic_const_exprs"
- "--features std --features generic_const_exprs"
+ - "--features all_lane_counts"
+ - "--features all_lane_counts --features std"
+ - "--features all_lane_counts --features generic_const_exprs"
+ - "--features all_lane_counts --features std --features generic_const_exprs"
steps:
- uses: actions/checkout@v2
diff --git a/library/portable-simd/README.md b/library/portable-simd/README.md
index db0af2da6..e8ac600de 100644
--- a/library/portable-simd/README.md
+++ b/library/portable-simd/README.md
@@ -24,19 +24,10 @@ or by setting up `rustup default nightly` or else with `cargo +nightly {build,te
```bash
cargo new hellosimd
```
-to create a new crate. Edit `hellosimd/Cargo.toml` to be
-```toml
-[package]
-name = "hellosimd"
-version = "0.1.0"
-edition = "2018"
-[dependencies]
-core_simd = { git = "https://github.com/rust-lang/portable-simd" }
-```
-
-and finally write this in `src/main.rs`:
+to create a new crate. Finally write this in `src/main.rs`:
```rust
-use core_simd::*;
+#![feature(portable_simd)]
+use std::simd::f32x4;
fn main() {
let a = f32x4::splat(10.0);
let b = f32x4::from_array([1.0, 2.0, 3.0, 4.0]);
@@ -44,24 +35,23 @@ fn main() {
}
```
-Explanation: We import all the bindings from the crate with the first line. Then, we construct our SIMD vectors with methods like `splat` or `from_array`. Finally, we can use operators on them like `+` and the appropriate SIMD instructions will be carried out. When we run `cargo run` you should get `[11.0, 12.0, 13.0, 14.0]`.
-
-## Code Organization
+Explanation: We construct our SIMD vectors with methods like `splat` or `from_array`. Next, we can use operators like `+` on them, and the appropriate SIMD instructions will be carried out. When we run `cargo run` you should get `[11.0, 12.0, 13.0, 14.0]`.
-Currently the crate is organized so that each element type is a file, and then the 64-bit, 128-bit, 256-bit, and 512-bit vectors using those types are contained in said file.
+## Supported vectors
-All types are then exported as a single, flat module.
+Currently, vectors may have up to 64 elements, but aliases are provided only up to 512-bit vectors.
Depending on the size of the primitive type, the number of lanes the vector will have varies. For example, 128-bit vectors have four `f32` lanes and two `f64` lanes.
The supported element types are as follows:
* **Floating Point:** `f32`, `f64`
-* **Signed Integers:** `i8`, `i16`, `i32`, `i64`, `i128`, `isize`
-* **Unsigned Integers:** `u8`, `u16`, `u32`, `u64`, `u128`, `usize`
-* **Masks:** `mask8`, `mask16`, `mask32`, `mask64`, `mask128`, `masksize`
+* **Signed Integers:** `i8`, `i16`, `i32`, `i64`, `isize` (`i128` excluded)
+* **Unsigned Integers:** `u8`, `u16`, `u32`, `u64`, `usize` (`u128` excluded)
+* **Pointers:** `*const T` and `*mut T` (zero-sized metadata only)
+* **Masks:** 8-bit, 16-bit, 32-bit, 64-bit, and `usize`-sized masks
-Floating point, signed integers, and unsigned integers are the [primitive types](https://doc.rust-lang.org/core/primitive/index.html) you're already used to.
-The `mask` types are "truthy" values, but they use the number of bits in their name instead of just 1 bit like a normal `bool` uses.
+Floating point, signed integers, unsigned integers, and pointers are the [primitive types](https://doc.rust-lang.org/core/primitive/index.html) you're already used to.
+The mask types have elements that are "truthy" values, like `bool`, but have an unspecified layout because different architectures prefer different layouts for mask types.
[simd-guide]: ./beginners-guide.md
[zulip-project-portable-simd]: https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd
diff --git a/library/portable-simd/crates/core_simd/Cargo.toml b/library/portable-simd/crates/core_simd/Cargo.toml
index 8a29cf156..d1a3a515a 100644
--- a/library/portable-simd/crates/core_simd/Cargo.toml
+++ b/library/portable-simd/crates/core_simd/Cargo.toml
@@ -13,12 +13,11 @@ default = ["as_crate"]
as_crate = []
std = []
generic_const_exprs = []
+all_lane_counts = []
-[target.'cfg(target_arch = "wasm32")'.dev-dependencies.wasm-bindgen]
-version = "0.2"
-
-[dev-dependencies.wasm-bindgen-test]
-version = "0.3"
+[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
+wasm-bindgen = "0.2"
+wasm-bindgen-test = "0.3"
[dev-dependencies.proptest]
version = "0.10"
diff --git a/library/portable-simd/crates/core_simd/examples/README.md b/library/portable-simd/crates/core_simd/examples/README.md
new file mode 100644
index 000000000..82747f1b5
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/examples/README.md
@@ -0,0 +1,13 @@
+### `stdsimd` examples
+
+This crate is a port of example uses of `stdsimd`, mostly taken from the `packed_simd` crate.
+
+The examples contain, as in the case of `dot_product.rs`, multiple ways of solving the problem, in order to show idiomatic uses of SIMD and iteration of performance designs.
+
+Run the tests with the command
+
+```
+cargo run --example dot_product
+```
+
+and verify the code for `dot_product.rs` on your machine.
diff --git a/library/portable-simd/crates/core_simd/examples/dot_product.rs b/library/portable-simd/crates/core_simd/examples/dot_product.rs
new file mode 100644
index 000000000..391f08f55
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/examples/dot_product.rs
@@ -0,0 +1,169 @@
+// Code taken from the `packed_simd` crate
+// Run this code with `cargo test --example dot_product`
+//use std::iter::zip;
+
+#![feature(array_chunks)]
+#![feature(slice_as_chunks)]
+// Add these imports to use the stdsimd library
+#![feature(portable_simd)]
+use core_simd::simd::*;
+
+// This is your barebones dot product implementation:
+// Take 2 vectors, multiply them element wise and *then*
+// go along the resulting array and add up the result.
+// In the next example we will see if there
+// is any difference to adding and multiplying in tandem.
+pub fn dot_prod_scalar_0(a: &[f32], b: &[f32]) -> f32 {
+ assert_eq!(a.len(), b.len());
+
+ a.iter().zip(b.iter()).map(|(a, b)| a * b).sum()
+}
+
+// When dealing with SIMD, it is very important to think about the amount
+// of data movement and when it happens. We're going over simple computation examples here, and yet
+// it is not trivial to understand what may or may not contribute to performance
+// changes. Eventually, you will need tools to inspect the generated assembly and confirm your
+// hypothesis and benchmarks - we will mention them later on.
+// With the use of `fold`, we're doing a multiplication,
+// and then adding it to the sum, one element from both vectors at a time.
+pub fn dot_prod_scalar_1(a: &[f32], b: &[f32]) -> f32 {
+ assert_eq!(a.len(), b.len());
+ a.iter()
+ .zip(b.iter())
+ .fold(0.0, |a, zipped| a + zipped.0 * zipped.1)
+}
+
+// We now move on to the SIMD implementations: notice the following constructs:
+// `array_chunks::<4>`: mapping this over the vector will let use construct SIMD vectors
+// `f32x4::from_array`: construct the SIMD vector from a slice
+// `(a * b).reduce_sum()`: Multiply both f32x4 vectors together, and then reduce them.
+// This approach essentially uses SIMD to produce a vector of length N/4 of all the products,
+// and then add those with `sum()`. This is suboptimal.
+// TODO: ASCII diagrams
+pub fn dot_prod_simd_0(a: &[f32], b: &[f32]) -> f32 {
+ assert_eq!(a.len(), b.len());
+ // TODO handle remainder when a.len() % 4 != 0
+ a.array_chunks::<4>()
+ .map(|&a| f32x4::from_array(a))
+ .zip(b.array_chunks::<4>().map(|&b| f32x4::from_array(b)))
+ .map(|(a, b)| (a * b).reduce_sum())
+ .sum()
+}
+
+// There's some simple ways to improve the previous code:
+// 1. Make a `zero` `f32x4` SIMD vector that we will be accumulating into
+// So that there is only one `sum()` reduction when the last `f32x4` has been processed
+// 2. Exploit Fused Multiply Add so that the multiplication, addition and sinking into the reduciton
+// happen in the same step.
+// If the arrays are large, minimizing the data shuffling will lead to great perf.
+// If the arrays are small, handling the remainder elements when the length isn't a multiple of 4
+// Can become a problem.
+pub fn dot_prod_simd_1(a: &[f32], b: &[f32]) -> f32 {
+ assert_eq!(a.len(), b.len());
+ // TODO handle remainder when a.len() % 4 != 0
+ a.array_chunks::<4>()
+ .map(|&a| f32x4::from_array(a))
+ .zip(b.array_chunks::<4>().map(|&b| f32x4::from_array(b)))
+ .fold(f32x4::splat(0.0), |acc, zipped| acc + zipped.0 * zipped.1)
+ .reduce_sum()
+}
+
+// A lot of knowledgeable use of SIMD comes from knowing specific instructions that are
+// available - let's try to use the `mul_add` instruction, which is the fused-multiply-add we were looking for.
+use std_float::StdFloat;
+pub fn dot_prod_simd_2(a: &[f32], b: &[f32]) -> f32 {
+ assert_eq!(a.len(), b.len());
+ // TODO handle remainder when a.len() % 4 != 0
+ let mut res = f32x4::splat(0.0);
+ a.array_chunks::<4>()
+ .map(|&a| f32x4::from_array(a))
+ .zip(b.array_chunks::<4>().map(|&b| f32x4::from_array(b)))
+ .for_each(|(a, b)| {
+ res = a.mul_add(b, res);
+ });
+ res.reduce_sum()
+}
+
+// Finally, we will write the same operation but handling the loop remainder.
+const LANES: usize = 4;
+pub fn dot_prod_simd_3(a: &[f32], b: &[f32]) -> f32 {
+ assert_eq!(a.len(), b.len());
+
+ let (a_extra, a_chunks) = a.as_rchunks();
+ let (b_extra, b_chunks) = b.as_rchunks();
+
+ // These are always true, but for emphasis:
+ assert_eq!(a_chunks.len(), b_chunks.len());
+ assert_eq!(a_extra.len(), b_extra.len());
+
+ let mut sums = [0.0; LANES];
+ for ((x, y), d) in std::iter::zip(a_extra, b_extra).zip(&mut sums) {
+ *d = x * y;
+ }
+
+ let mut sums = f32x4::from_array(sums);
+ std::iter::zip(a_chunks, b_chunks).for_each(|(x, y)| {
+ sums += f32x4::from_array(*x) * f32x4::from_array(*y);
+ });
+
+ sums.reduce_sum()
+}
+
+// Finally, we present an iterator version for handling remainders in a scalar fashion at the end of the loop.
+// Unfortunately, this is allocating 1 `XMM` register on the order of `~len(a)` - we'll see how we can get around it in the
+// next example.
+pub fn dot_prod_simd_4(a: &[f32], b: &[f32]) -> f32 {
+ let mut sum = a
+ .array_chunks::<4>()
+ .map(|&a| f32x4::from_array(a))
+ .zip(b.array_chunks::<4>().map(|&b| f32x4::from_array(b)))
+ .map(|(a, b)| a * b)
+ .fold(f32x4::splat(0.0), std::ops::Add::add)
+ .reduce_sum();
+ let remain = a.len() - (a.len() % 4);
+ sum += a[remain..]
+ .iter()
+ .zip(&b[remain..])
+ .map(|(a, b)| a * b)
+ .sum::<f32>();
+ sum
+}
+
+// This version allocates a single `XMM` register for accumulation, and the folds don't allocate on top of that.
+// Notice the the use of `mul_add`, which can do a multiply and an add operation ber iteration.
+pub fn dot_prod_simd_5(a: &[f32], b: &[f32]) -> f32 {
+ a.array_chunks::<4>()
+ .map(|&a| f32x4::from_array(a))
+ .zip(b.array_chunks::<4>().map(|&b| f32x4::from_array(b)))
+ .fold(f32x4::splat(0.), |acc, (a, b)| a.mul_add(b, acc))
+ .reduce_sum()
+}
+
+fn main() {
+ // Empty main to make cargo happy
+}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn smoke_test() {
+ use super::*;
+ let a: Vec<f32> = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0];
+ let b: Vec<f32> = vec![-8.0, -7.0, -6.0, -5.0, 4.0, 3.0, 2.0, 1.0];
+ let x: Vec<f32> = [0.5; 1003].to_vec();
+ let y: Vec<f32> = [2.0; 1003].to_vec();
+
+ // Basic check
+ assert_eq!(0.0, dot_prod_scalar_0(&a, &b));
+ assert_eq!(0.0, dot_prod_scalar_1(&a, &b));
+ assert_eq!(0.0, dot_prod_simd_0(&a, &b));
+ assert_eq!(0.0, dot_prod_simd_1(&a, &b));
+ assert_eq!(0.0, dot_prod_simd_2(&a, &b));
+ assert_eq!(0.0, dot_prod_simd_3(&a, &b));
+ assert_eq!(0.0, dot_prod_simd_4(&a, &b));
+ assert_eq!(0.0, dot_prod_simd_5(&a, &b));
+
+ // We can handle vectors that are non-multiples of 4
+ assert_eq!(1003.0, dot_prod_simd_3(&x, &y));
+ }
+}
diff --git a/library/portable-simd/crates/core_simd/src/alias.rs b/library/portable-simd/crates/core_simd/src/alias.rs
new file mode 100644
index 000000000..23f121c46
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/src/alias.rs
@@ -0,0 +1,227 @@
+macro_rules! number {
+ { 1 } => { "one" };
+ { 2 } => { "two" };
+ { 4 } => { "four" };
+ { 8 } => { "eight" };
+ { $x:literal } => { stringify!($x) };
+}
+
+macro_rules! plural {
+ { 1 } => { "" };
+ { $x:literal } => { "s" };
+}
+
+macro_rules! alias {
+ {
+ $(
+ $element_ty:ty = {
+ $($alias:ident $num_elements:tt)*
+ }
+ )*
+ } => {
+ $(
+ $(
+ #[doc = concat!("A SIMD vector with ", number!($num_elements), " element", plural!($num_elements), " of type [`", stringify!($element_ty), "`].")]
+ #[allow(non_camel_case_types)]
+ pub type $alias = $crate::simd::Simd<$element_ty, $num_elements>;
+ )*
+ )*
+ }
+}
+
+macro_rules! mask_alias {
+ {
+ $(
+ $element_ty:ty : $size:literal = {
+ $($alias:ident $num_elements:tt)*
+ }
+ )*
+ } => {
+ $(
+ $(
+ #[doc = concat!("A SIMD mask with ", number!($num_elements), " element", plural!($num_elements), " for vectors with ", $size, " element types.")]
+ ///
+ #[doc = concat!(
+ "The layout of this type is unspecified, and may change between platforms and/or Rust versions, and code should not assume that it is equivalent to `[",
+ stringify!($element_ty), "; ", $num_elements, "]`."
+ )]
+ #[allow(non_camel_case_types)]
+ pub type $alias = $crate::simd::Mask<$element_ty, $num_elements>;
+ )*
+ )*
+ }
+}
+
+alias! {
+ i8 = {
+ i8x1 1
+ i8x2 2
+ i8x4 4
+ i8x8 8
+ i8x16 16
+ i8x32 32
+ i8x64 64
+ }
+
+ i16 = {
+ i16x1 1
+ i16x2 2
+ i16x4 4
+ i16x8 8
+ i16x16 16
+ i16x32 32
+ i16x64 64
+ }
+
+ i32 = {
+ i32x1 1
+ i32x2 2
+ i32x4 4
+ i32x8 8
+ i32x16 16
+ i32x32 32
+ i32x64 64
+ }
+
+ i64 = {
+ i64x1 1
+ i64x2 2
+ i64x4 4
+ i64x8 8
+ i64x16 16
+ i64x32 32
+ i64x64 64
+ }
+
+ isize = {
+ isizex1 1
+ isizex2 2
+ isizex4 4
+ isizex8 8
+ isizex16 16
+ isizex32 32
+ isizex64 64
+ }
+
+ u8 = {
+ u8x1 1
+ u8x2 2
+ u8x4 4
+ u8x8 8
+ u8x16 16
+ u8x32 32
+ u8x64 64
+ }
+
+ u16 = {
+ u16x1 1
+ u16x2 2
+ u16x4 4
+ u16x8 8
+ u16x16 16
+ u16x32 32
+ u16x64 64
+ }
+
+ u32 = {
+ u32x1 1
+ u32x2 2
+ u32x4 4
+ u32x8 8
+ u32x16 16
+ u32x32 32
+ u32x64 64
+ }
+
+ u64 = {
+ u64x1 1
+ u64x2 2
+ u64x4 4
+ u64x8 8
+ u64x16 16
+ u64x32 32
+ u64x64 64
+ }
+
+ usize = {
+ usizex1 1
+ usizex2 2
+ usizex4 4
+ usizex8 8
+ usizex16 16
+ usizex32 32
+ usizex64 64
+ }
+
+ f32 = {
+ f32x1 1
+ f32x2 2
+ f32x4 4
+ f32x8 8
+ f32x16 16
+ f32x32 32
+ f32x64 64
+ }
+
+ f64 = {
+ f64x1 1
+ f64x2 2
+ f64x4 4
+ f64x8 8
+ f64x16 16
+ f64x32 32
+ f64x64 64
+ }
+}
+
+mask_alias! {
+ i8 : "8-bit" = {
+ mask8x1 1
+ mask8x2 2
+ mask8x4 4
+ mask8x8 8
+ mask8x16 16
+ mask8x32 32
+ mask8x64 64
+ }
+
+ i16 : "16-bit" = {
+ mask16x1 1
+ mask16x2 2
+ mask16x4 4
+ mask16x8 8
+ mask16x16 16
+ mask16x32 32
+ mask16x64 64
+ }
+
+ i32 : "32-bit" = {
+ mask32x1 1
+ mask32x2 2
+ mask32x4 4
+ mask32x8 8
+ mask32x16 16
+ mask32x32 32
+ mask32x64 64
+ }
+
+ i64 : "64-bit" = {
+ mask64x1 1
+ mask64x2 2
+ mask64x4 4
+ mask64x8 8
+ mask64x16 16
+ mask64x32 32
+ mask64x64 64
+ }
+
+ isize : "pointer-sized" = {
+ masksizex1 1
+ masksizex2 2
+ masksizex4 4
+ masksizex8 8
+ masksizex16 16
+ masksizex32 32
+ masksizex64 64
+ }
+}
diff --git a/library/portable-simd/crates/core_simd/src/cast.rs b/library/portable-simd/crates/core_simd/src/cast.rs
new file mode 100644
index 000000000..65a3f845f
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/src/cast.rs
@@ -0,0 +1,55 @@
+use crate::simd::SimdElement;
+
+/// Supporting trait for `Simd::cast`. Typically doesn't need to be used directly.
+///
+/// # Safety
+/// Implementing this trait asserts that the type is a valid vector element for the `simd_cast` or
+/// `simd_as` intrinsics.
+pub unsafe trait SimdCast: SimdElement {}
+
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for i8 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for i16 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for i32 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for i64 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for isize {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for u8 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for u16 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for u32 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for u64 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for usize {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for f32 {}
+// Safety: primitive number types can be cast to other primitive number types
+unsafe impl SimdCast for f64 {}
+
+/// Supporting trait for `Simd::cast_ptr`. Typically doesn't need to be used directly.
+///
+/// # Safety
+/// Implementing this trait asserts that the type is a valid vector element for the `simd_cast_ptr`
+/// intrinsic.
+pub unsafe trait SimdCastPtr<T> {}
+
+// Safety: pointers can be cast to other pointer types
+unsafe impl<T, U> SimdCastPtr<T> for *const U
+where
+ U: core::ptr::Pointee,
+ T: core::ptr::Pointee<Metadata = U::Metadata>,
+{
+}
+// Safety: pointers can be cast to other pointer types
+unsafe impl<T, U> SimdCastPtr<T> for *mut U
+where
+ U: core::ptr::Pointee,
+ T: core::ptr::Pointee<Metadata = U::Metadata>,
+{
+}
diff --git a/library/portable-simd/crates/core_simd/src/elements.rs b/library/portable-simd/crates/core_simd/src/elements.rs
index 701eb66b2..dc7f52a4d 100644
--- a/library/portable-simd/crates/core_simd/src/elements.rs
+++ b/library/portable-simd/crates/core_simd/src/elements.rs
@@ -1,11 +1,15 @@
+mod const_ptr;
mod float;
mod int;
+mod mut_ptr;
mod uint;
mod sealed {
pub trait Sealed {}
}
+pub use const_ptr::*;
pub use float::*;
pub use int::*;
+pub use mut_ptr::*;
pub use uint::*;
diff --git a/library/portable-simd/crates/core_simd/src/elements/const_ptr.rs b/library/portable-simd/crates/core_simd/src/elements/const_ptr.rs
new file mode 100644
index 000000000..0ef9802b5
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/src/elements/const_ptr.rs
@@ -0,0 +1,141 @@
+use super::sealed::Sealed;
+use crate::simd::{intrinsics, LaneCount, Mask, Simd, SimdPartialEq, SupportedLaneCount};
+
+/// Operations on SIMD vectors of constant pointers.
+pub trait SimdConstPtr: Copy + Sealed {
+ /// Vector of `usize` with the same number of lanes.
+ type Usize;
+
+ /// Vector of `isize` with the same number of lanes.
+ type Isize;
+
+ /// Vector of mutable pointers to the same type.
+ type MutPtr;
+
+ /// Mask type used for manipulating this SIMD vector type.
+ type Mask;
+
+ /// Returns `true` for each lane that is null.
+ fn is_null(self) -> Self::Mask;
+
+ /// Changes constness without changing the type.
+ ///
+ /// Equivalent to calling [`pointer::cast_mut`] on each lane.
+ fn cast_mut(self) -> Self::MutPtr;
+
+ /// Gets the "address" portion of the pointer.
+ ///
+ /// This method discards pointer semantic metadata, so the result cannot be
+ /// directly cast into a valid pointer.
+ ///
+ /// This method semantically discards *provenance* and
+ /// *address-space* information. To properly restore that information, use [`Self::with_addr`].
+ ///
+ /// Equivalent to calling [`pointer::addr`] on each lane.
+ fn addr(self) -> Self::Usize;
+
+ /// Creates a new pointer with the given address.
+ ///
+ /// This performs the same operation as a cast, but copies the *address-space* and
+ /// *provenance* of `self` to the new pointer.
+ ///
+ /// Equivalent to calling [`pointer::with_addr`] on each lane.
+ fn with_addr(self, addr: Self::Usize) -> Self;
+
+ /// Gets the "address" portion of the pointer, and "exposes" the provenance part for future use
+ /// in [`Self::from_exposed_addr`].
+ fn expose_addr(self) -> Self::Usize;
+
+ /// Convert an address back to a pointer, picking up a previously "exposed" provenance.
+ ///
+ /// Equivalent to calling [`core::ptr::from_exposed_addr`] on each lane.
+ fn from_exposed_addr(addr: Self::Usize) -> Self;
+
+ /// Calculates the offset from a pointer using wrapping arithmetic.
+ ///
+ /// Equivalent to calling [`pointer::wrapping_offset`] on each lane.
+ fn wrapping_offset(self, offset: Self::Isize) -> Self;
+
+ /// Calculates the offset from a pointer using wrapping arithmetic.
+ ///
+ /// Equivalent to calling [`pointer::wrapping_add`] on each lane.
+ fn wrapping_add(self, count: Self::Usize) -> Self;
+
+ /// Calculates the offset from a pointer using wrapping arithmetic.
+ ///
+ /// Equivalent to calling [`pointer::wrapping_sub`] on each lane.
+ fn wrapping_sub(self, count: Self::Usize) -> Self;
+}
+
+impl<T, const LANES: usize> Sealed for Simd<*const T, LANES> where
+ LaneCount<LANES>: SupportedLaneCount
+{
+}
+
+impl<T, const LANES: usize> SimdConstPtr for Simd<*const T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+{
+ type Usize = Simd<usize, LANES>;
+ type Isize = Simd<isize, LANES>;
+ type MutPtr = Simd<*mut T, LANES>;
+ type Mask = Mask<isize, LANES>;
+
+ #[inline]
+ fn is_null(self) -> Self::Mask {
+ Simd::splat(core::ptr::null()).simd_eq(self)
+ }
+
+ #[inline]
+ fn cast_mut(self) -> Self::MutPtr {
+ self.cast_ptr()
+ }
+
+ #[inline]
+ fn addr(self) -> Self::Usize {
+ // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
+ // SAFETY: Pointer-to-integer transmutes are valid (if you are okay with losing the
+ // provenance).
+ unsafe { core::mem::transmute_copy(&self) }
+ }
+
+ #[inline]
+ fn with_addr(self, addr: Self::Usize) -> Self {
+ // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
+ //
+ // In the mean-time, this operation is defined to be "as if" it was
+ // a wrapping_offset, so we can emulate it as such. This should properly
+ // restore pointer provenance even under today's compiler.
+ self.cast_ptr::<*const u8>()
+ .wrapping_offset(addr.cast::<isize>() - self.addr().cast::<isize>())
+ .cast_ptr()
+ }
+
+ #[inline]
+ fn expose_addr(self) -> Self::Usize {
+ // Safety: `self` is a pointer vector
+ unsafe { intrinsics::simd_expose_addr(self) }
+ }
+
+ #[inline]
+ fn from_exposed_addr(addr: Self::Usize) -> Self {
+ // Safety: `self` is a pointer vector
+ unsafe { intrinsics::simd_from_exposed_addr(addr) }
+ }
+
+ #[inline]
+ fn wrapping_offset(self, count: Self::Isize) -> Self {
+ // Safety: simd_arith_offset takes a vector of pointers and a vector of offsets
+ unsafe { intrinsics::simd_arith_offset(self, count) }
+ }
+
+ #[inline]
+ fn wrapping_add(self, count: Self::Usize) -> Self {
+ self.wrapping_offset(count.cast())
+ }
+
+ #[inline]
+ fn wrapping_sub(self, count: Self::Usize) -> Self {
+ self.wrapping_offset(-count.cast::<isize>())
+ }
+}
diff --git a/library/portable-simd/crates/core_simd/src/elements/mut_ptr.rs b/library/portable-simd/crates/core_simd/src/elements/mut_ptr.rs
new file mode 100644
index 000000000..d87986b4a
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/src/elements/mut_ptr.rs
@@ -0,0 +1,136 @@
+use super::sealed::Sealed;
+use crate::simd::{intrinsics, LaneCount, Mask, Simd, SimdPartialEq, SupportedLaneCount};
+
+/// Operations on SIMD vectors of mutable pointers.
+pub trait SimdMutPtr: Copy + Sealed {
+ /// Vector of `usize` with the same number of lanes.
+ type Usize;
+
+ /// Vector of `isize` with the same number of lanes.
+ type Isize;
+
+ /// Vector of constant pointers to the same type.
+ type ConstPtr;
+
+ /// Mask type used for manipulating this SIMD vector type.
+ type Mask;
+
+ /// Returns `true` for each lane that is null.
+ fn is_null(self) -> Self::Mask;
+
+ /// Changes constness without changing the type.
+ ///
+ /// Equivalent to calling [`pointer::cast_const`] on each lane.
+ fn cast_const(self) -> Self::ConstPtr;
+
+ /// Gets the "address" portion of the pointer.
+ ///
+ /// This method discards pointer semantic metadata, so the result cannot be
+ /// directly cast into a valid pointer.
+ ///
+ /// Equivalent to calling [`pointer::addr`] on each lane.
+ fn addr(self) -> Self::Usize;
+
+ /// Creates a new pointer with the given address.
+ ///
+ /// This performs the same operation as a cast, but copies the *address-space* and
+ /// *provenance* of `self` to the new pointer.
+ ///
+ /// Equivalent to calling [`pointer::with_addr`] on each lane.
+ fn with_addr(self, addr: Self::Usize) -> Self;
+
+ /// Gets the "address" portion of the pointer, and "exposes" the provenance part for future use
+ /// in [`Self::from_exposed_addr`].
+ fn expose_addr(self) -> Self::Usize;
+
+ /// Convert an address back to a pointer, picking up a previously "exposed" provenance.
+ ///
+ /// Equivalent to calling [`core::ptr::from_exposed_addr_mut`] on each lane.
+ fn from_exposed_addr(addr: Self::Usize) -> Self;
+
+ /// Calculates the offset from a pointer using wrapping arithmetic.
+ ///
+ /// Equivalent to calling [`pointer::wrapping_offset`] on each lane.
+ fn wrapping_offset(self, offset: Self::Isize) -> Self;
+
+ /// Calculates the offset from a pointer using wrapping arithmetic.
+ ///
+ /// Equivalent to calling [`pointer::wrapping_add`] on each lane.
+ fn wrapping_add(self, count: Self::Usize) -> Self;
+
+ /// Calculates the offset from a pointer using wrapping arithmetic.
+ ///
+ /// Equivalent to calling [`pointer::wrapping_sub`] on each lane.
+ fn wrapping_sub(self, count: Self::Usize) -> Self;
+}
+
+impl<T, const LANES: usize> Sealed for Simd<*mut T, LANES> where LaneCount<LANES>: SupportedLaneCount
+{}
+
+impl<T, const LANES: usize> SimdMutPtr for Simd<*mut T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+{
+ type Usize = Simd<usize, LANES>;
+ type Isize = Simd<isize, LANES>;
+ type ConstPtr = Simd<*const T, LANES>;
+ type Mask = Mask<isize, LANES>;
+
+ #[inline]
+ fn is_null(self) -> Self::Mask {
+ Simd::splat(core::ptr::null_mut()).simd_eq(self)
+ }
+
+ #[inline]
+ fn cast_const(self) -> Self::ConstPtr {
+ self.cast_ptr()
+ }
+
+ #[inline]
+ fn addr(self) -> Self::Usize {
+ // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
+ // SAFETY: Pointer-to-integer transmutes are valid (if you are okay with losing the
+ // provenance).
+ unsafe { core::mem::transmute_copy(&self) }
+ }
+
+ #[inline]
+ fn with_addr(self, addr: Self::Usize) -> Self {
+ // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
+ //
+ // In the mean-time, this operation is defined to be "as if" it was
+ // a wrapping_offset, so we can emulate it as such. This should properly
+ // restore pointer provenance even under today's compiler.
+ self.cast_ptr::<*mut u8>()
+ .wrapping_offset(addr.cast::<isize>() - self.addr().cast::<isize>())
+ .cast_ptr()
+ }
+
+ #[inline]
+ fn expose_addr(self) -> Self::Usize {
+ // Safety: `self` is a pointer vector
+ unsafe { intrinsics::simd_expose_addr(self) }
+ }
+
+ #[inline]
+ fn from_exposed_addr(addr: Self::Usize) -> Self {
+ // Safety: `self` is a pointer vector
+ unsafe { intrinsics::simd_from_exposed_addr(addr) }
+ }
+
+ #[inline]
+ fn wrapping_offset(self, count: Self::Isize) -> Self {
+ // Safety: simd_arith_offset takes a vector of pointers and a vector of offsets
+ unsafe { intrinsics::simd_arith_offset(self, count) }
+ }
+
+ #[inline]
+ fn wrapping_add(self, count: Self::Usize) -> Self {
+ self.wrapping_offset(count.cast())
+ }
+
+ #[inline]
+ fn wrapping_sub(self, count: Self::Usize) -> Self {
+ self.wrapping_offset(-count.cast::<isize>())
+ }
+}
diff --git a/library/portable-simd/crates/core_simd/src/eq.rs b/library/portable-simd/crates/core_simd/src/eq.rs
index c7111f720..80763c072 100644
--- a/library/portable-simd/crates/core_simd/src/eq.rs
+++ b/library/portable-simd/crates/core_simd/src/eq.rs
@@ -1,4 +1,6 @@
-use crate::simd::{intrinsics, LaneCount, Mask, Simd, SimdElement, SupportedLaneCount};
+use crate::simd::{
+ intrinsics, LaneCount, Mask, Simd, SimdConstPtr, SimdElement, SimdMutPtr, SupportedLaneCount,
+};
/// Parallel `PartialEq`.
pub trait SimdPartialEq {
@@ -71,3 +73,37 @@ macro_rules! impl_mask {
}
impl_mask! { i8, i16, i32, i64, isize }
+
+impl<T, const LANES: usize> SimdPartialEq for Simd<*const T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+{
+ type Mask = Mask<isize, LANES>;
+
+ #[inline]
+ fn simd_eq(self, other: Self) -> Self::Mask {
+ self.addr().simd_eq(other.addr())
+ }
+
+ #[inline]
+ fn simd_ne(self, other: Self) -> Self::Mask {
+ self.addr().simd_ne(other.addr())
+ }
+}
+
+impl<T, const LANES: usize> SimdPartialEq for Simd<*mut T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+{
+ type Mask = Mask<isize, LANES>;
+
+ #[inline]
+ fn simd_eq(self, other: Self) -> Self::Mask {
+ self.addr().simd_eq(other.addr())
+ }
+
+ #[inline]
+ fn simd_ne(self, other: Self) -> Self::Mask {
+ self.addr().simd_ne(other.addr())
+ }
+}
diff --git a/library/portable-simd/crates/core_simd/src/fmt.rs b/library/portable-simd/crates/core_simd/src/fmt.rs
index dbd9839c4..b7317969c 100644
--- a/library/portable-simd/crates/core_simd/src/fmt.rs
+++ b/library/portable-simd/crates/core_simd/src/fmt.rs
@@ -1,39 +1,21 @@
use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount};
use core::fmt;
-macro_rules! impl_fmt_trait {
- { $($trait:ident,)* } => {
- $(
- impl<T, const LANES: usize> fmt::$trait for Simd<T, LANES>
- where
- LaneCount<LANES>: SupportedLaneCount,
- T: SimdElement + fmt::$trait,
- {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- #[repr(transparent)]
- struct Wrapper<'a, T: fmt::$trait>(&'a T);
-
- impl<T: fmt::$trait> fmt::Debug for Wrapper<'_, T> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- self.0.fmt(f)
- }
- }
-
- f.debug_list()
- .entries(self.as_array().iter().map(|x| Wrapper(x)))
- .finish()
- }
- }
- )*
+impl<T, const LANES: usize> fmt::Debug for Simd<T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+ T: SimdElement + fmt::Debug,
+{
+ /// A `Simd<T, N>` has a debug format like the one for `[T]`:
+ /// ```
+ /// # #![feature(portable_simd)]
+ /// # #[cfg(feature = "as_crate")] use core_simd::simd::Simd;
+ /// # #[cfg(not(feature = "as_crate"))] use core::simd::Simd;
+ /// let floats = Simd::<f32, 4>::splat(-1.0);
+ /// assert_eq!(format!("{:?}", [-1.0; 4]), format!("{:?}", floats));
+ /// ```
+ #[inline]
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ <[T] as fmt::Debug>::fmt(self.as_array(), f)
}
}
-
-impl_fmt_trait! {
- Debug,
- Binary,
- LowerExp,
- UpperExp,
- Octal,
- LowerHex,
- UpperHex,
-}
diff --git a/library/portable-simd/crates/core_simd/src/intrinsics.rs b/library/portable-simd/crates/core_simd/src/intrinsics.rs
index 704e6ed01..dd6698e2b 100644
--- a/library/portable-simd/crates/core_simd/src/intrinsics.rs
+++ b/library/portable-simd/crates/core_simd/src/intrinsics.rs
@@ -61,9 +61,6 @@ extern "platform-intrinsic" {
/// xor
pub(crate) fn simd_xor<T>(x: T, y: T) -> T;
- /// getelementptr (without inbounds)
- pub(crate) fn simd_arith_offset<T, U>(ptrs: T, offsets: U) -> T;
-
/// fptoui/fptosi/uitofp/sitofp
/// casting floats to integers is truncating, so it is safe to convert values like e.g. 1.5
/// but the truncated value must fit in the target type or the result is poison.
@@ -150,4 +147,17 @@ extern "platform-intrinsic" {
pub(crate) fn simd_select<M, T>(m: M, yes: T, no: T) -> T;
#[allow(unused)]
pub(crate) fn simd_select_bitmask<M, T>(m: M, yes: T, no: T) -> T;
+
+ /// getelementptr (without inbounds)
+ /// equivalent to wrapping_offset
+ pub(crate) fn simd_arith_offset<T, U>(ptr: T, offset: U) -> T;
+
+ /// equivalent to `T as U` semantics, specifically for pointers
+ pub(crate) fn simd_cast_ptr<T, U>(ptr: T) -> U;
+
+ /// expose a pointer as an address
+ pub(crate) fn simd_expose_addr<T, U>(ptr: T) -> U;
+
+ /// convert an exposed address back to a pointer
+ pub(crate) fn simd_from_exposed_addr<T, U>(addr: T) -> U;
}
diff --git a/library/portable-simd/crates/core_simd/src/lane_count.rs b/library/portable-simd/crates/core_simd/src/lane_count.rs
index 63723e2ec..2b91eb9e8 100644
--- a/library/portable-simd/crates/core_simd/src/lane_count.rs
+++ b/library/portable-simd/crates/core_simd/src/lane_count.rs
@@ -23,24 +23,20 @@ pub trait SupportedLaneCount: Sealed {
impl<const LANES: usize> Sealed for LaneCount<LANES> {}
-impl SupportedLaneCount for LaneCount<1> {
- type BitMask = [u8; 1];
-}
-impl SupportedLaneCount for LaneCount<2> {
- type BitMask = [u8; 1];
-}
-impl SupportedLaneCount for LaneCount<4> {
- type BitMask = [u8; 1];
-}
-impl SupportedLaneCount for LaneCount<8> {
- type BitMask = [u8; 1];
-}
-impl SupportedLaneCount for LaneCount<16> {
- type BitMask = [u8; 2];
-}
-impl SupportedLaneCount for LaneCount<32> {
- type BitMask = [u8; 4];
-}
-impl SupportedLaneCount for LaneCount<64> {
- type BitMask = [u8; 8];
+macro_rules! supported_lane_count {
+ ($($lanes:literal),+) => {
+ $(
+ impl SupportedLaneCount for LaneCount<$lanes> {
+ type BitMask = [u8; ($lanes + 7) / 8];
+ }
+ )+
+ };
}
+
+supported_lane_count!(1, 2, 4, 8, 16, 32, 64);
+#[cfg(feature = "all_lane_counts")]
+supported_lane_count!(
+ 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 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
+);
diff --git a/library/portable-simd/crates/core_simd/src/lib.rs b/library/portable-simd/crates/core_simd/src/lib.rs
index 715f258f6..e5307de21 100644
--- a/library/portable-simd/crates/core_simd/src/lib.rs
+++ b/library/portable-simd/crates/core_simd/src/lib.rs
@@ -1,5 +1,8 @@
#![no_std]
#![feature(
+ const_refs_to_cell,
+ const_maybe_uninit_as_mut_ptr,
+ const_mut_refs,
convert_float_to_int,
decl_macro,
intra_doc_pointers,
@@ -7,7 +10,9 @@
repr_simd,
simd_ffi,
staged_api,
- stdsimd
+ stdsimd,
+ strict_provenance,
+ ptr_metadata
)]
#![cfg_attr(feature = "generic_const_exprs", feature(generic_const_exprs))]
#![cfg_attr(feature = "generic_const_exprs", allow(incomplete_features))]
@@ -19,4 +24,3 @@
#[path = "mod.rs"]
mod core_simd;
pub use self::core_simd::simd;
-pub use simd::*;
diff --git a/library/portable-simd/crates/core_simd/src/masks.rs b/library/portable-simd/crates/core_simd/src/masks.rs
index c36c336d8..e0f3c7bee 100644
--- a/library/portable-simd/crates/core_simd/src/masks.rs
+++ b/library/portable-simd/crates/core_simd/src/masks.rs
@@ -55,6 +55,7 @@ pub unsafe trait MaskElement: SimdElement + Sealed {}
macro_rules! impl_element {
{ $ty:ty } => {
impl Sealed for $ty {
+ #[inline]
fn valid<const LANES: usize>(value: Simd<Self, LANES>) -> bool
where
LaneCount<LANES>: SupportedLaneCount,
@@ -62,6 +63,7 @@ macro_rules! impl_element {
(value.simd_eq(Simd::splat(0 as _)) | value.simd_eq(Simd::splat(-1 as _))).all()
}
+ #[inline]
fn eq(self, other: Self) -> bool { self == other }
const TRUE: Self = -1;
@@ -83,8 +85,10 @@ impl_element! { isize }
///
/// Masks represent boolean inclusion/exclusion on a per-lane basis.
///
-/// The layout of this type is unspecified.
-#[repr(transparent)]
+/// The layout of this type is unspecified, and may change between platforms
+/// and/or Rust versions, and code should not assume that it is equivalent to
+/// `[T; LANES]`.
+#[cfg_attr(not(doc), repr(transparent))] // work around https://github.com/rust-lang/rust/issues/90435
pub struct Mask<T, const LANES: usize>(mask_impl::Mask<T, LANES>)
where
T: MaskElement,
@@ -102,6 +106,7 @@ where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn clone(&self) -> Self {
*self
}
@@ -113,11 +118,13 @@ where
LaneCount<LANES>: SupportedLaneCount,
{
/// Construct a mask by setting all lanes to the given value.
+ #[inline]
pub fn splat(value: bool) -> Self {
Self(mask_impl::Mask::splat(value))
}
/// Converts an array of bools to a SIMD mask.
+ #[inline]
pub fn from_array(array: [bool; LANES]) -> Self {
// SAFETY: Rust's bool has a layout of 1 byte (u8) with a value of
// true: 0b_0000_0001
@@ -134,6 +141,7 @@ where
}
/// Converts a SIMD mask to an array of bools.
+ #[inline]
pub fn to_array(self) -> [bool; LANES] {
// This follows mostly the same logic as from_array.
// SAFETY: Rust's bool has a layout of 1 byte (u8) with a value of
@@ -261,6 +269,7 @@ where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn from(array: [bool; LANES]) -> Self {
Self::from_array(array)
}
@@ -271,6 +280,7 @@ where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn from(vector: Mask<T, LANES>) -> Self {
vector.to_array()
}
@@ -520,60 +530,6 @@ where
}
}
-/// A mask for SIMD vectors with eight elements of 8 bits.
-pub type mask8x8 = Mask<i8, 8>;
-
-/// A mask for SIMD vectors with 16 elements of 8 bits.
-pub type mask8x16 = Mask<i8, 16>;
-
-/// A mask for SIMD vectors with 32 elements of 8 bits.
-pub type mask8x32 = Mask<i8, 32>;
-
-/// A mask for SIMD vectors with 64 elements of 8 bits.
-pub type mask8x64 = Mask<i8, 64>;
-
-/// A mask for SIMD vectors with four elements of 16 bits.
-pub type mask16x4 = Mask<i16, 4>;
-
-/// A mask for SIMD vectors with eight elements of 16 bits.
-pub type mask16x8 = Mask<i16, 8>;
-
-/// A mask for SIMD vectors with 16 elements of 16 bits.
-pub type mask16x16 = Mask<i16, 16>;
-
-/// A mask for SIMD vectors with 32 elements of 16 bits.
-pub type mask16x32 = Mask<i16, 32>;
-
-/// A mask for SIMD vectors with two elements of 32 bits.
-pub type mask32x2 = Mask<i32, 2>;
-
-/// A mask for SIMD vectors with four elements of 32 bits.
-pub type mask32x4 = Mask<i32, 4>;
-
-/// A mask for SIMD vectors with eight elements of 32 bits.
-pub type mask32x8 = Mask<i32, 8>;
-
-/// A mask for SIMD vectors with 16 elements of 32 bits.
-pub type mask32x16 = Mask<i32, 16>;
-
-/// A mask for SIMD vectors with two elements of 64 bits.
-pub type mask64x2 = Mask<i64, 2>;
-
-/// A mask for SIMD vectors with four elements of 64 bits.
-pub type mask64x4 = Mask<i64, 4>;
-
-/// A mask for SIMD vectors with eight elements of 64 bits.
-pub type mask64x8 = Mask<i64, 8>;
-
-/// A mask for SIMD vectors with two elements of pointer width.
-pub type masksizex2 = Mask<isize, 2>;
-
-/// A mask for SIMD vectors with four elements of pointer width.
-pub type masksizex4 = Mask<isize, 4>;
-
-/// A mask for SIMD vectors with eight elements of pointer width.
-pub type masksizex8 = Mask<isize, 8>;
-
macro_rules! impl_from {
{ $from:ty => $($to:ty),* } => {
$(
@@ -581,6 +537,7 @@ macro_rules! impl_from {
where
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn from(value: Mask<$from, LANES>) -> Self {
value.cast()
}
diff --git a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
index 365ecc0a3..20465ba9b 100644
--- a/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
+++ b/library/portable-simd/crates/core_simd/src/masks/bitmask.rs
@@ -26,6 +26,7 @@ where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn clone(&self) -> Self {
*self
}
@@ -36,6 +37,7 @@ where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn eq(&self, other: &Self) -> bool {
self.0.as_ref() == other.0.as_ref()
}
@@ -46,6 +48,7 @@ where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
self.0.as_ref().partial_cmp(other.0.as_ref())
}
@@ -63,6 +66,7 @@ where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.0.as_ref().cmp(other.0.as_ref())
}
diff --git a/library/portable-simd/crates/core_simd/src/masks/full_masks.rs b/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
index b5ba198e5..1d13c45b8 100644
--- a/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
+++ b/library/portable-simd/crates/core_simd/src/masks/full_masks.rs
@@ -37,6 +37,7 @@ where
T: MaskElement + PartialEq,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn eq(&self, other: &Self) -> bool {
self.0.eq(&other.0)
}
@@ -47,6 +48,7 @@ where
T: MaskElement + PartialOrd,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
self.0.partial_cmp(&other.0)
}
@@ -64,6 +66,7 @@ where
T: MaskElement + Ord,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.0.cmp(&other.0)
}
@@ -262,6 +265,7 @@ where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
{
+ #[inline]
fn from(value: Mask<T, LANES>) -> Self {
value.0
}
diff --git a/library/portable-simd/crates/core_simd/src/masks/to_bitmask.rs b/library/portable-simd/crates/core_simd/src/masks/to_bitmask.rs
index 2235f016c..fc7d6b781 100644
--- a/library/portable-simd/crates/core_simd/src/masks/to_bitmask.rs
+++ b/library/portable-simd/crates/core_simd/src/masks/to_bitmask.rs
@@ -48,10 +48,12 @@ macro_rules! impl_integer_intrinsic {
impl<T: MaskElement> ToBitMask for Mask<T, $lanes> {
type BitMask = $int;
+ #[inline]
fn to_bitmask(self) -> $int {
self.0.to_bitmask_integer()
}
+ #[inline]
fn from_bitmask(bitmask: $int) -> Self {
Self(mask_impl::Mask::from_bitmask_integer(bitmask))
}
@@ -83,10 +85,12 @@ where
{
const BYTES: usize = bitmask_len(LANES);
+ #[inline]
fn to_bitmask_array(self) -> [u8; Self::BYTES] {
self.0.to_bitmask_array()
}
+ #[inline]
fn from_bitmask_array(bitmask: [u8; Self::BYTES]) -> Self {
Mask(mask_impl::Mask::from_bitmask_array(bitmask))
}
diff --git a/library/portable-simd/crates/core_simd/src/mod.rs b/library/portable-simd/crates/core_simd/src/mod.rs
index b472aa3ab..35c659b7a 100644
--- a/library/portable-simd/crates/core_simd/src/mod.rs
+++ b/library/portable-simd/crates/core_simd/src/mod.rs
@@ -6,6 +6,8 @@ pub(crate) mod intrinsics;
#[cfg(feature = "generic_const_exprs")]
mod to_bytes;
+mod alias;
+mod cast;
mod elements;
mod eq;
mod fmt;
@@ -15,6 +17,7 @@ mod masks;
mod ops;
mod ord;
mod select;
+mod swizzle_dyn;
mod vector;
mod vendor;
@@ -22,11 +25,14 @@ mod vendor;
pub mod simd {
pub(crate) use crate::core_simd::intrinsics;
+ pub use crate::core_simd::alias::*;
+ pub use crate::core_simd::cast::*;
pub use crate::core_simd::elements::*;
pub use crate::core_simd::eq::*;
pub use crate::core_simd::lane_count::{LaneCount, SupportedLaneCount};
pub use crate::core_simd::masks::*;
pub use crate::core_simd::ord::*;
pub use crate::core_simd::swizzle::*;
+ pub use crate::core_simd::swizzle_dyn::*;
pub use crate::core_simd::vector::*;
}
diff --git a/library/portable-simd/crates/core_simd/src/ops/deref.rs b/library/portable-simd/crates/core_simd/src/ops/deref.rs
index 9883a74c9..302bf148b 100644
--- a/library/portable-simd/crates/core_simd/src/ops/deref.rs
+++ b/library/portable-simd/crates/core_simd/src/ops/deref.rs
@@ -71,7 +71,7 @@ macro_rules! deref_ops {
#[inline]
#[must_use = "operator returns a new vector without mutating the inputs"]
- fn $call(self, rhs: &$simd) -> Self::Output {
+ fn $call(self, rhs: &'rhs $simd) -> Self::Output {
(*self).$call(*rhs)
}
}
diff --git a/library/portable-simd/crates/core_simd/src/ord.rs b/library/portable-simd/crates/core_simd/src/ord.rs
index 9a87bc2e3..1ae9cd061 100644
--- a/library/portable-simd/crates/core_simd/src/ord.rs
+++ b/library/portable-simd/crates/core_simd/src/ord.rs
@@ -1,4 +1,6 @@
-use crate::simd::{intrinsics, LaneCount, Mask, Simd, SimdPartialEq, SupportedLaneCount};
+use crate::simd::{
+ intrinsics, LaneCount, Mask, Simd, SimdConstPtr, SimdMutPtr, SimdPartialEq, SupportedLaneCount,
+};
/// Parallel `PartialOrd`.
pub trait SimdPartialOrd: SimdPartialEq {
@@ -211,3 +213,101 @@ macro_rules! impl_mask {
}
impl_mask! { i8, i16, i32, i64, isize }
+
+impl<T, const LANES: usize> SimdPartialOrd for Simd<*const T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+{
+ #[inline]
+ fn simd_lt(self, other: Self) -> Self::Mask {
+ self.addr().simd_lt(other.addr())
+ }
+
+ #[inline]
+ fn simd_le(self, other: Self) -> Self::Mask {
+ self.addr().simd_le(other.addr())
+ }
+
+ #[inline]
+ fn simd_gt(self, other: Self) -> Self::Mask {
+ self.addr().simd_gt(other.addr())
+ }
+
+ #[inline]
+ fn simd_ge(self, other: Self) -> Self::Mask {
+ self.addr().simd_ge(other.addr())
+ }
+}
+
+impl<T, const LANES: usize> SimdOrd for Simd<*const T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+{
+ #[inline]
+ fn simd_max(self, other: Self) -> Self {
+ self.simd_lt(other).select(other, self)
+ }
+
+ #[inline]
+ fn simd_min(self, other: Self) -> Self {
+ self.simd_gt(other).select(other, self)
+ }
+
+ #[inline]
+ fn simd_clamp(self, min: Self, max: Self) -> Self {
+ assert!(
+ min.simd_le(max).all(),
+ "each lane in `min` must be less than or equal to the corresponding lane in `max`",
+ );
+ self.simd_max(min).simd_min(max)
+ }
+}
+
+impl<T, const LANES: usize> SimdPartialOrd for Simd<*mut T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+{
+ #[inline]
+ fn simd_lt(self, other: Self) -> Self::Mask {
+ self.addr().simd_lt(other.addr())
+ }
+
+ #[inline]
+ fn simd_le(self, other: Self) -> Self::Mask {
+ self.addr().simd_le(other.addr())
+ }
+
+ #[inline]
+ fn simd_gt(self, other: Self) -> Self::Mask {
+ self.addr().simd_gt(other.addr())
+ }
+
+ #[inline]
+ fn simd_ge(self, other: Self) -> Self::Mask {
+ self.addr().simd_ge(other.addr())
+ }
+}
+
+impl<T, const LANES: usize> SimdOrd for Simd<*mut T, LANES>
+where
+ LaneCount<LANES>: SupportedLaneCount,
+{
+ #[inline]
+ fn simd_max(self, other: Self) -> Self {
+ self.simd_lt(other).select(other, self)
+ }
+
+ #[inline]
+ fn simd_min(self, other: Self) -> Self {
+ self.simd_gt(other).select(other, self)
+ }
+
+ #[inline]
+ fn simd_clamp(self, min: Self, max: Self) -> Self {
+ assert!(
+ min.simd_le(max).all(),
+ "each lane in `min` must be less than or equal to the corresponding lane in `max`",
+ );
+ self.simd_max(min).simd_min(max)
+ }
+}
diff --git a/library/portable-simd/crates/core_simd/src/swizzle.rs b/library/portable-simd/crates/core_simd/src/swizzle.rs
index 22999d249..68f20516c 100644
--- a/library/portable-simd/crates/core_simd/src/swizzle.rs
+++ b/library/portable-simd/crates/core_simd/src/swizzle.rs
@@ -265,16 +265,13 @@ where
/// Interleave two vectors.
///
- /// Produces two vectors with lanes taken alternately from `self` and `other`.
+ /// The resulting vectors contain lanes taken alternatively from `self` and `other`, first
+ /// filling the first result, and then the second.
///
- /// The first result contains the first `LANES / 2` lanes from `self` and `other`,
- /// alternating, starting with the first lane of `self`.
- ///
- /// The second result contains the last `LANES / 2` lanes from `self` and `other`,
- /// alternating, starting with the lane `LANES / 2` from the start of `self`.
+ /// The reverse of this operation is [`Simd::deinterleave`].
///
/// ```
- /// #![feature(portable_simd)]
+ /// # #![feature(portable_simd)]
/// # use core::simd::Simd;
/// let a = Simd::from_array([0, 1, 2, 3]);
/// let b = Simd::from_array([4, 5, 6, 7]);
@@ -285,29 +282,17 @@ where
#[inline]
#[must_use = "method returns a new vector and does not mutate the original inputs"]
pub fn interleave(self, other: Self) -> (Self, Self) {
- const fn lo<const LANES: usize>() -> [Which; LANES] {
- let mut idx = [Which::First(0); LANES];
- let mut i = 0;
- while i < LANES {
- let offset = i / 2;
- idx[i] = if i % 2 == 0 {
- Which::First(offset)
- } else {
- Which::Second(offset)
- };
- i += 1;
- }
- idx
- }
- const fn hi<const LANES: usize>() -> [Which; LANES] {
+ const fn interleave<const LANES: usize>(high: bool) -> [Which; LANES] {
let mut idx = [Which::First(0); LANES];
let mut i = 0;
while i < LANES {
- let offset = (LANES + i) / 2;
- idx[i] = if i % 2 == 0 {
- Which::First(offset)
+ // Treat the source as a concatenated vector
+ let dst_index = if high { i + LANES } else { i };
+ let src_index = dst_index / 2 + (dst_index % 2) * LANES;
+ idx[i] = if src_index < LANES {
+ Which::First(src_index)
} else {
- Which::Second(offset)
+ Which::Second(src_index % LANES)
};
i += 1;
}
@@ -318,11 +303,11 @@ where
struct Hi;
impl<const LANES: usize> Swizzle2<LANES, LANES> for Lo {
- const INDEX: [Which; LANES] = lo::<LANES>();
+ const INDEX: [Which; LANES] = interleave::<LANES>(false);
}
impl<const LANES: usize> Swizzle2<LANES, LANES> for Hi {
- const INDEX: [Which; LANES] = hi::<LANES>();
+ const INDEX: [Which; LANES] = interleave::<LANES>(true);
}
(Lo::swizzle2(self, other), Hi::swizzle2(self, other))
@@ -336,8 +321,10 @@ where
/// The second result takes every other lane of `self` and then `other`, starting with
/// the second lane.
///
+ /// The reverse of this operation is [`Simd::interleave`].
+ ///
/// ```
- /// #![feature(portable_simd)]
+ /// # #![feature(portable_simd)]
/// # use core::simd::Simd;
/// let a = Simd::from_array([0, 4, 1, 5]);
/// let b = Simd::from_array([2, 6, 3, 7]);
@@ -348,22 +335,17 @@ where
#[inline]
#[must_use = "method returns a new vector and does not mutate the original inputs"]
pub fn deinterleave(self, other: Self) -> (Self, Self) {
- const fn even<const LANES: usize>() -> [Which; LANES] {
- let mut idx = [Which::First(0); LANES];
- let mut i = 0;
- while i < LANES / 2 {
- idx[i] = Which::First(2 * i);
- idx[i + LANES / 2] = Which::Second(2 * i);
- i += 1;
- }
- idx
- }
- const fn odd<const LANES: usize>() -> [Which; LANES] {
+ const fn deinterleave<const LANES: usize>(second: bool) -> [Which; LANES] {
let mut idx = [Which::First(0); LANES];
let mut i = 0;
- while i < LANES / 2 {
- idx[i] = Which::First(2 * i + 1);
- idx[i + LANES / 2] = Which::Second(2 * i + 1);
+ while i < LANES {
+ // Treat the source as a concatenated vector
+ let src_index = i * 2 + second as usize;
+ idx[i] = if src_index < LANES {
+ Which::First(src_index)
+ } else {
+ Which::Second(src_index % LANES)
+ };
i += 1;
}
idx
@@ -373,11 +355,11 @@ where
struct Odd;
impl<const LANES: usize> Swizzle2<LANES, LANES> for Even {
- const INDEX: [Which; LANES] = even::<LANES>();
+ const INDEX: [Which; LANES] = deinterleave::<LANES>(false);
}
impl<const LANES: usize> Swizzle2<LANES, LANES> for Odd {
- const INDEX: [Which; LANES] = odd::<LANES>();
+ const INDEX: [Which; LANES] = deinterleave::<LANES>(true);
}
(Even::swizzle2(self, other), Odd::swizzle2(self, other))
diff --git a/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs b/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs
new file mode 100644
index 000000000..6065d6459
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs
@@ -0,0 +1,157 @@
+use crate::simd::{LaneCount, Simd, SupportedLaneCount};
+use core::mem;
+
+impl<const N: usize> Simd<u8, N>
+where
+ LaneCount<N>: SupportedLaneCount,
+{
+ /// Swizzle a vector of bytes according to the index vector.
+ /// Indices within range select the appropriate byte.
+ /// Indices "out of bounds" instead select 0.
+ ///
+ /// Note that the current implementation is selected during build-time
+ /// of the standard library, so `cargo build -Zbuild-std` may be necessary
+ /// to unlock better performance, especially for larger vectors.
+ /// A planned compiler improvement will enable using `#[target_feature]` instead.
+ #[inline]
+ pub fn swizzle_dyn(self, idxs: Simd<u8, N>) -> Self {
+ #![allow(unused_imports, unused_unsafe)]
+ #[cfg(target_arch = "aarch64")]
+ use core::arch::aarch64::{uint8x8_t, vqtbl1q_u8, vtbl1_u8};
+ #[cfg(all(target_arch = "arm", target_feature = "v7", target_feature = "neon"))]
+ use core::arch::arm::{uint8x8_t, vtbl1_u8};
+ #[cfg(target_arch = "wasm32")]
+ use core::arch::wasm32 as wasm;
+ #[cfg(target_arch = "x86")]
+ use core::arch::x86;
+ #[cfg(target_arch = "x86_64")]
+ use core::arch::x86_64 as x86;
+ // SAFETY: Intrinsics covered by cfg
+ unsafe {
+ match N {
+ #[cfg(target_feature = "neon")]
+ 8 => transize(vtbl1_u8, self, idxs),
+ #[cfg(target_feature = "ssse3")]
+ 16 => transize(x86::_mm_shuffle_epi8, self, idxs),
+ #[cfg(target_feature = "simd128")]
+ 16 => transize(wasm::i8x16_swizzle, self, idxs),
+ #[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
+ 16 => transize(vqtbl1q_u8, self, idxs),
+ #[cfg(all(target_feature = "avx2", not(target_feature = "avx512vbmi")))]
+ 32 => transize_raw(avx2_pshufb, self, idxs),
+ #[cfg(target_feature = "avx512vl,avx512vbmi")]
+ 32 => transize(x86::_mm256_permutexvar_epi8, self, idxs),
+ // Notable absence: avx512bw shuffle
+ // If avx512bw is available, odds of avx512vbmi are good
+ // FIXME: initial AVX512VBMI variant didn't actually pass muster
+ // #[cfg(target_feature = "avx512vbmi")]
+ // 64 => transize(x86::_mm512_permutexvar_epi8, self, idxs),
+ _ => {
+ let mut array = [0; N];
+ for (i, k) in idxs.to_array().into_iter().enumerate() {
+ if (k as usize) < N {
+ array[i] = self[k as usize];
+ };
+ }
+ array.into()
+ }
+ }
+ }
+ }
+}
+
+/// "vpshufb like it was meant to be" on AVX2
+///
+/// # Safety
+/// This requires AVX2 to work
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+#[target_feature(enable = "avx2")]
+#[allow(unused)]
+#[inline]
+#[allow(clippy::let_and_return)]
+unsafe fn avx2_pshufb(bytes: Simd<u8, 32>, idxs: Simd<u8, 32>) -> Simd<u8, 32> {
+ use crate::simd::SimdPartialOrd;
+ #[cfg(target_arch = "x86")]
+ use core::arch::x86;
+ #[cfg(target_arch = "x86_64")]
+ use core::arch::x86_64 as x86;
+ use x86::_mm256_permute2x128_si256 as avx2_cross_shuffle;
+ use x86::_mm256_shuffle_epi8 as avx2_half_pshufb;
+ let mid = Simd::splat(16u8);
+ let high = mid + mid;
+ // SAFETY: Caller promised AVX2
+ unsafe {
+ // This is ordering sensitive, and LLVM will order these how you put them.
+ // Most AVX2 impls use ~5 "ports", and only 1 or 2 are capable of permutes.
+ // But the "compose" step will lower to ops that can also use at least 1 other port.
+ // So this tries to break up permutes so composition flows through "open" ports.
+ // Comparative benches should be done on multiple AVX2 CPUs before reordering this
+
+ let hihi = avx2_cross_shuffle::<0x11>(bytes.into(), bytes.into());
+ let hi_shuf = Simd::from(avx2_half_pshufb(
+ hihi, // duplicate the vector's top half
+ idxs.into(), // so that using only 4 bits of an index still picks bytes 16-31
+ ));
+ // A zero-fill during the compose step gives the "all-Neon-like" OOB-is-0 semantics
+ let compose = idxs.simd_lt(high).select(hi_shuf, Simd::splat(0));
+ let lolo = avx2_cross_shuffle::<0x00>(bytes.into(), bytes.into());
+ let lo_shuf = Simd::from(avx2_half_pshufb(lolo, idxs.into()));
+ // Repeat, then pick indices < 16, overwriting indices 0-15 from previous compose step
+ let compose = idxs.simd_lt(mid).select(lo_shuf, compose);
+ compose
+ }
+}
+
+/// This sets up a call to an architecture-specific function, and in doing so
+/// it persuades rustc that everything is the correct size. Which it is.
+/// This would not be needed if one could convince Rust that, by matching on N,
+/// N is that value, and thus it would be valid to substitute e.g. 16.
+///
+/// # Safety
+/// The correctness of this function hinges on the sizes agreeing in actuality.
+#[allow(dead_code)]
+#[inline(always)]
+unsafe fn transize<T, const N: usize>(
+ f: unsafe fn(T, T) -> T,
+ bytes: Simd<u8, N>,
+ idxs: Simd<u8, N>,
+) -> Simd<u8, N>
+where
+ LaneCount<N>: SupportedLaneCount,
+{
+ let idxs = zeroing_idxs(idxs);
+ // SAFETY: Same obligation to use this function as to use mem::transmute_copy.
+ unsafe { mem::transmute_copy(&f(mem::transmute_copy(&bytes), mem::transmute_copy(&idxs))) }
+}
+
+/// Make indices that yield 0 for this architecture
+#[inline(always)]
+fn zeroing_idxs<const N: usize>(idxs: Simd<u8, N>) -> Simd<u8, N>
+where
+ LaneCount<N>: SupportedLaneCount,
+{
+ // On x86, make sure the top bit is set.
+ #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+ let idxs = {
+ use crate::simd::SimdPartialOrd;
+ idxs.simd_lt(Simd::splat(N as u8))
+ .select(idxs, Simd::splat(u8::MAX))
+ };
+ // Simply do nothing on most architectures.
+ idxs
+}
+
+/// As transize but no implicit call to `zeroing_idxs`.
+#[allow(dead_code)]
+#[inline(always)]
+unsafe fn transize_raw<T, const N: usize>(
+ f: unsafe fn(T, T) -> T,
+ bytes: Simd<u8, N>,
+ idxs: Simd<u8, N>,
+) -> Simd<u8, N>
+where
+ LaneCount<N>: SupportedLaneCount,
+{
+ // SAFETY: Same obligation to use this function as to use mem::transmute_copy.
+ unsafe { mem::transmute_copy(&f(mem::transmute_copy(&bytes), mem::transmute_copy(&idxs))) }
+}
diff --git a/library/portable-simd/crates/core_simd/src/vector.rs b/library/portable-simd/crates/core_simd/src/vector.rs
index d52d1ac4d..3809cc961 100644
--- a/library/portable-simd/crates/core_simd/src/vector.rs
+++ b/library/portable-simd/crates/core_simd/src/vector.rs
@@ -1,60 +1,63 @@
-mod float;
-mod int;
-mod uint;
-
-pub use float::*;
-pub use int::*;
-pub use uint::*;
-
-// Vectors of pointers are not for public use at the current time.
-pub(crate) mod ptr;
-
use crate::simd::{
- intrinsics, LaneCount, Mask, MaskElement, SimdPartialOrd, SupportedLaneCount, Swizzle,
+ intrinsics, LaneCount, Mask, MaskElement, SimdCast, SimdCastPtr, SimdConstPtr, SimdMutPtr,
+ SimdPartialOrd, SupportedLaneCount, Swizzle,
};
+use core::convert::{TryFrom, TryInto};
-/// A SIMD vector of `LANES` elements of type `T`. `Simd<T, N>` has the same shape as [`[T; N]`](array), but operates like `T`.
+/// A SIMD vector with the shape of `[T; N]` but the operations of `T`.
///
-/// Two vectors of the same type and length will, by convention, support the operators (+, *, etc.) that `T` does.
-/// These take the lanes at each index on the left-hand side and right-hand side, perform the operation,
-/// and return the result in the same lane in a vector of equal size. For a given operator, this is equivalent to zipping
-/// the two arrays together and mapping the operator over each lane.
+/// `Simd<T, N>` supports the operators (+, *, etc.) that `T` does in "elementwise" fashion.
+/// These take the element at each index from the left-hand side and right-hand side,
+/// perform the operation, then return the result in the same index in a vector of equal size.
+/// However, `Simd` differs from normal iteration and normal arrays:
+/// - `Simd<T, N>` executes `N` operations in a single step with no `break`s
+/// - `Simd<T, N>` can have an alignment greater than `T`, for better mechanical sympathy
+///
+/// By always imposing these constraints on `Simd`, it is easier to compile elementwise operations
+/// into machine instructions that can themselves be executed in parallel.
///
/// ```rust
-/// # #![feature(array_zip, portable_simd)]
+/// # #![feature(portable_simd)]
/// # use core::simd::{Simd};
-/// let a0: [i32; 4] = [-2, 0, 2, 4];
-/// let a1 = [10, 9, 8, 7];
-/// let zm_add = a0.zip(a1).map(|(lhs, rhs)| lhs + rhs);
-/// let zm_mul = a0.zip(a1).map(|(lhs, rhs)| lhs * rhs);
+/// # use core::array;
+/// let a: [i32; 4] = [-2, 0, 2, 4];
+/// let b = [10, 9, 8, 7];
+/// let sum = array::from_fn(|i| a[i] + b[i]);
+/// let prod = array::from_fn(|i| a[i] * b[i]);
///
/// // `Simd<T, N>` implements `From<[T; N]>`
-/// let (v0, v1) = (Simd::from(a0), Simd::from(a1));
+/// let (v, w) = (Simd::from(a), Simd::from(b));
/// // Which means arrays implement `Into<Simd<T, N>>`.
-/// assert_eq!(v0 + v1, zm_add.into());
-/// assert_eq!(v0 * v1, zm_mul.into());
+/// assert_eq!(v + w, sum.into());
+/// assert_eq!(v * w, prod.into());
/// ```
///
-/// `Simd` with integers has the quirk that these operations are also inherently wrapping, as if `T` was [`Wrapping<T>`].
+///
+/// `Simd` with integer elements treats operators as wrapping, as if `T` was [`Wrapping<T>`].
/// Thus, `Simd` does not implement `wrapping_add`, because that is the default behavior.
/// This means there is no warning on overflows, even in "debug" builds.
/// For most applications where `Simd` is appropriate, it is "not a bug" to wrap,
/// and even "debug builds" are unlikely to tolerate the loss of performance.
/// You may want to consider using explicitly checked arithmetic if such is required.
-/// Division by zero still causes a panic, so you may want to consider using floating point numbers if that is unacceptable.
+/// Division by zero on integers still causes a panic, so
+/// you may want to consider using `f32` or `f64` if that is unacceptable.
///
/// [`Wrapping<T>`]: core::num::Wrapping
///
/// # Layout
-/// `Simd<T, N>` has a layout similar to `[T; N]` (identical "shapes"), but with a greater alignment.
+/// `Simd<T, N>` has a layout similar to `[T; N]` (identical "shapes"), with a greater alignment.
/// `[T; N]` is aligned to `T`, but `Simd<T, N>` will have an alignment based on both `T` and `N`.
-/// It is thus sound to [`transmute`] `Simd<T, N>` to `[T; N]`, and will typically optimize to zero cost,
-/// but the reverse transmutation is more likely to require a copy the compiler cannot simply elide.
+/// Thus it is sound to [`transmute`] `Simd<T, N>` to `[T; N]` and should optimize to "zero cost",
+/// but the reverse transmutation may require a copy the compiler cannot simply elide.
///
/// # ABI "Features"
-/// Due to Rust's safety guarantees, `Simd<T, N>` is currently passed to and from functions via memory, not SIMD registers,
-/// except as an optimization. `#[inline]` hints are recommended on functions that accept `Simd<T, N>` or return it.
-/// The need for this may be corrected in the future.
+/// Due to Rust's safety guarantees, `Simd<T, N>` is currently passed and returned via memory,
+/// not SIMD registers, except as an optimization. Using `#[inline]` on functions that accept
+/// `Simd<T, N>` or return it is recommended, at the cost of code generation time, as
+/// inlining SIMD-using functions can omit a large function prolog or epilog and thus
+/// improve both speed and code size. The need for this may be corrected in the future.
+///
+/// Using `#[inline(always)]` still requires additional care.
///
/// # Safe SIMD with Unsafe Rust
///
@@ -65,18 +68,22 @@ use crate::simd::{
/// Thus, when using `unsafe` Rust to read and write `Simd<T, N>` through [raw pointers], it is a good idea to first try with
/// [`read_unaligned`] and [`write_unaligned`]. This is because:
/// - [`read`] and [`write`] require full alignment (in this case, `Simd<T, N>`'s alignment)
-/// - the likely source for reading or destination for writing `Simd<T, N>` is [`[T]`](slice) and similar types, aligned to `T`
-/// - combining these actions would violate the `unsafe` contract and explode the program into a puff of **undefined behavior**
-/// - the compiler can implicitly adjust layouts to make unaligned reads or writes fully aligned if it sees the optimization
-/// - most contemporary processors suffer no performance penalty for "unaligned" reads and writes that are aligned at runtime
+/// - `Simd<T, N>` is often read from or written to [`[T]`](slice) and other types aligned to `T`
+/// - combining these actions violates the `unsafe` contract and explodes the program into
+/// a puff of **undefined behavior**
+/// - the compiler can implicitly adjust layouts to make unaligned reads or writes fully aligned
+/// if it sees the optimization
+/// - most contemporary processors with "aligned" and "unaligned" read and write instructions
+/// exhibit no performance difference if the "unaligned" variant is aligned at runtime
///
-/// By imposing less obligations, unaligned functions are less likely to make the program unsound,
+/// Less obligations mean unaligned reads and writes are less likely to make the program unsound,
/// and may be just as fast as stricter alternatives.
-/// When trying to guarantee alignment, [`[T]::as_simd`][as_simd] is an option for converting `[T]` to `[Simd<T, N>]`,
-/// and allows soundly operating on an aligned SIMD body, but it may cost more time when handling the scalar head and tail.
-/// If these are not sufficient, then it is most ideal to design data structures to be already aligned
-/// to the `Simd<T, N>` you wish to use before using `unsafe` Rust to read or write.
-/// More conventional ways to compensate for these facts, like materializing `Simd` to or from an array first,
+/// When trying to guarantee alignment, [`[T]::as_simd`][as_simd] is an option for
+/// converting `[T]` to `[Simd<T, N>]`, and allows soundly operating on an aligned SIMD body,
+/// but it may cost more time when handling the scalar head and tail.
+/// If these are not enough, it is most ideal to design data structures to be already aligned
+/// to `mem::align_of::<Simd<T, N>>()` before using `unsafe` Rust to read or write.
+/// Other ways to compensate for these facts, like materializing `Simd` to or from an array first,
/// are handled by safe methods like [`Simd::from_array`] and [`Simd::from_slice`].
///
/// [`transmute`]: core::mem::transmute
@@ -86,21 +93,26 @@ use crate::simd::{
/// [`read`]: pointer::read
/// [`write`]: pointer::write
/// [as_simd]: slice::as_simd
+//
+// NOTE: Accessing the inner array directly in any way (e.g. by using the `.0` field syntax) or
+// directly constructing an instance of the type (i.e. `let vector = Simd(array)`) should be
+// avoided, as it will likely become illegal on `#[repr(simd)]` structs in the future. It also
+// causes rustc to emit illegal LLVM IR in some cases.
#[repr(simd)]
-pub struct Simd<T, const LANES: usize>([T; LANES])
+pub struct Simd<T, const N: usize>([T; N])
where
- T: SimdElement,
- LaneCount<LANES>: SupportedLaneCount;
+ LaneCount<N>: SupportedLaneCount,
+ T: SimdElement;
-impl<T, const LANES: usize> Simd<T, LANES>
+impl<T, const N: usize> Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
{
- /// Number of lanes in this vector.
- pub const LANES: usize = LANES;
+ /// Number of elements in this vector.
+ pub const LANES: usize = N;
- /// Returns the number of lanes in this SIMD vector.
+ /// Returns the number of elements in this SIMD vector.
///
/// # Examples
///
@@ -111,10 +123,10 @@ where
/// assert_eq!(v.lanes(), 4);
/// ```
pub const fn lanes(&self) -> usize {
- LANES
+ Self::LANES
}
- /// Constructs a new SIMD vector with all lanes set to the given value.
+ /// Constructs a new SIMD vector with all elements set to the given value.
///
/// # Examples
///
@@ -125,11 +137,11 @@ where
/// assert_eq!(v.as_array(), &[8, 8, 8, 8]);
/// ```
pub fn splat(value: T) -> Self {
- // This is preferred over `[value; LANES]`, since it's explicitly a splat:
+ // This is preferred over `[value; N]`, since it's explicitly a splat:
// https://github.com/rust-lang/rust/issues/97804
struct Splat;
- impl<const LANES: usize> Swizzle<1, LANES> for Splat {
- const INDEX: [usize; LANES] = [0; LANES];
+ impl<const N: usize> Swizzle<1, N> for Splat {
+ const INDEX: [usize; N] = [0; N];
}
Splat::swizzle(Simd::<T, 1>::from([value]))
}
@@ -144,32 +156,100 @@ where
/// let v: u64x4 = Simd::from_array([0, 1, 2, 3]);
/// assert_eq!(v.as_array(), &[0, 1, 2, 3]);
/// ```
- pub const fn as_array(&self) -> &[T; LANES] {
- &self.0
+ pub const fn as_array(&self) -> &[T; N] {
+ // SAFETY: `Simd<T, N>` is just an overaligned `[T; N]` with
+ // potential padding at the end, so pointer casting to a
+ // `&[T; N]` is safe.
+ //
+ // NOTE: This deliberately doesn't just use `&self.0`, see the comment
+ // on the struct definition for details.
+ unsafe { &*(self as *const Self as *const [T; N]) }
}
/// Returns a mutable array reference containing the entire SIMD vector.
- pub fn as_mut_array(&mut self) -> &mut [T; LANES] {
- &mut self.0
+ pub fn as_mut_array(&mut self) -> &mut [T; N] {
+ // SAFETY: `Simd<T, N>` is just an overaligned `[T; N]` with
+ // potential padding at the end, so pointer casting to a
+ // `&mut [T; N]` is safe.
+ //
+ // NOTE: This deliberately doesn't just use `&mut self.0`, see the comment
+ // on the struct definition for details.
+ unsafe { &mut *(self as *mut Self as *mut [T; N]) }
+ }
+
+ /// Load a vector from an array of `T`.
+ ///
+ /// This function is necessary since `repr(simd)` has padding for non-power-of-2 vectors (at the time of writing).
+ /// With padding, `read_unaligned` will read past the end of an array of N elements.
+ ///
+ /// # Safety
+ /// Reading `ptr` must be safe, as if by `<*const [T; N]>::read_unaligned`.
+ const unsafe fn load(ptr: *const [T; N]) -> Self {
+ // There are potentially simpler ways to write this function, but this should result in
+ // LLVM `load <N x T>`
+
+ let mut tmp = core::mem::MaybeUninit::<Self>::uninit();
+ // SAFETY: `Simd<T, N>` always contains `N` elements of type `T`. It may have padding
+ // which does not need to be initialized. The safety of reading `ptr` is ensured by the
+ // caller.
+ unsafe {
+ core::ptr::copy_nonoverlapping(ptr, tmp.as_mut_ptr().cast(), 1);
+ tmp.assume_init()
+ }
+ }
+
+ /// Store a vector to an array of `T`.
+ ///
+ /// See `load` as to why this function is necessary.
+ ///
+ /// # Safety
+ /// Writing to `ptr` must be safe, as if by `<*mut [T; N]>::write_unaligned`.
+ const unsafe fn store(self, ptr: *mut [T; N]) {
+ // There are potentially simpler ways to write this function, but this should result in
+ // LLVM `store <N x T>`
+
+ // Creating a temporary helps LLVM turn the memcpy into a store.
+ let tmp = self;
+ // SAFETY: `Simd<T, N>` always contains `N` elements of type `T`. The safety of writing
+ // `ptr` is ensured by the caller.
+ unsafe { core::ptr::copy_nonoverlapping(tmp.as_array(), ptr, 1) }
}
/// Converts an array to a SIMD vector.
- pub const fn from_array(array: [T; LANES]) -> Self {
- Self(array)
+ pub const fn from_array(array: [T; N]) -> Self {
+ // SAFETY: `&array` is safe to read.
+ //
+ // FIXME: We currently use a pointer load instead of `transmute_copy` because `repr(simd)`
+ // results in padding for non-power-of-2 vectors (so vectors are larger than arrays).
+ //
+ // NOTE: This deliberately doesn't just use `Self(array)`, see the comment
+ // on the struct definition for details.
+ unsafe { Self::load(&array) }
}
/// Converts a SIMD vector to an array.
- pub const fn to_array(self) -> [T; LANES] {
- self.0
+ pub const fn to_array(self) -> [T; N] {
+ let mut tmp = core::mem::MaybeUninit::uninit();
+ // SAFETY: writing to `tmp` is safe and initializes it.
+ //
+ // FIXME: We currently use a pointer store instead of `transmute_copy` because `repr(simd)`
+ // results in padding for non-power-of-2 vectors (so vectors are larger than arrays).
+ //
+ // NOTE: This deliberately doesn't just use `self.0`, see the comment
+ // on the struct definition for details.
+ unsafe {
+ self.store(tmp.as_mut_ptr());
+ tmp.assume_init()
+ }
}
- /// Converts a slice to a SIMD vector containing `slice[..LANES]`.
+ /// Converts a slice to a SIMD vector containing `slice[..N]`.
///
/// # Panics
///
- /// Panics if the slice's length is less than the vector's `Simd::LANES`.
+ /// Panics if the slice's length is less than the vector's `Simd::N`.
///
- /// # Examples
+ /// # Example
///
/// ```
/// # #![feature(portable_simd)]
@@ -180,22 +260,49 @@ where
/// ```
#[must_use]
pub const fn from_slice(slice: &[T]) -> Self {
- assert!(slice.len() >= LANES, "slice length must be at least the number of lanes");
- let mut array = [slice[0]; LANES];
- let mut i = 0;
- while i < LANES {
- array[i] = slice[i];
- i += 1;
- }
- Self(array)
+ assert!(
+ slice.len() >= Self::LANES,
+ "slice length must be at least the number of elements"
+ );
+ // SAFETY: We just checked that the slice contains
+ // at least `N` elements.
+ unsafe { Self::load(slice.as_ptr().cast()) }
+ }
+
+ /// Writes a SIMD vector to the first `N` elements of a slice.
+ ///
+ /// # Panics
+ ///
+ /// Panics if the slice's length is less than the vector's `Simd::N`.
+ ///
+ /// # Example
+ ///
+ /// ```
+ /// # #![feature(portable_simd)]
+ /// # #[cfg(feature = "as_crate")] use core_simd::simd;
+ /// # #[cfg(not(feature = "as_crate"))] use core::simd;
+ /// # use simd::u32x4;
+ /// let mut dest = vec![0; 6];
+ /// let v = u32x4::from_array([1, 2, 3, 4]);
+ /// v.copy_to_slice(&mut dest);
+ /// assert_eq!(&dest, &[1, 2, 3, 4, 0, 0]);
+ /// ```
+ pub fn copy_to_slice(self, slice: &mut [T]) {
+ assert!(
+ slice.len() >= Self::LANES,
+ "slice length must be at least the number of elements"
+ );
+ // SAFETY: We just checked that the slice contains
+ // at least `N` elements.
+ unsafe { self.store(slice.as_mut_ptr().cast()) }
}
- /// Performs lanewise conversion of a SIMD vector's elements to another SIMD-valid type.
+ /// Performs elementwise conversion of a SIMD vector's elements to another SIMD-valid type.
///
- /// This follows the semantics of Rust's `as` conversion for casting
- /// integers to unsigned integers (interpreting as the other type, so `-1` to `MAX`),
- /// and from floats to integers (truncating, or saturating at the limits) for each lane,
- /// or vice versa.
+ /// This follows the semantics of Rust's `as` conversion for casting integers between
+ /// signed and unsigned (interpreting integers as 2s complement, so `-1` to `U::MAX` and
+ /// `1 << (U::BITS -1)` becoming `I::MIN` ), and from floats to integers (truncating,
+ /// or saturating at the limits) for each element.
///
/// # Examples
/// ```
@@ -215,11 +322,26 @@ where
/// ```
#[must_use]
#[inline]
- pub fn cast<U: SimdElement>(self) -> Simd<U, LANES> {
- // Safety: The input argument is a vector of a valid SIMD element type.
+ pub fn cast<U: SimdCast>(self) -> Simd<U, N>
+ where
+ T: SimdCast,
+ {
+ // Safety: supported types are guaranteed by SimdCast
unsafe { intrinsics::simd_as(self) }
}
+ /// Casts a vector of pointers to another pointer type.
+ #[must_use]
+ #[inline]
+ pub fn cast_ptr<U>(self) -> Simd<U, N>
+ where
+ T: SimdCastPtr<U>,
+ U: SimdElement,
+ {
+ // Safety: supported types are guaranteed by SimdCastPtr
+ unsafe { intrinsics::simd_cast_ptr(self) }
+ }
+
/// Rounds toward zero and converts to the same-width integer type, assuming that
/// the value is finite and fits in that type.
///
@@ -235,90 +357,90 @@ where
///
/// [cast]: Simd::cast
#[inline]
- pub unsafe fn to_int_unchecked<I>(self) -> Simd<I, LANES>
+ #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
+ pub unsafe fn to_int_unchecked<I>(self) -> Simd<I, N>
where
- T: core::convert::FloatToInt<I>,
- I: SimdElement,
+ T: core::convert::FloatToInt<I> + SimdCast,
+ I: SimdCast,
{
- // Safety: `self` is a vector, and `FloatToInt` ensures the type can be casted to
- // an integer.
+ // Safety: supported types are guaranteed by SimdCast, the caller is responsible for the extra invariants
unsafe { intrinsics::simd_cast(self) }
}
/// Reads from potentially discontiguous indices in `slice` to construct a SIMD vector.
- /// If an index is out-of-bounds, the lane is instead selected from the `or` vector.
+ /// If an index is out-of-bounds, the element is instead selected from the `or` vector.
///
/// # Examples
/// ```
/// # #![feature(portable_simd)]
/// # use core::simd::Simd;
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
- /// let idxs = Simd::from_array([9, 3, 0, 5]);
+ /// let idxs = Simd::from_array([9, 3, 0, 5]); // Note the index that is out-of-bounds
/// let alt = Simd::from_array([-5, -4, -3, -2]);
///
- /// let result = Simd::gather_or(&vec, idxs, alt); // Note the lane that is out-of-bounds.
+ /// let result = Simd::gather_or(&vec, idxs, alt);
/// assert_eq!(result, Simd::from_array([-5, 13, 10, 15]));
/// ```
#[must_use]
#[inline]
- pub fn gather_or(slice: &[T], idxs: Simd<usize, LANES>, or: Self) -> Self {
+ pub fn gather_or(slice: &[T], idxs: Simd<usize, N>, or: Self) -> Self {
Self::gather_select(slice, Mask::splat(true), idxs, or)
}
- /// Reads from potentially discontiguous indices in `slice` to construct a SIMD vector.
- /// If an index is out-of-bounds, the lane is set to the default value for the type.
+ /// Reads from indices in `slice` to construct a SIMD vector.
+ /// If an index is out-of-bounds, the element is set to the default given by `T: Default`.
///
/// # Examples
/// ```
/// # #![feature(portable_simd)]
/// # use core::simd::Simd;
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
- /// let idxs = Simd::from_array([9, 3, 0, 5]);
+ /// let idxs = Simd::from_array([9, 3, 0, 5]); // Note the index that is out-of-bounds
///
- /// let result = Simd::gather_or_default(&vec, idxs); // Note the lane that is out-of-bounds.
+ /// let result = Simd::gather_or_default(&vec, idxs);
/// assert_eq!(result, Simd::from_array([0, 13, 10, 15]));
/// ```
#[must_use]
#[inline]
- pub fn gather_or_default(slice: &[T], idxs: Simd<usize, LANES>) -> Self
+ pub fn gather_or_default(slice: &[T], idxs: Simd<usize, N>) -> Self
where
T: Default,
{
Self::gather_or(slice, idxs, Self::splat(T::default()))
}
- /// Reads from potentially discontiguous indices in `slice` to construct a SIMD vector.
- /// The mask `enable`s all `true` lanes and disables all `false` lanes.
- /// If an index is disabled or is out-of-bounds, the lane is selected from the `or` vector.
+ /// Reads from indices in `slice` to construct a SIMD vector.
+ /// The mask `enable`s all `true` indices and disables all `false` indices.
+ /// If an index is disabled or is out-of-bounds, the element is selected from the `or` vector.
///
/// # Examples
/// ```
/// # #![feature(portable_simd)]
/// # use core::simd::{Simd, Mask};
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
- /// let idxs = Simd::from_array([9, 3, 0, 5]);
+ /// let idxs = Simd::from_array([9, 3, 0, 5]); // Includes an out-of-bounds index
/// let alt = Simd::from_array([-5, -4, -3, -2]);
- /// let enable = Mask::from_array([true, true, true, false]); // Note the mask of the last lane.
+ /// let enable = Mask::from_array([true, true, true, false]); // Includes a masked element
///
- /// let result = Simd::gather_select(&vec, enable, idxs, alt); // Note the lane that is out-of-bounds.
+ /// let result = Simd::gather_select(&vec, enable, idxs, alt);
/// assert_eq!(result, Simd::from_array([-5, 13, 10, -2]));
/// ```
#[must_use]
#[inline]
pub fn gather_select(
slice: &[T],
- enable: Mask<isize, LANES>,
- idxs: Simd<usize, LANES>,
+ enable: Mask<isize, N>,
+ idxs: Simd<usize, N>,
or: Self,
) -> Self {
- let enable: Mask<isize, LANES> = enable & idxs.simd_lt(Simd::splat(slice.len()));
- // Safety: We have masked-off out-of-bounds lanes.
+ let enable: Mask<isize, N> = enable & idxs.simd_lt(Simd::splat(slice.len()));
+ // Safety: We have masked-off out-of-bounds indices.
unsafe { Self::gather_select_unchecked(slice, enable, idxs, or) }
}
- /// Reads from potentially discontiguous indices in `slice` to construct a SIMD vector.
- /// The mask `enable`s all `true` lanes and disables all `false` lanes.
- /// If an index is disabled, the lane is selected from the `or` vector.
+ /// Reads from indices in `slice` to construct a SIMD vector.
+ /// The mask `enable`s all `true` indices and disables all `false` indices.
+ /// If an index is disabled, the element is selected from the `or` vector.
///
/// # Safety
///
@@ -332,57 +454,123 @@ where
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::{Simd, SimdPartialOrd, Mask};
/// let vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
- /// let idxs = Simd::from_array([9, 3, 0, 5]);
+ /// let idxs = Simd::from_array([9, 3, 0, 5]); // Includes an out-of-bounds index
/// let alt = Simd::from_array([-5, -4, -3, -2]);
- /// let enable = Mask::from_array([true, true, true, false]); // Note the final mask lane.
+ /// let enable = Mask::from_array([true, true, true, false]); // Includes a masked element
/// // If this mask was used to gather, it would be unsound. Let's fix that.
/// let enable = enable & idxs.simd_lt(Simd::splat(vec.len()));
///
- /// // We have masked the OOB lane, so it's safe to gather now.
+ /// // The out-of-bounds index has been masked, so it's safe to gather now.
/// let result = unsafe { Simd::gather_select_unchecked(&vec, enable, idxs, alt) };
/// assert_eq!(result, Simd::from_array([-5, 13, 10, -2]));
/// ```
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
#[must_use]
#[inline]
+ #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub unsafe fn gather_select_unchecked(
slice: &[T],
- enable: Mask<isize, LANES>,
- idxs: Simd<usize, LANES>,
+ enable: Mask<isize, N>,
+ idxs: Simd<usize, N>,
or: Self,
) -> Self {
- let base_ptr = crate::simd::ptr::SimdConstPtr::splat(slice.as_ptr());
+ let base_ptr = Simd::<*const T, N>::splat(slice.as_ptr());
// Ferris forgive me, I have done pointer arithmetic here.
let ptrs = base_ptr.wrapping_add(idxs);
- // Safety: The ptrs have been bounds-masked to prevent memory-unsafe reads insha'allah
- unsafe { intrinsics::simd_gather(or, ptrs, enable.to_int()) }
+ // Safety: The caller is responsible for determining the indices are okay to read
+ unsafe { Self::gather_select_ptr(ptrs, enable, or) }
+ }
+
+ /// Read elementwise from pointers into a SIMD vector.
+ ///
+ /// # Safety
+ ///
+ /// Each read must satisfy the same conditions as [`core::ptr::read`].
+ ///
+ /// # Example
+ /// ```
+ /// # #![feature(portable_simd)]
+ /// # #[cfg(feature = "as_crate")] use core_simd::simd;
+ /// # #[cfg(not(feature = "as_crate"))] use core::simd;
+ /// # use simd::{Simd, SimdConstPtr};
+ /// let values = [6, 2, 4, 9];
+ /// let offsets = Simd::from_array([1, 0, 0, 3]);
+ /// let source = Simd::splat(values.as_ptr()).wrapping_add(offsets);
+ /// let gathered = unsafe { Simd::gather_ptr(source) };
+ /// assert_eq!(gathered, Simd::from_array([2, 6, 6, 9]));
+ /// ```
+ #[must_use]
+ #[inline]
+ #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
+ pub unsafe fn gather_ptr(source: Simd<*const T, N>) -> Self
+ where
+ T: Default,
+ {
+ // TODO: add an intrinsic that doesn't use a passthru vector, and remove the T: Default bound
+ // Safety: The caller is responsible for upholding all invariants
+ unsafe { Self::gather_select_ptr(source, Mask::splat(true), Self::default()) }
+ }
+
+ /// Conditionally read elementwise from pointers into a SIMD vector.
+ /// The mask `enable`s all `true` pointers and disables all `false` pointers.
+ /// If a pointer is disabled, the element is selected from the `or` vector,
+ /// and no read is performed.
+ ///
+ /// # Safety
+ ///
+ /// Enabled elements must satisfy the same conditions as [`core::ptr::read`].
+ ///
+ /// # Example
+ /// ```
+ /// # #![feature(portable_simd)]
+ /// # #[cfg(feature = "as_crate")] use core_simd::simd;
+ /// # #[cfg(not(feature = "as_crate"))] use core::simd;
+ /// # use simd::{Mask, Simd, SimdConstPtr};
+ /// let values = [6, 2, 4, 9];
+ /// let enable = Mask::from_array([true, true, false, true]);
+ /// let offsets = Simd::from_array([1, 0, 0, 3]);
+ /// let source = Simd::splat(values.as_ptr()).wrapping_add(offsets);
+ /// let gathered = unsafe { Simd::gather_select_ptr(source, enable, Simd::splat(0)) };
+ /// assert_eq!(gathered, Simd::from_array([2, 6, 0, 9]));
+ /// ```
+ #[must_use]
+ #[inline]
+ #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
+ pub unsafe fn gather_select_ptr(
+ source: Simd<*const T, N>,
+ enable: Mask<isize, N>,
+ or: Self,
+ ) -> Self {
+ // Safety: The caller is responsible for upholding all invariants
+ unsafe { intrinsics::simd_gather(or, source, enable.to_int()) }
}
/// Writes the values in a SIMD vector to potentially discontiguous indices in `slice`.
- /// If two lanes in the scattered vector would write to the same index
- /// only the last lane is guaranteed to actually be written.
+ /// If an index is out-of-bounds, the write is suppressed without panicking.
+ /// If two elements in the scattered vector would write to the same index
+ /// only the last element is guaranteed to actually be written.
///
/// # Examples
/// ```
/// # #![feature(portable_simd)]
/// # use core::simd::Simd;
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
- /// let idxs = Simd::from_array([9, 3, 0, 0]);
+ /// let idxs = Simd::from_array([9, 3, 0, 0]); // Note the duplicate index.
/// let vals = Simd::from_array([-27, 82, -41, 124]);
///
- /// vals.scatter(&mut vec, idxs); // index 0 receives two writes.
+ /// vals.scatter(&mut vec, idxs); // two logical writes means the last wins.
/// assert_eq!(vec, vec![124, 11, 12, 82, 14, 15, 16, 17, 18]);
/// ```
#[inline]
- pub fn scatter(self, slice: &mut [T], idxs: Simd<usize, LANES>) {
+ pub fn scatter(self, slice: &mut [T], idxs: Simd<usize, N>) {
self.scatter_select(slice, Mask::splat(true), idxs)
}
- /// Writes the values in a SIMD vector to multiple potentially discontiguous indices in `slice`.
- /// The mask `enable`s all `true` lanes and disables all `false` lanes.
- /// If an enabled index is out-of-bounds, the lane is not written.
- /// If two enabled lanes in the scattered vector would write to the same index,
- /// only the last lane is guaranteed to actually be written.
+ /// Writes values from a SIMD vector to multiple potentially discontiguous indices in `slice`.
+ /// The mask `enable`s all `true` indices and disables all `false` indices.
+ /// If an enabled index is out-of-bounds, the write is suppressed without panicking.
+ /// If two enabled elements in the scattered vector would write to the same index,
+ /// only the last element is guaranteed to actually be written.
///
/// # Examples
/// ```
@@ -391,29 +579,24 @@ where
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::{Simd, Mask};
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
- /// let idxs = Simd::from_array([9, 3, 0, 0]);
+ /// let idxs = Simd::from_array([9, 3, 0, 0]); // Includes an out-of-bounds index
/// let vals = Simd::from_array([-27, 82, -41, 124]);
- /// let enable = Mask::from_array([true, true, true, false]); // Note the mask of the last lane.
+ /// let enable = Mask::from_array([true, true, true, false]); // Includes a masked element
///
- /// vals.scatter_select(&mut vec, enable, idxs); // index 0's second write is masked, thus omitted.
+ /// vals.scatter_select(&mut vec, enable, idxs); // The last write is masked, thus omitted.
/// assert_eq!(vec, vec![-41, 11, 12, 82, 14, 15, 16, 17, 18]);
/// ```
#[inline]
- pub fn scatter_select(
- self,
- slice: &mut [T],
- enable: Mask<isize, LANES>,
- idxs: Simd<usize, LANES>,
- ) {
- let enable: Mask<isize, LANES> = enable & idxs.simd_lt(Simd::splat(slice.len()));
- // Safety: We have masked-off out-of-bounds lanes.
+ pub fn scatter_select(self, slice: &mut [T], enable: Mask<isize, N>, idxs: Simd<usize, N>) {
+ let enable: Mask<isize, N> = enable & idxs.simd_lt(Simd::splat(slice.len()));
+ // Safety: We have masked-off out-of-bounds indices.
unsafe { self.scatter_select_unchecked(slice, enable, idxs) }
}
- /// Writes the values in a SIMD vector to multiple potentially discontiguous indices in `slice`.
- /// The mask `enable`s all `true` lanes and disables all `false` lanes.
- /// If two enabled lanes in the scattered vector would write to the same index,
- /// only the last lane is guaranteed to actually be written.
+ /// Writes values from a SIMD vector to multiple potentially discontiguous indices in `slice`.
+ /// The mask `enable`s all `true` indices and disables all `false` indices.
+ /// If two enabled elements in the scattered vector would write to the same index,
+ /// only the last element is guaranteed to actually be written.
///
/// # Safety
///
@@ -429,22 +612,23 @@ where
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
/// let idxs = Simd::from_array([9, 3, 0, 0]);
/// let vals = Simd::from_array([-27, 82, -41, 124]);
- /// let enable = Mask::from_array([true, true, true, false]); // Note the mask of the last lane.
+ /// let enable = Mask::from_array([true, true, true, false]); // Masks the final index
/// // If this mask was used to scatter, it would be unsound. Let's fix that.
/// let enable = enable & idxs.simd_lt(Simd::splat(vec.len()));
///
- /// // We have masked the OOB lane, so it's safe to scatter now.
+ /// // We have masked the OOB index, so it's safe to scatter now.
/// unsafe { vals.scatter_select_unchecked(&mut vec, enable, idxs); }
- /// // index 0's second write is masked, thus was omitted.
+ /// // The second write to index 0 was masked, thus omitted.
/// assert_eq!(vec, vec![-41, 11, 12, 82, 14, 15, 16, 17, 18]);
/// ```
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
#[inline]
+ #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub unsafe fn scatter_select_unchecked(
self,
slice: &mut [T],
- enable: Mask<isize, LANES>,
- idxs: Simd<usize, LANES>,
+ enable: Mask<isize, N>,
+ idxs: Simd<usize, N>,
) {
// Safety: This block works with *mut T derived from &mut 'a [T],
// which means it is delicate in Rust's borrowing model, circa 2021:
@@ -458,36 +642,89 @@ where
// 3. &mut [T] which will become our base ptr.
unsafe {
// Now Entering ☢️ *mut T Zone
- let base_ptr = crate::simd::ptr::SimdMutPtr::splat(slice.as_mut_ptr());
+ let base_ptr = Simd::<*mut T, N>::splat(slice.as_mut_ptr());
// Ferris forgive me, I have done pointer arithmetic here.
let ptrs = base_ptr.wrapping_add(idxs);
// The ptrs have been bounds-masked to prevent memory-unsafe writes insha'allah
- intrinsics::simd_scatter(self, ptrs, enable.to_int())
+ self.scatter_select_ptr(ptrs, enable);
// Cleared ☢️ *mut T Zone
}
}
+
+ /// Write pointers elementwise into a SIMD vector.
+ ///
+ /// # Safety
+ ///
+ /// Each write must satisfy the same conditions as [`core::ptr::write`].
+ ///
+ /// # Example
+ /// ```
+ /// # #![feature(portable_simd)]
+ /// # #[cfg(feature = "as_crate")] use core_simd::simd;
+ /// # #[cfg(not(feature = "as_crate"))] use core::simd;
+ /// # use simd::{Simd, SimdMutPtr};
+ /// let mut values = [0; 4];
+ /// let offset = Simd::from_array([3, 2, 1, 0]);
+ /// let ptrs = Simd::splat(values.as_mut_ptr()).wrapping_add(offset);
+ /// unsafe { Simd::from_array([6, 3, 5, 7]).scatter_ptr(ptrs); }
+ /// assert_eq!(values, [7, 5, 3, 6]);
+ /// ```
+ #[inline]
+ #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
+ pub unsafe fn scatter_ptr(self, dest: Simd<*mut T, N>) {
+ // Safety: The caller is responsible for upholding all invariants
+ unsafe { self.scatter_select_ptr(dest, Mask::splat(true)) }
+ }
+
+ /// Conditionally write pointers elementwise into a SIMD vector.
+ /// The mask `enable`s all `true` pointers and disables all `false` pointers.
+ /// If a pointer is disabled, the write to its pointee is skipped.
+ ///
+ /// # Safety
+ ///
+ /// Enabled pointers must satisfy the same conditions as [`core::ptr::write`].
+ ///
+ /// # Example
+ /// ```
+ /// # #![feature(portable_simd)]
+ /// # #[cfg(feature = "as_crate")] use core_simd::simd;
+ /// # #[cfg(not(feature = "as_crate"))] use core::simd;
+ /// # use simd::{Mask, Simd, SimdMutPtr};
+ /// let mut values = [0; 4];
+ /// let offset = Simd::from_array([3, 2, 1, 0]);
+ /// let ptrs = Simd::splat(values.as_mut_ptr()).wrapping_add(offset);
+ /// let enable = Mask::from_array([true, true, false, false]);
+ /// unsafe { Simd::from_array([6, 3, 5, 7]).scatter_select_ptr(ptrs, enable); }
+ /// assert_eq!(values, [0, 0, 3, 6]);
+ /// ```
+ #[inline]
+ #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
+ pub unsafe fn scatter_select_ptr(self, dest: Simd<*mut T, N>, enable: Mask<isize, N>) {
+ // Safety: The caller is responsible for upholding all invariants
+ unsafe { intrinsics::simd_scatter(self, dest, enable.to_int()) }
+ }
}
-impl<T, const LANES: usize> Copy for Simd<T, LANES>
+impl<T, const N: usize> Copy for Simd<T, N>
where
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
- LaneCount<LANES>: SupportedLaneCount,
{
}
-impl<T, const LANES: usize> Clone for Simd<T, LANES>
+impl<T, const N: usize> Clone for Simd<T, N>
where
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
- LaneCount<LANES>: SupportedLaneCount,
{
fn clone(&self) -> Self {
*self
}
}
-impl<T, const LANES: usize> Default for Simd<T, LANES>
+impl<T, const N: usize> Default for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement + Default,
{
#[inline]
@@ -496,20 +733,20 @@ where
}
}
-impl<T, const LANES: usize> PartialEq for Simd<T, LANES>
+impl<T, const N: usize> PartialEq for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement + PartialEq,
{
#[inline]
fn eq(&self, other: &Self) -> bool {
// Safety: All SIMD vectors are SimdPartialEq, and the comparison produces a valid mask.
let mask = unsafe {
- let tfvec: Simd<<T as SimdElement>::Mask, LANES> = intrinsics::simd_eq(*self, *other);
+ let tfvec: Simd<<T as SimdElement>::Mask, N> = intrinsics::simd_eq(*self, *other);
Mask::from_int_unchecked(tfvec)
};
- // Two vectors are equal if all lanes tested true for vertical equality.
+ // Two vectors are equal if all elements are equal when compared elementwise
mask.all()
}
@@ -518,18 +755,18 @@ where
fn ne(&self, other: &Self) -> bool {
// Safety: All SIMD vectors are SimdPartialEq, and the comparison produces a valid mask.
let mask = unsafe {
- let tfvec: Simd<<T as SimdElement>::Mask, LANES> = intrinsics::simd_ne(*self, *other);
+ let tfvec: Simd<<T as SimdElement>::Mask, N> = intrinsics::simd_ne(*self, *other);
Mask::from_int_unchecked(tfvec)
};
- // Two vectors are non-equal if any lane tested true for vertical non-equality.
+ // Two vectors are non-equal if any elements are non-equal when compared elementwise
mask.any()
}
}
-impl<T, const LANES: usize> PartialOrd for Simd<T, LANES>
+impl<T, const N: usize> PartialOrd for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement + PartialOrd,
{
#[inline]
@@ -539,16 +776,16 @@ where
}
}
-impl<T, const LANES: usize> Eq for Simd<T, LANES>
+impl<T, const N: usize> Eq for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement + Eq,
{
}
-impl<T, const LANES: usize> Ord for Simd<T, LANES>
+impl<T, const N: usize> Ord for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement + Ord,
{
#[inline]
@@ -558,9 +795,9 @@ where
}
}
-impl<T, const LANES: usize> core::hash::Hash for Simd<T, LANES>
+impl<T, const N: usize> core::hash::Hash for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement + core::hash::Hash,
{
#[inline]
@@ -573,72 +810,96 @@ where
}
// array references
-impl<T, const LANES: usize> AsRef<[T; LANES]> for Simd<T, LANES>
+impl<T, const N: usize> AsRef<[T; N]> for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
{
#[inline]
- fn as_ref(&self) -> &[T; LANES] {
- &self.0
+ fn as_ref(&self) -> &[T; N] {
+ self.as_array()
}
}
-impl<T, const LANES: usize> AsMut<[T; LANES]> for Simd<T, LANES>
+impl<T, const N: usize> AsMut<[T; N]> for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
{
#[inline]
- fn as_mut(&mut self) -> &mut [T; LANES] {
- &mut self.0
+ fn as_mut(&mut self) -> &mut [T; N] {
+ self.as_mut_array()
}
}
// slice references
-impl<T, const LANES: usize> AsRef<[T]> for Simd<T, LANES>
+impl<T, const N: usize> AsRef<[T]> for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
{
#[inline]
fn as_ref(&self) -> &[T] {
- &self.0
+ self.as_array()
}
}
-impl<T, const LANES: usize> AsMut<[T]> for Simd<T, LANES>
+impl<T, const N: usize> AsMut<[T]> for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
{
#[inline]
fn as_mut(&mut self) -> &mut [T] {
- &mut self.0
+ self.as_mut_array()
}
}
// vector/array conversion
-impl<T, const LANES: usize> From<[T; LANES]> for Simd<T, LANES>
+impl<T, const N: usize> From<[T; N]> for Simd<T, N>
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
{
- fn from(array: [T; LANES]) -> Self {
- Self(array)
+ fn from(array: [T; N]) -> Self {
+ Self::from_array(array)
}
}
-impl<T, const LANES: usize> From<Simd<T, LANES>> for [T; LANES]
+impl<T, const N: usize> From<Simd<T, N>> for [T; N]
where
- LaneCount<LANES>: SupportedLaneCount,
+ LaneCount<N>: SupportedLaneCount,
T: SimdElement,
{
- fn from(vector: Simd<T, LANES>) -> Self {
+ fn from(vector: Simd<T, N>) -> Self {
vector.to_array()
}
}
+impl<T, const N: usize> TryFrom<&[T]> for Simd<T, N>
+where
+ LaneCount<N>: SupportedLaneCount,
+ T: SimdElement,
+{
+ type Error = core::array::TryFromSliceError;
+
+ fn try_from(slice: &[T]) -> Result<Self, core::array::TryFromSliceError> {
+ Ok(Self::from_array(slice.try_into()?))
+ }
+}
+
+impl<T, const N: usize> TryFrom<&mut [T]> for Simd<T, N>
+where
+ LaneCount<N>: SupportedLaneCount,
+ T: SimdElement,
+{
+ type Error = core::array::TryFromSliceError;
+
+ fn try_from(slice: &mut [T]) -> Result<Self, core::array::TryFromSliceError> {
+ Ok(Self::from_array(slice.try_into()?))
+ }
+}
+
mod sealed {
pub trait Sealed {}
}
@@ -740,3 +1001,27 @@ impl Sealed for f64 {}
unsafe impl SimdElement for f64 {
type Mask = i64;
}
+
+impl<T> Sealed for *const T {}
+
+// Safety: (thin) const pointers are valid SIMD element types, and are supported by this API
+//
+// Fat pointers may be supported in the future.
+unsafe impl<T> SimdElement for *const T
+where
+ T: core::ptr::Pointee<Metadata = ()>,
+{
+ type Mask = isize;
+}
+
+impl<T> Sealed for *mut T {}
+
+// Safety: (thin) mut pointers are valid SIMD element types, and are supported by this API
+//
+// Fat pointers may be supported in the future.
+unsafe impl<T> SimdElement for *mut T
+where
+ T: core::ptr::Pointee<Metadata = ()>,
+{
+ type Mask = isize;
+}
diff --git a/library/portable-simd/crates/core_simd/src/vector/float.rs b/library/portable-simd/crates/core_simd/src/vector/float.rs
deleted file mode 100644
index f836c99b1..000000000
--- a/library/portable-simd/crates/core_simd/src/vector/float.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#![allow(non_camel_case_types)]
-
-use crate::simd::Simd;
-
-/// A 64-bit SIMD vector with two elements of type `f32`.
-pub type f32x2 = Simd<f32, 2>;
-
-/// A 128-bit SIMD vector with four elements of type `f32`.
-pub type f32x4 = Simd<f32, 4>;
-
-/// A 256-bit SIMD vector with eight elements of type `f32`.
-pub type f32x8 = Simd<f32, 8>;
-
-/// A 512-bit SIMD vector with 16 elements of type `f32`.
-pub type f32x16 = Simd<f32, 16>;
-
-/// A 128-bit SIMD vector with two elements of type `f64`.
-pub type f64x2 = Simd<f64, 2>;
-
-/// A 256-bit SIMD vector with four elements of type `f64`.
-pub type f64x4 = Simd<f64, 4>;
-
-/// A 512-bit SIMD vector with eight elements of type `f64`.
-pub type f64x8 = Simd<f64, 8>;
diff --git a/library/portable-simd/crates/core_simd/src/vector/int.rs b/library/portable-simd/crates/core_simd/src/vector/int.rs
deleted file mode 100644
index 20e56c7dc..000000000
--- a/library/portable-simd/crates/core_simd/src/vector/int.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-#![allow(non_camel_case_types)]
-
-use crate::simd::Simd;
-
-/// A SIMD vector with two elements of type `isize`.
-pub type isizex2 = Simd<isize, 2>;
-
-/// A SIMD vector with four elements of type `isize`.
-pub type isizex4 = Simd<isize, 4>;
-
-/// A SIMD vector with eight elements of type `isize`.
-pub type isizex8 = Simd<isize, 8>;
-
-/// A 32-bit SIMD vector with two elements of type `i16`.
-pub type i16x2 = Simd<i16, 2>;
-
-/// A 64-bit SIMD vector with four elements of type `i16`.
-pub type i16x4 = Simd<i16, 4>;
-
-/// A 128-bit SIMD vector with eight elements of type `i16`.
-pub type i16x8 = Simd<i16, 8>;
-
-/// A 256-bit SIMD vector with 16 elements of type `i16`.
-pub type i16x16 = Simd<i16, 16>;
-
-/// A 512-bit SIMD vector with 32 elements of type `i16`.
-pub type i16x32 = Simd<i16, 32>;
-
-/// A 64-bit SIMD vector with two elements of type `i32`.
-pub type i32x2 = Simd<i32, 2>;
-
-/// A 128-bit SIMD vector with four elements of type `i32`.
-pub type i32x4 = Simd<i32, 4>;
-
-/// A 256-bit SIMD vector with eight elements of type `i32`.
-pub type i32x8 = Simd<i32, 8>;
-
-/// A 512-bit SIMD vector with 16 elements of type `i32`.
-pub type i32x16 = Simd<i32, 16>;
-
-/// A 128-bit SIMD vector with two elements of type `i64`.
-pub type i64x2 = Simd<i64, 2>;
-
-/// A 256-bit SIMD vector with four elements of type `i64`.
-pub type i64x4 = Simd<i64, 4>;
-
-/// A 512-bit SIMD vector with eight elements of type `i64`.
-pub type i64x8 = Simd<i64, 8>;
-
-/// A 32-bit SIMD vector with four elements of type `i8`.
-pub type i8x4 = Simd<i8, 4>;
-
-/// A 64-bit SIMD vector with eight elements of type `i8`.
-pub type i8x8 = Simd<i8, 8>;
-
-/// A 128-bit SIMD vector with 16 elements of type `i8`.
-pub type i8x16 = Simd<i8, 16>;
-
-/// A 256-bit SIMD vector with 32 elements of type `i8`.
-pub type i8x32 = Simd<i8, 32>;
-
-/// A 512-bit SIMD vector with 64 elements of type `i8`.
-pub type i8x64 = Simd<i8, 64>;
diff --git a/library/portable-simd/crates/core_simd/src/vector/ptr.rs b/library/portable-simd/crates/core_simd/src/vector/ptr.rs
deleted file mode 100644
index fa756344d..000000000
--- a/library/portable-simd/crates/core_simd/src/vector/ptr.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-//! Private implementation details of public gather/scatter APIs.
-use crate::simd::intrinsics;
-use crate::simd::{LaneCount, Simd, SupportedLaneCount};
-
-/// A vector of *const T.
-#[derive(Debug, Copy, Clone)]
-#[repr(simd)]
-pub(crate) struct SimdConstPtr<T, const LANES: usize>([*const T; LANES]);
-
-impl<T, const LANES: usize> SimdConstPtr<T, LANES>
-where
- LaneCount<LANES>: SupportedLaneCount,
- T: Sized,
-{
- #[inline]
- #[must_use]
- pub fn splat(ptr: *const T) -> Self {
- Self([ptr; LANES])
- }
-
- #[inline]
- #[must_use]
- pub fn wrapping_add(self, addend: Simd<usize, LANES>) -> Self {
- // Safety: this intrinsic doesn't have a precondition
- unsafe { intrinsics::simd_arith_offset(self, addend) }
- }
-}
-
-/// A vector of *mut T. Be very careful around potential aliasing.
-#[derive(Debug, Copy, Clone)]
-#[repr(simd)]
-pub(crate) struct SimdMutPtr<T, const LANES: usize>([*mut T; LANES]);
-
-impl<T, const LANES: usize> SimdMutPtr<T, LANES>
-where
- LaneCount<LANES>: SupportedLaneCount,
- T: Sized,
-{
- #[inline]
- #[must_use]
- pub fn splat(ptr: *mut T) -> Self {
- Self([ptr; LANES])
- }
-
- #[inline]
- #[must_use]
- pub fn wrapping_add(self, addend: Simd<usize, LANES>) -> Self {
- // Safety: this intrinsic doesn't have a precondition
- unsafe { intrinsics::simd_arith_offset(self, addend) }
- }
-}
diff --git a/library/portable-simd/crates/core_simd/src/vector/uint.rs b/library/portable-simd/crates/core_simd/src/vector/uint.rs
deleted file mode 100644
index b4a69c443..000000000
--- a/library/portable-simd/crates/core_simd/src/vector/uint.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-#![allow(non_camel_case_types)]
-
-use crate::simd::Simd;
-
-/// A SIMD vector with two elements of type `usize`.
-pub type usizex2 = Simd<usize, 2>;
-
-/// A SIMD vector with four elements of type `usize`.
-pub type usizex4 = Simd<usize, 4>;
-
-/// A SIMD vector with eight elements of type `usize`.
-pub type usizex8 = Simd<usize, 8>;
-
-/// A 32-bit SIMD vector with two elements of type `u16`.
-pub type u16x2 = Simd<u16, 2>;
-
-/// A 64-bit SIMD vector with four elements of type `u16`.
-pub type u16x4 = Simd<u16, 4>;
-
-/// A 128-bit SIMD vector with eight elements of type `u16`.
-pub type u16x8 = Simd<u16, 8>;
-
-/// A 256-bit SIMD vector with 16 elements of type `u16`.
-pub type u16x16 = Simd<u16, 16>;
-
-/// A 512-bit SIMD vector with 32 elements of type `u16`.
-pub type u16x32 = Simd<u16, 32>;
-
-/// A 64-bit SIMD vector with two elements of type `u32`.
-pub type u32x2 = Simd<u32, 2>;
-
-/// A 128-bit SIMD vector with four elements of type `u32`.
-pub type u32x4 = Simd<u32, 4>;
-
-/// A 256-bit SIMD vector with eight elements of type `u32`.
-pub type u32x8 = Simd<u32, 8>;
-
-/// A 512-bit SIMD vector with 16 elements of type `u32`.
-pub type u32x16 = Simd<u32, 16>;
-
-/// A 128-bit SIMD vector with two elements of type `u64`.
-pub type u64x2 = Simd<u64, 2>;
-
-/// A 256-bit SIMD vector with four elements of type `u64`.
-pub type u64x4 = Simd<u64, 4>;
-
-/// A 512-bit SIMD vector with eight elements of type `u64`.
-pub type u64x8 = Simd<u64, 8>;
-
-/// A 32-bit SIMD vector with four elements of type `u8`.
-pub type u8x4 = Simd<u8, 4>;
-
-/// A 64-bit SIMD vector with eight elements of type `u8`.
-pub type u8x8 = Simd<u8, 8>;
-
-/// A 128-bit SIMD vector with 16 elements of type `u8`.
-pub type u8x16 = Simd<u8, 16>;
-
-/// A 256-bit SIMD vector with 32 elements of type `u8`.
-pub type u8x32 = Simd<u8, 32>;
-
-/// A 512-bit SIMD vector with 64 elements of type `u8`.
-pub type u8x64 = Simd<u8, 64>;
diff --git a/library/portable-simd/crates/core_simd/tests/autoderef.rs b/library/portable-simd/crates/core_simd/tests/autoderef.rs
index 9359da16e..3181826ef 100644
--- a/library/portable-simd/crates/core_simd/tests/autoderef.rs
+++ b/library/portable-simd/crates/core_simd/tests/autoderef.rs
@@ -1,6 +1,6 @@
// Test that we handle all our "auto-deref" cases correctly.
#![feature(portable_simd)]
-use core_simd::f32x4;
+use core_simd::simd::f32x4;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::*;
diff --git a/library/portable-simd/crates/core_simd/tests/mask_ops_impl/mask_macros.rs b/library/portable-simd/crates/core_simd/tests/mask_ops_impl/mask_macros.rs
index 795f9e27c..faafa5fa5 100644
--- a/library/portable-simd/crates/core_simd/tests/mask_ops_impl/mask_macros.rs
+++ b/library/portable-simd/crates/core_simd/tests/mask_ops_impl/mask_macros.rs
@@ -2,7 +2,7 @@ macro_rules! mask_tests {
{ $vector:ident, $lanes:literal } => {
#[cfg(test)]
mod $vector {
- use core_simd::$vector as Vector;
+ use core_simd::simd::$vector as Vector;
const LANES: usize = $lanes;
#[cfg(target_arch = "wasm32")]
diff --git a/library/portable-simd/crates/core_simd/tests/masks.rs b/library/portable-simd/crates/core_simd/tests/masks.rs
index 673d0db93..9f8bad1c3 100644
--- a/library/portable-simd/crates/core_simd/tests/masks.rs
+++ b/library/portable-simd/crates/core_simd/tests/masks.rs
@@ -13,11 +13,13 @@ macro_rules! test_mask_api {
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::*;
+ use core_simd::simd::Mask;
+
#[test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
fn set_and_test() {
let values = [true, false, false, true, false, false, true, false];
- let mut mask = core_simd::Mask::<$type, 8>::splat(false);
+ let mut mask = Mask::<$type, 8>::splat(false);
for (lane, value) in values.iter().copied().enumerate() {
mask.set(lane, value);
}
@@ -29,7 +31,7 @@ macro_rules! test_mask_api {
#[test]
#[should_panic]
fn set_invalid_lane() {
- let mut mask = core_simd::Mask::<$type, 8>::splat(false);
+ let mut mask = Mask::<$type, 8>::splat(false);
mask.set(8, true);
let _ = mask;
}
@@ -37,24 +39,24 @@ macro_rules! test_mask_api {
#[test]
#[should_panic]
fn test_invalid_lane() {
- let mask = core_simd::Mask::<$type, 8>::splat(false);
+ let mask = Mask::<$type, 8>::splat(false);
let _ = mask.test(8);
}
#[test]
fn any() {
- assert!(!core_simd::Mask::<$type, 8>::splat(false).any());
- assert!(core_simd::Mask::<$type, 8>::splat(true).any());
- let mut v = core_simd::Mask::<$type, 8>::splat(false);
+ assert!(!Mask::<$type, 8>::splat(false).any());
+ assert!(Mask::<$type, 8>::splat(true).any());
+ let mut v = Mask::<$type, 8>::splat(false);
v.set(2, true);
assert!(v.any());
}
#[test]
fn all() {
- assert!(!core_simd::Mask::<$type, 8>::splat(false).all());
- assert!(core_simd::Mask::<$type, 8>::splat(true).all());
- let mut v = core_simd::Mask::<$type, 8>::splat(false);
+ assert!(!Mask::<$type, 8>::splat(false).all());
+ assert!(Mask::<$type, 8>::splat(true).all());
+ let mut v = Mask::<$type, 8>::splat(false);
v.set(2, true);
assert!(!v.all());
}
@@ -62,57 +64,57 @@ macro_rules! test_mask_api {
#[test]
fn roundtrip_int_conversion() {
let values = [true, false, false, true, false, false, true, false];
- let mask = core_simd::Mask::<$type, 8>::from_array(values);
+ let mask = Mask::<$type, 8>::from_array(values);
let int = mask.to_int();
assert_eq!(int.to_array(), [-1, 0, 0, -1, 0, 0, -1, 0]);
- assert_eq!(core_simd::Mask::<$type, 8>::from_int(int), mask);
+ assert_eq!(Mask::<$type, 8>::from_int(int), mask);
}
#[test]
fn roundtrip_bitmask_conversion() {
- use core_simd::ToBitMask;
+ use core_simd::simd::ToBitMask;
let values = [
true, false, false, true, false, false, true, false,
true, true, false, false, false, false, false, true,
];
- let mask = core_simd::Mask::<$type, 16>::from_array(values);
+ let mask = Mask::<$type, 16>::from_array(values);
let bitmask = mask.to_bitmask();
assert_eq!(bitmask, 0b1000001101001001);
- assert_eq!(core_simd::Mask::<$type, 16>::from_bitmask(bitmask), mask);
+ assert_eq!(Mask::<$type, 16>::from_bitmask(bitmask), mask);
}
#[test]
fn roundtrip_bitmask_conversion_short() {
- use core_simd::ToBitMask;
+ use core_simd::simd::ToBitMask;
let values = [
false, false, false, true,
];
- let mask = core_simd::Mask::<$type, 4>::from_array(values);
+ let mask = Mask::<$type, 4>::from_array(values);
let bitmask = mask.to_bitmask();
assert_eq!(bitmask, 0b1000);
- assert_eq!(core_simd::Mask::<$type, 4>::from_bitmask(bitmask), mask);
+ assert_eq!(Mask::<$type, 4>::from_bitmask(bitmask), mask);
let values = [true, false];
- let mask = core_simd::Mask::<$type, 2>::from_array(values);
+ let mask = Mask::<$type, 2>::from_array(values);
let bitmask = mask.to_bitmask();
assert_eq!(bitmask, 0b01);
- assert_eq!(core_simd::Mask::<$type, 2>::from_bitmask(bitmask), mask);
+ assert_eq!(Mask::<$type, 2>::from_bitmask(bitmask), mask);
}
#[test]
fn cast() {
- fn cast_impl<T: core_simd::MaskElement>()
+ fn cast_impl<T: core_simd::simd::MaskElement>()
where
- core_simd::Mask<$type, 8>: Into<core_simd::Mask<T, 8>>,
+ Mask<$type, 8>: Into<Mask<T, 8>>,
{
let values = [true, false, false, true, false, false, true, false];
- let mask = core_simd::Mask::<$type, 8>::from_array(values);
+ let mask = Mask::<$type, 8>::from_array(values);
let cast_mask = mask.cast::<T>();
assert_eq!(values, cast_mask.to_array());
- let into_mask: core_simd::Mask<T, 8> = mask.into();
+ let into_mask: Mask<T, 8> = mask.into();
assert_eq!(values, into_mask.to_array());
}
@@ -126,15 +128,15 @@ macro_rules! test_mask_api {
#[cfg(feature = "generic_const_exprs")]
#[test]
fn roundtrip_bitmask_array_conversion() {
- use core_simd::ToBitMaskArray;
+ use core_simd::simd::ToBitMaskArray;
let values = [
true, false, false, true, false, false, true, false,
true, true, false, false, false, false, false, true,
];
- let mask = core_simd::Mask::<$type, 16>::from_array(values);
+ let mask = Mask::<$type, 16>::from_array(values);
let bitmask = mask.to_bitmask_array();
assert_eq!(bitmask, [0b01001001, 0b10000011]);
- assert_eq!(core_simd::Mask::<$type, 16>::from_bitmask_array(bitmask), mask);
+ assert_eq!(Mask::<$type, 16>::from_bitmask_array(bitmask), mask);
}
}
}
@@ -150,9 +152,10 @@ mod mask_api {
#[test]
fn convert() {
+ use core_simd::simd::Mask;
let values = [true, false, false, true, false, false, true, false];
assert_eq!(
- core_simd::Mask::<i8, 8>::from_array(values),
- core_simd::Mask::<i32, 8>::from_array(values).into()
+ Mask::<i8, 8>::from_array(values),
+ Mask::<i32, 8>::from_array(values).into()
);
}
diff --git a/library/portable-simd/crates/core_simd/tests/ops_macros.rs b/library/portable-simd/crates/core_simd/tests/ops_macros.rs
index f759394d0..3a02f3f01 100644
--- a/library/portable-simd/crates/core_simd/tests/ops_macros.rs
+++ b/library/portable-simd/crates/core_simd/tests/ops_macros.rs
@@ -7,7 +7,7 @@ macro_rules! impl_unary_op_test {
test_helpers::test_lanes! {
fn $fn<const LANES: usize>() {
test_helpers::test_unary_elementwise(
- &<core_simd::Simd<$scalar, LANES> as core::ops::$trait>::$fn,
+ &<core_simd::simd::Simd<$scalar, LANES> as core::ops::$trait>::$fn,
&$scalar_fn,
&|_| true,
);
@@ -27,7 +27,7 @@ macro_rules! impl_binary_op_test {
{ $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr } => {
mod $fn {
use super::*;
- use core_simd::Simd;
+ use core_simd::simd::Simd;
test_helpers::test_lanes! {
fn normal<const LANES: usize>() {
@@ -64,7 +64,7 @@ macro_rules! impl_binary_checked_op_test {
{ $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr, $check_fn:expr } => {
mod $fn {
use super::*;
- use core_simd::Simd;
+ use core_simd::simd::Simd;
test_helpers::test_lanes! {
fn normal<const LANES: usize>() {
@@ -173,7 +173,7 @@ macro_rules! impl_signed_tests {
{ $scalar:tt } => {
mod $scalar {
use core_simd::simd::SimdInt;
- type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>;
+ type Vector<const LANES: usize> = core_simd::simd::Simd<Scalar, LANES>;
type Scalar = $scalar;
impl_common_integer_tests! { Vector, Scalar }
@@ -314,7 +314,7 @@ macro_rules! impl_unsigned_tests {
{ $scalar:tt } => {
mod $scalar {
use core_simd::simd::SimdUint;
- type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>;
+ type Vector<const LANES: usize> = core_simd::simd::Simd<Scalar, LANES>;
type Scalar = $scalar;
impl_common_integer_tests! { Vector, Scalar }
@@ -348,8 +348,8 @@ macro_rules! impl_unsigned_tests {
macro_rules! impl_float_tests {
{ $scalar:tt, $int_scalar:tt } => {
mod $scalar {
- use core_simd::SimdFloat;
- type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>;
+ use core_simd::simd::SimdFloat;
+ type Vector<const LANES: usize> = core_simd::simd::Simd<Scalar, LANES>;
type Scalar = $scalar;
impl_unary_op_test!(Scalar, Neg::neg);
diff --git a/library/portable-simd/crates/core_simd/tests/pointers.rs b/library/portable-simd/crates/core_simd/tests/pointers.rs
new file mode 100644
index 000000000..0ae8f83b8
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/tests/pointers.rs
@@ -0,0 +1,111 @@
+#![feature(portable_simd, strict_provenance)]
+
+use core_simd::simd::{Simd, SimdConstPtr, SimdMutPtr};
+
+macro_rules! common_tests {
+ { $constness:ident } => {
+ test_helpers::test_lanes! {
+ fn is_null<const LANES: usize>() {
+ test_helpers::test_unary_mask_elementwise(
+ &Simd::<*$constness u32, LANES>::is_null,
+ &<*$constness u32>::is_null,
+ &|_| true,
+ );
+ }
+
+ fn addr<const LANES: usize>() {
+ test_helpers::test_unary_elementwise(
+ &Simd::<*$constness u32, LANES>::addr,
+ &<*$constness u32>::addr,
+ &|_| true,
+ );
+ }
+
+ fn with_addr<const LANES: usize>() {
+ test_helpers::test_binary_elementwise(
+ &Simd::<*$constness u32, LANES>::with_addr,
+ &<*$constness u32>::with_addr,
+ &|_, _| true,
+ );
+ }
+
+ fn expose_addr<const LANES: usize>() {
+ test_helpers::test_unary_elementwise(
+ &Simd::<*$constness u32, LANES>::expose_addr,
+ &<*$constness u32>::expose_addr,
+ &|_| true,
+ );
+ }
+
+ fn wrapping_offset<const LANES: usize>() {
+ test_helpers::test_binary_elementwise(
+ &Simd::<*$constness u32, LANES>::wrapping_offset,
+ &<*$constness u32>::wrapping_offset,
+ &|_, _| true,
+ );
+ }
+
+ fn wrapping_add<const LANES: usize>() {
+ test_helpers::test_binary_elementwise(
+ &Simd::<*$constness u32, LANES>::wrapping_add,
+ &<*$constness u32>::wrapping_add,
+ &|_, _| true,
+ );
+ }
+
+ fn wrapping_sub<const LANES: usize>() {
+ test_helpers::test_binary_elementwise(
+ &Simd::<*$constness u32, LANES>::wrapping_sub,
+ &<*$constness u32>::wrapping_sub,
+ &|_, _| true,
+ );
+ }
+ }
+ }
+}
+
+mod const_ptr {
+ use super::*;
+ common_tests! { const }
+
+ test_helpers::test_lanes! {
+ fn cast_mut<const LANES: usize>() {
+ test_helpers::test_unary_elementwise(
+ &Simd::<*const u32, LANES>::cast_mut,
+ &<*const u32>::cast_mut,
+ &|_| true,
+ );
+ }
+
+ fn from_exposed_addr<const LANES: usize>() {
+ test_helpers::test_unary_elementwise(
+ &Simd::<*const u32, LANES>::from_exposed_addr,
+ &core::ptr::from_exposed_addr::<u32>,
+ &|_| true,
+ );
+ }
+ }
+}
+
+mod mut_ptr {
+ use super::*;
+ common_tests! { mut }
+
+ test_helpers::test_lanes! {
+ fn cast_const<const LANES: usize>() {
+ test_helpers::test_unary_elementwise(
+ &Simd::<*mut u32, LANES>::cast_const,
+ &<*mut u32>::cast_const,
+ &|_| true,
+ );
+ }
+
+ fn from_exposed_addr<const LANES: usize>() {
+ test_helpers::test_unary_elementwise(
+ &Simd::<*mut u32, LANES>::from_exposed_addr,
+ &core::ptr::from_exposed_addr_mut::<u32>,
+ &|_| true,
+ );
+ }
+ }
+}
diff --git a/library/portable-simd/crates/core_simd/tests/round.rs b/library/portable-simd/crates/core_simd/tests/round.rs
index 484fd5bf4..8b9638ad4 100644
--- a/library/portable-simd/crates/core_simd/tests/round.rs
+++ b/library/portable-simd/crates/core_simd/tests/round.rs
@@ -5,7 +5,7 @@ macro_rules! float_rounding_test {
mod $scalar {
use std_float::StdFloat;
- type Vector<const LANES: usize> = core_simd::Simd<$scalar, LANES>;
+ type Vector<const LANES: usize> = core_simd::simd::Simd<$scalar, LANES>;
type Scalar = $scalar;
type IntScalar = $int_scalar;
diff --git a/library/portable-simd/crates/core_simd/tests/swizzle.rs b/library/portable-simd/crates/core_simd/tests/swizzle.rs
index 51c63611a..8cd7c33e8 100644
--- a/library/portable-simd/crates/core_simd/tests/swizzle.rs
+++ b/library/portable-simd/crates/core_simd/tests/swizzle.rs
@@ -1,5 +1,5 @@
#![feature(portable_simd)]
-use core_simd::{Simd, Swizzle};
+use core_simd::simd::{Simd, Swizzle};
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::*;
@@ -60,3 +60,17 @@ fn interleave() {
assert_eq!(even, a);
assert_eq!(odd, b);
}
+
+// portable-simd#298
+#[test]
+#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+fn interleave_one() {
+ let a = Simd::from_array([0]);
+ let b = Simd::from_array([1]);
+ let (lo, hi) = a.interleave(b);
+ assert_eq!(lo.to_array(), [0]);
+ assert_eq!(hi.to_array(), [1]);
+ let (even, odd) = lo.deinterleave(hi);
+ assert_eq!(even, a);
+ assert_eq!(odd, b);
+}
diff --git a/library/portable-simd/crates/core_simd/tests/swizzle_dyn.rs b/library/portable-simd/crates/core_simd/tests/swizzle_dyn.rs
new file mode 100644
index 000000000..646cd5f33
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/tests/swizzle_dyn.rs
@@ -0,0 +1,74 @@
+#![feature(portable_simd)]
+use core::{fmt, ops::RangeInclusive};
+use proptest;
+use test_helpers::{self, biteq, make_runner, prop_assert_biteq};
+
+fn swizzle_dyn_scalar_ver<const N: usize>(values: [u8; N], idxs: [u8; N]) -> [u8; N] {
+ let mut array = [0; N];
+ for (i, k) in idxs.into_iter().enumerate() {
+ if (k as usize) < N {
+ array[i] = values[k as usize];
+ };
+ }
+ array
+}
+
+test_helpers::test_lanes! {
+ fn swizzle_dyn<const N: usize>() {
+ match_simd_with_fallback(
+ &core_simd::simd::Simd::<u8, N>::swizzle_dyn,
+ &swizzle_dyn_scalar_ver,
+ &|_, _| true,
+ );
+ }
+}
+
+fn match_simd_with_fallback<Scalar, ScalarResult, Vector, VectorResult, const N: usize>(
+ fv: &dyn Fn(Vector, Vector) -> VectorResult,
+ fs: &dyn Fn([Scalar; N], [Scalar; N]) -> [ScalarResult; N],
+ check: &dyn Fn([Scalar; N], [Scalar; N]) -> bool,
+) where
+ Scalar: Copy + fmt::Debug + SwizzleStrategy,
+ ScalarResult: Copy + biteq::BitEq + fmt::Debug + SwizzleStrategy,
+ Vector: Into<[Scalar; N]> + From<[Scalar; N]> + Copy,
+ VectorResult: Into<[ScalarResult; N]> + From<[ScalarResult; N]> + Copy,
+{
+ test_swizzles_2(&|x: [Scalar; N], y: [Scalar; N]| {
+ proptest::prop_assume!(check(x, y));
+ let result_v: [ScalarResult; N] = fv(x.into(), y.into()).into();
+ let result_s: [ScalarResult; N] = fs(x, y);
+ crate::prop_assert_biteq!(result_v, result_s);
+ Ok(())
+ });
+}
+
+fn test_swizzles_2<A: fmt::Debug + SwizzleStrategy, B: fmt::Debug + SwizzleStrategy>(
+ f: &dyn Fn(A, B) -> proptest::test_runner::TestCaseResult,
+) {
+ let mut runner = make_runner();
+ runner
+ .run(
+ &(A::swizzled_strategy(), B::swizzled_strategy()),
+ |(a, b)| f(a, b),
+ )
+ .unwrap();
+}
+
+pub trait SwizzleStrategy {
+ type Strategy: proptest::strategy::Strategy<Value = Self>;
+ fn swizzled_strategy() -> Self::Strategy;
+}
+
+impl SwizzleStrategy for u8 {
+ type Strategy = RangeInclusive<u8>;
+ fn swizzled_strategy() -> Self::Strategy {
+ 0..=64
+ }
+}
+
+impl<T: fmt::Debug + SwizzleStrategy, const N: usize> SwizzleStrategy for [T; N] {
+ type Strategy = test_helpers::array::UniformArrayStrategy<T::Strategy, Self>;
+ fn swizzled_strategy() -> Self::Strategy {
+ Self::Strategy::new(T::swizzled_strategy())
+ }
+}
diff --git a/library/portable-simd/crates/core_simd/tests/to_bytes.rs b/library/portable-simd/crates/core_simd/tests/to_bytes.rs
index debb4335e..be0ee4349 100644
--- a/library/portable-simd/crates/core_simd/tests/to_bytes.rs
+++ b/library/portable-simd/crates/core_simd/tests/to_bytes.rs
@@ -2,7 +2,7 @@
#![allow(incomplete_features)]
#![cfg(feature = "generic_const_exprs")]
-use core_simd::Simd;
+use core_simd::simd::Simd;
#[test]
fn byte_convert() {
diff --git a/library/portable-simd/crates/core_simd/tests/try_from_slice.rs b/library/portable-simd/crates/core_simd/tests/try_from_slice.rs
new file mode 100644
index 000000000..859e3b94f
--- /dev/null
+++ b/library/portable-simd/crates/core_simd/tests/try_from_slice.rs
@@ -0,0 +1,25 @@
+#![feature(portable_simd)]
+
+#[cfg(target_arch = "wasm32")]
+use wasm_bindgen_test::*;
+
+#[cfg(target_arch = "wasm32")]
+wasm_bindgen_test_configure!(run_in_browser);
+
+use core_simd::simd::i32x4;
+
+#[test]
+#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
+fn try_from_slice() {
+ // Equal length
+ assert_eq!(
+ i32x4::try_from([1, 2, 3, 4].as_slice()).unwrap(),
+ i32x4::from_array([1, 2, 3, 4])
+ );
+
+ // Slice length > vector length
+ assert!(i32x4::try_from([1, 2, 3, 4, 5].as_slice()).is_err());
+
+ // Slice length < vector length
+ assert!(i32x4::try_from([1, 2, 3].as_slice()).is_err());
+}
diff --git a/library/portable-simd/crates/test_helpers/Cargo.toml b/library/portable-simd/crates/test_helpers/Cargo.toml
index a04b0961d..1d2bc8b51 100644
--- a/library/portable-simd/crates/test_helpers/Cargo.toml
+++ b/library/portable-simd/crates/test_helpers/Cargo.toml
@@ -8,3 +8,6 @@ publish = false
version = "0.10"
default-features = false
features = ["alloc"]
+
+[features]
+all_lane_counts = []
diff --git a/library/portable-simd/crates/test_helpers/src/array.rs b/library/portable-simd/crates/test_helpers/src/array.rs
index 5ffc92269..984a42732 100644
--- a/library/portable-simd/crates/test_helpers/src/array.rs
+++ b/library/portable-simd/crates/test_helpers/src/array.rs
@@ -41,6 +41,7 @@ where
fn new_tree(&self, runner: &mut TestRunner) -> NewTree<Self> {
let tree: [S::Tree; LANES] = unsafe {
+ #[allow(clippy::uninit_assumed_init)]
let mut tree: [MaybeUninit<S::Tree>; LANES] = MaybeUninit::uninit().assume_init();
for t in tree.iter_mut() {
*t = MaybeUninit::new(self.strategy.new_tree(runner)?)
@@ -60,6 +61,7 @@ impl<T: ValueTree, const LANES: usize> ValueTree for ArrayValueTree<[T; LANES]>
fn current(&self) -> Self::Value {
unsafe {
+ #[allow(clippy::uninit_assumed_init)]
let mut value: [MaybeUninit<T::Value>; LANES] = MaybeUninit::uninit().assume_init();
for (tree_elem, value_elem) in self.tree.iter().zip(value.iter_mut()) {
*value_elem = MaybeUninit::new(tree_elem.current());
diff --git a/library/portable-simd/crates/test_helpers/src/biteq.rs b/library/portable-simd/crates/test_helpers/src/biteq.rs
index 00350e224..7d91260d8 100644
--- a/library/portable-simd/crates/test_helpers/src/biteq.rs
+++ b/library/portable-simd/crates/test_helpers/src/biteq.rs
@@ -55,6 +55,26 @@ macro_rules! impl_float_biteq {
impl_float_biteq! { f32, f64 }
+impl<T> BitEq for *const T {
+ fn biteq(&self, other: &Self) -> bool {
+ self == other
+ }
+
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+ write!(f, "{:?}", self)
+ }
+}
+
+impl<T> BitEq for *mut T {
+ fn biteq(&self, other: &Self) -> bool {
+ self == other
+ }
+
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+ write!(f, "{:?}", self)
+ }
+}
+
impl<T: BitEq, const N: usize> BitEq for [T; N] {
fn biteq(&self, other: &Self) -> bool {
self.iter()
diff --git a/library/portable-simd/crates/test_helpers/src/lib.rs b/library/portable-simd/crates/test_helpers/src/lib.rs
index 141bee18a..b26cdc311 100644
--- a/library/portable-simd/crates/test_helpers/src/lib.rs
+++ b/library/portable-simd/crates/test_helpers/src/lib.rs
@@ -38,6 +38,28 @@ impl_num! { usize }
impl_num! { f32 }
impl_num! { f64 }
+impl<T> DefaultStrategy for *const T {
+ type Strategy = proptest::strategy::Map<proptest::num::isize::Any, fn(isize) -> *const T>;
+ fn default_strategy() -> Self::Strategy {
+ fn map<T>(x: isize) -> *const T {
+ x as _
+ }
+ use proptest::strategy::Strategy;
+ proptest::num::isize::ANY.prop_map(map)
+ }
+}
+
+impl<T> DefaultStrategy for *mut T {
+ type Strategy = proptest::strategy::Map<proptest::num::isize::Any, fn(isize) -> *mut T>;
+ fn default_strategy() -> Self::Strategy {
+ fn map<T>(x: isize) -> *mut T {
+ x as _
+ }
+ use proptest::strategy::Strategy;
+ proptest::num::isize::ANY.prop_map(map)
+ }
+}
+
#[cfg(not(target_arch = "wasm32"))]
impl DefaultStrategy for u128 {
type Strategy = proptest::num::u128::Any;
@@ -135,21 +157,21 @@ pub fn test_unary_elementwise<Scalar, ScalarResult, Vector, VectorResult, const
fs: &dyn Fn(Scalar) -> ScalarResult,
check: &dyn Fn([Scalar; LANES]) -> bool,
) where
- Scalar: Copy + Default + core::fmt::Debug + DefaultStrategy,
- ScalarResult: Copy + Default + biteq::BitEq + core::fmt::Debug + DefaultStrategy,
+ Scalar: Copy + core::fmt::Debug + DefaultStrategy,
+ ScalarResult: Copy + biteq::BitEq + core::fmt::Debug + DefaultStrategy,
Vector: Into<[Scalar; LANES]> + From<[Scalar; LANES]> + Copy,
VectorResult: Into<[ScalarResult; LANES]> + From<[ScalarResult; LANES]> + Copy,
{
test_1(&|x: [Scalar; LANES]| {
proptest::prop_assume!(check(x));
let result_1: [ScalarResult; LANES] = fv(x.into()).into();
- let result_2: [ScalarResult; LANES] = {
- let mut result = [ScalarResult::default(); LANES];
- for (i, o) in x.iter().zip(result.iter_mut()) {
- *o = fs(*i);
- }
- result
- };
+ let result_2: [ScalarResult; LANES] = x
+ .iter()
+ .copied()
+ .map(fs)
+ .collect::<Vec<_>>()
+ .try_into()
+ .unwrap();
crate::prop_assert_biteq!(result_1, result_2);
Ok(())
});
@@ -162,7 +184,7 @@ pub fn test_unary_mask_elementwise<Scalar, Vector, Mask, const LANES: usize>(
fs: &dyn Fn(Scalar) -> bool,
check: &dyn Fn([Scalar; LANES]) -> bool,
) where
- Scalar: Copy + Default + core::fmt::Debug + DefaultStrategy,
+ Scalar: Copy + core::fmt::Debug + DefaultStrategy,
Vector: Into<[Scalar; LANES]> + From<[Scalar; LANES]> + Copy,
Mask: Into<[bool; LANES]> + From<[bool; LANES]> + Copy,
{
@@ -196,9 +218,9 @@ pub fn test_binary_elementwise<
fs: &dyn Fn(Scalar1, Scalar2) -> ScalarResult,
check: &dyn Fn([Scalar1; LANES], [Scalar2; LANES]) -> bool,
) where
- Scalar1: Copy + Default + core::fmt::Debug + DefaultStrategy,
- Scalar2: Copy + Default + core::fmt::Debug + DefaultStrategy,
- ScalarResult: Copy + Default + biteq::BitEq + core::fmt::Debug + DefaultStrategy,
+ Scalar1: Copy + core::fmt::Debug + DefaultStrategy,
+ Scalar2: Copy + core::fmt::Debug + DefaultStrategy,
+ ScalarResult: Copy + biteq::BitEq + core::fmt::Debug + DefaultStrategy,
Vector1: Into<[Scalar1; LANES]> + From<[Scalar1; LANES]> + Copy,
Vector2: Into<[Scalar2; LANES]> + From<[Scalar2; LANES]> + Copy,
VectorResult: Into<[ScalarResult; LANES]> + From<[ScalarResult; LANES]> + Copy,
@@ -206,13 +228,14 @@ pub fn test_binary_elementwise<
test_2(&|x: [Scalar1; LANES], y: [Scalar2; LANES]| {
proptest::prop_assume!(check(x, y));
let result_1: [ScalarResult; LANES] = fv(x.into(), y.into()).into();
- let result_2: [ScalarResult; LANES] = {
- let mut result = [ScalarResult::default(); LANES];
- for ((i1, i2), o) in x.iter().zip(y.iter()).zip(result.iter_mut()) {
- *o = fs(*i1, *i2);
- }
- result
- };
+ let result_2: [ScalarResult; LANES] = x
+ .iter()
+ .copied()
+ .zip(y.iter().copied())
+ .map(|(x, y)| fs(x, y))
+ .collect::<Vec<_>>()
+ .try_into()
+ .unwrap();
crate::prop_assert_biteq!(result_1, result_2);
Ok(())
});
@@ -333,6 +356,39 @@ pub fn test_ternary_elementwise<
);
}
+#[doc(hidden)]
+#[macro_export]
+macro_rules! test_lanes_helper {
+ ($($(#[$meta:meta])* $fn_name:ident $lanes:literal;)+) => {
+ $(
+ #[test]
+ $(#[$meta])*
+ fn $fn_name() {
+ implementation::<$lanes>();
+ }
+ )+
+ };
+ (
+ $(#[$meta:meta])+;
+ $($(#[$meta_before:meta])+ $fn_name_before:ident $lanes_before:literal;)*
+ $fn_name:ident $lanes:literal;
+ $($fn_name_rest:ident $lanes_rest:literal;)*
+ ) => {
+ $crate::test_lanes_helper!(
+ $(#[$meta])+;
+ $($(#[$meta_before])+ $fn_name_before $lanes_before;)*
+ $(#[$meta])+ $fn_name $lanes;
+ $($fn_name_rest $lanes_rest;)*
+ );
+ };
+ (
+ $(#[$meta_ignored:meta])+;
+ $($(#[$meta:meta])+ $fn_name:ident $lanes:literal;)+
+ ) => {
+ $crate::test_lanes_helper!($($(#[$meta])+ $fn_name $lanes;)+);
+ };
+}
+
/// Expand a const-generic test into separate tests for each possible lane count.
#[macro_export]
macro_rules! test_lanes {
@@ -345,57 +401,96 @@ macro_rules! test_lanes {
fn implementation<const $lanes: usize>()
where
- core_simd::LaneCount<$lanes>: core_simd::SupportedLaneCount,
+ core_simd::simd::LaneCount<$lanes>: core_simd::simd::SupportedLaneCount,
$body
#[cfg(target_arch = "wasm32")]
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
- #[test]
- #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
- fn lanes_1() {
- implementation::<1>();
- }
-
- #[test]
- #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
- fn lanes_2() {
- implementation::<2>();
- }
-
- #[test]
- #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
- fn lanes_4() {
- implementation::<4>();
- }
+ $crate::test_lanes_helper!(
+ #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)];
+ lanes_1 1;
+ lanes_2 2;
+ lanes_4 4;
+ );
- #[test]
- #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
- fn lanes_8() {
- implementation::<8>();
- }
-
- #[test]
- #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
+ $crate::test_lanes_helper!(
+ #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)];
+ lanes_8 8;
+ lanes_16 16;
+ lanes_32 32;
+ lanes_64 64;
+ );
+
+ #[cfg(feature = "all_lane_counts")]
+ $crate::test_lanes_helper!(
+ // test some odd and even non-power-of-2 lengths on miri
+ #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)];
+ lanes_3 3;
+ lanes_5 5;
+ lanes_6 6;
+ );
+
+ #[cfg(feature = "all_lane_counts")]
#[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
- fn lanes_16() {
- implementation::<16>();
- }
-
- #[test]
- #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
- #[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
- fn lanes_32() {
- implementation::<32>();
- }
-
- #[test]
- #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
- #[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
- fn lanes_64() {
- implementation::<64>();
- }
+ $crate::test_lanes_helper!(
+ #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)];
+ lanes_7 7;
+ lanes_9 9;
+ lanes_10 10;
+ lanes_11 11;
+ lanes_12 12;
+ lanes_13 13;
+ lanes_14 14;
+ lanes_15 15;
+ lanes_17 17;
+ lanes_18 18;
+ lanes_19 19;
+ lanes_20 20;
+ lanes_21 21;
+ lanes_22 22;
+ lanes_23 23;
+ lanes_24 24;
+ lanes_25 25;
+ lanes_26 26;
+ lanes_27 27;
+ lanes_28 28;
+ lanes_29 29;
+ lanes_30 30;
+ lanes_31 31;
+ lanes_33 33;
+ lanes_34 34;
+ lanes_35 35;
+ lanes_36 36;
+ lanes_37 37;
+ lanes_38 38;
+ lanes_39 39;
+ lanes_40 40;
+ lanes_41 41;
+ lanes_42 42;
+ lanes_43 43;
+ lanes_44 44;
+ lanes_45 45;
+ lanes_46 46;
+ lanes_47 47;
+ lanes_48 48;
+ lanes_49 49;
+ lanes_50 50;
+ lanes_51 51;
+ lanes_52 52;
+ lanes_53 53;
+ lanes_54 54;
+ lanes_55 55;
+ lanes_56 56;
+ lanes_57 57;
+ lanes_58 58;
+ lanes_59 59;
+ lanes_60 60;
+ lanes_61 61;
+ lanes_62 62;
+ lanes_63 63;
+ );
}
)*
}
@@ -413,50 +508,93 @@ macro_rules! test_lanes_panic {
fn implementation<const $lanes: usize>()
where
- core_simd::LaneCount<$lanes>: core_simd::SupportedLaneCount,
+ core_simd::simd::LaneCount<$lanes>: core_simd::simd::SupportedLaneCount,
$body
- #[test]
- #[should_panic]
- fn lanes_1() {
- implementation::<1>();
- }
-
- #[test]
- #[should_panic]
- fn lanes_2() {
- implementation::<2>();
- }
-
- #[test]
- #[should_panic]
- fn lanes_4() {
- implementation::<4>();
- }
-
- #[test]
- #[should_panic]
- fn lanes_8() {
- implementation::<8>();
- }
+ $crate::test_lanes_helper!(
+ #[should_panic];
+ lanes_1 1;
+ lanes_2 2;
+ lanes_4 4;
+ );
- #[test]
- #[should_panic]
- fn lanes_16() {
- implementation::<16>();
- }
-
- #[test]
- #[should_panic]
- fn lanes_32() {
- implementation::<32>();
- }
-
- #[test]
- #[should_panic]
- fn lanes_64() {
- implementation::<64>();
- }
+ #[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
+ $crate::test_lanes_helper!(
+ #[should_panic];
+ lanes_8 8;
+ lanes_16 16;
+ lanes_32 32;
+ lanes_64 64;
+ );
+
+ #[cfg(feature = "all_lane_counts")]
+ $crate::test_lanes_helper!(
+ // test some odd and even non-power-of-2 lengths on miri
+ #[should_panic];
+ lanes_3 3;
+ lanes_5 5;
+ lanes_6 6;
+ );
+
+ #[cfg(feature = "all_lane_counts")]
+ #[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
+ $crate::test_lanes_helper!(
+ #[should_panic];
+ lanes_7 7;
+ lanes_9 9;
+ lanes_10 10;
+ lanes_11 11;
+ lanes_12 12;
+ lanes_13 13;
+ lanes_14 14;
+ lanes_15 15;
+ lanes_17 17;
+ lanes_18 18;
+ lanes_19 19;
+ lanes_20 20;
+ lanes_21 21;
+ lanes_22 22;
+ lanes_23 23;
+ lanes_24 24;
+ lanes_25 25;
+ lanes_26 26;
+ lanes_27 27;
+ lanes_28 28;
+ lanes_29 29;
+ lanes_30 30;
+ lanes_31 31;
+ lanes_33 33;
+ lanes_34 34;
+ lanes_35 35;
+ lanes_36 36;
+ lanes_37 37;
+ lanes_38 38;
+ lanes_39 39;
+ lanes_40 40;
+ lanes_41 41;
+ lanes_42 42;
+ lanes_43 43;
+ lanes_44 44;
+ lanes_45 45;
+ lanes_46 46;
+ lanes_47 47;
+ lanes_48 48;
+ lanes_49 49;
+ lanes_50 50;
+ lanes_51 51;
+ lanes_52 52;
+ lanes_53 53;
+ lanes_54 54;
+ lanes_55 55;
+ lanes_56 56;
+ lanes_57 57;
+ lanes_58 58;
+ lanes_59 59;
+ lanes_60 60;
+ lanes_61 61;
+ lanes_62 62;
+ lanes_63 63;
+ );
}
)*
}
diff --git a/library/proc_macro/src/bridge/mod.rs b/library/proc_macro/src/bridge/mod.rs
index 4c1e196b5..caecda1bc 100644
--- a/library/proc_macro/src/bridge/mod.rs
+++ b/library/proc_macro/src/bridge/mod.rs
@@ -14,6 +14,7 @@ use std::hash::Hash;
use std::marker;
use std::mem;
use std::ops::Bound;
+use std::ops::Range;
use std::panic;
use std::sync::atomic::AtomicUsize;
use std::sync::Once;
@@ -93,6 +94,7 @@ macro_rules! with_api {
fn source_file($self: $S::Span) -> $S::SourceFile;
fn parent($self: $S::Span) -> Option<$S::Span>;
fn source($self: $S::Span) -> $S::Span;
+ fn byte_range($self: $S::Span) -> Range<usize>;
fn start($self: $S::Span) -> LineColumn;
fn end($self: $S::Span) -> LineColumn;
fn before($self: $S::Span) -> $S::Span;
@@ -335,6 +337,8 @@ pub enum LitKind {
StrRaw(u8),
ByteStr,
ByteStrRaw(u8),
+ CStr,
+ CStrRaw(u8),
Err,
}
@@ -348,6 +352,8 @@ rpc_encode_decode!(
StrRaw(n),
ByteStr,
ByteStrRaw(n),
+ CStr,
+ CStrRaw(n),
Err,
}
);
@@ -519,3 +525,7 @@ pub struct ExpnGlobals<Span> {
compound_traits!(
struct ExpnGlobals<Span> { def_site, call_site, mixed_site }
);
+
+compound_traits!(
+ struct Range<T> { start, end }
+);
diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs
index 9d081c8b8..c64665b6a 100644
--- a/library/proc_macro/src/lib.rs
+++ b/library/proc_macro/src/lib.rs
@@ -44,7 +44,7 @@ mod diagnostic;
pub use diagnostic::{Diagnostic, Level, MultiSpan};
use std::cmp::Ordering;
-use std::ops::RangeBounds;
+use std::ops::{Range, RangeBounds};
use std::path::PathBuf;
use std::str::FromStr;
use std::{error, fmt};
@@ -488,6 +488,12 @@ impl Span {
Span(self.0.source())
}
+ /// Returns the span's byte position range in the source file.
+ #[unstable(feature = "proc_macro_span", issue = "54725")]
+ pub fn byte_range(&self) -> Range<usize> {
+ self.0.byte_range()
+ }
+
/// Gets the starting line/column in the source file for this span.
#[unstable(feature = "proc_macro_span", issue = "54725")]
pub fn start(&self) -> LineColumn {
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
index 96c75f97f..09afc696c 100644
--- a/library/std/Cargo.toml
+++ b/library/std/Cargo.toml
@@ -15,19 +15,19 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" }
core = { path = "../core" }
-libc = { version = "0.2.140", default-features = false, features = ['rustc-dep-of-std'] }
-compiler_builtins = { version = "0.1.91" }
+libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'] }
+compiler_builtins = { version = "0.1.92" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
-hashbrown = { version = "0.12", default-features = false, features = ['rustc-dep-of-std'] }
+hashbrown = { version = "0.13", default-features = false, features = ['rustc-dep-of-std'] }
std_detect = { path = "../stdarch/crates/std_detect", default-features = false, features = ['rustc-dep-of-std'] }
# Dependencies of the `backtrace` crate
-addr2line = { version = "0.17.0", optional = true, default-features = false }
+addr2line = { version = "0.18.0", optional = true, default-features = false }
rustc-demangle = { version = "0.1.21", features = ['rustc-dep-of-std'] }
-miniz_oxide = { version = "0.5.0", optional = true, default-features = false }
+miniz_oxide = { version = "0.6.0", optional = true, default-features = false }
[dependencies.object]
-version = "0.29.0"
+version = "0.30.0"
optional = true
default-features = false
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']
diff --git a/library/std/build.rs b/library/std/build.rs
index cf708db6f..0fb03c8e8 100644
--- a/library/std/build.rs
+++ b/library/std/build.rs
@@ -34,6 +34,7 @@ fn main() {
|| target.contains("espidf")
|| target.contains("solid")
|| target.contains("nintendo-3ds")
+ || target.contains("vita")
|| target.contains("nto")
{
// These platforms don't have any special requirements.
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs
index c5a5991cc..ec774e62d 100644
--- a/library/std/src/alloc.rs
+++ b/library/std/src/alloc.rs
@@ -93,7 +93,7 @@ pub use alloc_crate::alloc::*;
///
/// ```rust
/// use std::alloc::{System, GlobalAlloc, Layout};
-/// use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
+/// use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
///
/// struct Counter;
///
@@ -103,14 +103,14 @@ pub use alloc_crate::alloc::*;
/// unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
/// let ret = System.alloc(layout);
/// if !ret.is_null() {
-/// ALLOCATED.fetch_add(layout.size(), SeqCst);
+/// ALLOCATED.fetch_add(layout.size(), Relaxed);
/// }
/// ret
/// }
///
/// unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
/// System.dealloc(ptr, layout);
-/// ALLOCATED.fetch_sub(layout.size(), SeqCst);
+/// ALLOCATED.fetch_sub(layout.size(), Relaxed);
/// }
/// }
///
@@ -118,7 +118,7 @@ pub use alloc_crate::alloc::*;
/// static A: Counter = Counter;
///
/// fn main() {
-/// println!("allocated bytes before main: {}", ALLOCATED.load(SeqCst));
+/// println!("allocated bytes before main: {}", ALLOCATED.load(Relaxed));
/// }
/// ```
///
diff --git a/library/std/src/ascii.rs b/library/std/src/ascii.rs
index c29f01577..b18ab50de 100644
--- a/library/std/src/ascii.rs
+++ b/library/std/src/ascii.rs
@@ -16,6 +16,9 @@
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::ascii::{escape_default, EscapeDefault};
+#[unstable(feature = "ascii_char", issue = "110998")]
+pub use core::ascii::Char;
+
/// Extension methods for ASCII-subset only operations.
///
/// Be aware that operations on seemingly non-ASCII characters can sometimes
diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs
index 3afc8287e..c722bad2e 100644
--- a/library/std/src/collections/hash/map.rs
+++ b/library/std/src/collections/hash/map.rs
@@ -3168,8 +3168,7 @@ impl DefaultHasher {
}
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
-#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
-impl const Default for DefaultHasher {
+impl Default for DefaultHasher {
/// Creates a new `DefaultHasher` using [`new`].
/// See its documentation for more.
///
@@ -3181,8 +3180,7 @@ impl const Default for DefaultHasher {
}
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
-#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
-impl const Hasher for DefaultHasher {
+impl Hasher for DefaultHasher {
// The underlying `SipHasher13` doesn't override the other
// `write_*` methods, so it's ok not to forward them here.
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index c550378e7..89dfdfafd 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -15,6 +15,7 @@ use crate::ffi::OsString;
use crate::fmt;
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write};
use crate::path::{Path, PathBuf};
+use crate::sealed::Sealed;
use crate::sys::fs as fs_imp;
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
use crate::time::SystemTime;
@@ -249,9 +250,9 @@ pub struct DirBuilder {
pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
fn inner(path: &Path) -> io::Result<Vec<u8>> {
let mut file = File::open(path)?;
- let size = file.metadata().map(|m| m.len()).unwrap_or(0);
- let mut bytes = Vec::with_capacity(size as usize);
- io::default_read_to_end(&mut file, &mut bytes)?;
+ let size = file.metadata().map(|m| m.len() as usize).ok();
+ let mut bytes = Vec::with_capacity(size.unwrap_or(0));
+ io::default_read_to_end(&mut file, &mut bytes, size)?;
Ok(bytes)
}
inner(path.as_ref())
@@ -289,9 +290,9 @@ pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
pub fn read_to_string<P: AsRef<Path>>(path: P) -> io::Result<String> {
fn inner(path: &Path) -> io::Result<String> {
let mut file = File::open(path)?;
- let size = file.metadata().map(|m| m.len()).unwrap_or(0);
- let mut string = String::with_capacity(size as usize);
- io::default_read_to_string(&mut file, &mut string)?;
+ let size = file.metadata().map(|m| m.len() as usize).ok();
+ let mut string = String::with_capacity(size.unwrap_or(0));
+ io::default_read_to_string(&mut file, &mut string, size)?;
Ok(string)
}
inner(path.as_ref())
@@ -709,6 +710,7 @@ impl File {
// `AsRawHandle`/`IntoRawHandle`/`FromRawHandle` on Windows.
impl AsInner<fs_imp::File> for File {
+ #[inline]
fn as_inner(&self) -> &fs_imp::File {
&self.inner
}
@@ -732,12 +734,12 @@ impl fmt::Debug for File {
}
/// Indicates how much extra capacity is needed to read the rest of the file.
-fn buffer_capacity_required(mut file: &File) -> usize {
- let size = file.metadata().map(|m| m.len()).unwrap_or(0);
- let pos = file.stream_position().unwrap_or(0);
+fn buffer_capacity_required(mut file: &File) -> Option<usize> {
+ let size = file.metadata().map(|m| m.len()).ok()?;
+ let pos = file.stream_position().ok()?;
// Don't worry about `usize` overflow because reading will fail regardless
// in that case.
- size.saturating_sub(pos) as usize
+ Some(size.saturating_sub(pos) as usize)
}
#[stable(feature = "rust1", since = "1.0.0")]
@@ -761,14 +763,16 @@ impl Read for File {
// Reserves space in the buffer based on the file size when available.
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
- buf.reserve(buffer_capacity_required(self));
- io::default_read_to_end(self, buf)
+ let size = buffer_capacity_required(self);
+ buf.reserve(size.unwrap_or(0));
+ io::default_read_to_end(self, buf, size)
}
// Reserves space in the buffer based on the file size when available.
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
- buf.reserve(buffer_capacity_required(self));
- io::default_read_to_string(self, buf)
+ let size = buffer_capacity_required(self);
+ buf.reserve(size.unwrap_or(0));
+ io::default_read_to_string(self, buf, size)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
@@ -817,14 +821,16 @@ impl Read for &File {
// Reserves space in the buffer based on the file size when available.
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
- buf.reserve(buffer_capacity_required(self));
- io::default_read_to_end(self, buf)
+ let size = buffer_capacity_required(self);
+ buf.reserve(size.unwrap_or(0));
+ io::default_read_to_end(self, buf, size)
}
// Reserves space in the buffer based on the file size when available.
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
- buf.reserve(buffer_capacity_required(self));
- io::default_read_to_string(self, buf)
+ let size = buffer_capacity_required(self);
+ buf.reserve(size.unwrap_or(0));
+ io::default_read_to_string(self, buf, size)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1083,12 +1089,14 @@ impl OpenOptions {
}
impl AsInner<fs_imp::OpenOptions> for OpenOptions {
+ #[inline]
fn as_inner(&self) -> &fs_imp::OpenOptions {
&self.0
}
}
impl AsInnerMut<fs_imp::OpenOptions> for OpenOptions {
+ #[inline]
fn as_inner_mut(&mut self) -> &mut fs_imp::OpenOptions {
&mut self.0
}
@@ -1348,6 +1356,7 @@ impl fmt::Debug for Metadata {
}
impl AsInner<fs_imp::FileAttr> for Metadata {
+ #[inline]
fn as_inner(&self) -> &fs_imp::FileAttr {
&self.0
}
@@ -1383,6 +1392,16 @@ impl FileTimes {
}
}
+impl AsInnerMut<fs_imp::FileTimes> for FileTimes {
+ fn as_inner_mut(&mut self) -> &mut fs_imp::FileTimes {
+ &mut self.0
+ }
+}
+
+// For implementing OS extension traits in `std::os`
+#[unstable(feature = "file_set_times", issue = "98245")]
+impl Sealed for FileTimes {}
+
impl Permissions {
/// Returns `true` if these permissions describe a readonly (unwritable) file.
///
@@ -1600,6 +1619,7 @@ impl FileType {
}
impl AsInner<fs_imp::FileType> for FileType {
+ #[inline]
fn as_inner(&self) -> &fs_imp::FileType {
&self.0
}
@@ -1612,6 +1632,7 @@ impl FromInner<fs_imp::FilePermissions> for Permissions {
}
impl AsInner<fs_imp::FilePermissions> for Permissions {
+ #[inline]
fn as_inner(&self) -> &fs_imp::FilePermissions {
&self.0
}
@@ -1766,6 +1787,7 @@ impl fmt::Debug for DirEntry {
}
impl AsInner<fs_imp::DirEntry> for DirEntry {
+ #[inline]
fn as_inner(&self) -> &fs_imp::DirEntry {
&self.0
}
@@ -1935,7 +1957,7 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
/// On success, the total number of bytes copied is returned and it is equal to
/// the length of the `to` file as reported by `metadata`.
///
-/// If you’re wanting to copy the contents of one file to another and you’re
+/// If you want to copy the contents of one file to another and you’re
/// working with [`File`]s, see the [`io::copy()`] function.
///
/// # Platform-specific behavior
@@ -2280,6 +2302,11 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
///
/// See [`fs::remove_file`] and [`fs::remove_dir`].
///
+/// `remove_dir_all` will fail if `remove_dir` or `remove_file` fail on any constituent paths, including the root path.
+/// As a result, the directory you are deleting must exist, meaning that this function is not idempotent.
+///
+/// Consider ignoring the error if validating the removal is not required for your use case.
+///
/// [`fs::remove_file`]: remove_file
/// [`fs::remove_dir`]: remove_dir
///
@@ -2501,6 +2528,7 @@ impl DirBuilder {
}
impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
+ #[inline]
fn as_inner_mut(&mut self) -> &mut fs_imp::DirBuilder {
&mut self.inner
}
@@ -2511,9 +2539,10 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
/// This function will traverse symbolic links to query information about the
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
///
-/// As opposed to the [`Path::exists`] method, this one doesn't silently ignore errors
-/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
-/// denied on some of the parent directories.)
+/// As opposed to the [`Path::exists`] method, this will only return `Ok(true)` or `Ok(false)`
+/// if the path was _verified_ to exist or not exist. If its existence can neither be confirmed
+/// nor denied, an `Err(_)` will be propagated instead. This can be the case if e.g. listing
+/// permission is denied on one of the parent directories.
///
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs
index 401def184..e2480bcbb 100644
--- a/library/std/src/fs/tests.rs
+++ b/library/std/src/fs/tests.rs
@@ -1,7 +1,7 @@
use crate::io::prelude::*;
use crate::env;
-use crate::fs::{self, File, OpenOptions};
+use crate::fs::{self, File, FileTimes, OpenOptions};
use crate::io::{BorrowedBuf, ErrorKind, SeekFrom};
use crate::mem::MaybeUninit;
use crate::path::Path;
@@ -9,7 +9,7 @@ use crate::str;
use crate::sync::Arc;
use crate::sys_common::io::test::{tmpdir, TempDir};
use crate::thread;
-use crate::time::{Duration, Instant};
+use crate::time::{Duration, Instant, SystemTime};
use rand::RngCore;
@@ -919,6 +919,7 @@ fn symlink_noexist() {
#[test]
fn read_link() {
+ let tmpdir = tmpdir();
if cfg!(windows) {
// directory symlink
assert_eq!(check!(fs::read_link(r"C:\Users\All Users")), Path::new(r"C:\ProgramData"));
@@ -933,8 +934,11 @@ fn read_link() {
Path::new(r"C:\Users")
);
}
+ // Check that readlink works with non-drive paths on Windows.
+ let link = tmpdir.join("link_unc");
+ check!(symlink_dir(r"\\localhost\c$\", &link));
+ assert_eq!(check!(fs::read_link(&link)), Path::new(r"\\localhost\c$\"));
}
- let tmpdir = tmpdir();
let link = tmpdir.join("link");
if !got_symlink_permission(&tmpdir) {
return;
@@ -1629,3 +1633,53 @@ fn rename_directory() {
assert!(new_path.join("newdir").is_dir());
assert!(new_path.join("newdir/temp.txt").exists());
}
+
+#[test]
+fn test_file_times() {
+ #[cfg(target_os = "ios")]
+ use crate::os::ios::fs::FileTimesExt;
+ #[cfg(target_os = "macos")]
+ use crate::os::macos::fs::FileTimesExt;
+ #[cfg(target_os = "watchos")]
+ use crate::os::watchos::fs::FileTimesExt;
+ #[cfg(windows)]
+ use crate::os::windows::fs::FileTimesExt;
+
+ let tmp = tmpdir();
+ let file = File::create(tmp.join("foo")).unwrap();
+ let mut times = FileTimes::new();
+ let accessed = SystemTime::UNIX_EPOCH + Duration::from_secs(12345);
+ let modified = SystemTime::UNIX_EPOCH + Duration::from_secs(54321);
+ times = times.set_accessed(accessed).set_modified(modified);
+ #[cfg(any(windows, target_os = "macos", target_os = "ios", target_os = "watchos"))]
+ let created = SystemTime::UNIX_EPOCH + Duration::from_secs(32123);
+ #[cfg(any(windows, target_os = "macos", target_os = "ios", target_os = "watchos"))]
+ {
+ times = times.set_created(created);
+ }
+ match file.set_times(times) {
+ // Allow unsupported errors on platforms which don't support setting times.
+ #[cfg(not(any(
+ windows,
+ all(
+ unix,
+ not(any(
+ target_os = "android",
+ target_os = "redox",
+ target_os = "espidf",
+ target_os = "horizon"
+ ))
+ )
+ )))]
+ Err(e) if e.kind() == ErrorKind::Unsupported => return,
+ Err(e) => panic!("error setting file times: {e:?}"),
+ Ok(_) => {}
+ }
+ let metadata = file.metadata().unwrap();
+ assert_eq!(metadata.accessed().unwrap(), accessed);
+ assert_eq!(metadata.modified().unwrap(), modified);
+ #[cfg(any(windows, target_os = "macos", target_os = "ios", target_os = "watchos"))]
+ {
+ assert_eq!(metadata.created().unwrap(), created);
+ }
+}
diff --git a/library/std/src/io/buffered/tests.rs b/library/std/src/io/buffered/tests.rs
index 4c1b7d576..35a5291a3 100644
--- a/library/std/src/io/buffered/tests.rs
+++ b/library/std/src/io/buffered/tests.rs
@@ -831,9 +831,9 @@ fn partial_line_buffered_after_line_write() {
assert_eq!(&writer.get_ref().buffer, b"Line 1\nLine 2\nLine 3");
}
-/// Test that, given a partial line that exceeds the length of
-/// LineBuffer's buffer (that is, without a trailing newline), that that
-/// line is written to the inner writer
+/// Test that for calls to LineBuffer::write where the passed bytes do not contain
+/// a newline and on their own are greater in length than the internal buffer, the
+/// passed bytes are immediately written to the inner writer.
#[test]
fn long_line_flushed() {
let writer = ProgrammableSink::default();
@@ -844,9 +844,10 @@ fn long_line_flushed() {
}
/// Test that, given a very long partial line *after* successfully
-/// flushing a complete line, that that line is buffered unconditionally,
-/// and no additional writes take place. This assures the property that
-/// `write` should make at-most-one attempt to write new data.
+/// flushing a complete line, the very long partial line is buffered
+/// unconditionally, and no additional writes take place. This assures
+/// the property that `write` should make at-most-one attempt to write
+/// new data.
#[test]
fn line_long_tail_not_flushed() {
let writer = ProgrammableSink::default();
diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs
index 38b98afff..1d9d93f5b 100644
--- a/library/std/src/io/copy.rs
+++ b/library/std/src/io/copy.rs
@@ -10,7 +10,7 @@ use crate::mem::MaybeUninit;
/// On success, the total number of bytes that were copied from
/// `reader` to `writer` is returned.
///
-/// If you’re wanting to copy the contents of one file to another and you’re
+/// If you want to copy the contents of one file to another and you’re
/// working with filesystem paths, see the [`fs::copy`] function.
///
/// [`fs::copy`]: crate::fs::copy
diff --git a/library/std/src/io/impls.rs b/library/std/src/io/impls.rs
index e5048dcc8..a7428776d 100644
--- a/library/std/src/io/impls.rs
+++ b/library/std/src/io/impls.rs
@@ -9,6 +9,7 @@ use crate::io::{
self, BorrowedCursor, BufRead, ErrorKind, IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write,
};
use crate::mem;
+use crate::str;
// =============================================================================
// Forwarding implementations
@@ -307,6 +308,17 @@ impl Read for &[u8] {
*self = &self[len..];
Ok(len)
}
+
+ #[inline]
+ fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+ let content = str::from_utf8(self).map_err(|_| {
+ io::const_io_error!(ErrorKind::InvalidData, "stream did not contain valid UTF-8")
+ })?;
+ buf.push_str(content);
+ let len = self.len();
+ *self = &self[len..];
+ Ok(len)
+ }
}
#[stable(feature = "rust1", since = "1.0.0")]
@@ -336,7 +348,7 @@ impl Write for &mut [u8] {
#[inline]
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
let amt = cmp::min(data.len(), self.len());
- let (a, b) = mem::replace(self, &mut []).split_at_mut(amt);
+ let (a, b) = mem::take(self).split_at_mut(amt);
a.copy_from_slice(&data[..amt]);
*self = b;
Ok(amt)
@@ -434,6 +446,33 @@ impl<A: Allocator> Read for VecDeque<u8, A> {
self.drain(..n);
Ok(())
}
+
+ #[inline]
+ fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+ // The total len is known upfront so we can reserve it in a single call.
+ let len = self.len();
+ buf.reserve(len);
+
+ let (front, back) = self.as_slices();
+ buf.extend_from_slice(front);
+ buf.extend_from_slice(back);
+ self.clear();
+ Ok(len)
+ }
+
+ #[inline]
+ fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+ // We have to use a single contiguous slice because the `VecDequeue` might be split in the
+ // middle of an UTF-8 character.
+ let len = self.len();
+ let content = self.make_contiguous();
+ let string = str::from_utf8(content).map_err(|_| {
+ io::const_io_error!(ErrorKind::InvalidData, "stream did not contain valid UTF-8")
+ })?;
+ buf.push_str(string);
+ self.clear();
+ Ok(len)
+ }
}
/// Write is implemented for `VecDeque<u8>` by appending to the `VecDeque`, growing it as needed.
@@ -446,6 +485,21 @@ impl<A: Allocator> Write for VecDeque<u8, A> {
}
#[inline]
+ fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
+ let len = bufs.iter().map(|b| b.len()).sum();
+ self.reserve(len);
+ for buf in bufs {
+ self.extend(&**buf);
+ }
+ Ok(len)
+ }
+
+ #[inline]
+ fn is_write_vectored(&self) -> bool {
+ true
+ }
+
+ #[inline]
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.extend(buf);
Ok(())
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index ea66d0409..8a007d095 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -253,7 +253,7 @@ mod tests;
use crate::cmp;
use crate::fmt;
-use crate::mem::replace;
+use crate::mem::take;
use crate::ops::{Deref, DerefMut};
use crate::slice;
use crate::str;
@@ -357,9 +357,17 @@ where
// of data to return. Simply tacking on an extra DEFAULT_BUF_SIZE space every
// time is 4,500 times (!) slower than a default reservation size of 32 if the
// reader has a very small amount of data to return.
-pub(crate) fn default_read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize> {
+pub(crate) fn default_read_to_end<R: Read + ?Sized>(
+ r: &mut R,
+ buf: &mut Vec<u8>,
+ size_hint: Option<usize>,
+) -> Result<usize> {
let start_len = buf.len();
let start_cap = buf.capacity();
+ // Optionally limit the maximum bytes read on each iteration.
+ // This adds an arbitrary fiddle factor to allow for more data than we expect.
+ let max_read_size =
+ size_hint.and_then(|s| s.checked_add(1024)?.checked_next_multiple_of(DEFAULT_BUF_SIZE));
let mut initialized = 0; // Extra initialized bytes from previous loop iteration
loop {
@@ -367,7 +375,12 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>
buf.reserve(32); // buf is full, need more space
}
- let mut read_buf: BorrowedBuf<'_> = buf.spare_capacity_mut().into();
+ let mut spare = buf.spare_capacity_mut();
+ if let Some(size) = max_read_size {
+ let len = cmp::min(spare.len(), size);
+ spare = &mut spare[..len]
+ }
+ let mut read_buf: BorrowedBuf<'_> = spare.into();
// SAFETY: These bytes were initialized but not filled in the previous loop
unsafe {
@@ -419,6 +432,7 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>
pub(crate) fn default_read_to_string<R: Read + ?Sized>(
r: &mut R,
buf: &mut String,
+ size_hint: Option<usize>,
) -> Result<usize> {
// Note that we do *not* call `r.read_to_end()` here. We are passing
// `&mut Vec<u8>` (the raw contents of `buf`) into the `read_to_end`
@@ -429,7 +443,7 @@ pub(crate) fn default_read_to_string<R: Read + ?Sized>(
// To prevent extraneously checking the UTF-8-ness of the entire buffer
// we pass it to our hardcoded `default_read_to_end` implementation which
// we know is guaranteed to only read data into the end of the buffer.
- unsafe { append_to_string(buf, |b| default_read_to_end(r, b)) }
+ unsafe { append_to_string(buf, |b| default_read_to_end(r, b, size_hint)) }
}
pub(crate) fn default_read_vectored<F>(read: F, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
@@ -579,7 +593,8 @@ pub trait Read {
/// This may happen for example because fewer bytes are actually available right now
/// (e. g. being close to end-of-file) or because read() was interrupted by a signal.
///
- /// As this trait is safe to implement, callers cannot rely on `n <= buf.len()` for safety.
+ /// As this trait is safe to implement, callers in unsafe code cannot rely on
+ /// `n <= buf.len()` for safety.
/// Extra care needs to be taken when `unsafe` functions are used to access the read bytes.
/// Callers have to ensure that no unchecked out-of-bounds accesses are possible even if
/// `n > buf.len()`.
@@ -589,8 +604,8 @@ pub trait Read {
/// contents of `buf` being true. It is recommended that *implementations*
/// only write data to `buf` instead of reading its contents.
///
- /// Correspondingly, however, *callers* of this method must not assume any guarantees
- /// about how the implementation uses `buf`. The trait is safe to implement,
+ /// Correspondingly, however, *callers* of this method in unsafe code must not assume
+ /// any guarantees about how the implementation uses `buf`. The trait is safe to implement,
/// so it is possible that the code that's supposed to write to the buffer might also read
/// from it. It is your responsibility to make sure that `buf` is initialized
/// before calling `read`. Calling `read` with an uninitialized `buf` (of the kind one
@@ -709,7 +724,7 @@ pub trait Read {
/// [`std::fs::read`]: crate::fs::read
#[stable(feature = "rust1", since = "1.0.0")]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
- default_read_to_end(self, buf)
+ default_read_to_end(self, buf, None)
}
/// Read all bytes until EOF in this source, appending them to `buf`.
@@ -752,7 +767,7 @@ pub trait Read {
/// [`std::fs::read_to_string`]: crate::fs::read_to_string
#[stable(feature = "rust1", since = "1.0.0")]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
- default_read_to_string(self, buf)
+ default_read_to_string(self, buf, None)
}
/// Read the exact number of bytes required to fill `buf`.
@@ -1186,7 +1201,7 @@ impl<'a> IoSliceMut<'a> {
}
}
- *bufs = &mut replace(bufs, &mut [])[remove..];
+ *bufs = &mut take(bufs)[remove..];
if bufs.is_empty() {
assert!(n == accumulated_len, "advancing io slices beyond their length");
} else {
@@ -1329,7 +1344,7 @@ impl<'a> IoSlice<'a> {
}
}
- *bufs = &mut replace(bufs, &mut [])[remove..];
+ *bufs = &mut take(bufs)[remove..];
if bufs.is_empty() {
assert!(n == accumulated_len, "advancing io slices beyond their length");
} else {
diff --git a/library/std/src/io/readbuf/tests.rs b/library/std/src/io/readbuf/tests.rs
index cc1b423f2..89a2f6b22 100644
--- a/library/std/src/io/readbuf/tests.rs
+++ b/library/std/src/io/readbuf/tests.rs
@@ -36,7 +36,7 @@ fn initialize_unfilled() {
}
#[test]
-fn addvance_filled() {
+fn advance_filled() {
let buf: &mut [_] = &mut [0; 16];
let mut rbuf: BorrowedBuf<'_> = buf.into();
diff --git a/library/std/src/io/tests.rs b/library/std/src/io/tests.rs
index f4a886d88..6d30f5e6c 100644
--- a/library/std/src/io/tests.rs
+++ b/library/std/src/io/tests.rs
@@ -314,7 +314,7 @@ fn bench_read_to_end(b: &mut test::Bencher) {
b.iter(|| {
let mut lr = repeat(1).take(10000000);
let mut vec = Vec::with_capacity(1024);
- super::default_read_to_end(&mut lr, &mut vec)
+ super::default_read_to_end(&mut lr, &mut vec, None)
});
}
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs
index 43842bee9..eb46f4e54 100644
--- a/library/std/src/keyword_docs.rs
+++ b/library/std/src/keyword_docs.rs
@@ -1925,7 +1925,7 @@ mod type_keyword {}
/// `unsafe_op_in_unsafe_fn` lint can be enabled to warn against that and require explicit unsafe
/// blocks even inside `unsafe fn`.
///
-/// See the [Rustnomicon] and the [Reference] for more information.
+/// See the [Rustonomicon] and the [Reference] for more information.
///
/// # Examples
///
@@ -2129,7 +2129,7 @@ mod type_keyword {}
/// [`impl`]: keyword.impl.html
/// [raw pointers]: ../reference/types/pointer.html
/// [memory safety]: ../book/ch19-01-unsafe-rust.html
-/// [Rustnomicon]: ../nomicon/index.html
+/// [Rustonomicon]: ../nomicon/index.html
/// [nomicon-soundness]: ../nomicon/safe-unsafe-meaning.html
/// [soundness]: https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library
/// [Reference]: ../reference/unsafety.html
@@ -2287,7 +2287,7 @@ mod use_keyword {}
/// # #![allow(dead_code)]
/// pub enum Cow<'a, B>
/// where
-/// B: 'a + ToOwned + ?Sized,
+/// B: ToOwned + ?Sized,
/// {
/// Borrowed(&'a B),
/// Owned(<B as ToOwned>::Owned),
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 98fcc76aa..318a46d1b 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -289,6 +289,7 @@
#![feature(float_next_up_down)]
#![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)]
+#![feature(int_roundings)]
#![feature(ip)]
#![feature(ip_in_core)]
#![feature(maybe_uninit_slice)]
diff --git a/library/std/src/net/tcp.rs b/library/std/src/net/tcp.rs
index 4b42ad65e..141a18a42 100644
--- a/library/std/src/net/tcp.rs
+++ b/library/std/src/net/tcp.rs
@@ -691,6 +691,7 @@ impl Write for &TcpStream {
}
impl AsInner<net_imp::TcpStream> for TcpStream {
+ #[inline]
fn as_inner(&self) -> &net_imp::TcpStream {
&self.0
}
@@ -755,6 +756,15 @@ impl TcpListener {
/// ];
/// let listener = TcpListener::bind(&addrs[..]).unwrap();
/// ```
+ ///
+ /// Creates a TCP listener bound to a port assigned by the operating system
+ /// at `127.0.0.1`.
+ ///
+ /// ```no_run
+ /// use std::net::TcpListener;
+ ///
+ /// let socket = TcpListener::bind("127.0.0.1:0").unwrap();
+ /// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<TcpListener> {
super::each_addr(addr, net_imp::TcpListener::bind).map(TcpListener)
@@ -1033,6 +1043,7 @@ impl Iterator for IntoIncoming {
impl FusedIterator for IntoIncoming {}
impl AsInner<net_imp::TcpListener> for TcpListener {
+ #[inline]
fn as_inner(&self) -> &net_imp::TcpListener {
&self.0
}
diff --git a/library/std/src/net/udp.rs b/library/std/src/net/udp.rs
index 864e1b0f3..5ca4ed832 100644
--- a/library/std/src/net/udp.rs
+++ b/library/std/src/net/udp.rs
@@ -90,6 +90,15 @@ impl UdpSocket {
/// ];
/// let socket = UdpSocket::bind(&addrs[..]).expect("couldn't bind to address");
/// ```
+ ///
+ /// Creates a UDP socket bound to a port assigned by the operating system
+ /// at `127.0.0.1`.
+ ///
+ /// ```no_run
+ /// use std::net::UdpSocket;
+ ///
+ /// let socket = UdpSocket::bind("127.0.0.1:0").unwrap();
+ /// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<UdpSocket> {
super::each_addr(addr, net_imp::UdpSocket::bind).map(UdpSocket)
@@ -788,6 +797,7 @@ impl UdpSocket {
// `AsRawSocket`/`IntoRawSocket`/`FromRawSocket` on Windows.
impl AsInner<net_imp::UdpSocket> for UdpSocket {
+ #[inline]
fn as_inner(&self) -> &net_imp::UdpSocket {
&self.0
}
diff --git a/library/std/src/os/fuchsia/raw.rs b/library/std/src/os/fuchsia/raw.rs
index ea6b94f2f..cb570beb8 100644
--- a/library/std/src/os/fuchsia/raw.rs
+++ b/library/std/src/os/fuchsia/raw.rs
@@ -286,3 +286,9 @@ mod arch {
pub __unused: [c_long; 3],
}
}
+
+#[cfg(target_arch = "riscv64")]
+mod arch {
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub use libc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
+}
diff --git a/library/std/src/os/ios/fs.rs b/library/std/src/os/ios/fs.rs
index 4a4637ce0..6d4d54b7c 100644
--- a/library/std/src/os/ios/fs.rs
+++ b/library/std/src/os/ios/fs.rs
@@ -1,7 +1,9 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
-use crate::fs::Metadata;
-use crate::sys_common::AsInner;
+use crate::fs::{self, Metadata};
+use crate::sealed::Sealed;
+use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
+use crate::time::SystemTime;
#[allow(deprecated)]
use crate::os::ios::raw;
@@ -140,3 +142,19 @@ impl MetadataExt for Metadata {
self.as_inner().as_inner().st_lspare as u32
}
}
+
+/// OS-specific extensions to [`fs::FileTimes`].
+#[unstable(feature = "file_set_times", issue = "98245")]
+pub trait FileTimesExt: Sealed {
+ /// Set the creation time of a file.
+ #[unstable(feature = "file_set_times", issue = "98245")]
+ fn set_created(self, t: SystemTime) -> Self;
+}
+
+#[unstable(feature = "file_set_times", issue = "98245")]
+impl FileTimesExt for fs::FileTimes {
+ fn set_created(mut self, t: SystemTime) -> Self {
+ self.as_inner_mut().set_created(t.into_inner());
+ self
+ }
+}
diff --git a/library/std/src/os/linux/process.rs b/library/std/src/os/linux/process.rs
index 540363c03..2b3ff76d7 100644
--- a/library/std/src/os/linux/process.rs
+++ b/library/std/src/os/linux/process.rs
@@ -52,6 +52,7 @@ pub struct PidFd {
}
impl AsInner<FileDesc> for PidFd {
+ #[inline]
fn as_inner(&self) -> &FileDesc {
&self.inner
}
@@ -70,6 +71,7 @@ impl IntoInner<FileDesc> for PidFd {
}
impl AsRawFd for PidFd {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.as_inner().as_raw_fd()
}
diff --git a/library/std/src/os/macos/fs.rs b/library/std/src/os/macos/fs.rs
index 91915da6a..fe82d03d8 100644
--- a/library/std/src/os/macos/fs.rs
+++ b/library/std/src/os/macos/fs.rs
@@ -1,7 +1,9 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
-use crate::fs::Metadata;
-use crate::sys_common::AsInner;
+use crate::fs::{self, Metadata};
+use crate::sealed::Sealed;
+use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
+use crate::time::SystemTime;
#[allow(deprecated)]
use crate::os::macos::raw;
@@ -146,3 +148,19 @@ impl MetadataExt for Metadata {
[qspare[0] as u64, qspare[1] as u64]
}
}
+
+/// OS-specific extensions to [`fs::FileTimes`].
+#[unstable(feature = "file_set_times", issue = "98245")]
+pub trait FileTimesExt: Sealed {
+ /// Set the creation time of a file.
+ #[unstable(feature = "file_set_times", issue = "98245")]
+ fn set_created(self, t: SystemTime) -> Self;
+}
+
+#[unstable(feature = "file_set_times", issue = "98245")]
+impl FileTimesExt for fs::FileTimes {
+ fn set_created(mut self, t: SystemTime) -> Self {
+ self.as_inner_mut().set_created(t.into_inner());
+ self
+ }
+}
diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs
index b148d8a00..5b54cc5f2 100644
--- a/library/std/src/os/mod.rs
+++ b/library/std/src/os/mod.rs
@@ -137,6 +137,8 @@ pub mod redox;
pub mod solaris;
#[cfg(target_os = "solid_asp3")]
pub mod solid;
+#[cfg(target_os = "vita")]
+pub mod vita;
#[cfg(target_os = "vxworks")]
pub mod vxworks;
#[cfg(target_os = "watchos")]
diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs
index a0e664acd..1e1c36931 100644
--- a/library/std/src/os/unix/fs.rs
+++ b/library/std/src/os/unix/fs.rs
@@ -368,7 +368,7 @@ pub trait OpenOptionsExt {
///
/// ```no_run
/// # #![feature(rustc_private)]
- /// extern crate libc;
+ /// use libc;
/// use std::fs::OpenOptions;
/// use std::os::unix::fs::OpenOptionsExt;
///
diff --git a/library/std/src/os/unix/mod.rs b/library/std/src/os/unix/mod.rs
index eb2d7ce11..6fe111118 100644
--- a/library/std/src/os/unix/mod.rs
+++ b/library/std/src/os/unix/mod.rs
@@ -73,6 +73,8 @@ mod platform {
pub use crate::os::redox::*;
#[cfg(target_os = "solaris")]
pub use crate::os::solaris::*;
+ #[cfg(target_os = "vita")]
+ pub use crate::os::vita::*;
#[cfg(target_os = "vxworks")]
pub use crate::os::vxworks::*;
#[cfg(target_os = "watchos")]
diff --git a/library/std/src/os/vita/fs.rs b/library/std/src/os/vita/fs.rs
new file mode 100644
index 000000000..a5a06764a
--- /dev/null
+++ b/library/std/src/os/vita/fs.rs
@@ -0,0 +1,95 @@
+#![stable(feature = "metadata_ext", since = "1.1.0")]
+
+use crate::fs::Metadata;
+use crate::sys_common::AsInner;
+
+/// OS-specific extensions to [`fs::Metadata`].
+///
+/// [`fs::Metadata`]: crate::fs::Metadata
+#[stable(feature = "metadata_ext", since = "1.1.0")]
+pub trait MetadataExt {
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_dev(&self) -> u64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_ino(&self) -> u64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_mode(&self) -> u32;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_nlink(&self) -> u64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_uid(&self) -> u32;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_gid(&self) -> u32;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_rdev(&self) -> u64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_size(&self) -> u64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_atime(&self) -> i64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_atime_nsec(&self) -> i64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_mtime(&self) -> i64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_mtime_nsec(&self) -> i64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_ctime(&self) -> i64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_ctime_nsec(&self) -> i64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_blksize(&self) -> u64;
+ #[stable(feature = "metadata_ext2", since = "1.8.0")]
+ fn st_blocks(&self) -> u64;
+}
+
+#[stable(feature = "metadata_ext", since = "1.1.0")]
+impl MetadataExt for Metadata {
+ fn st_dev(&self) -> u64 {
+ self.as_inner().as_inner().st_dev as u64
+ }
+ fn st_ino(&self) -> u64 {
+ self.as_inner().as_inner().st_ino as u64
+ }
+ fn st_mode(&self) -> u32 {
+ self.as_inner().as_inner().st_mode as u32
+ }
+ fn st_nlink(&self) -> u64 {
+ self.as_inner().as_inner().st_nlink as u64
+ }
+ fn st_uid(&self) -> u32 {
+ self.as_inner().as_inner().st_uid as u32
+ }
+ fn st_gid(&self) -> u32 {
+ self.as_inner().as_inner().st_gid as u32
+ }
+ fn st_rdev(&self) -> u64 {
+ self.as_inner().as_inner().st_rdev as u64
+ }
+ fn st_size(&self) -> u64 {
+ self.as_inner().as_inner().st_size as u64
+ }
+ fn st_atime(&self) -> i64 {
+ self.as_inner().as_inner().st_atime as i64
+ }
+ fn st_atime_nsec(&self) -> i64 {
+ 0
+ }
+ fn st_mtime(&self) -> i64 {
+ self.as_inner().as_inner().st_mtime as i64
+ }
+ fn st_mtime_nsec(&self) -> i64 {
+ 0
+ }
+ fn st_ctime(&self) -> i64 {
+ self.as_inner().as_inner().st_ctime as i64
+ }
+ fn st_ctime_nsec(&self) -> i64 {
+ 0
+ }
+ fn st_blksize(&self) -> u64 {
+ self.as_inner().as_inner().st_blksize as u64
+ }
+ fn st_blocks(&self) -> u64 {
+ self.as_inner().as_inner().st_blocks as u64
+ }
+}
diff --git a/library/std/src/os/vita/mod.rs b/library/std/src/os/vita/mod.rs
new file mode 100644
index 000000000..da9edd12f
--- /dev/null
+++ b/library/std/src/os/vita/mod.rs
@@ -0,0 +1,6 @@
+//! Definitions for vita
+
+#![stable(feature = "raw_ext", since = "1.1.0")]
+
+pub mod fs;
+pub(crate) mod raw;
diff --git a/library/std/src/os/vita/raw.rs b/library/std/src/os/vita/raw.rs
new file mode 100644
index 000000000..74cae4d41
--- /dev/null
+++ b/library/std/src/os/vita/raw.rs
@@ -0,0 +1,70 @@
+//! vita raw type definitions
+
+#![stable(feature = "raw_ext", since = "1.1.0")]
+#![deprecated(
+ since = "1.8.0",
+ note = "these type aliases are no longer supported by \
+ the standard library, the `libc` crate on \
+ crates.io should be used instead for the correct \
+ definitions"
+)]
+#![allow(deprecated)]
+
+use crate::os::raw::c_long;
+use crate::os::unix::raw::{gid_t, uid_t};
+
+#[stable(feature = "pthread_t", since = "1.8.0")]
+pub type pthread_t = libc::pthread_t;
+
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type blkcnt_t = libc::blkcnt_t;
+
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type blksize_t = libc::blksize_t;
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type dev_t = libc::dev_t;
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type ino_t = libc::ino_t;
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type mode_t = libc::mode_t;
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type nlink_t = libc::nlink_t;
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type off_t = libc::off_t;
+
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub type time_t = libc::time_t;
+
+#[repr(C)]
+#[derive(Clone)]
+#[stable(feature = "raw_ext", since = "1.1.0")]
+pub struct stat {
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_dev: dev_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_ino: ino_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_mode: mode_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_nlink: nlink_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_uid: uid_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_gid: gid_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_rdev: dev_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_size: off_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_atime: time_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_mtime: time_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_ctime: time_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_blksize: blksize_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_blocks: blkcnt_t,
+ #[stable(feature = "raw_ext", since = "1.1.0")]
+ pub st_spare4: [c_long; 2usize],
+}
diff --git a/library/std/src/os/watchos/fs.rs b/library/std/src/os/watchos/fs.rs
index a14fe35a7..2ecc4c68a 100644
--- a/library/std/src/os/watchos/fs.rs
+++ b/library/std/src/os/watchos/fs.rs
@@ -1,7 +1,9 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
-use crate::fs::Metadata;
-use crate::sys_common::AsInner;
+use crate::fs::{self, Metadata};
+use crate::sealed::Sealed;
+use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
+use crate::time::SystemTime;
#[allow(deprecated)]
use crate::os::watchos::raw;
@@ -140,3 +142,19 @@ impl MetadataExt for Metadata {
self.as_inner().as_inner().st_lspare as u32
}
}
+
+/// OS-specific extensions to [`fs::FileTimes`].
+#[unstable(feature = "file_set_times", issue = "98245")]
+pub trait FileTimesExt: Sealed {
+ /// Set the creation time of a file.
+ #[unstable(feature = "file_set_times", issue = "98245")]
+ fn set_created(self, t: SystemTime) -> Self;
+}
+
+#[unstable(feature = "file_set_times", issue = "98245")]
+impl FileTimesExt for fs::FileTimes {
+ fn set_created(mut self, t: SystemTime) -> Self {
+ self.as_inner_mut().set_created(t.into_inner());
+ self
+ }
+}
diff --git a/library/std/src/os/windows/fs.rs b/library/std/src/os/windows/fs.rs
index a091f06dd..94509e547 100644
--- a/library/std/src/os/windows/fs.rs
+++ b/library/std/src/os/windows/fs.rs
@@ -9,7 +9,8 @@ use crate::io;
use crate::path::Path;
use crate::sealed::Sealed;
use crate::sys;
-use crate::sys_common::{AsInner, AsInnerMut};
+use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
+use crate::time::SystemTime;
/// Windows-specific extensions to [`fs::File`].
#[stable(feature = "file_offset", since = "1.15.0")]
@@ -526,6 +527,22 @@ impl FileTypeExt for fs::FileType {
}
}
+/// Windows-specific extensions to [`fs::FileTimes`].
+#[unstable(feature = "file_set_times", issue = "98245")]
+pub trait FileTimesExt: Sealed {
+ /// Set the creation time of a file.
+ #[unstable(feature = "file_set_times", issue = "98245")]
+ fn set_created(self, t: SystemTime) -> Self;
+}
+
+#[unstable(feature = "file_set_times", issue = "98245")]
+impl FileTimesExt for fs::FileTimes {
+ fn set_created(mut self, t: SystemTime) -> Self {
+ self.as_inner_mut().set_created(t.into_inner());
+ self
+ }
+}
+
/// Creates a new symlink to a non-directory file on the filesystem.
///
/// The `link` path will be a file symbolic link pointing to the `original`
diff --git a/library/std/src/os/windows/io/handle.rs b/library/std/src/os/windows/io/handle.rs
index 50410fcdf..274af08a3 100644
--- a/library/std/src/os/windows/io/handle.rs
+++ b/library/std/src/os/windows/io/handle.rs
@@ -9,7 +9,7 @@ use crate::io;
use crate::marker::PhantomData;
use crate::mem::forget;
use crate::ptr;
-use crate::sys::c;
+use crate::sys;
use crate::sys::cvt;
use crate::sys_common::{AsInner, FromInner, IntoInner};
@@ -190,14 +190,14 @@ impl BorrowedHandle<'_> {
/// object as the existing `BorrowedHandle` instance.
#[stable(feature = "io_safety", since = "1.63.0")]
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedHandle> {
- self.duplicate(0, false, c::DUPLICATE_SAME_ACCESS)
+ self.duplicate(0, false, sys::c::DUPLICATE_SAME_ACCESS)
}
pub(crate) fn duplicate(
&self,
- access: c::DWORD,
+ access: u32,
inherit: bool,
- options: c::DWORD,
+ options: u32,
) -> io::Result<OwnedHandle> {
let handle = self.as_raw_handle();
@@ -211,14 +211,14 @@ impl BorrowedHandle<'_> {
let mut ret = ptr::null_mut();
cvt(unsafe {
- let cur_proc = c::GetCurrentProcess();
- c::DuplicateHandle(
+ let cur_proc = sys::c::GetCurrentProcess();
+ sys::c::DuplicateHandle(
cur_proc,
handle,
cur_proc,
&mut ret,
access,
- inherit as c::BOOL,
+ inherit as sys::c::BOOL,
options,
)
})?;
@@ -233,7 +233,7 @@ impl TryFrom<HandleOrInvalid> for OwnedHandle {
#[inline]
fn try_from(handle_or_invalid: HandleOrInvalid) -> Result<Self, InvalidHandleError> {
let owned_handle = handle_or_invalid.0;
- if owned_handle.handle == c::INVALID_HANDLE_VALUE {
+ if owned_handle.handle == sys::c::INVALID_HANDLE_VALUE {
// Don't call `CloseHandle`; it'd be harmless, except that it could
// overwrite the `GetLastError` error.
forget(owned_handle);
@@ -365,7 +365,7 @@ impl Drop for OwnedHandle {
#[inline]
fn drop(&mut self) {
unsafe {
- let _ = c::CloseHandle(self.handle);
+ let _ = sys::c::CloseHandle(self.handle);
}
}
}
@@ -437,6 +437,42 @@ impl<T: AsHandle> AsHandle for &mut T {
}
}
+#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
+/// This impl allows implementing traits that require `AsHandle` on Arc.
+/// ```
+/// # #[cfg(windows)] mod group_cfg {
+/// # use std::os::windows::io::AsHandle;
+/// use std::fs::File;
+/// use std::sync::Arc;
+///
+/// trait MyTrait: AsHandle {}
+/// impl MyTrait for Arc<File> {}
+/// impl MyTrait for Box<File> {}
+/// # }
+/// ```
+impl<T: AsHandle> AsHandle for crate::sync::Arc<T> {
+ #[inline]
+ fn as_handle(&self) -> BorrowedHandle<'_> {
+ (**self).as_handle()
+ }
+}
+
+#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
+impl<T: AsHandle> AsHandle for crate::rc::Rc<T> {
+ #[inline]
+ fn as_handle(&self) -> BorrowedHandle<'_> {
+ (**self).as_handle()
+ }
+}
+
+#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
+impl<T: AsHandle> AsHandle for Box<T> {
+ #[inline]
+ fn as_handle(&self) -> BorrowedHandle<'_> {
+ (**self).as_handle()
+ }
+}
+
#[stable(feature = "io_safety", since = "1.63.0")]
impl AsHandle for BorrowedHandle<'_> {
#[inline]
@@ -450,7 +486,7 @@ impl AsHandle for OwnedHandle {
#[inline]
fn as_handle(&self) -> BorrowedHandle<'_> {
// Safety: `OwnedHandle` and `BorrowedHandle` have the same validity
- // invariants, and the `BorrowdHandle` is bounded by the lifetime
+ // invariants, and the `BorrowedHandle` is bounded by the lifetime
// of `&self`.
unsafe { BorrowedHandle::borrow_raw(self.as_raw_handle()) }
}
diff --git a/library/std/src/os/windows/io/raw.rs b/library/std/src/os/windows/io/raw.rs
index 49e4f304f..1759e2e7f 100644
--- a/library/std/src/os/windows/io/raw.rs
+++ b/library/std/src/os/windows/io/raw.rs
@@ -11,7 +11,6 @@ use crate::os::windows::io::{OwnedHandle, OwnedSocket};
use crate::os::windows::raw;
use crate::ptr;
use crate::sys;
-use crate::sys::c;
use crate::sys_common::{self, AsInner, FromInner, IntoInner};
/// Raw HANDLEs.
@@ -104,42 +103,42 @@ impl AsRawHandle for fs::File {
#[stable(feature = "asraw_stdio", since = "1.21.0")]
impl AsRawHandle for io::Stdin {
fn as_raw_handle(&self) -> RawHandle {
- stdio_handle(unsafe { c::GetStdHandle(c::STD_INPUT_HANDLE) as RawHandle })
+ stdio_handle(unsafe { sys::c::GetStdHandle(sys::c::STD_INPUT_HANDLE) as RawHandle })
}
}
#[stable(feature = "asraw_stdio", since = "1.21.0")]
impl AsRawHandle for io::Stdout {
fn as_raw_handle(&self) -> RawHandle {
- stdio_handle(unsafe { c::GetStdHandle(c::STD_OUTPUT_HANDLE) as RawHandle })
+ stdio_handle(unsafe { sys::c::GetStdHandle(sys::c::STD_OUTPUT_HANDLE) as RawHandle })
}
}
#[stable(feature = "asraw_stdio", since = "1.21.0")]
impl AsRawHandle for io::Stderr {
fn as_raw_handle(&self) -> RawHandle {
- stdio_handle(unsafe { c::GetStdHandle(c::STD_ERROR_HANDLE) as RawHandle })
+ stdio_handle(unsafe { sys::c::GetStdHandle(sys::c::STD_ERROR_HANDLE) as RawHandle })
}
}
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
impl<'a> AsRawHandle for io::StdinLock<'a> {
fn as_raw_handle(&self) -> RawHandle {
- stdio_handle(unsafe { c::GetStdHandle(c::STD_INPUT_HANDLE) as RawHandle })
+ stdio_handle(unsafe { sys::c::GetStdHandle(sys::c::STD_INPUT_HANDLE) as RawHandle })
}
}
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
impl<'a> AsRawHandle for io::StdoutLock<'a> {
fn as_raw_handle(&self) -> RawHandle {
- stdio_handle(unsafe { c::GetStdHandle(c::STD_OUTPUT_HANDLE) as RawHandle })
+ stdio_handle(unsafe { sys::c::GetStdHandle(sys::c::STD_OUTPUT_HANDLE) as RawHandle })
}
}
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
impl<'a> AsRawHandle for io::StderrLock<'a> {
fn as_raw_handle(&self) -> RawHandle {
- stdio_handle(unsafe { c::GetStdHandle(c::STD_ERROR_HANDLE) as RawHandle })
+ stdio_handle(unsafe { sys::c::GetStdHandle(sys::c::STD_ERROR_HANDLE) as RawHandle })
}
}
@@ -152,14 +151,14 @@ fn stdio_handle(raw: RawHandle) -> RawHandle {
// console. In that case, return null to the user, which is consistent
// with what they'd get in the parent, and which avoids the problem that
// `INVALID_HANDLE_VALUE` aliases the current process handle.
- if raw == c::INVALID_HANDLE_VALUE { ptr::null_mut() } else { raw }
+ if raw == sys::c::INVALID_HANDLE_VALUE { ptr::null_mut() } else { raw }
}
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawHandle for fs::File {
#[inline]
unsafe fn from_raw_handle(handle: RawHandle) -> fs::File {
- let handle = handle as c::HANDLE;
+ let handle = handle as sys::c::HANDLE;
fs::File::from_inner(sys::fs::File::from_inner(FromInner::from_inner(
OwnedHandle::from_raw_handle(handle),
)))
diff --git a/library/std/src/os/windows/io/socket.rs b/library/std/src/os/windows/io/socket.rs
index 5c1634084..6359835ca 100644
--- a/library/std/src/os/windows/io/socket.rs
+++ b/library/std/src/os/windows/io/socket.rs
@@ -9,7 +9,6 @@ use crate::marker::PhantomData;
use crate::mem;
use crate::mem::forget;
use crate::sys;
-use crate::sys::c;
#[cfg(not(target_vendor = "uwp"))]
use crate::sys::cvt;
@@ -76,7 +75,7 @@ impl BorrowedSocket<'_> {
#[rustc_const_stable(feature = "io_safety", since = "1.63.0")]
#[stable(feature = "io_safety", since = "1.63.0")]
pub const unsafe fn borrow_raw(socket: RawSocket) -> Self {
- assert!(socket != c::INVALID_SOCKET as RawSocket);
+ assert!(socket != sys::c::INVALID_SOCKET as RawSocket);
Self { socket, _phantom: PhantomData }
}
}
@@ -94,7 +93,11 @@ impl OwnedSocket {
#[cfg(not(target_vendor = "uwp"))]
pub(crate) fn set_no_inherit(&self) -> io::Result<()> {
cvt(unsafe {
- c::SetHandleInformation(self.as_raw_socket() as c::HANDLE, c::HANDLE_FLAG_INHERIT, 0)
+ sys::c::SetHandleInformation(
+ self.as_raw_socket() as sys::c::HANDLE,
+ sys::c::HANDLE_FLAG_INHERIT,
+ 0,
+ )
})
.map(drop)
}
@@ -110,43 +113,47 @@ impl BorrowedSocket<'_> {
/// object as the existing `BorrowedSocket` instance.
#[stable(feature = "io_safety", since = "1.63.0")]
pub fn try_clone_to_owned(&self) -> io::Result<OwnedSocket> {
- let mut info = unsafe { mem::zeroed::<c::WSAPROTOCOL_INFO>() };
+ let mut info = unsafe { mem::zeroed::<sys::c::WSAPROTOCOL_INFOW>() };
let result = unsafe {
- c::WSADuplicateSocketW(self.as_raw_socket(), c::GetCurrentProcessId(), &mut info)
+ sys::c::WSADuplicateSocketW(
+ self.as_raw_socket(),
+ sys::c::GetCurrentProcessId(),
+ &mut info,
+ )
};
sys::net::cvt(result)?;
let socket = unsafe {
- c::WSASocketW(
+ sys::c::WSASocketW(
info.iAddressFamily,
info.iSocketType,
info.iProtocol,
&mut info,
0,
- c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT,
+ sys::c::WSA_FLAG_OVERLAPPED | sys::c::WSA_FLAG_NO_HANDLE_INHERIT,
)
};
- if socket != c::INVALID_SOCKET {
+ if socket != sys::c::INVALID_SOCKET {
unsafe { Ok(OwnedSocket::from_raw_socket(socket)) }
} else {
- let error = unsafe { c::WSAGetLastError() };
+ let error = unsafe { sys::c::WSAGetLastError() };
- if error != c::WSAEPROTOTYPE && error != c::WSAEINVAL {
+ if error != sys::c::WSAEPROTOTYPE && error != sys::c::WSAEINVAL {
return Err(io::Error::from_raw_os_error(error));
}
let socket = unsafe {
- c::WSASocketW(
+ sys::c::WSASocketW(
info.iAddressFamily,
info.iSocketType,
info.iProtocol,
&mut info,
0,
- c::WSA_FLAG_OVERLAPPED,
+ sys::c::WSA_FLAG_OVERLAPPED,
)
};
- if socket == c::INVALID_SOCKET {
+ if socket == sys::c::INVALID_SOCKET {
return Err(last_error());
}
@@ -161,7 +168,7 @@ impl BorrowedSocket<'_> {
/// Returns the last error from the Windows socket interface.
fn last_error() -> io::Error {
- io::Error::from_raw_os_error(unsafe { c::WSAGetLastError() })
+ io::Error::from_raw_os_error(unsafe { sys::c::WSAGetLastError() })
}
#[stable(feature = "io_safety", since = "1.63.0")]
@@ -194,7 +201,7 @@ impl IntoRawSocket for OwnedSocket {
impl FromRawSocket for OwnedSocket {
#[inline]
unsafe fn from_raw_socket(socket: RawSocket) -> Self {
- debug_assert_ne!(socket, c::INVALID_SOCKET as RawSocket);
+ debug_assert_ne!(socket, sys::c::INVALID_SOCKET as RawSocket);
Self { socket }
}
}
@@ -204,7 +211,7 @@ impl Drop for OwnedSocket {
#[inline]
fn drop(&mut self) {
unsafe {
- let _ = c::closesocket(self.socket);
+ let _ = sys::c::closesocket(self.socket);
}
}
}
@@ -247,6 +254,42 @@ impl<T: AsSocket> AsSocket for &mut T {
}
}
+#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
+/// This impl allows implementing traits that require `AsSocket` on Arc.
+/// ```
+/// # #[cfg(windows)] mod group_cfg {
+/// # use std::os::windows::io::AsSocket;
+/// use std::net::UdpSocket;
+/// use std::sync::Arc;
+///
+/// trait MyTrait: AsSocket {}
+/// impl MyTrait for Arc<UdpSocket> {}
+/// impl MyTrait for Box<UdpSocket> {}
+/// # }
+/// ```
+impl<T: AsSocket> AsSocket for crate::sync::Arc<T> {
+ #[inline]
+ fn as_socket(&self) -> BorrowedSocket<'_> {
+ (**self).as_socket()
+ }
+}
+
+#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
+impl<T: AsSocket> AsSocket for crate::rc::Rc<T> {
+ #[inline]
+ fn as_socket(&self) -> BorrowedSocket<'_> {
+ (**self).as_socket()
+ }
+}
+
+#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
+impl<T: AsSocket> AsSocket for Box<T> {
+ #[inline]
+ fn as_socket(&self) -> BorrowedSocket<'_> {
+ (**self).as_socket()
+ }
+}
+
#[stable(feature = "io_safety", since = "1.63.0")]
impl AsSocket for BorrowedSocket<'_> {
#[inline]
@@ -260,7 +303,7 @@ impl AsSocket for OwnedSocket {
#[inline]
fn as_socket(&self) -> BorrowedSocket<'_> {
// Safety: `OwnedSocket` and `BorrowedSocket` have the same validity
- // invariants, and the `BorrowdSocket` is bounded by the lifetime
+ // invariants, and the `BorrowedSocket` is bounded by the lifetime
// of `&self`.
unsafe { BorrowedSocket::borrow_raw(self.as_raw_socket()) }
}
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs
index 345d72ef8..69a6f3e6d 100644
--- a/library/std/src/panic.rs
+++ b/library/std/src/panic.rs
@@ -19,14 +19,16 @@ pub macro panic_2015 {
$crate::rt::begin_panic("explicit panic")
}),
($msg:expr $(,)?) => ({
- $crate::rt::begin_panic($msg)
+ $crate::rt::begin_panic($msg);
}),
// Special-case the single-argument case for const_panic.
("{}", $arg:expr $(,)?) => ({
- $crate::rt::panic_display(&$arg)
+ $crate::rt::panic_display(&$arg);
}),
($fmt:expr, $($arg:tt)+) => ({
- $crate::rt::panic_fmt($crate::const_format_args!($fmt, $($arg)+))
+ // Semicolon to prevent temporaries inside the formatting machinery from
+ // being considered alive in the caller after the panic_fmt call.
+ $crate::rt::panic_fmt($crate::const_format_args!($fmt, $($arg)+));
}),
}
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index a46a29cba..a6a370409 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -298,8 +298,18 @@ pub mod panic_count {
pub const ALWAYS_ABORT_FLAG: usize = 1 << (usize::BITS - 1);
- // Panic count for the current thread.
- thread_local! { static LOCAL_PANIC_COUNT: Cell<usize> = const { Cell::new(0) } }
+ /// A reason for forcing an immediate abort on panic.
+ #[derive(Debug)]
+ pub enum MustAbort {
+ AlwaysAbort,
+ PanicInHook,
+ }
+
+ // Panic count for the current thread and whether a panic hook is currently
+ // being executed..
+ thread_local! {
+ static LOCAL_PANIC_COUNT: Cell<(usize, bool)> = const { Cell::new((0, false)) }
+ }
// Sum of panic counts from all threads. The purpose of this is to have
// a fast path in `count_is_zero` (which is used by `panicking`). In any particular
@@ -328,34 +338,39 @@ pub mod panic_count {
// panicking thread consumes at least 2 bytes of address space.
static GLOBAL_PANIC_COUNT: AtomicUsize = AtomicUsize::new(0);
- // Return the state of the ALWAYS_ABORT_FLAG and number of panics.
+ // Increases the global and local panic count, and returns whether an
+ // immediate abort is required.
//
- // If ALWAYS_ABORT_FLAG is not set, the number is determined on a per-thread
- // base (stored in LOCAL_PANIC_COUNT), i.e. it is the amount of recursive calls
- // of the calling thread.
- // If ALWAYS_ABORT_FLAG is set, the number equals the *global* number of panic
- // calls. See above why LOCAL_PANIC_COUNT is not used.
- pub fn increase() -> (bool, usize) {
+ // This also updates thread-local state to keep track of whether a panic
+ // hook is currently executing.
+ pub fn increase(run_panic_hook: bool) -> Option<MustAbort> {
let global_count = GLOBAL_PANIC_COUNT.fetch_add(1, Ordering::Relaxed);
- let must_abort = global_count & ALWAYS_ABORT_FLAG != 0;
- let panics = if must_abort {
- global_count & !ALWAYS_ABORT_FLAG
- } else {
- LOCAL_PANIC_COUNT.with(|c| {
- let next = c.get() + 1;
- c.set(next);
- next
- })
- };
- (must_abort, panics)
+ if global_count & ALWAYS_ABORT_FLAG != 0 {
+ return Some(MustAbort::AlwaysAbort);
+ }
+
+ LOCAL_PANIC_COUNT.with(|c| {
+ let (count, in_panic_hook) = c.get();
+ if in_panic_hook {
+ return Some(MustAbort::PanicInHook);
+ }
+ c.set((count + 1, run_panic_hook));
+ None
+ })
+ }
+
+ pub fn finished_panic_hook() {
+ LOCAL_PANIC_COUNT.with(|c| {
+ let (count, _) = c.get();
+ c.set((count, false));
+ });
}
pub fn decrease() {
GLOBAL_PANIC_COUNT.fetch_sub(1, Ordering::Relaxed);
LOCAL_PANIC_COUNT.with(|c| {
- let next = c.get() - 1;
- c.set(next);
- next
+ let (count, _) = c.get();
+ c.set((count - 1, false));
});
}
@@ -366,7 +381,7 @@ pub mod panic_count {
// Disregards ALWAYS_ABORT_FLAG
#[must_use]
pub fn get_count() -> usize {
- LOCAL_PANIC_COUNT.with(|c| c.get())
+ LOCAL_PANIC_COUNT.with(|c| c.get().0)
}
// Disregards ALWAYS_ABORT_FLAG
@@ -394,7 +409,7 @@ pub mod panic_count {
#[inline(never)]
#[cold]
fn is_zero_slow_path() -> bool {
- LOCAL_PANIC_COUNT.with(|c| c.get() == 0)
+ LOCAL_PANIC_COUNT.with(|c| c.get().0 == 0)
}
}
@@ -541,7 +556,7 @@ pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
// Lazily, the first time this gets called, run the actual string formatting.
self.string.get_or_insert_with(|| {
let mut s = String::new();
- drop(s.write_fmt(*inner));
+ let _err = s.write_fmt(*inner);
s
})
}
@@ -655,23 +670,22 @@ fn rust_panic_with_hook(
location: &Location<'_>,
can_unwind: bool,
) -> ! {
- let (must_abort, panics) = panic_count::increase();
-
- // If this is the third nested call (e.g., panics == 2, this is 0-indexed),
- // the panic hook probably triggered the last panic, otherwise the
- // double-panic check would have aborted the process. In this case abort the
- // process real quickly as we don't want to try calling it again as it'll
- // probably just panic again.
- if must_abort || panics > 2 {
- if panics > 2 {
- // Don't try to print the message in this case
- // - perhaps that is causing the recursive panics.
- rtprintpanic!("thread panicked while processing panic. aborting.\n");
- } else {
- // Unfortunately, this does not print a backtrace, because creating
- // a `Backtrace` will allocate, which we must to avoid here.
- let panicinfo = PanicInfo::internal_constructor(message, location, can_unwind);
- rtprintpanic!("{panicinfo}\npanicked after panic::always_abort(), aborting.\n");
+ let must_abort = panic_count::increase(true);
+
+ // Check if we need to abort immediately.
+ if let Some(must_abort) = must_abort {
+ match must_abort {
+ panic_count::MustAbort::PanicInHook => {
+ // Don't try to print the message in this case
+ // - perhaps that is causing the recursive panics.
+ rtprintpanic!("thread panicked while processing panic. aborting.\n");
+ }
+ panic_count::MustAbort::AlwaysAbort => {
+ // Unfortunately, this does not print a backtrace, because creating
+ // a `Backtrace` will allocate, which we must to avoid here.
+ let panicinfo = PanicInfo::internal_constructor(message, location, can_unwind);
+ rtprintpanic!("{panicinfo}\npanicked after panic::always_abort(), aborting.\n");
+ }
}
crate::sys::abort_internal();
}
@@ -697,16 +711,16 @@ fn rust_panic_with_hook(
};
drop(hook);
- if panics > 1 || !can_unwind {
- // If a thread panics while it's already unwinding then we
- // have limited options. Currently our preference is to
- // just abort. In the future we may consider resuming
- // unwinding or otherwise exiting the thread cleanly.
- if !can_unwind {
- rtprintpanic!("thread caused non-unwinding panic. aborting.\n");
- } else {
- rtprintpanic!("thread panicked while panicking. aborting.\n");
- }
+ // Indicate that we have finished executing the panic hook. After this point
+ // it is fine if there is a panic while executing destructors, as long as it
+ // it contained within a `catch_unwind`.
+ panic_count::finished_panic_hook();
+
+ if !can_unwind {
+ // If a thread panics while running destructors or tries to unwind
+ // through a nounwind function (e.g. extern "C") then we cannot continue
+ // unwinding and have to abort immediately.
+ rtprintpanic!("thread caused non-unwinding panic. aborting.\n");
crate::sys::abort_internal();
}
@@ -716,7 +730,7 @@ fn rust_panic_with_hook(
/// This is the entry point for `resume_unwind`.
/// It just forwards the payload to the panic runtime.
pub fn rust_panic_without_hook(payload: Box<dyn Any + Send>) -> ! {
- panic_count::increase();
+ panic_count::increase(false);
struct RewrapBox(Box<dyn Any + Send>);
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index b3d883de0..febdeb514 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -117,7 +117,7 @@ use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR}
/// use std::path::Prefix::*;
/// use std::ffi::OsStr;
///
-/// fn get_path_prefix(s: &str) -> Prefix {
+/// fn get_path_prefix(s: &str) -> Prefix<'_> {
/// let path = Path::new(s);
/// match path.components().next().unwrap() {
/// Component::Prefix(prefix_component) => prefix_component.kind(),
@@ -733,8 +733,9 @@ impl<'a> Components<'a> {
}
}
- // parse a given byte sequence into the corresponding path component
- fn parse_single_component<'b>(&self, comp: &'b [u8]) -> Option<Component<'b>> {
+ // parse a given byte sequence following the OsStr encoding into the
+ // corresponding path component
+ unsafe fn parse_single_component<'b>(&self, comp: &'b [u8]) -> Option<Component<'b>> {
match comp {
b"." if self.prefix_verbatim() => Some(Component::CurDir),
b"." => None, // . components are normalized away, except at
@@ -754,7 +755,8 @@ impl<'a> Components<'a> {
None => (0, self.path),
Some(i) => (1, &self.path[..i]),
};
- (comp.len() + extra, self.parse_single_component(comp))
+ // SAFETY: `comp` is a valid substring, since it is split on a separator.
+ (comp.len() + extra, unsafe { self.parse_single_component(comp) })
}
// parse a component from the right, saying how many bytes to consume to
@@ -766,7 +768,8 @@ impl<'a> Components<'a> {
None => (0, &self.path[start..]),
Some(i) => (1, &self.path[start + i + 1..]),
};
- (comp.len() + extra, self.parse_single_component(comp))
+ // SAFETY: `comp` is a valid substring, since it is split on a separator.
+ (comp.len() + extra, unsafe { self.parse_single_component(comp) })
}
// trim away repeated separators (i.e., empty components) on the left
@@ -1395,11 +1398,16 @@ impl PathBuf {
///
/// let mut buf = PathBuf::from("/");
/// assert!(buf.file_name() == None);
- /// buf.set_file_name("bar");
- /// assert!(buf == PathBuf::from("/bar"));
+ ///
+ /// buf.set_file_name("foo.txt");
+ /// assert!(buf == PathBuf::from("/foo.txt"));
/// assert!(buf.file_name().is_some());
- /// buf.set_file_name("baz.txt");
- /// assert!(buf == PathBuf::from("/baz.txt"));
+ ///
+ /// buf.set_file_name("bar.txt");
+ /// assert!(buf == PathBuf::from("/bar.txt"));
+ ///
+ /// buf.set_file_name("baz");
+ /// assert!(buf == PathBuf::from("/baz"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn set_file_name<S: AsRef<OsStr>>(&mut self, file_name: S) {
@@ -2562,7 +2570,8 @@ impl Path {
/// ```
/// use std::path::{Path, PathBuf};
///
- /// let path = Path::new("/tmp/foo.txt");
+ /// let path = Path::new("/tmp/foo.png");
+ /// assert_eq!(path.with_file_name("bar"), PathBuf::from("/tmp/bar"));
/// assert_eq!(path.with_file_name("bar.txt"), PathBuf::from("/tmp/bar.txt"));
///
/// let path = Path::new("/tmp");
@@ -2844,9 +2853,11 @@ impl Path {
/// This function will traverse symbolic links to query information about the
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
///
- /// As opposed to the [`exists()`] method, this one doesn't silently ignore errors
- /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
- /// denied on some of the parent directories.)
+ /// [`Path::exists()`] only checks whether or not a path was both found and readable. By
+ /// contrast, `try_exists` will return `Ok(true)` or `Ok(false)`, respectively, if the path
+ /// was _verified_ to exist or not exist. If its existence can neither be confirmed nor
+ /// denied, it will propagate an `Err(_)` instead. This can be the case if e.g. listing
+ /// permission is denied on one of the parent directories.
///
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
diff --git a/library/std/src/personality/dwarf/eh.rs b/library/std/src/personality/dwarf/eh.rs
index 87585a8fc..79624703a 100644
--- a/library/std/src/personality/dwarf/eh.rs
+++ b/library/std/src/personality/dwarf/eh.rs
@@ -47,6 +47,7 @@ pub enum EHAction {
None,
Cleanup(usize),
Catch(usize),
+ Filter(usize),
Terminate,
}
@@ -142,9 +143,11 @@ unsafe fn interpret_cs_action(
let ttype_index = action_reader.read_sleb128();
if ttype_index == 0 {
EHAction::Cleanup(lpad)
- } else {
+ } else if ttype_index > 0 {
// Stop unwinding Rust panics at catch_unwind.
EHAction::Catch(lpad)
+ } else {
+ EHAction::Filter(lpad)
}
}
}
diff --git a/library/std/src/personality/gcc.rs b/library/std/src/personality/gcc.rs
index 0421b47be..82edb11cb 100644
--- a/library/std/src/personality/gcc.rs
+++ b/library/std/src/personality/gcc.rs
@@ -135,7 +135,7 @@ cfg_if::cfg_if! {
EHAction::None | EHAction::Cleanup(_) => {
return continue_unwind(exception_object, context);
}
- EHAction::Catch(_) => {
+ EHAction::Catch(_) | EHAction::Filter(_) => {
// EHABI requires the personality routine to update the
// SP value in the barrier cache of the exception object.
(*exception_object).private[5] =
@@ -147,7 +147,8 @@ cfg_if::cfg_if! {
} else {
match eh_action {
EHAction::None => return continue_unwind(exception_object, context),
- EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => {
+ EHAction::Filter(_) if state & uw::_US_FORCE_UNWIND as c_int != 0 => return continue_unwind(exception_object, context),
+ EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => {
uw::_Unwind_SetGR(
context,
UNWIND_DATA_REG.0,
@@ -201,13 +202,15 @@ cfg_if::cfg_if! {
if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 {
match eh_action {
EHAction::None | EHAction::Cleanup(_) => uw::_URC_CONTINUE_UNWIND,
- EHAction::Catch(_) => uw::_URC_HANDLER_FOUND,
+ EHAction::Catch(_) | EHAction::Filter(_) => uw::_URC_HANDLER_FOUND,
EHAction::Terminate => uw::_URC_FATAL_PHASE1_ERROR,
}
} else {
match eh_action {
EHAction::None => uw::_URC_CONTINUE_UNWIND,
- EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => {
+ // Forced unwinding hits a terminate action.
+ EHAction::Filter(_) if actions as i32 & uw::_UA_FORCE_UNWIND as i32 != 0 => uw::_URC_CONTINUE_UNWIND,
+ EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => {
uw::_Unwind_SetGR(
context,
UNWIND_DATA_REG.0,
diff --git a/library/std/src/prelude/v1.rs b/library/std/src/prelude/v1.rs
index 2aefd7c51..7a7a77376 100644
--- a/library/std/src/prelude/v1.rs
+++ b/library/std/src/prelude/v1.rs
@@ -91,10 +91,10 @@ pub use core::prelude::v1::cfg_eval;
)]
pub use core::prelude::v1::type_ascribe;
-// The file so far is equivalent to src/libcore/prelude/v1.rs,
-// and below to src/liballoc/prelude.rs.
-// Those files are duplicated rather than using glob imports
-// because we want docs to show these re-exports as pointing to within `std`.
+// The file so far is equivalent to core/src/prelude/v1.rs. It is duplicated
+// rather than glob imported because we want docs to show these re-exports as
+// pointing to within `std`.
+// Below are the items from the alloc crate.
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs
index 3df990e5d..8266e8990 100644
--- a/library/std/src/primitive_docs.rs
+++ b/library/std/src/primitive_docs.rs
@@ -1,8 +1,7 @@
// `library/{std,core}/src/primitive_docs.rs` should have the same contents.
// These are different files so that relative links work properly without
// having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same.
-#[cfg_attr(bootstrap, doc(primitive = "bool"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "bool")]
+#[rustc_doc_primitive = "bool"]
#[doc(alias = "true")]
#[doc(alias = "false")]
/// The boolean type.
@@ -64,8 +63,7 @@
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_bool {}
-#[cfg_attr(bootstrap, doc(primitive = "never"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "never")]
+#[rustc_doc_primitive = "never"]
#[doc(alias = "!")]
//
/// The `!` type, also called "never".
@@ -276,8 +274,7 @@ mod prim_bool {}
#[unstable(feature = "never_type", issue = "35121")]
mod prim_never {}
-#[cfg_attr(bootstrap, doc(primitive = "char"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "char")]
+#[rustc_doc_primitive = "char"]
#[allow(rustdoc::invalid_rust_codeblocks)]
/// A character type.
///
@@ -401,8 +398,7 @@ mod prim_never {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_char {}
-#[cfg_attr(bootstrap, doc(primitive = "unit"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "unit")]
+#[rustc_doc_primitive = "unit"]
#[doc(alias = "(")]
#[doc(alias = ")")]
#[doc(alias = "()")]
@@ -464,8 +460,7 @@ impl Copy for () {
// empty
}
-#[cfg_attr(bootstrap, doc(primitive = "pointer"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "pointer")]
+#[rustc_doc_primitive = "pointer"]
#[doc(alias = "ptr")]
#[doc(alias = "*")]
#[doc(alias = "*const")]
@@ -555,6 +550,7 @@ impl Copy for () {
///
/// ```
/// # #![feature(rustc_private)]
+/// #[allow(unused_extern_crates)]
/// extern crate libc;
///
/// use std::mem;
@@ -581,8 +577,7 @@ impl Copy for () {
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_pointer {}
-#[cfg_attr(bootstrap, doc(primitive = "array"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "array")]
+#[rustc_doc_primitive = "array"]
#[doc(alias = "[]")]
#[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases
#[doc(alias = "[T; N]")]
@@ -616,6 +611,9 @@ mod prim_pointer {}
/// if the element type allows it. As a stopgap, trait implementations are
/// statically generated up to size 32.
///
+/// Arrays of sizes from 1 to 12 (inclusive) implement [`From<Tuple>`], where `Tuple`
+/// is a homogenous [prim@tuple] of appropriate length.
+///
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
/// an array. Indeed, this provides most of the API for working with arrays.
///
@@ -678,6 +676,13 @@ mod prim_pointer {}
/// move_away(roa);
/// ```
///
+/// Arrays can be created from homogenous tuples of appropriate length:
+///
+/// ```
+/// let tuple: (u32, u32, u32) = (1, 2, 3);
+/// let array: [u32; 3] = tuple.into();
+/// ```
+///
/// # Editions
///
/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
@@ -780,11 +785,11 @@ mod prim_pointer {}
/// [`Borrow`]: borrow::Borrow
/// [`BorrowMut`]: borrow::BorrowMut
/// [slice pattern]: ../reference/patterns.html#slice-patterns
+/// [`From<Tuple>`]: convert::From
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_array {}
-#[cfg_attr(bootstrap, doc(primitive = "slice"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "slice")]
+#[rustc_doc_primitive = "slice"]
#[doc(alias = "[")]
#[doc(alias = "]")]
#[doc(alias = "[]")]
@@ -876,8 +881,7 @@ mod prim_array {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_slice {}
-#[cfg_attr(bootstrap, doc(primitive = "str"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "str")]
+#[rustc_doc_primitive = "str"]
/// String slices.
///
/// *[See also the `std::str` module](crate::str).*
@@ -944,8 +948,7 @@ mod prim_slice {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_str {}
-#[cfg_attr(bootstrap, doc(primitive = "tuple"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "tuple")]
+#[rustc_doc_primitive = "tuple"]
#[doc(alias = "(")]
#[doc(alias = ")")]
#[doc(alias = "()")]
@@ -1009,7 +1012,9 @@ mod prim_str {}
/// * [`Debug`]
/// * [`Default`]
/// * [`Hash`]
+/// * [`From<[T; N]>`][from]
///
+/// [from]: convert::From
/// [`Debug`]: fmt::Debug
/// [`Hash`]: hash::Hash
///
@@ -1060,6 +1065,13 @@ mod prim_str {}
/// assert_eq!(y, 5);
/// ```
///
+/// Homogenous tuples can be created from arrays of appropriate length:
+///
+/// ```
+/// let array: [u32; 3] = [1, 2, 3];
+/// let tuple: (u32, u32, u32) = array.into();
+/// ```
+///
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_tuple {}
@@ -1088,8 +1100,7 @@ impl<T: Copy> Copy for (T,) {
// empty
}
-#[cfg_attr(bootstrap, doc(primitive = "f32"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f32")]
+#[rustc_doc_primitive = "f32"]
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
///
/// This type can represent a wide range of decimal numbers, like `3.5`, `27`,
@@ -1155,8 +1166,7 @@ impl<T: Copy> Copy for (T,) {
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_f32 {}
-#[cfg_attr(bootstrap, doc(primitive = "f64"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f64")]
+#[rustc_doc_primitive = "f64"]
/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008).
///
/// This type is very similar to [`f32`], but has increased
@@ -1171,78 +1181,67 @@ mod prim_f32 {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_f64 {}
-#[cfg_attr(bootstrap, doc(primitive = "i8"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i8")]
+#[rustc_doc_primitive = "i8"]
//
/// The 8-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i8 {}
-#[cfg_attr(bootstrap, doc(primitive = "i16"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i16")]
+#[rustc_doc_primitive = "i16"]
//
/// The 16-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i16 {}
-#[cfg_attr(bootstrap, doc(primitive = "i32"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i32")]
+#[rustc_doc_primitive = "i32"]
//
/// The 32-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i32 {}
-#[cfg_attr(bootstrap, doc(primitive = "i64"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i64")]
+#[rustc_doc_primitive = "i64"]
//
/// The 64-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_i64 {}
-#[cfg_attr(bootstrap, doc(primitive = "i128"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i128")]
+#[rustc_doc_primitive = "i128"]
//
/// The 128-bit signed integer type.
#[stable(feature = "i128", since = "1.26.0")]
mod prim_i128 {}
-#[cfg_attr(bootstrap, doc(primitive = "u8"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u8")]
+#[rustc_doc_primitive = "u8"]
//
/// The 8-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_u8 {}
-#[cfg_attr(bootstrap, doc(primitive = "u16"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u16")]
+#[rustc_doc_primitive = "u16"]
//
/// The 16-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_u16 {}
-#[cfg_attr(bootstrap, doc(primitive = "u32"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u32")]
+#[rustc_doc_primitive = "u32"]
//
/// The 32-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_u32 {}
-#[cfg_attr(bootstrap, doc(primitive = "u64"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u64")]
+#[rustc_doc_primitive = "u64"]
//
/// The 64-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_u64 {}
-#[cfg_attr(bootstrap, doc(primitive = "u128"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u128")]
+#[rustc_doc_primitive = "u128"]
//
/// The 128-bit unsigned integer type.
#[stable(feature = "i128", since = "1.26.0")]
mod prim_u128 {}
-#[cfg_attr(bootstrap, doc(primitive = "isize"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "isize")]
+#[rustc_doc_primitive = "isize"]
//
/// The pointer-sized signed integer type.
///
@@ -1252,8 +1251,7 @@ mod prim_u128 {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_isize {}
-#[cfg_attr(bootstrap, doc(primitive = "usize"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "usize")]
+#[rustc_doc_primitive = "usize"]
//
/// The pointer-sized unsigned integer type.
///
@@ -1263,8 +1261,7 @@ mod prim_isize {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_usize {}
-#[cfg_attr(bootstrap, doc(primitive = "reference"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "reference")]
+#[rustc_doc_primitive = "reference"]
#[doc(alias = "&")]
#[doc(alias = "&mut")]
//
@@ -1396,8 +1393,7 @@ mod prim_usize {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_ref {}
-#[cfg_attr(bootstrap, doc(primitive = "fn"))]
-#[cfg_attr(not(bootstrap), rustc_doc_primitive = "fn")]
+#[rustc_doc_primitive = "fn"]
//
/// Function pointers, like `fn(usize) -> bool`.
///
diff --git a/library/std/src/process.rs b/library/std/src/process.rs
index 0ab72f7ea..9da74a5dd 100644
--- a/library/std/src/process.rs
+++ b/library/std/src/process.rs
@@ -211,6 +211,7 @@ pub struct Child {
impl crate::sealed::Sealed for Child {}
impl AsInner<imp::Process> for Child {
+ #[inline]
fn as_inner(&self) -> &imp::Process {
&self.handle
}
@@ -304,6 +305,7 @@ impl Write for &ChildStdin {
}
impl AsInner<AnonPipe> for ChildStdin {
+ #[inline]
fn as_inner(&self) -> &AnonPipe {
&self.inner
}
@@ -373,6 +375,7 @@ impl Read for ChildStdout {
}
impl AsInner<AnonPipe> for ChildStdout {
+ #[inline]
fn as_inner(&self) -> &AnonPipe {
&self.inner
}
@@ -438,6 +441,7 @@ impl Read for ChildStderr {
}
impl AsInner<AnonPipe> for ChildStderr {
+ #[inline]
fn as_inner(&self) -> &AnonPipe {
&self.inner
}
@@ -1107,12 +1111,14 @@ impl fmt::Debug for Command {
}
impl AsInner<imp::Command> for Command {
+ #[inline]
fn as_inner(&self) -> &imp::Command {
&self.inner
}
}
impl AsInnerMut<imp::Command> for Command {
+ #[inline]
fn as_inner_mut(&mut self) -> &mut imp::Command {
&mut self.inner
}
@@ -1605,6 +1611,7 @@ impl ExitStatus {
}
impl AsInner<imp::ExitStatus> for ExitStatus {
+ #[inline]
fn as_inner(&self) -> &imp::ExitStatus {
&self.0
}
@@ -1835,7 +1842,7 @@ impl ExitCode {
/// # use std::fmt;
/// # enum UhOhError { GenericProblem, Specific, WithCode { exit_code: ExitCode, _x: () } }
/// # impl fmt::Display for UhOhError {
- /// # fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { unimplemented!() }
+ /// # fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { unimplemented!() }
/// # }
/// // there's no way to gracefully recover from an UhOhError, so we just
/// // print a message and exit
@@ -1884,6 +1891,7 @@ impl From<u8> for ExitCode {
}
impl AsInner<imp::ExitCode> for ExitCode {
+ #[inline]
fn as_inner(&self) -> &imp::ExitCode {
&self.0
}
diff --git a/library/std/src/sync/lazy_lock.rs b/library/std/src/sync/lazy_lock.rs
index 8e9ea293c..a6bc468b0 100644
--- a/library/std/src/sync/lazy_lock.rs
+++ b/library/std/src/sync/lazy_lock.rs
@@ -1,9 +1,9 @@
use crate::cell::UnsafeCell;
-use crate::fmt;
use crate::mem::ManuallyDrop;
use crate::ops::Deref;
use crate::panic::{RefUnwindSafe, UnwindSafe};
use crate::sync::Once;
+use crate::{fmt, ptr};
use super::once::ExclusiveState;
@@ -69,6 +69,42 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
LazyLock { once: Once::new(), data: UnsafeCell::new(Data { f: ManuallyDrop::new(f) }) }
}
+ /// Consumes this `LazyLock` returning the stored value.
+ ///
+ /// Returns `Ok(value)` if `Lazy` is initialized and `Err(f)` otherwise.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(lazy_cell)]
+ /// #![feature(lazy_cell_consume)]
+ ///
+ /// use std::sync::LazyLock;
+ ///
+ /// let hello = "Hello, World!".to_string();
+ ///
+ /// let lazy = LazyLock::new(|| hello.to_uppercase());
+ ///
+ /// assert_eq!(&*lazy, "HELLO, WORLD!");
+ /// assert_eq!(LazyLock::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string()));
+ /// ```
+ #[unstable(feature = "lazy_cell_consume", issue = "109736")]
+ pub fn into_inner(mut this: Self) -> Result<T, F> {
+ let state = this.once.state();
+ match state {
+ ExclusiveState::Poisoned => panic!("LazyLock instance has previously been poisoned"),
+ state => {
+ let this = ManuallyDrop::new(this);
+ let data = unsafe { ptr::read(&this.data) }.into_inner();
+ match state {
+ ExclusiveState::Incomplete => Err(ManuallyDrop::into_inner(unsafe { data.f })),
+ ExclusiveState::Complete => Ok(ManuallyDrop::into_inner(unsafe { data.value })),
+ ExclusiveState::Poisoned => unreachable!(),
+ }
+ }
+ }
+ }
+
/// Forces the evaluation of this lazy value and
/// returns a reference to result. This is equivalent
/// to the `Deref` impl, but is explicit.
diff --git a/library/std/src/sync/mpmc/error.rs b/library/std/src/sync/mpmc/error.rs
index 1b8a1f387..33b2bff85 100644
--- a/library/std/src/sync/mpmc/error.rs
+++ b/library/std/src/sync/mpmc/error.rs
@@ -35,7 +35,7 @@ impl<T> fmt::Display for SendTimeoutError<T> {
}
}
-impl<T: Send> error::Error for SendTimeoutError<T> {}
+impl<T> error::Error for SendTimeoutError<T> {}
impl<T> From<SendError<T>> for SendTimeoutError<T> {
fn from(err: SendError<T>) -> SendTimeoutError<T> {
diff --git a/library/std/src/sync/mpsc/mod.rs b/library/std/src/sync/mpsc/mod.rs
index 6e3c28f10..0e0c87d1c 100644
--- a/library/std/src/sync/mpsc/mod.rs
+++ b/library/std/src/sync/mpsc/mod.rs
@@ -1124,7 +1124,7 @@ impl<T> fmt::Display for SendError<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Send> error::Error for SendError<T> {
+impl<T> error::Error for SendError<T> {
#[allow(deprecated)]
fn description(&self) -> &str {
"sending on a closed channel"
@@ -1152,7 +1152,7 @@ impl<T> fmt::Display for TrySendError<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Send> error::Error for TrySendError<T> {
+impl<T> error::Error for TrySendError<T> {
#[allow(deprecated)]
fn description(&self) -> &str {
match *self {
diff --git a/library/std/src/sync/once_lock.rs b/library/std/src/sync/once_lock.rs
index ab25a5bcc..e83bc35ee 100644
--- a/library/std/src/sync/once_lock.rs
+++ b/library/std/src/sync/once_lock.rs
@@ -344,8 +344,7 @@ impl<T: RefUnwindSafe + UnwindSafe> RefUnwindSafe for OnceLock<T> {}
impl<T: UnwindSafe> UnwindSafe for OnceLock<T> {}
#[stable(feature = "once_cell", since = "1.70.0")]
-#[rustc_const_unstable(feature = "const_default_impls", issue = "87864")]
-impl<T> const Default for OnceLock<T> {
+impl<T> Default for OnceLock<T> {
/// Creates a new empty cell.
///
/// # Example
diff --git a/library/std/src/sync/once_lock/tests.rs b/library/std/src/sync/once_lock/tests.rs
index 46695225b..d5d32e73d 100644
--- a/library/std/src/sync/once_lock/tests.rs
+++ b/library/std/src/sync/once_lock/tests.rs
@@ -24,7 +24,7 @@ fn sync_once_cell() {
assert_eq!(ONCE_CELL.get(), Some(&92));
});
- ONCE_CELL.get_or_init(|| panic!("Kabom!"));
+ ONCE_CELL.get_or_init(|| panic!("Kaboom!"));
assert_eq!(ONCE_CELL.get(), Some(&92));
}
diff --git a/library/std/src/sync/remutex.rs b/library/std/src/sync/remutex.rs
index 519ec2c32..0ced48d10 100644
--- a/library/std/src/sync/remutex.rs
+++ b/library/std/src/sync/remutex.rs
@@ -7,7 +7,7 @@ use crate::panic::{RefUnwindSafe, UnwindSafe};
use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed};
use crate::sys::locks as sys;
-/// A re-entrant mutual exclusion
+/// A reentrant mutual exclusion
///
/// This mutex will block *other* threads waiting for the lock to become
/// available. The thread which has already locked the mutex can lock it
diff --git a/library/std/src/sys/common/thread_local/fast_local.rs b/library/std/src/sys/common/thread_local/fast_local.rs
index e229eb16a..447044a79 100644
--- a/library/std/src/sys/common/thread_local/fast_local.rs
+++ b/library/std/src/sys/common/thread_local/fast_local.rs
@@ -1,16 +1,17 @@
+use super::lazy::LazyKeyInner;
+use crate::cell::Cell;
+use crate::sys::thread_local_dtor::register_dtor;
+use crate::{fmt, mem, panic};
+
#[doc(hidden)]
-#[macro_export]
-#[allow_internal_unstable(
- thread_local_internals,
- cfg_target_thread_local,
- thread_local,
- libstd_thread_internals
-)]
+#[allow_internal_unstable(thread_local_internals, cfg_target_thread_local, thread_local)]
#[allow_internal_unsafe]
-macro_rules! __thread_local_inner {
+#[unstable(feature = "thread_local_internals", issue = "none")]
+#[rustc_macro_transparency = "semitransparent"]
+pub macro thread_local_inner {
// used to generate the `LocalKey` value for const-initialized thread locals
(@key $t:ty, const $init:expr) => {{
- #[cfg_attr(not(bootstrap), inline)]
+ #[inline]
#[deny(unsafe_op_in_unsafe_fn)]
unsafe fn __getit(
_init: $crate::option::Option<&mut $crate::option::Option<$t>>,
@@ -49,7 +50,7 @@ macro_rules! __thread_local_inner {
// 0 == we haven't registered a destructor, so do
// so now.
0 => {
- $crate::thread::__LocalKeyInner::<$t>::register_dtor(
+ $crate::thread::local_impl::Key::<$t>::register_dtor(
$crate::ptr::addr_of_mut!(VAL) as *mut $crate::primitive::u8,
destroy,
);
@@ -69,7 +70,7 @@ macro_rules! __thread_local_inner {
unsafe {
$crate::thread::LocalKey::new(__getit)
}
- }};
+ }},
// used to generate the `LocalKey` value for `thread_local!`
(@key $t:ty, $init:expr) => {
@@ -77,13 +78,13 @@ macro_rules! __thread_local_inner {
#[inline]
fn __init() -> $t { $init }
- #[cfg_attr(not(bootstrap), inline)]
+ #[inline]
unsafe fn __getit(
init: $crate::option::Option<&mut $crate::option::Option<$t>>,
) -> $crate::option::Option<&'static $t> {
#[thread_local]
- static __KEY: $crate::thread::__LocalKeyInner<$t> =
- $crate::thread::__LocalKeyInner::<$t>::new();
+ static __KEY: $crate::thread::local_impl::Key<$t> =
+ $crate::thread::local_impl::Key::<$t>::new();
// FIXME: remove the #[allow(...)] marker when macros don't
// raise warning for missing/extraneous unsafe blocks anymore.
@@ -107,148 +108,140 @@ macro_rules! __thread_local_inner {
$crate::thread::LocalKey::new(__getit)
}
}
- };
+ },
($(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $($init:tt)*) => {
$(#[$attr])* $vis const $name: $crate::thread::LocalKey<$t> =
- $crate::__thread_local_inner!(@key $t, $($init)*);
- }
+ $crate::thread::local_impl::thread_local_inner!(@key $t, $($init)*);
+ },
}
-#[doc(hidden)]
-pub mod fast {
- use super::super::lazy::LazyKeyInner;
- use crate::cell::Cell;
- use crate::sys::thread_local_dtor::register_dtor;
- use crate::{fmt, mem, panic};
-
- #[derive(Copy, Clone)]
- enum DtorState {
- Unregistered,
- Registered,
- RunningOrHasRun,
- }
+#[derive(Copy, Clone)]
+enum DtorState {
+ Unregistered,
+ Registered,
+ RunningOrHasRun,
+}
- // This data structure has been carefully constructed so that the fast path
- // only contains one branch on x86. That optimization is necessary to avoid
- // duplicated tls lookups on OSX.
+// This data structure has been carefully constructed so that the fast path
+// only contains one branch on x86. That optimization is necessary to avoid
+// duplicated tls lookups on OSX.
+//
+// LLVM issue: https://bugs.llvm.org/show_bug.cgi?id=41722
+pub struct Key<T> {
+ // If `LazyKeyInner::get` returns `None`, that indicates either:
+ // * The value has never been initialized
+ // * The value is being recursively initialized
+ // * The value has already been destroyed or is being destroyed
+ // To determine which kind of `None`, check `dtor_state`.
//
- // LLVM issue: https://bugs.llvm.org/show_bug.cgi?id=41722
- pub struct Key<T> {
- // If `LazyKeyInner::get` returns `None`, that indicates either:
- // * The value has never been initialized
- // * The value is being recursively initialized
- // * The value has already been destroyed or is being destroyed
- // To determine which kind of `None`, check `dtor_state`.
- //
- // This is very optimizer friendly for the fast path - initialized but
- // not yet dropped.
- inner: LazyKeyInner<T>,
+ // This is very optimizer friendly for the fast path - initialized but
+ // not yet dropped.
+ inner: LazyKeyInner<T>,
- // Metadata to keep track of the state of the destructor. Remember that
- // this variable is thread-local, not global.
- dtor_state: Cell<DtorState>,
- }
+ // Metadata to keep track of the state of the destructor. Remember that
+ // this variable is thread-local, not global.
+ dtor_state: Cell<DtorState>,
+}
- impl<T> fmt::Debug for Key<T> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("Key").finish_non_exhaustive()
- }
+impl<T> fmt::Debug for Key<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("Key").finish_non_exhaustive()
}
+}
- impl<T> Key<T> {
- pub const fn new() -> Key<T> {
- Key { inner: LazyKeyInner::new(), dtor_state: Cell::new(DtorState::Unregistered) }
- }
+impl<T> Key<T> {
+ pub const fn new() -> Key<T> {
+ Key { inner: LazyKeyInner::new(), dtor_state: Cell::new(DtorState::Unregistered) }
+ }
- // note that this is just a publicly-callable function only for the
- // const-initialized form of thread locals, basically a way to call the
- // free `register_dtor` function defined elsewhere in std.
- pub unsafe fn register_dtor(a: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
- unsafe {
- register_dtor(a, dtor);
- }
+ // note that this is just a publicly-callable function only for the
+ // const-initialized form of thread locals, basically a way to call the
+ // free `register_dtor` function defined elsewhere in std.
+ pub unsafe fn register_dtor(a: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
+ unsafe {
+ register_dtor(a, dtor);
}
+ }
- pub unsafe fn get<F: FnOnce() -> T>(&self, init: F) -> Option<&'static T> {
- // SAFETY: See the definitions of `LazyKeyInner::get` and
- // `try_initialize` for more information.
- //
- // The caller must ensure no mutable references are ever active to
- // the inner cell or the inner T when this is called.
- // The `try_initialize` is dependant on the passed `init` function
- // for this.
- unsafe {
- match self.inner.get() {
- Some(val) => Some(val),
- None => self.try_initialize(init),
- }
+ pub unsafe fn get<F: FnOnce() -> T>(&self, init: F) -> Option<&'static T> {
+ // SAFETY: See the definitions of `LazyKeyInner::get` and
+ // `try_initialize` for more information.
+ //
+ // The caller must ensure no mutable references are ever active to
+ // the inner cell or the inner T when this is called.
+ // The `try_initialize` is dependant on the passed `init` function
+ // for this.
+ unsafe {
+ match self.inner.get() {
+ Some(val) => Some(val),
+ None => self.try_initialize(init),
}
}
+ }
- // `try_initialize` is only called once per fast thread local variable,
- // except in corner cases where thread_local dtors reference other
- // thread_local's, or it is being recursively initialized.
- //
- // Macos: Inlining this function can cause two `tlv_get_addr` calls to
- // be performed for every call to `Key::get`.
- // LLVM issue: https://bugs.llvm.org/show_bug.cgi?id=41722
- #[inline(never)]
- unsafe fn try_initialize<F: FnOnce() -> T>(&self, init: F) -> Option<&'static T> {
+ // `try_initialize` is only called once per fast thread local variable,
+ // except in corner cases where thread_local dtors reference other
+ // thread_local's, or it is being recursively initialized.
+ //
+ // Macos: Inlining this function can cause two `tlv_get_addr` calls to
+ // be performed for every call to `Key::get`.
+ // LLVM issue: https://bugs.llvm.org/show_bug.cgi?id=41722
+ #[inline(never)]
+ unsafe fn try_initialize<F: FnOnce() -> T>(&self, init: F) -> Option<&'static T> {
+ // SAFETY: See comment above (this function doc).
+ if !mem::needs_drop::<T>() || unsafe { self.try_register_dtor() } {
// SAFETY: See comment above (this function doc).
- if !mem::needs_drop::<T>() || unsafe { self.try_register_dtor() } {
- // SAFETY: See comment above (this function doc).
- Some(unsafe { self.inner.initialize(init) })
- } else {
- None
- }
+ Some(unsafe { self.inner.initialize(init) })
+ } else {
+ None
}
+ }
- // `try_register_dtor` is only called once per fast thread local
- // variable, except in corner cases where thread_local dtors reference
- // other thread_local's, or it is being recursively initialized.
- unsafe fn try_register_dtor(&self) -> bool {
- match self.dtor_state.get() {
- DtorState::Unregistered => {
- // SAFETY: dtor registration happens before initialization.
- // Passing `self` as a pointer while using `destroy_value<T>`
- // is safe because the function will build a pointer to a
- // Key<T>, which is the type of self and so find the correct
- // size.
- unsafe { register_dtor(self as *const _ as *mut u8, destroy_value::<T>) };
- self.dtor_state.set(DtorState::Registered);
- true
- }
- DtorState::Registered => {
- // recursively initialized
- true
- }
- DtorState::RunningOrHasRun => false,
+ // `try_register_dtor` is only called once per fast thread local
+ // variable, except in corner cases where thread_local dtors reference
+ // other thread_local's, or it is being recursively initialized.
+ unsafe fn try_register_dtor(&self) -> bool {
+ match self.dtor_state.get() {
+ DtorState::Unregistered => {
+ // SAFETY: dtor registration happens before initialization.
+ // Passing `self` as a pointer while using `destroy_value<T>`
+ // is safe because the function will build a pointer to a
+ // Key<T>, which is the type of self and so find the correct
+ // size.
+ unsafe { register_dtor(self as *const _ as *mut u8, destroy_value::<T>) };
+ self.dtor_state.set(DtorState::Registered);
+ true
}
+ DtorState::Registered => {
+ // recursively initialized
+ true
+ }
+ DtorState::RunningOrHasRun => false,
}
}
+}
- unsafe extern "C" fn destroy_value<T>(ptr: *mut u8) {
- let ptr = ptr as *mut Key<T>;
+unsafe extern "C" fn destroy_value<T>(ptr: *mut u8) {
+ let ptr = ptr as *mut Key<T>;
- // SAFETY:
- //
- // The pointer `ptr` has been built just above and comes from
- // `try_register_dtor` where it is originally a Key<T> coming from `self`,
- // making it non-NUL and of the correct type.
- //
- // Right before we run the user destructor be sure to set the
- // `Option<T>` to `None`, and `dtor_state` to `RunningOrHasRun`. This
- // causes future calls to `get` to run `try_initialize_drop` again,
- // which will now fail, and return `None`.
- //
- // Wrap the call in a catch to ensure unwinding is caught in the event
- // a panic takes place in a destructor.
- if let Err(_) = panic::catch_unwind(panic::AssertUnwindSafe(|| unsafe {
- let value = (*ptr).inner.take();
- (*ptr).dtor_state.set(DtorState::RunningOrHasRun);
- drop(value);
- })) {
- rtabort!("thread local panicked on drop");
- }
+ // SAFETY:
+ //
+ // The pointer `ptr` has been built just above and comes from
+ // `try_register_dtor` where it is originally a Key<T> coming from `self`,
+ // making it non-NUL and of the correct type.
+ //
+ // Right before we run the user destructor be sure to set the
+ // `Option<T>` to `None`, and `dtor_state` to `RunningOrHasRun`. This
+ // causes future calls to `get` to run `try_initialize_drop` again,
+ // which will now fail, and return `None`.
+ //
+ // Wrap the call in a catch to ensure unwinding is caught in the event
+ // a panic takes place in a destructor.
+ if let Err(_) = panic::catch_unwind(panic::AssertUnwindSafe(|| unsafe {
+ let value = (*ptr).inner.take();
+ (*ptr).dtor_state.set(DtorState::RunningOrHasRun);
+ drop(value);
+ })) {
+ rtabort!("thread local panicked on drop");
}
}
diff --git a/library/std/src/sys/common/thread_local/mod.rs b/library/std/src/sys/common/thread_local/mod.rs
index 1fee84a04..77f645883 100644
--- a/library/std/src/sys/common/thread_local/mod.rs
+++ b/library/std/src/sys/common/thread_local/mod.rs
@@ -1,35 +1,29 @@
-//! The following module declarations are outside cfg_if because the internal
-//! `__thread_local_internal` macro does not seem to be exported properly when using cfg_if
#![unstable(feature = "thread_local_internals", reason = "should not be necessary", issue = "none")]
-#[cfg(all(target_thread_local, not(all(target_family = "wasm", not(target_feature = "atomics")))))]
-mod fast_local;
-#[cfg(all(
- not(target_thread_local),
- not(all(target_family = "wasm", not(target_feature = "atomics")))
-))]
-mod os_local;
-#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
-mod static_local;
+// There are three thread-local implementations: "static", "fast", "OS".
+// The "OS" thread local key type is accessed via platform-specific API calls and is slow, while the
+// "fast" key type is accessed via code generated via LLVM, where TLS keys are set up by the linker.
+// "static" is for single-threaded platforms where a global static is sufficient.
-#[cfg(not(test))]
cfg_if::cfg_if! {
if #[cfg(all(target_family = "wasm", not(target_feature = "atomics")))] {
#[doc(hidden)]
- pub use static_local::statik::Key;
- } else if #[cfg(all(target_thread_local, not(all(target_family = "wasm", not(target_feature = "atomics")))))] {
+ mod static_local;
#[doc(hidden)]
- pub use fast_local::fast::Key;
- } else if #[cfg(all(not(target_thread_local), not(all(target_family = "wasm", not(target_feature = "atomics")))))] {
+ pub use static_local::{Key, thread_local_inner};
+ } else if #[cfg(target_thread_local)] {
#[doc(hidden)]
- pub use os_local::os::Key;
+ mod fast_local;
+ #[doc(hidden)]
+ pub use fast_local::{Key, thread_local_inner};
+ } else {
+ #[doc(hidden)]
+ mod os_local;
+ #[doc(hidden)]
+ pub use os_local::{Key, thread_local_inner};
}
}
-#[doc(hidden)]
-#[cfg(test)]
-pub use realstd::thread::__LocalKeyInner as Key;
-
mod lazy {
use crate::cell::UnsafeCell;
use crate::hint;
diff --git a/library/std/src/sys/common/thread_local/os_local.rs b/library/std/src/sys/common/thread_local/os_local.rs
index 1442a397e..5d48ce1e0 100644
--- a/library/std/src/sys/common/thread_local/os_local.rs
+++ b/library/std/src/sys/common/thread_local/os_local.rs
@@ -1,28 +1,29 @@
+use super::lazy::LazyKeyInner;
+use crate::cell::Cell;
+use crate::sys_common::thread_local_key::StaticKey as OsStaticKey;
+use crate::{fmt, marker, panic, ptr};
+
#[doc(hidden)]
-#[macro_export]
-#[allow_internal_unstable(
- thread_local_internals,
- cfg_target_thread_local,
- thread_local,
- libstd_thread_internals
-)]
+#[allow_internal_unstable(thread_local_internals)]
#[allow_internal_unsafe]
-macro_rules! __thread_local_inner {
+#[unstable(feature = "thread_local_internals", issue = "none")]
+#[rustc_macro_transparency = "semitransparent"]
+pub macro thread_local_inner {
// used to generate the `LocalKey` value for const-initialized thread locals
(@key $t:ty, const $init:expr) => {{
- #[cfg_attr(not(bootstrap), inline)]
+ #[inline]
#[deny(unsafe_op_in_unsafe_fn)]
unsafe fn __getit(
_init: $crate::option::Option<&mut $crate::option::Option<$t>>,
) -> $crate::option::Option<&'static $t> {
const INIT_EXPR: $t = $init;
- // On platforms without `#[thread_local]` we fall back to the
+ // On platforms without `#[thread_local]` we fall back to the
// same implementation as below for os thread locals.
#[inline]
const fn __init() -> $t { INIT_EXPR }
- static __KEY: $crate::thread::__LocalKeyInner<$t> =
- $crate::thread::__LocalKeyInner::new();
+ static __KEY: $crate::thread::local_impl::Key<$t> =
+ $crate::thread::local_impl::Key::new();
#[allow(unused_unsafe)]
unsafe {
__KEY.get(move || {
@@ -41,7 +42,7 @@ macro_rules! __thread_local_inner {
unsafe {
$crate::thread::LocalKey::new(__getit)
}
- }};
+ }},
// used to generate the `LocalKey` value for `thread_local!`
(@key $t:ty, $init:expr) => {
@@ -55,8 +56,8 @@ macro_rules! __thread_local_inner {
unsafe fn __getit(
init: $crate::option::Option<&mut $crate::option::Option<$t>>,
) -> $crate::option::Option<&'static $t> {
- static __KEY: $crate::thread::__LocalKeyInner<$t> =
- $crate::thread::__LocalKeyInner::new();
+ static __KEY: $crate::thread::local_impl::Key<$t> =
+ $crate::thread::local_impl::Key::new();
// FIXME: remove the #[allow(...)] marker when macros don't
// raise warning for missing/extraneous unsafe blocks anymore.
@@ -80,118 +81,110 @@ macro_rules! __thread_local_inner {
$crate::thread::LocalKey::new(__getit)
}
}
- };
+ },
($(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $($init:tt)*) => {
$(#[$attr])* $vis const $name: $crate::thread::LocalKey<$t> =
- $crate::__thread_local_inner!(@key $t, $($init)*);
- }
+ $crate::thread::local_impl::thread_local_inner!(@key $t, $($init)*);
+ },
}
-#[doc(hidden)]
-pub mod os {
- use super::super::lazy::LazyKeyInner;
- use crate::cell::Cell;
- use crate::sys_common::thread_local_key::StaticKey as OsStaticKey;
- use crate::{fmt, marker, panic, ptr};
-
- /// Use a regular global static to store this key; the state provided will then be
- /// thread-local.
- pub struct Key<T> {
- // OS-TLS key that we'll use to key off.
- os: OsStaticKey,
- marker: marker::PhantomData<Cell<T>>,
- }
+/// Use a regular global static to store this key; the state provided will then be
+/// thread-local.
+pub struct Key<T> {
+ // OS-TLS key that we'll use to key off.
+ os: OsStaticKey,
+ marker: marker::PhantomData<Cell<T>>,
+}
- impl<T> fmt::Debug for Key<T> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("Key").finish_non_exhaustive()
- }
+impl<T> fmt::Debug for Key<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("Key").finish_non_exhaustive()
}
+}
- unsafe impl<T> Sync for Key<T> {}
+unsafe impl<T> Sync for Key<T> {}
- struct Value<T: 'static> {
- inner: LazyKeyInner<T>,
- key: &'static Key<T>,
+struct Value<T: 'static> {
+ inner: LazyKeyInner<T>,
+ key: &'static Key<T>,
+}
+
+impl<T: 'static> Key<T> {
+ #[rustc_const_unstable(feature = "thread_local_internals", issue = "none")]
+ pub const fn new() -> Key<T> {
+ Key { os: OsStaticKey::new(Some(destroy_value::<T>)), marker: marker::PhantomData }
}
- impl<T: 'static> Key<T> {
- #[rustc_const_unstable(feature = "thread_local_internals", issue = "none")]
- pub const fn new() -> Key<T> {
- Key { os: OsStaticKey::new(Some(destroy_value::<T>)), marker: marker::PhantomData }
+ /// It is a requirement for the caller to ensure that no mutable
+ /// reference is active when this method is called.
+ pub unsafe fn get(&'static self, init: impl FnOnce() -> T) -> Option<&'static T> {
+ // SAFETY: See the documentation for this method.
+ let ptr = unsafe { self.os.get() as *mut Value<T> };
+ if ptr.addr() > 1 {
+ // SAFETY: the check ensured the pointer is safe (its destructor
+ // is not running) + it is coming from a trusted source (self).
+ if let Some(ref value) = unsafe { (*ptr).inner.get() } {
+ return Some(value);
+ }
}
+ // SAFETY: At this point we are sure we have no value and so
+ // initializing (or trying to) is safe.
+ unsafe { self.try_initialize(init) }
+ }
- /// It is a requirement for the caller to ensure that no mutable
- /// reference is active when this method is called.
- pub unsafe fn get(&'static self, init: impl FnOnce() -> T) -> Option<&'static T> {
- // SAFETY: See the documentation for this method.
- let ptr = unsafe { self.os.get() as *mut Value<T> };
- if ptr.addr() > 1 {
- // SAFETY: the check ensured the pointer is safe (its destructor
- // is not running) + it is coming from a trusted source (self).
- if let Some(ref value) = unsafe { (*ptr).inner.get() } {
- return Some(value);
- }
- }
- // SAFETY: At this point we are sure we have no value and so
- // initializing (or trying to) is safe.
- unsafe { self.try_initialize(init) }
+ // `try_initialize` is only called once per os thread local variable,
+ // except in corner cases where thread_local dtors reference other
+ // thread_local's, or it is being recursively initialized.
+ unsafe fn try_initialize(&'static self, init: impl FnOnce() -> T) -> Option<&'static T> {
+ // SAFETY: No mutable references are ever handed out meaning getting
+ // the value is ok.
+ let ptr = unsafe { self.os.get() as *mut Value<T> };
+ if ptr.addr() == 1 {
+ // destructor is running
+ return None;
}
- // `try_initialize` is only called once per os thread local variable,
- // except in corner cases where thread_local dtors reference other
- // thread_local's, or it is being recursively initialized.
- unsafe fn try_initialize(&'static self, init: impl FnOnce() -> T) -> Option<&'static T> {
- // SAFETY: No mutable references are ever handed out meaning getting
- // the value is ok.
- let ptr = unsafe { self.os.get() as *mut Value<T> };
- if ptr.addr() == 1 {
- // destructor is running
- return None;
+ let ptr = if ptr.is_null() {
+ // If the lookup returned null, we haven't initialized our own
+ // local copy, so do that now.
+ let ptr = Box::into_raw(Box::new(Value { inner: LazyKeyInner::new(), key: self }));
+ // SAFETY: At this point we are sure there is no value inside
+ // ptr so setting it will not affect anyone else.
+ unsafe {
+ self.os.set(ptr as *mut u8);
}
-
- let ptr = if ptr.is_null() {
- // If the lookup returned null, we haven't initialized our own
- // local copy, so do that now.
- let ptr = Box::into_raw(Box::new(Value { inner: LazyKeyInner::new(), key: self }));
- // SAFETY: At this point we are sure there is no value inside
- // ptr so setting it will not affect anyone else.
- unsafe {
- self.os.set(ptr as *mut u8);
- }
- ptr
- } else {
- // recursive initialization
- ptr
- };
-
- // SAFETY: ptr has been ensured as non-NUL just above an so can be
- // dereferenced safely.
- unsafe { Some((*ptr).inner.initialize(init)) }
- }
+ ptr
+ } else {
+ // recursive initialization
+ ptr
+ };
+
+ // SAFETY: ptr has been ensured as non-NUL just above an so can be
+ // dereferenced safely.
+ unsafe { Some((*ptr).inner.initialize(init)) }
}
+}
- unsafe extern "C" fn destroy_value<T: 'static>(ptr: *mut u8) {
- // SAFETY:
- //
- // The OS TLS ensures that this key contains a null value when this
- // destructor starts to run. We set it back to a sentinel value of 1 to
- // ensure that any future calls to `get` for this thread will return
- // `None`.
- //
- // Note that to prevent an infinite loop we reset it back to null right
- // before we return from the destructor ourselves.
- //
- // Wrap the call in a catch to ensure unwinding is caught in the event
- // a panic takes place in a destructor.
- if let Err(_) = panic::catch_unwind(|| unsafe {
- let ptr = Box::from_raw(ptr as *mut Value<T>);
- let key = ptr.key;
- key.os.set(ptr::invalid_mut(1));
- drop(ptr);
- key.os.set(ptr::null_mut());
- }) {
- rtabort!("thread local panicked on drop");
- }
+unsafe extern "C" fn destroy_value<T: 'static>(ptr: *mut u8) {
+ // SAFETY:
+ //
+ // The OS TLS ensures that this key contains a null value when this
+ // destructor starts to run. We set it back to a sentinel value of 1 to
+ // ensure that any future calls to `get` for this thread will return
+ // `None`.
+ //
+ // Note that to prevent an infinite loop we reset it back to null right
+ // before we return from the destructor ourselves.
+ //
+ // Wrap the call in a catch to ensure unwinding is caught in the event
+ // a panic takes place in a destructor.
+ if let Err(_) = panic::catch_unwind(|| unsafe {
+ let ptr = Box::from_raw(ptr as *mut Value<T>);
+ let key = ptr.key;
+ key.os.set(ptr::invalid_mut(1));
+ drop(ptr);
+ key.os.set(ptr::null_mut());
+ }) {
+ rtabort!("thread local panicked on drop");
}
}
diff --git a/library/std/src/sys/common/thread_local/static_local.rs b/library/std/src/sys/common/thread_local/static_local.rs
index ec4f2a12b..80322a978 100644
--- a/library/std/src/sys/common/thread_local/static_local.rs
+++ b/library/std/src/sys/common/thread_local/static_local.rs
@@ -1,13 +1,12 @@
+use super::lazy::LazyKeyInner;
+use crate::fmt;
+
#[doc(hidden)]
-#[macro_export]
-#[allow_internal_unstable(
- thread_local_internals,
- cfg_target_thread_local,
- thread_local,
- libstd_thread_internals
-)]
+#[allow_internal_unstable(thread_local_internals)]
#[allow_internal_unsafe]
-macro_rules! __thread_local_inner {
+#[unstable(feature = "thread_local_internals", issue = "none")]
+#[rustc_macro_transparency = "semitransparent"]
+pub macro thread_local_inner {
// used to generate the `LocalKey` value for const-initialized thread locals
(@key $t:ty, const $init:expr) => {{
#[inline] // see comments below
@@ -30,7 +29,7 @@ macro_rules! __thread_local_inner {
unsafe {
$crate::thread::LocalKey::new(__getit)
}
- }};
+ }},
// used to generate the `LocalKey` value for `thread_local!`
(@key $t:ty, $init:expr) => {
@@ -41,8 +40,8 @@ macro_rules! __thread_local_inner {
unsafe fn __getit(
init: $crate::option::Option<&mut $crate::option::Option<$t>>,
) -> $crate::option::Option<&'static $t> {
- static __KEY: $crate::thread::__LocalKeyInner<$t> =
- $crate::thread::__LocalKeyInner::new();
+ static __KEY: $crate::thread::local_impl::Key<$t> =
+ $crate::thread::local_impl::Key::new();
// FIXME: remove the #[allow(...)] marker when macros don't
// raise warning for missing/extraneous unsafe blocks anymore.
@@ -66,50 +65,45 @@ macro_rules! __thread_local_inner {
$crate::thread::LocalKey::new(__getit)
}
}
- };
+ },
($(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $($init:tt)*) => {
$(#[$attr])* $vis const $name: $crate::thread::LocalKey<$t> =
- $crate::__thread_local_inner!(@key $t, $($init)*);
- }
+ $crate::thread::local_impl::thread_local_inner!(@key $t, $($init)*);
+ },
}
/// On some targets like wasm there's no threads, so no need to generate
/// thread locals and we can instead just use plain statics!
-#[doc(hidden)]
-pub mod statik {
- use super::super::lazy::LazyKeyInner;
- use crate::fmt;
- pub struct Key<T> {
- inner: LazyKeyInner<T>,
- }
+pub struct Key<T> {
+ inner: LazyKeyInner<T>,
+}
- unsafe impl<T> Sync for Key<T> {}
+unsafe impl<T> Sync for Key<T> {}
- impl<T> fmt::Debug for Key<T> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("Key").finish_non_exhaustive()
- }
+impl<T> fmt::Debug for Key<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("Key").finish_non_exhaustive()
}
+}
- impl<T> Key<T> {
- pub const fn new() -> Key<T> {
- Key { inner: LazyKeyInner::new() }
- }
+impl<T> Key<T> {
+ pub const fn new() -> Key<T> {
+ Key { inner: LazyKeyInner::new() }
+ }
- pub unsafe fn get(&self, init: impl FnOnce() -> T) -> Option<&'static T> {
- // SAFETY: The caller must ensure no reference is ever handed out to
- // the inner cell nor mutable reference to the Option<T> inside said
- // cell. This make it safe to hand a reference, though the lifetime
- // of 'static is itself unsafe, making the get method unsafe.
- let value = unsafe {
- match self.inner.get() {
- Some(ref value) => value,
- None => self.inner.initialize(init),
- }
- };
+ pub unsafe fn get(&self, init: impl FnOnce() -> T) -> Option<&'static T> {
+ // SAFETY: The caller must ensure no reference is ever handed out to
+ // the inner cell nor mutable reference to the Option<T> inside said
+ // cell. This make it safe to hand a reference, though the lifetime
+ // of 'static is itself unsafe, making the get method unsafe.
+ let value = unsafe {
+ match self.inner.get() {
+ Some(ref value) => value,
+ None => self.inner.initialize(init),
+ }
+ };
- Some(value)
- }
+ Some(value)
}
}
diff --git a/library/std/src/sys/hermit/fd.rs b/library/std/src/sys/hermit/fd.rs
index 3a2cdd301..ccde05aa1 100644
--- a/library/std/src/sys/hermit/fd.rs
+++ b/library/std/src/sys/hermit/fd.rs
@@ -75,6 +75,7 @@ impl FromRawFd for FileDesc {
}
impl AsInner<OwnedFd> for FileDesc {
+ #[inline]
fn as_inner(&self) -> &OwnedFd {
&self.fd
}
diff --git a/library/std/src/sys/hermit/fs.rs b/library/std/src/sys/hermit/fs.rs
index cf0b27176..4bb735668 100644
--- a/library/std/src/sys/hermit/fs.rs
+++ b/library/std/src/sys/hermit/fs.rs
@@ -367,12 +367,14 @@ impl DirBuilder {
}
impl AsInner<FileDesc> for File {
+ #[inline]
fn as_inner(&self) -> &FileDesc {
&self.0
}
}
impl AsInnerMut<FileDesc> for File {
+ #[inline]
fn as_inner_mut(&mut self) -> &mut FileDesc {
&mut self.0
}
@@ -397,6 +399,7 @@ impl AsFd for File {
}
impl AsRawFd for File {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
diff --git a/library/std/src/sys/hermit/net.rs b/library/std/src/sys/hermit/net.rs
index d6f64a297..8c2d489d6 100644
--- a/library/std/src/sys/hermit/net.rs
+++ b/library/std/src/sys/hermit/net.rs
@@ -340,6 +340,7 @@ impl Socket {
}
impl AsInner<FileDesc> for Socket {
+ #[inline]
fn as_inner(&self) -> &FileDesc {
&self.0
}
@@ -364,6 +365,7 @@ impl AsFd for Socket {
}
impl AsRawFd for Socket {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
diff --git a/library/std/src/sys/hermit/time.rs b/library/std/src/sys/hermit/time.rs
index 32ddc4346..5440d85df 100644
--- a/library/std/src/sys/hermit/time.rs
+++ b/library/std/src/sys/hermit/time.rs
@@ -40,11 +40,7 @@ impl Timespec {
}
fn checked_add_duration(&self, other: &Duration) -> Option<Timespec> {
- let mut secs = other
- .as_secs()
- .try_into() // <- target type would be `libc::time_t`
- .ok()
- .and_then(|secs| self.t.tv_sec.checked_add(secs))?;
+ let mut secs = self.tv_sec.checked_add_unsigned(other.as_secs())?;
// Nano calculations can't overflow because nanos are <1B which fit
// in a u32.
@@ -57,11 +53,7 @@ impl Timespec {
}
fn checked_sub_duration(&self, other: &Duration) -> Option<Timespec> {
- let mut secs = other
- .as_secs()
- .try_into() // <- target type would be `libc::time_t`
- .ok()
- .and_then(|secs| self.t.tv_sec.checked_sub(secs))?;
+ let mut secs = self.tv_sec.checked_sub_unsigned(other.as_secs())?;
// Similar to above, nanos can't overflow.
let mut nsec = self.t.tv_nsec as i32 - other.subsec_nanos() as i32;
diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs
index e767b2866..c72be1380 100644
--- a/library/std/src/sys/mod.rs
+++ b/library/std/src/sys/mod.rs
@@ -52,31 +52,6 @@ cfg_if::cfg_if! {
}
}
-// Import essential modules from platforms used in `std::os` when documenting.
-//
-// Note that on some platforms those modules don't compile
-// (missing things in `libc` which is empty), so they are not included in `std::os` and can be
-// omitted here as well.
-
-#[cfg(doc)]
-#[cfg(not(any(
- all(target_arch = "wasm32", not(target_os = "wasi")),
- all(target_vendor = "fortanix", target_env = "sgx")
-)))]
-cfg_if::cfg_if! {
- if #[cfg(not(windows))] {
- // On non-Windows platforms (aka linux/osx/etc) pull in a "minimal"
- // amount of windows goop which ends up compiling
-
- #[macro_use]
- #[path = "windows/compat.rs"]
- pub mod compat;
-
- #[path = "windows/c.rs"]
- pub mod c;
- }
-}
-
cfg_if::cfg_if! {
// Fuchsia components default to full backtrace.
if #[cfg(target_os = "fuchsia")] {
diff --git a/library/std/src/sys/sgx/abi/entry.S b/library/std/src/sys/sgx/abi/entry.S
index f61bcf06f..8a063b65d 100644
--- a/library/std/src/sys/sgx/abi/entry.S
+++ b/library/std/src/sys/sgx/abi/entry.S
@@ -26,7 +26,7 @@ IMAGE_BASE:
.Lxsave_clear:
.org .+24
.Lxsave_mxcsr:
- .short 0x1f80
+ .short 0x1fbf
/* We can store a bunch of data in the gap between MXCSR and the XSAVE header */
@@ -58,7 +58,7 @@ IMAGE_BASE:
globvar DEBUG 1
/* The base address (relative to enclave start) of the enclave text section */
globvar TEXT_BASE 8
- /* The size in bytes of enclacve text section */
+ /* The size in bytes of enclave text section */
globvar TEXT_SIZE 8
/* The base address (relative to enclave start) of the enclave .eh_frame_hdr section */
globvar EH_FRM_HDR_OFFSET 8
@@ -66,7 +66,7 @@ IMAGE_BASE:
globvar EH_FRM_HDR_LEN 8
/* The base address (relative to enclave start) of the enclave .eh_frame section */
globvar EH_FRM_OFFSET 8
- /* The size in bytes of enclacve .eh_frame section */
+ /* The size in bytes of enclave .eh_frame section */
globvar EH_FRM_LEN 8
.org .Lxsave_clear+512
@@ -178,6 +178,7 @@ sgx_entry:
mov $-1, %rax
mov $-1, %rdx
xrstor .Lxsave_clear(%rip)
+ lfence
mov %r10, %rdx
/* check if returning from usercall */
@@ -311,6 +312,9 @@ usercall:
movq $0,%gs:tcsls_last_rsp
/* restore callee-saved state, cf. "save" above */
mov %r11,%rsp
+ /* MCDT mitigation requires an lfence after ldmxcsr _before_ any of the affected */
+ /* vector instructions is used. We omit the lfence here as one is required before */
+ /* the jmp instruction anyway. */
ldmxcsr (%rsp)
fldcw 4(%rsp)
add $8, %rsp
diff --git a/library/std/src/sys/sgx/fd.rs b/library/std/src/sys/sgx/fd.rs
index 0c02a1076..b3686d0e2 100644
--- a/library/std/src/sys/sgx/fd.rs
+++ b/library/std/src/sys/sgx/fd.rs
@@ -62,6 +62,7 @@ impl FileDesc {
}
impl AsInner<Fd> for FileDesc {
+ #[inline]
fn as_inner(&self) -> &Fd {
&self.fd
}
diff --git a/library/std/src/sys/sgx/net.rs b/library/std/src/sys/sgx/net.rs
index 923be5eb9..03620a08f 100644
--- a/library/std/src/sys/sgx/net.rs
+++ b/library/std/src/sys/sgx/net.rs
@@ -24,6 +24,7 @@ impl Socket {
}
impl AsInner<FileDesc> for Socket {
+ #[inline]
fn as_inner(&self) -> &FileDesc {
&self.inner
}
@@ -220,6 +221,7 @@ impl TcpStream {
}
impl AsInner<Socket> for TcpStream {
+ #[inline]
fn as_inner(&self) -> &Socket {
&self.inner
}
@@ -304,6 +306,7 @@ impl TcpListener {
}
impl AsInner<Socket> for TcpListener {
+ #[inline]
fn as_inner(&self) -> &Socket {
&self.inner
}
diff --git a/library/std/src/sys/sgx/waitqueue/mod.rs b/library/std/src/sys/sgx/waitqueue/mod.rs
index 61bb11d9a..5e1d859ee 100644
--- a/library/std/src/sys/sgx/waitqueue/mod.rs
+++ b/library/std/src/sys/sgx/waitqueue/mod.rs
@@ -202,12 +202,18 @@ impl WaitQueue {
pub fn notify_one<T>(
mut guard: SpinMutexGuard<'_, WaitVariable<T>>,
) -> Result<WaitGuard<'_, T>, SpinMutexGuard<'_, WaitVariable<T>>> {
+ // SAFETY: lifetime of the pop() return value is limited to the map
+ // closure (The closure return value is 'static). The underlying
+ // stack frame won't be freed until after the WaitGuard created below
+ // is dropped.
unsafe {
- if let Some(entry) = guard.queue.inner.pop() {
+ let tcs = guard.queue.inner.pop().map(|entry| -> Tcs {
let mut entry_guard = entry.lock();
- let tcs = entry_guard.tcs;
entry_guard.wake = true;
- drop(entry);
+ entry_guard.tcs
+ });
+
+ if let Some(tcs) = tcs {
Ok(WaitGuard { mutex_guard: Some(guard), notified_tcs: NotifiedTcs::Single(tcs) })
} else {
Err(guard)
@@ -223,6 +229,9 @@ impl WaitQueue {
pub fn notify_all<T>(
mut guard: SpinMutexGuard<'_, WaitVariable<T>>,
) -> Result<WaitGuard<'_, T>, SpinMutexGuard<'_, WaitVariable<T>>> {
+ // SAFETY: lifetime of the pop() return values are limited to the
+ // while loop body. The underlying stack frames won't be freed until
+ // after the WaitGuard created below is dropped.
unsafe {
let mut count = 0;
while let Some(entry) = guard.queue.inner.pop() {
@@ -230,6 +239,7 @@ impl WaitQueue {
let mut entry_guard = entry.lock();
entry_guard.wake = true;
}
+
if let Some(count) = NonZeroUsize::new(count) {
Ok(WaitGuard { mutex_guard: Some(guard), notified_tcs: NotifiedTcs::All { count } })
} else {
diff --git a/library/std/src/sys/solid/net.rs b/library/std/src/sys/solid/net.rs
index 7d7bfae14..0bd2bc3b9 100644
--- a/library/std/src/sys/solid/net.rs
+++ b/library/std/src/sys/solid/net.rs
@@ -112,6 +112,7 @@ impl FileDesc {
}
impl AsInner<c_int> for FileDesc {
+ #[inline]
fn as_inner(&self) -> &c_int {
&self.fd
}
@@ -462,6 +463,7 @@ impl Socket {
}
impl AsInner<c_int> for Socket {
+ #[inline]
fn as_inner(&self) -> &c_int {
self.0.as_inner()
}
diff --git a/library/std/src/sys/solid/time.rs b/library/std/src/sys/solid/time.rs
index ce31cb45a..f83f1644f 100644
--- a/library/std/src/sys/solid/time.rs
+++ b/library/std/src/sys/solid/time.rs
@@ -47,10 +47,10 @@ impl SystemTime {
}
pub fn checked_add_duration(&self, other: &Duration) -> Option<SystemTime> {
- Some(SystemTime(self.0.checked_add(other.as_secs().try_into().ok()?)?))
+ Some(SystemTime(self.0.checked_add_unsigned(other.as_secs())?))
}
pub fn checked_sub_duration(&self, other: &Duration) -> Option<SystemTime> {
- Some(SystemTime(self.0.checked_sub(other.as_secs().try_into().ok()?)?))
+ Some(SystemTime(self.0.checked_sub_unsigned(other.as_secs())?))
}
}
diff --git a/library/std/src/sys/unix/alloc.rs b/library/std/src/sys/unix/alloc.rs
index 9d6567c9f..8604b5398 100644
--- a/library/std/src/sys/unix/alloc.rs
+++ b/library/std/src/sys/unix/alloc.rs
@@ -59,7 +59,8 @@ cfg_if::cfg_if! {
target_os = "redox",
target_os = "solaris",
target_os = "espidf",
- target_os = "horizon"
+ target_os = "horizon",
+ target_os = "vita",
))] {
#[inline]
unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
diff --git a/library/std/src/sys/unix/args.rs b/library/std/src/sys/unix/args.rs
index 3d79058b3..9ed4d9c1e 100644
--- a/library/std/src/sys/unix/args.rs
+++ b/library/std/src/sys/unix/args.rs
@@ -265,7 +265,7 @@ mod imp {
}
}
-#[cfg(target_os = "espidf")]
+#[cfg(any(target_os = "espidf", target_os = "vita"))]
mod imp {
use super::Args;
diff --git a/library/std/src/sys/unix/env.rs b/library/std/src/sys/unix/env.rs
index 1a9276f11..8c3ef88d8 100644
--- a/library/std/src/sys/unix/env.rs
+++ b/library/std/src/sys/unix/env.rs
@@ -141,6 +141,17 @@ pub mod os {
pub const EXE_EXTENSION: &str = "elf";
}
+#[cfg(target_os = "vita")]
+pub mod os {
+ pub const FAMILY: &str = "unix";
+ pub const OS: &str = "vita";
+ pub const DLL_PREFIX: &str = "lib";
+ pub const DLL_SUFFIX: &str = ".so";
+ pub const DLL_EXTENSION: &str = "so";
+ pub const EXE_SUFFIX: &str = ".elf";
+ pub const EXE_EXTENSION: &str = "elf";
+}
+
#[cfg(all(target_os = "emscripten", target_arch = "asmjs"))]
pub mod os {
pub const FAMILY: &str = "unix";
diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs
index ce5c048f2..cb630eede 100644
--- a/library/std/src/sys/unix/fd.rs
+++ b/library/std/src/sys/unix/fd.rs
@@ -75,6 +75,7 @@ const fn max_iov() -> usize {
target_os = "nto",
target_os = "openbsd",
target_os = "horizon",
+ target_os = "vita",
target_os = "watchos",
)))]
const fn max_iov() -> usize {
@@ -93,7 +94,7 @@ impl FileDesc {
Ok(ret as usize)
}
- #[cfg(not(any(target_os = "espidf", target_os = "horizon")))]
+ #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))]
pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
let ret = cvt(unsafe {
libc::readv(
@@ -105,14 +106,14 @@ impl FileDesc {
Ok(ret as usize)
}
- #[cfg(any(target_os = "espidf", target_os = "horizon"))]
+ #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))]
pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
io::default_read_vectored(|b| self.read(b), bufs)
}
#[inline]
pub fn is_read_vectored(&self) -> bool {
- cfg!(not(any(target_os = "espidf", target_os = "horizon")))
+ cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))
}
pub fn read_to_end(&self, buf: &mut Vec<u8>) -> io::Result<usize> {
@@ -253,7 +254,7 @@ impl FileDesc {
Ok(ret as usize)
}
- #[cfg(not(any(target_os = "espidf", target_os = "horizon")))]
+ #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))]
pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
let ret = cvt(unsafe {
libc::writev(
@@ -265,14 +266,14 @@ impl FileDesc {
Ok(ret as usize)
}
- #[cfg(any(target_os = "espidf", target_os = "horizon"))]
+ #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))]
pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
io::default_write_vectored(|b| self.write(b), bufs)
}
#[inline]
pub fn is_write_vectored(&self) -> bool {
- cfg!(not(any(target_os = "espidf", target_os = "horizon")))
+ cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))
}
pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
@@ -481,6 +482,7 @@ impl<'a> Read for &'a FileDesc {
}
impl AsInner<OwnedFd> for FileDesc {
+ #[inline]
fn as_inner(&self) -> &OwnedFd {
&self.0
}
@@ -505,6 +507,7 @@ impl AsFd for FileDesc {
}
impl AsRawFd for FileDesc {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs
index abef170dd..09e9ae272 100644
--- a/library/std/src/sys/unix/fs.rs
+++ b/library/std/src/sys/unix/fs.rs
@@ -349,6 +349,8 @@ pub struct FilePermissions {
pub struct FileTimes {
accessed: Option<SystemTime>,
modified: Option<SystemTime>,
+ #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
+ created: Option<SystemTime>,
}
#[derive(Copy, Clone, Eq, Debug)]
@@ -447,7 +449,12 @@ impl FileAttr {
#[cfg(not(any(target_os = "netbsd", target_os = "nto")))]
impl FileAttr {
- #[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))]
+ #[cfg(not(any(
+ target_os = "vxworks",
+ target_os = "espidf",
+ target_os = "horizon",
+ target_os = "vita"
+ )))]
pub fn modified(&self) -> io::Result<SystemTime> {
#[cfg(target_pointer_width = "32")]
cfg_has_statx! {
@@ -459,7 +466,7 @@ impl FileAttr {
Ok(SystemTime::new(self.stat.st_mtime as i64, self.stat.st_mtime_nsec as i64))
}
- #[cfg(any(target_os = "vxworks", target_os = "espidf"))]
+ #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))]
pub fn modified(&self) -> io::Result<SystemTime> {
Ok(SystemTime::new(self.stat.st_mtime as i64, 0))
}
@@ -469,7 +476,12 @@ impl FileAttr {
Ok(SystemTime::from(self.stat.st_mtim))
}
- #[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))]
+ #[cfg(not(any(
+ target_os = "vxworks",
+ target_os = "espidf",
+ target_os = "horizon",
+ target_os = "vita"
+ )))]
pub fn accessed(&self) -> io::Result<SystemTime> {
#[cfg(target_pointer_width = "32")]
cfg_has_statx! {
@@ -481,7 +493,7 @@ impl FileAttr {
Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atime_nsec as i64))
}
- #[cfg(any(target_os = "vxworks", target_os = "espidf"))]
+ #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))]
pub fn accessed(&self) -> io::Result<SystemTime> {
Ok(SystemTime::new(self.stat.st_atime as i64, 0))
}
@@ -547,6 +559,7 @@ impl FileAttr {
}
impl AsInner<stat64> for FileAttr {
+ #[inline]
fn as_inner(&self) -> &stat64 {
&self.stat
}
@@ -580,6 +593,11 @@ impl FileTimes {
pub fn set_modified(&mut self, t: SystemTime) {
self.modified = Some(t);
}
+
+ #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
+ pub fn set_created(&mut self, t: SystemTime) {
+ self.created = Some(t);
+ }
}
impl FileType {
@@ -865,6 +883,7 @@ impl DirEntry {
target_os = "vxworks",
target_os = "espidf",
target_os = "horizon",
+ target_os = "vita",
target_os = "nto",
))]
pub fn ino(&self) -> u64 {
@@ -1193,37 +1212,51 @@ impl File {
None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }),
}
};
- #[cfg(not(any(target_os = "redox", target_os = "espidf", target_os = "horizon")))]
- let times = [to_timespec(times.accessed)?, to_timespec(times.modified)?];
cfg_if::cfg_if! {
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon"))] {
// Redox doesn't appear to support `UTIME_OMIT`.
// ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
// the same as for Redox.
- drop(times);
+ let _ = times;
Err(io::const_io_error!(
io::ErrorKind::Unsupported,
"setting file times not supported",
))
- } else if #[cfg(any(target_os = "android", target_os = "macos"))] {
- // futimens requires macOS 10.13, and Android API level 19
+ } else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] {
+ let mut buf = [mem::MaybeUninit::<libc::timespec>::uninit(); 3];
+ let mut num_times = 0;
+ let mut attrlist: libc::attrlist = unsafe { mem::zeroed() };
+ attrlist.bitmapcount = libc::ATTR_BIT_MAP_COUNT;
+ if times.created.is_some() {
+ buf[num_times].write(to_timespec(times.created)?);
+ num_times += 1;
+ attrlist.commonattr |= libc::ATTR_CMN_CRTIME;
+ }
+ if times.modified.is_some() {
+ buf[num_times].write(to_timespec(times.modified)?);
+ num_times += 1;
+ attrlist.commonattr |= libc::ATTR_CMN_MODTIME;
+ }
+ if times.accessed.is_some() {
+ buf[num_times].write(to_timespec(times.accessed)?);
+ num_times += 1;
+ attrlist.commonattr |= libc::ATTR_CMN_ACCTIME;
+ }
+ cvt(unsafe { libc::fsetattrlist(
+ self.as_raw_fd(),
+ (&attrlist as *const libc::attrlist).cast::<libc::c_void>().cast_mut(),
+ buf.as_ptr().cast::<libc::c_void>().cast_mut(),
+ num_times * mem::size_of::<libc::timespec>(),
+ 0
+ ) })?;
+ Ok(())
+ } else if #[cfg(target_os = "android")] {
+ let times = [to_timespec(times.accessed)?, to_timespec(times.modified)?];
+ // futimens requires Android API level 19
cvt(unsafe {
weak!(fn futimens(c_int, *const libc::timespec) -> c_int);
match futimens.get() {
Some(futimens) => futimens(self.as_raw_fd(), times.as_ptr()),
- #[cfg(target_os = "macos")]
- None => {
- fn ts_to_tv(ts: &libc::timespec) -> libc::timeval {
- libc::timeval {
- tv_sec: ts.tv_sec,
- tv_usec: (ts.tv_nsec / 1000) as _
- }
- }
- let timevals = [ts_to_tv(&times[0]), ts_to_tv(&times[1])];
- libc::futimes(self.as_raw_fd(), timevals.as_ptr())
- }
- // futimes requires even newer Android.
- #[cfg(target_os = "android")]
None => return Err(io::const_io_error!(
io::ErrorKind::Unsupported,
"setting file times requires Android API level >= 19",
@@ -1232,6 +1265,22 @@ impl File {
})?;
Ok(())
} else {
+ #[cfg(all(target_os = "linux", target_env = "gnu", target_pointer_width = "32", not(target_arch = "riscv32")))]
+ {
+ use crate::sys::{time::__timespec64, weak::weak};
+
+ // Added in glibc 2.34
+ weak!(fn __futimens64(libc::c_int, *const __timespec64) -> libc::c_int);
+
+ if let Some(futimens64) = __futimens64.get() {
+ let to_timespec = |time: Option<SystemTime>| time.map(|time| time.t.to_timespec64())
+ .unwrap_or(__timespec64::new(0, libc::UTIME_OMIT as _));
+ let times = [to_timespec(times.accessed), to_timespec(times.modified)];
+ cvt(unsafe { futimens64(self.as_raw_fd(), times.as_ptr()) })?;
+ return Ok(());
+ }
+ }
+ let times = [to_timespec(times.accessed)?, to_timespec(times.modified)?];
cvt(unsafe { libc::futimens(self.as_raw_fd(), times.as_ptr()) })?;
Ok(())
}
@@ -1254,12 +1303,14 @@ impl DirBuilder {
}
impl AsInner<FileDesc> for File {
+ #[inline]
fn as_inner(&self) -> &FileDesc {
&self.0
}
}
impl AsInnerMut<FileDesc> for File {
+ #[inline]
fn as_inner_mut(&mut self) -> &mut FileDesc {
&mut self.0
}
@@ -1284,6 +1335,7 @@ impl AsFd for File {
}
impl AsRawFd for File {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
diff --git a/library/std/src/sys/unix/l4re.rs b/library/std/src/sys/unix/l4re.rs
index 996758893..ee016887e 100644
--- a/library/std/src/sys/unix/l4re.rs
+++ b/library/std/src/sys/unix/l4re.rs
@@ -129,6 +129,7 @@ pub mod net {
}
impl AsInner<FileDesc> for Socket {
+ #[inline]
fn as_inner(&self) -> &FileDesc {
&self.0
}
@@ -153,6 +154,7 @@ pub mod net {
}
impl AsRawFd for Socket {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
@@ -183,6 +185,7 @@ pub mod net {
unimpl!();
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
@@ -305,6 +308,7 @@ pub mod net {
unimpl!();
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
@@ -371,6 +375,7 @@ pub mod net {
unimpl!();
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs
index 68c9520cc..bb9e65e68 100644
--- a/library/std/src/sys/unix/mod.rs
+++ b/library/std/src/sys/unix/mod.rs
@@ -92,6 +92,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
target_os = "redox",
target_os = "l4re",
target_os = "horizon",
+ target_os = "vita",
)))]
'poll: {
use crate::sys::os::errno;
@@ -140,6 +141,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
target_os = "vxworks",
target_os = "l4re",
target_os = "horizon",
+ target_os = "vita",
)))]
{
use crate::sys::os::errno;
@@ -162,7 +164,12 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
}
unsafe fn reset_sigpipe(#[allow(unused_variables)] sigpipe: u8) {
- #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "horizon")))]
+ #[cfg(not(any(
+ target_os = "emscripten",
+ target_os = "fuchsia",
+ target_os = "horizon",
+ target_os = "vita"
+ )))]
{
// We don't want to add this as a public type to std, nor do we
// want to `include!` a file from the compiler (which would break
@@ -199,7 +206,8 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
target_os = "espidf",
target_os = "emscripten",
target_os = "fuchsia",
- target_os = "horizon"
+ target_os = "horizon",
+ target_os = "vita"
)))]
static UNIX_SIGPIPE_ATTR_SPECIFIED: crate::sync::atomic::AtomicBool =
crate::sync::atomic::AtomicBool::new(false);
@@ -208,7 +216,8 @@ static UNIX_SIGPIPE_ATTR_SPECIFIED: crate::sync::atomic::AtomicBool =
target_os = "espidf",
target_os = "emscripten",
target_os = "fuchsia",
- target_os = "horizon"
+ target_os = "horizon",
+ target_os = "vita",
)))]
pub(crate) fn unix_sigpipe_attr_specified() -> bool {
UNIX_SIGPIPE_ATTR_SPECIFIED.load(crate::sync::atomic::Ordering::Relaxed)
@@ -402,7 +411,7 @@ cfg_if::cfg_if! {
}
}
-#[cfg(any(target_os = "espidf", target_os = "horizon"))]
+#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))]
mod unsupported {
use crate::io;
diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs
index 573bfa658..39edb136c 100644
--- a/library/std/src/sys/unix/net.rs
+++ b/library/std/src/sys/unix/net.rs
@@ -490,6 +490,7 @@ impl Socket {
}
impl AsInner<FileDesc> for Socket {
+ #[inline]
fn as_inner(&self) -> &FileDesc {
&self.0
}
@@ -514,6 +515,7 @@ impl AsFd for Socket {
}
impl AsRawFd for Socket {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs
index a345af76f..8edfd3313 100644
--- a/library/std/src/sys/unix/os.rs
+++ b/library/std/src/sys/unix/os.rs
@@ -460,7 +460,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
path.canonicalize()
}
-#[cfg(any(target_os = "espidf", target_os = "horizon"))]
+#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))]
pub fn current_exe() -> io::Result<PathBuf> {
super::unsupported::unsupported()
}
@@ -614,7 +614,8 @@ pub fn home_dir() -> Option<PathBuf> {
target_os = "redox",
target_os = "vxworks",
target_os = "espidf",
- target_os = "horizon"
+ target_os = "horizon",
+ target_os = "vita",
))]
unsafe fn fallback() -> Option<OsString> {
None
@@ -627,7 +628,8 @@ pub fn home_dir() -> Option<PathBuf> {
target_os = "redox",
target_os = "vxworks",
target_os = "espidf",
- target_os = "horizon"
+ target_os = "horizon",
+ target_os = "vita",
)))]
unsafe fn fallback() -> Option<OsString> {
let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) {
diff --git a/library/std/src/sys/unix/os_str.rs b/library/std/src/sys/unix/os_str.rs
index 017e2af29..488217f39 100644
--- a/library/std/src/sys/unix/os_str.rs
+++ b/library/std/src/sys/unix/os_str.rs
@@ -89,6 +89,7 @@ impl IntoInner<Vec<u8>> for Buf {
}
impl AsInner<[u8]> for Buf {
+ #[inline]
fn as_inner(&self) -> &[u8] {
&self.inner
}
diff --git a/library/std/src/sys/unix/pipe.rs b/library/std/src/sys/unix/pipe.rs
index dc17c9fac..938a46bfd 100644
--- a/library/std/src/sys/unix/pipe.rs
+++ b/library/std/src/sys/unix/pipe.rs
@@ -135,6 +135,7 @@ pub fn read2(p1: AnonPipe, v1: &mut Vec<u8>, p2: AnonPipe, v2: &mut Vec<u8>) ->
}
impl AsRawFd for AnonPipe {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
diff --git a/library/std/src/sys/unix/process/mod.rs b/library/std/src/sys/unix/process/mod.rs
index 3701510f3..0cf163d9f 100644
--- a/library/std/src/sys/unix/process/mod.rs
+++ b/library/std/src/sys/unix/process/mod.rs
@@ -14,7 +14,7 @@ cfg_if::cfg_if! {
} else if #[cfg(target_os = "vxworks")] {
#[path = "process_vxworks.rs"]
mod process_inner;
- } else if #[cfg(any(target_os = "espidf", target_os = "horizon"))] {
+ } else if #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] {
#[path = "process_unsupported.rs"]
mod process_inner;
} else {
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs
index ceaff5966..612d43fe2 100644
--- a/library/std/src/sys/unix/process/process_unix.rs
+++ b/library/std/src/sys/unix/process/process_unix.rs
@@ -735,7 +735,7 @@ impl ExitStatus {
// true on all actual versions of Unix, is widely assumed, and is specified in SuS
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
// true for a platform pretending to be Unix, the tests (our doctests, and also
- // procsss_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
+ // process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
match NonZero_c_int::try_from(self.0) {
/* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)),
/* was zero, couldn't convert */ Err(_) => Ok(()),
diff --git a/library/std/src/sys/unix/process/process_vxworks.rs b/library/std/src/sys/unix/process/process_vxworks.rs
index 569a4b149..c40e7ada0 100644
--- a/library/std/src/sys/unix/process/process_vxworks.rs
+++ b/library/std/src/sys/unix/process/process_vxworks.rs
@@ -199,7 +199,7 @@ impl ExitStatus {
// true on all actual versions of Unix, is widely assumed, and is specified in SuS
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html. If it is not
// true for a platform pretending to be Unix, the tests (our doctests, and also
- // procsss_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
+ // process_unix/tests.rs) will spot it. `ExitStatusError::code` assumes this too.
match NonZero_c_int::try_from(self.0) {
Ok(failure) => Err(ExitStatusError(failure)),
Err(_) => Ok(()),
diff --git a/library/std/src/sys/unix/rand.rs b/library/std/src/sys/unix/rand.rs
index 0f347ffab..d8b63546b 100644
--- a/library/std/src/sys/unix/rand.rs
+++ b/library/std/src/sys/unix/rand.rs
@@ -21,7 +21,8 @@ pub fn hashmap_random_keys() -> (u64, u64) {
not(target_os = "fuchsia"),
not(target_os = "redox"),
not(target_os = "vxworks"),
- not(target_os = "emscripten")
+ not(target_os = "emscripten"),
+ not(target_os = "vita"),
))]
mod imp {
use crate::fs::File;
@@ -175,7 +176,7 @@ mod imp {
}
}
-#[cfg(any(target_os = "openbsd", target_os = "emscripten"))]
+#[cfg(any(target_os = "openbsd", target_os = "emscripten", target_os = "vita"))]
mod imp {
use crate::sys::os::errno;
diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs
index 15070b1f6..7307d9b2c 100644
--- a/library/std/src/sys/unix/thread.rs
+++ b/library/std/src/sys/unix/thread.rs
@@ -326,6 +326,25 @@ pub fn available_parallelism() -> io::Result<NonZeroUsize> {
} else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd"))] {
use crate::ptr;
+ #[cfg(target_os = "freebsd")]
+ {
+ let mut set: libc::cpuset_t = unsafe { mem::zeroed() };
+ unsafe {
+ if libc::cpuset_getaffinity(
+ libc::CPU_LEVEL_WHICH,
+ libc::CPU_WHICH_PID,
+ -1,
+ mem::size_of::<libc::cpuset_t>(),
+ &mut set,
+ ) == 0 {
+ let count = libc::CPU_COUNT(&set) as usize;
+ if count > 0 {
+ return Ok(NonZeroUsize::new_unchecked(count));
+ }
+ }
+ }
+ }
+
let mut cpus: libc::c_uint = 0;
let mut cpus_size = crate::mem::size_of_val(&cpus);
diff --git a/library/std/src/sys/unix/time.rs b/library/std/src/sys/unix/time.rs
index 6f5358340..a9fbc7ab1 100644
--- a/library/std/src/sys/unix/time.rs
+++ b/library/std/src/sys/unix/time.rs
@@ -113,11 +113,7 @@ impl Timespec {
}
pub fn checked_add_duration(&self, other: &Duration) -> Option<Timespec> {
- let mut secs = other
- .as_secs()
- .try_into() // <- target type would be `i64`
- .ok()
- .and_then(|secs| self.tv_sec.checked_add(secs))?;
+ let mut secs = self.tv_sec.checked_add_unsigned(other.as_secs())?;
// Nano calculations can't overflow because nanos are <1B which fit
// in a u32.
@@ -126,15 +122,11 @@ impl Timespec {
nsec -= NSEC_PER_SEC as u32;
secs = secs.checked_add(1)?;
}
- Some(Timespec::new(secs, nsec as i64))
+ Some(Timespec::new(secs, nsec.into()))
}
pub fn checked_sub_duration(&self, other: &Duration) -> Option<Timespec> {
- let mut secs = other
- .as_secs()
- .try_into() // <- target type would be `i64`
- .ok()
- .and_then(|secs| self.tv_sec.checked_sub(secs))?;
+ let mut secs = self.tv_sec.checked_sub_unsigned(other.as_secs())?;
// Similar to above, nanos can't overflow.
let mut nsec = self.tv_nsec.0 as i32 - other.subsec_nanos() as i32;
@@ -142,7 +134,7 @@ impl Timespec {
nsec += NSEC_PER_SEC as i32;
secs = secs.checked_sub(1)?;
}
- Some(Timespec::new(secs, nsec as i64))
+ Some(Timespec::new(secs, nsec.into()))
}
#[allow(dead_code)]
@@ -166,6 +158,16 @@ impl Timespec {
}
self.to_timespec()
}
+
+ #[cfg(all(
+ target_os = "linux",
+ target_env = "gnu",
+ target_pointer_width = "32",
+ not(target_arch = "riscv32")
+ ))]
+ pub fn to_timespec64(&self) -> __timespec64 {
+ __timespec64::new(self.tv_sec, self.tv_nsec.0 as _)
+ }
}
impl From<libc::timespec> for Timespec {
@@ -196,6 +198,18 @@ pub(in crate::sys::unix) struct __timespec64 {
target_pointer_width = "32",
not(target_arch = "riscv32")
))]
+impl __timespec64 {
+ pub(in crate::sys::unix) fn new(tv_sec: i64, tv_nsec: i32) -> Self {
+ Self { tv_sec, tv_nsec, _padding: 0 }
+ }
+}
+
+#[cfg(all(
+ target_os = "linux",
+ target_env = "gnu",
+ target_pointer_width = "32",
+ not(target_arch = "riscv32")
+))]
impl From<__timespec64> for Timespec {
fn from(t: __timespec64) -> Timespec {
Timespec::new(t.tv_sec, t.tv_nsec.into())
diff --git a/library/std/src/sys/unsupported/io.rs b/library/std/src/sys/unsupported/io.rs
index 82610ffab..6372fca74 100644
--- a/library/std/src/sys/unsupported/io.rs
+++ b/library/std/src/sys/unsupported/io.rs
@@ -30,7 +30,7 @@ impl<'a> IoSliceMut<'a> {
#[inline]
pub fn advance(&mut self, n: usize) {
- let slice = mem::replace(&mut self.0, &mut []);
+ let slice = mem::take(&mut self.0);
let (_, remaining) = slice.split_at_mut(n);
self.0 = remaining;
}
diff --git a/library/std/src/sys/unsupported/mod.rs b/library/std/src/sys/unsupported/mod.rs
index 15b22c620..e1a38de64 100644
--- a/library/std/src/sys/unsupported/mod.rs
+++ b/library/std/src/sys/unsupported/mod.rs
@@ -22,6 +22,7 @@ pub mod thread;
#[cfg(target_thread_local)]
pub mod thread_local_dtor;
pub mod thread_local_key;
+pub mod thread_parking;
pub mod time;
mod common;
diff --git a/library/std/src/sys/unsupported/thread_parking.rs b/library/std/src/sys/unsupported/thread_parking.rs
new file mode 100644
index 000000000..197078bb1
--- /dev/null
+++ b/library/std/src/sys/unsupported/thread_parking.rs
@@ -0,0 +1,11 @@
+use crate::pin::Pin;
+use crate::time::Duration;
+
+pub struct Parker {}
+
+impl Parker {
+ pub unsafe fn new_in_place(_parker: *mut Parker) {}
+ pub unsafe fn park(self: Pin<&Self>) {}
+ pub unsafe fn park_timeout(self: Pin<&Self>, _dur: Duration) {}
+ pub fn unpark(self: Pin<&Self>) {}
+}
diff --git a/library/std/src/sys/wasi/fd.rs b/library/std/src/sys/wasi/fd.rs
index 191db4b60..9a8b2a0be 100644
--- a/library/std/src/sys/wasi/fd.rs
+++ b/library/std/src/sys/wasi/fd.rs
@@ -275,12 +275,14 @@ impl WasiFd {
}
impl AsInner<OwnedFd> for WasiFd {
+ #[inline]
fn as_inner(&self) -> &OwnedFd {
&self.fd
}
}
impl AsInnerMut<OwnedFd> for WasiFd {
+ #[inline]
fn as_inner_mut(&mut self) -> &mut OwnedFd {
&mut self.fd
}
@@ -305,6 +307,7 @@ impl AsFd for WasiFd {
}
impl AsRawFd for WasiFd {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.fd.as_raw_fd()
}
diff --git a/library/std/src/sys/wasi/fs.rs b/library/std/src/sys/wasi/fs.rs
index 3a205267e..8d1dbf591 100644
--- a/library/std/src/sys/wasi/fs.rs
+++ b/library/std/src/sys/wasi/fs.rs
@@ -498,6 +498,7 @@ impl File {
}
impl AsInner<WasiFd> for File {
+ #[inline]
fn as_inner(&self) -> &WasiFd {
&self.fd
}
@@ -522,6 +523,7 @@ impl AsFd for File {
}
impl AsRawFd for File {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.fd.as_raw_fd()
}
diff --git a/library/std/src/sys/wasi/mod.rs b/library/std/src/sys/wasi/mod.rs
index 1dc3f2b20..a22237080 100644
--- a/library/std/src/sys/wasi/mod.rs
+++ b/library/std/src/sys/wasi/mod.rs
@@ -32,8 +32,6 @@ pub mod io;
#[path = "../unsupported/locks/mod.rs"]
pub mod locks;
pub mod net;
-#[path = "../unsupported/once.rs"]
-pub mod once;
pub mod os;
#[path = "../unix/os_str.rs"]
pub mod os_str;
@@ -49,8 +47,17 @@ pub mod thread;
pub mod thread_local_dtor;
#[path = "../unsupported/thread_local_key.rs"]
pub mod thread_local_key;
+#[path = "../unsupported/thread_parking.rs"]
+pub mod thread_parking;
pub mod time;
+cfg_if::cfg_if! {
+ if #[cfg(not(target_feature = "atomics"))] {
+ #[path = "../unsupported/once.rs"]
+ pub mod once;
+ }
+}
+
#[path = "../unsupported/common.rs"]
#[deny(unsafe_op_in_unsafe_fn)]
#[allow(unused)]
diff --git a/library/std/src/sys/wasi/net.rs b/library/std/src/sys/wasi/net.rs
index 59d94a368..2239880ff 100644
--- a/library/std/src/sys/wasi/net.rs
+++ b/library/std/src/sys/wasi/net.rs
@@ -17,6 +17,7 @@ pub struct TcpStream {
}
impl AsInner<WasiFd> for Socket {
+ #[inline]
fn as_inner(&self) -> &WasiFd {
&self.0
}
@@ -41,6 +42,7 @@ impl AsFd for Socket {
}
impl AsRawFd for Socket {
+ #[inline]
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
@@ -184,6 +186,7 @@ impl TcpStream {
}
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
@@ -274,6 +277,7 @@ impl TcpListener {
}
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
@@ -284,6 +288,7 @@ impl TcpListener {
}
impl AsInner<Socket> for TcpListener {
+ #[inline]
fn as_inner(&self) -> &Socket {
&self.inner
}
@@ -436,6 +441,7 @@ impl UdpSocket {
unsupported()
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
@@ -446,6 +452,7 @@ impl UdpSocket {
}
impl AsInner<Socket> for UdpSocket {
+ #[inline]
fn as_inner(&self) -> &Socket {
&self.inner
}
diff --git a/library/std/src/sys/wasm/mod.rs b/library/std/src/sys/wasm/mod.rs
index 77ebe3c4a..6c05b56e1 100644
--- a/library/std/src/sys/wasm/mod.rs
+++ b/library/std/src/sys/wasm/mod.rs
@@ -70,6 +70,8 @@ cfg_if::cfg_if! {
pub mod once;
#[path = "../unsupported/thread.rs"]
pub mod thread;
+ #[path = "../unsupported/thread_parking.rs"]
+ pub mod thread_parking;
}
}
diff --git a/library/std/src/sys/windows/args.rs b/library/std/src/sys/windows/args.rs
index 43c0cdb65..5bfd8b52e 100644
--- a/library/std/src/sys/windows/args.rs
+++ b/library/std/src/sys/windows/args.rs
@@ -313,6 +313,9 @@ pub(crate) fn make_bat_command_line(
///
/// This is necessary because cmd.exe does not support verbatim paths.
pub(crate) fn to_user_path(path: &Path) -> io::Result<Vec<u16>> {
+ from_wide_to_user_path(to_u16s(path)?)
+}
+pub(crate) fn from_wide_to_user_path(mut path: Vec<u16>) -> io::Result<Vec<u16>> {
use crate::ptr;
use crate::sys::windows::fill_utf16_buf;
@@ -325,8 +328,6 @@ pub(crate) fn to_user_path(path: &Path) -> io::Result<Vec<u16>> {
const N: u16 = b'N' as _;
const C: u16 = b'C' as _;
- let mut path = to_u16s(path)?;
-
// Early return if the path is too long to remove the verbatim prefix.
const LEGACY_MAX_PATH: usize = 260;
if path.len() > LEGACY_MAX_PATH {
diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs
index 1f4092ad7..2bc40c474 100644
--- a/library/std/src/sys/windows/c.rs
+++ b/library/std/src/sys/windows/c.rs
@@ -6,33 +6,18 @@
use crate::ffi::CStr;
use crate::mem;
-use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort};
-use crate::os::windows::io::{BorrowedHandle, HandleOrInvalid, HandleOrNull};
+pub use crate::os::raw::c_int;
+use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void};
+use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
use crate::ptr;
use core::ffi::NonZero_c_ulong;
-use libc::{c_void, size_t, wchar_t};
-
-pub use crate::os::raw::c_int;
-
-#[path = "c/errors.rs"] // c.rs is included from two places so we need to specify this
-mod errors;
-pub use errors::*;
+#[path = "c/windows_sys.rs"] // c.rs is included from two places so we need to specify this
+mod windows_sys;
+pub use windows_sys::*;
-pub use self::EXCEPTION_DISPOSITION::*;
-pub use self::FILE_INFO_BY_HANDLE_CLASS::*;
-
-pub type DWORD_PTR = ULONG_PTR;
pub type DWORD = c_ulong;
pub type NonZeroDWORD = NonZero_c_ulong;
-pub type HANDLE = LPVOID;
-pub type HINSTANCE = HANDLE;
-pub type HMODULE = HINSTANCE;
-pub type HRESULT = LONG;
-pub type BOOL = c_int;
-pub type BYTE = u8;
-pub type BOOLEAN = BYTE;
-pub type GROUP = c_uint;
pub type LARGE_INTEGER = c_longlong;
pub type LONG = c_long;
pub type UINT = c_uint;
@@ -41,218 +26,40 @@ pub type USHORT = c_ushort;
pub type SIZE_T = usize;
pub type WORD = u16;
pub type CHAR = c_char;
-pub type CCHAR = c_char;
-pub type ULONG_PTR = usize;
pub type ULONG = c_ulong;
-pub type NTSTATUS = LONG;
pub type ACCESS_MASK = DWORD;
-pub type LPBOOL = *mut BOOL;
-pub type LPBYTE = *mut BYTE;
-pub type LPCCH = *const CHAR;
-pub type LPCSTR = *const CHAR;
-pub type LPCWCH = *const WCHAR;
-pub type LPCWSTR = *const WCHAR;
pub type LPCVOID = *const c_void;
-pub type LPDWORD = *mut DWORD;
pub type LPHANDLE = *mut HANDLE;
pub type LPOVERLAPPED = *mut OVERLAPPED;
-pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
-pub type LPSTARTUPINFO = *mut STARTUPINFO;
-pub type LPSTR = *mut CHAR;
pub type LPVOID = *mut c_void;
pub type LPWCH = *mut WCHAR;
-pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
-pub type LPWSADATA = *mut WSADATA;
-pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
pub type LPWSTR = *mut WCHAR;
-pub type LPFILETIME = *mut FILETIME;
-pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
-pub type LPWSABUF = *mut WSABUF;
-pub type LPWSAOVERLAPPED = *mut c_void;
-pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = *mut c_void;
-pub type BCRYPT_ALG_HANDLE = LPVOID;
-pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE;
pub type PLARGE_INTEGER = *mut c_longlong;
pub type PSRWLOCK = *mut SRWLOCK;
-pub type LPINIT_ONCE = *mut INIT_ONCE;
-pub type SOCKET = crate::os::windows::raw::SOCKET;
pub type socklen_t = c_int;
pub type ADDRESS_FAMILY = USHORT;
+pub use FD_SET as fd_set;
+pub use LINGER as linger;
+pub use TIMEVAL as timeval;
-pub const TRUE: BOOL = 1;
-pub const FALSE: BOOL = 0;
-
-pub const CSTR_LESS_THAN: c_int = 1;
-pub const CSTR_EQUAL: c_int = 2;
-pub const CSTR_GREATER_THAN: c_int = 3;
-
-pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
-pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
-pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
-pub const INVALID_FILE_ATTRIBUTES: DWORD = DWORD::MAX;
-
-pub const FILE_SHARE_DELETE: DWORD = 0x4;
-pub const FILE_SHARE_READ: DWORD = 0x1;
-pub const FILE_SHARE_WRITE: DWORD = 0x2;
+pub type CONDITION_VARIABLE = RTL_CONDITION_VARIABLE;
+pub type SRWLOCK = RTL_SRWLOCK;
+pub type INIT_ONCE = RTL_RUN_ONCE;
-pub const FILE_OPEN: ULONG = 0x00000001;
-pub const FILE_OPEN_REPARSE_POINT: ULONG = 0x200000;
-pub const OBJ_DONT_REPARSE: ULONG = 0x1000;
+pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr: ptr::null_mut() };
+pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { Ptr: ptr::null_mut() };
+pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { Ptr: ptr::null_mut() };
-pub const CREATE_ALWAYS: DWORD = 2;
-pub const CREATE_NEW: DWORD = 1;
-pub const OPEN_ALWAYS: DWORD = 4;
-pub const OPEN_EXISTING: DWORD = 3;
-pub const TRUNCATE_EXISTING: DWORD = 5;
-
-pub const FILE_LIST_DIRECTORY: DWORD = 0x1;
-pub const FILE_WRITE_DATA: DWORD = 0x00000002;
-pub const FILE_APPEND_DATA: DWORD = 0x00000004;
-pub const FILE_WRITE_EA: DWORD = 0x00000010;
-pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
-pub const DELETE: DWORD = 0x10000;
-pub const READ_CONTROL: DWORD = 0x00020000;
-pub const SYNCHRONIZE: DWORD = 0x00100000;
-pub const GENERIC_READ: DWORD = 0x80000000;
-pub const GENERIC_WRITE: DWORD = 0x40000000;
-pub const STANDARD_RIGHTS_WRITE: DWORD = READ_CONTROL;
-pub const FILE_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE
- | FILE_WRITE_DATA
- | FILE_WRITE_ATTRIBUTES
- | FILE_WRITE_EA
- | FILE_APPEND_DATA
- | SYNCHRONIZE;
-
-pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
-pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
-pub const SECURITY_SQOS_PRESENT: DWORD = 0x00100000;
-
-pub const FIONBIO: c_ulong = 0x8004667e;
-
-pub const MAX_PATH: usize = 260;
-
-pub const FILE_TYPE_PIPE: u32 = 3;
-
-pub const CP_UTF8: DWORD = 65001;
-pub const MB_ERR_INVALID_CHARS: DWORD = 0x08;
-pub const WC_ERR_INVALID_CHARS: DWORD = 0x80;
-
-#[repr(C)]
-#[derive(Copy)]
-pub struct WIN32_FIND_DATAW {
- pub dwFileAttributes: DWORD,
- pub ftCreationTime: FILETIME,
- pub ftLastAccessTime: FILETIME,
- pub ftLastWriteTime: FILETIME,
- pub nFileSizeHigh: DWORD,
- pub nFileSizeLow: DWORD,
- pub dwReserved0: DWORD,
- pub dwReserved1: DWORD,
- pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
- pub cAlternateFileName: [wchar_t; 14],
-}
-impl Clone for WIN32_FIND_DATAW {
- fn clone(&self) -> Self {
- *self
- }
-}
-
-pub const WSA_FLAG_OVERLAPPED: DWORD = 0x01;
-pub const WSA_FLAG_NO_HANDLE_INHERIT: DWORD = 0x80;
-
-pub const WSADESCRIPTION_LEN: usize = 256;
-pub const WSASYS_STATUS_LEN: usize = 128;
-pub const WSAPROTOCOL_LEN: DWORD = 255;
-pub const INVALID_SOCKET: SOCKET = !0;
-
-pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
-
-pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: usize = 16 * 1024;
-pub const FSCTL_GET_REPARSE_POINT: DWORD = 0x900a8;
-pub const IO_REPARSE_TAG_SYMLINK: DWORD = 0xa000000c;
-pub const IO_REPARSE_TAG_MOUNT_POINT: DWORD = 0xa0000003;
-pub const SYMLINK_FLAG_RELATIVE: DWORD = 0x00000001;
-pub const FSCTL_SET_REPARSE_POINT: DWORD = 0x900a4;
-
-pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 0x1;
-pub const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: DWORD = 0x2;
-
-// Note that these are not actually HANDLEs, just values to pass to GetStdHandle
-pub const STD_INPUT_HANDLE: DWORD = -10i32 as DWORD;
-pub const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
-pub const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
-
-pub const PROGRESS_CONTINUE: DWORD = 0;
-
-pub const E_NOTIMPL: HRESULT = 0x80004001u32 as HRESULT;
-
-pub const INVALID_HANDLE_VALUE: HANDLE = ptr::invalid_mut(!0);
-
-pub const FACILITY_NT_BIT: DWORD = 0x1000_0000;
-
-pub const FORMAT_MESSAGE_FROM_SYSTEM: DWORD = 0x00001000;
-pub const FORMAT_MESSAGE_FROM_HMODULE: DWORD = 0x00000800;
-pub const FORMAT_MESSAGE_IGNORE_INSERTS: DWORD = 0x00000200;
-
-pub const TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF;
-
-pub const DLL_THREAD_DETACH: DWORD = 3;
-pub const DLL_PROCESS_DETACH: DWORD = 0;
-
-pub const INFINITE: DWORD = !0;
-
-pub const DUPLICATE_SAME_ACCESS: DWORD = 0x00000002;
-
-pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { ptr: ptr::null_mut() };
-pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { ptr: ptr::null_mut() };
-pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { ptr: ptr::null_mut() };
-
-pub const INIT_ONCE_INIT_FAILED: DWORD = 0x00000004;
-
-pub const DETACHED_PROCESS: DWORD = 0x00000008;
-pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
-pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
-pub const STARTF_USESTDHANDLES: DWORD = 0x00000100;
-
-pub const AF_INET: c_int = 2;
-pub const AF_INET6: c_int = 23;
-pub const SD_BOTH: c_int = 2;
-pub const SD_RECEIVE: c_int = 0;
-pub const SD_SEND: c_int = 1;
-pub const SOCK_DGRAM: c_int = 2;
-pub const SOCK_STREAM: c_int = 1;
-pub const SOCKET_ERROR: c_int = -1;
-pub const SOL_SOCKET: c_int = 0xffff;
-pub const SO_LINGER: c_int = 0x0080;
-pub const SO_RCVTIMEO: c_int = 0x1006;
-pub const SO_SNDTIMEO: c_int = 0x1005;
-pub const IPPROTO_IP: c_int = 0;
-pub const IPPROTO_TCP: c_int = 6;
-pub const IPPROTO_IPV6: c_int = 41;
-pub const TCP_NODELAY: c_int = 0x0001;
-pub const IP_TTL: c_int = 4;
-pub const IPV6_V6ONLY: c_int = 27;
-pub const SO_ERROR: c_int = 0x1007;
-pub const SO_BROADCAST: c_int = 0x0020;
-pub const IP_MULTICAST_LOOP: c_int = 11;
-pub const IPV6_MULTICAST_LOOP: c_int = 11;
-pub const IP_MULTICAST_TTL: c_int = 10;
-pub const IP_ADD_MEMBERSHIP: c_int = 12;
-pub const IP_DROP_MEMBERSHIP: c_int = 13;
-pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
-pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
-pub const MSG_PEEK: c_int = 0x2;
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub struct linger {
- pub l_onoff: c_ushort,
- pub l_linger: c_ushort,
-}
+// Some windows_sys types have different signs than the types we use.
+pub const OBJ_DONT_REPARSE: u32 = windows_sys::OBJ_DONT_REPARSE as u32;
+pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: u32 =
+ windows_sys::FRS_ERR_SYSVOL_POPULATE_TIMEOUT as u32;
+pub const AF_INET: c_int = windows_sys::AF_INET as c_int;
+pub const AF_INET6: c_int = windows_sys::AF_INET6 as c_int;
#[repr(C)]
pub struct ip_mreq {
@@ -266,66 +73,19 @@ pub struct ipv6_mreq {
pub ipv6mr_interface: c_uint,
}
-pub const VOLUME_NAME_DOS: DWORD = 0x0;
-pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
-
-pub const FILE_BEGIN: DWORD = 0;
-pub const FILE_CURRENT: DWORD = 1;
-pub const FILE_END: DWORD = 2;
-
-pub const WAIT_OBJECT_0: DWORD = 0x00000000;
-pub const WAIT_TIMEOUT: DWORD = 258;
-pub const WAIT_FAILED: DWORD = 0xFFFFFFFF;
-
-pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
-pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
-pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
-pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
-pub const PIPE_WAIT: DWORD = 0x00000000;
-pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
-pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
-pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
-
-pub const FD_SETSIZE: usize = 64;
-
-pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000;
-
-pub const STATUS_SUCCESS: NTSTATUS = 0x00000000;
-pub const STATUS_DELETE_PENDING: NTSTATUS = 0xc0000056_u32 as _;
-pub const STATUS_INVALID_PARAMETER: NTSTATUS = 0xc000000d_u32 as _;
-
-pub const STATUS_PENDING: NTSTATUS = 0x103 as _;
-pub const STATUS_END_OF_FILE: NTSTATUS = 0xC0000011_u32 as _;
-
// Equivalent to the `NT_SUCCESS` C preprocessor macro.
// See: https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values
pub fn nt_success(status: NTSTATUS) -> bool {
status >= 0
}
-pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: DWORD = 0x00000002;
-
-#[repr(C)]
-pub struct UNICODE_STRING {
- pub Length: u16,
- pub MaximumLength: u16,
- pub Buffer: *mut u16,
-}
impl UNICODE_STRING {
pub fn from_ref(slice: &[u16]) -> Self {
let len = slice.len() * mem::size_of::<u16>();
Self { Length: len as _, MaximumLength: len as _, Buffer: slice.as_ptr() as _ }
}
}
-#[repr(C)]
-pub struct OBJECT_ATTRIBUTES {
- pub Length: ULONG,
- pub RootDirectory: HANDLE,
- pub ObjectName: *const UNICODE_STRING,
- pub Attributes: ULONG,
- pub SecurityDescriptor: *mut c_void,
- pub SecurityQualityOfService: *mut c_void,
-}
+
impl Default for OBJECT_ATTRIBUTES {
fn default() -> Self {
Self {
@@ -338,193 +98,20 @@ impl Default for OBJECT_ATTRIBUTES {
}
}
}
-#[repr(C)]
-union IO_STATUS_BLOCK_union {
- Status: NTSTATUS,
- Pointer: *mut c_void,
-}
-impl Default for IO_STATUS_BLOCK_union {
- fn default() -> Self {
- let mut this = Self { Pointer: ptr::null_mut() };
- this.Status = STATUS_PENDING;
- this
- }
-}
-#[repr(C)]
-#[derive(Default)]
-pub struct IO_STATUS_BLOCK {
- u: IO_STATUS_BLOCK_union,
- pub Information: usize,
-}
+
impl IO_STATUS_BLOCK {
+ pub const PENDING: Self =
+ IO_STATUS_BLOCK { Anonymous: IO_STATUS_BLOCK_0 { Status: STATUS_PENDING }, Information: 0 };
pub fn status(&self) -> NTSTATUS {
- // SAFETY: If `self.u.Status` was set then this is obviously safe.
- // If `self.u.Pointer` was set then this is the equivalent to converting
+ // SAFETY: If `self.Anonymous.Status` was set then this is obviously safe.
+ // If `self.Anonymous.Pointer` was set then this is the equivalent to converting
// the pointer to an integer, which is also safe.
// Currently the only safe way to construct `IO_STATUS_BLOCK` outside of
// this module is to call the `default` method, which sets the `Status`.
- unsafe { self.u.Status }
+ unsafe { self.Anonymous.Status }
}
}
-pub type LPOVERLAPPED_COMPLETION_ROUTINE = unsafe extern "system" fn(
- dwErrorCode: DWORD,
- dwNumberOfBytesTransferred: DWORD,
- lpOverlapped: *mut OVERLAPPED,
-);
-
-type IO_APC_ROUTINE = unsafe extern "system" fn(
- ApcContext: *mut c_void,
- IoStatusBlock: *mut IO_STATUS_BLOCK,
- Reserved: ULONG,
-);
-
-#[repr(C)]
-#[cfg(not(target_pointer_width = "64"))]
-pub struct WSADATA {
- pub wVersion: WORD,
- pub wHighVersion: WORD,
- pub szDescription: [u8; WSADESCRIPTION_LEN + 1],
- pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1],
- pub iMaxSockets: u16,
- pub iMaxUdpDg: u16,
- pub lpVendorInfo: *mut u8,
-}
-#[repr(C)]
-#[cfg(target_pointer_width = "64")]
-pub struct WSADATA {
- pub wVersion: WORD,
- pub wHighVersion: WORD,
- pub iMaxSockets: u16,
- pub iMaxUdpDg: u16,
- pub lpVendorInfo: *mut u8,
- pub szDescription: [u8; WSADESCRIPTION_LEN + 1],
- pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1],
-}
-
-#[derive(Copy, Clone)]
-#[repr(C)]
-pub struct WSABUF {
- pub len: ULONG,
- pub buf: *mut CHAR,
-}
-
-#[repr(C)]
-pub struct WSAPROTOCOL_INFO {
- pub dwServiceFlags1: DWORD,
- pub dwServiceFlags2: DWORD,
- pub dwServiceFlags3: DWORD,
- pub dwServiceFlags4: DWORD,
- pub dwProviderFlags: DWORD,
- pub ProviderId: GUID,
- pub dwCatalogEntryId: DWORD,
- pub ProtocolChain: WSAPROTOCOLCHAIN,
- pub iVersion: c_int,
- pub iAddressFamily: c_int,
- pub iMaxSockAddr: c_int,
- pub iMinSockAddr: c_int,
- pub iSocketType: c_int,
- pub iProtocol: c_int,
- pub iProtocolMaxOffset: c_int,
- pub iNetworkByteOrder: c_int,
- pub iSecurityScheme: c_int,
- pub dwMessageSize: DWORD,
- pub dwProviderReserved: DWORD,
- pub szProtocol: [u16; (WSAPROTOCOL_LEN as usize) + 1],
-}
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub struct WIN32_FILE_ATTRIBUTE_DATA {
- pub dwFileAttributes: DWORD,
- pub ftCreationTime: FILETIME,
- pub ftLastAccessTime: FILETIME,
- pub ftLastWriteTime: FILETIME,
- pub nFileSizeHigh: DWORD,
- pub nFileSizeLow: DWORD,
-}
-
-#[repr(C)]
-#[allow(dead_code)] // we only use some variants
-pub enum FILE_INFO_BY_HANDLE_CLASS {
- FileBasicInfo = 0,
- FileStandardInfo = 1,
- FileNameInfo = 2,
- FileRenameInfo = 3,
- FileDispositionInfo = 4,
- FileAllocationInfo = 5,
- FileEndOfFileInfo = 6,
- FileStreamInfo = 7,
- FileCompressionInfo = 8,
- FileAttributeTagInfo = 9,
- FileIdBothDirectoryInfo = 10, // 0xA
- FileIdBothDirectoryRestartInfo = 11, // 0xB
- FileIoPriorityHintInfo = 12, // 0xC
- FileRemoteProtocolInfo = 13, // 0xD
- FileFullDirectoryInfo = 14, // 0xE
- FileFullDirectoryRestartInfo = 15, // 0xF
- FileStorageInfo = 16, // 0x10
- FileAlignmentInfo = 17, // 0x11
- FileIdInfo = 18, // 0x12
- FileIdExtdDirectoryInfo = 19, // 0x13
- FileIdExtdDirectoryRestartInfo = 20, // 0x14
- FileDispositionInfoEx = 21, // 0x15, Windows 10 version 1607
- MaximumFileInfoByHandlesClass,
-}
-
-#[repr(C)]
-pub struct FILE_ATTRIBUTE_TAG_INFO {
- pub FileAttributes: DWORD,
- pub ReparseTag: DWORD,
-}
-
-#[repr(C)]
-pub struct FILE_DISPOSITION_INFO {
- pub DeleteFile: BOOLEAN,
-}
-
-pub const FILE_DISPOSITION_DELETE: DWORD = 0x1;
-pub const FILE_DISPOSITION_POSIX_SEMANTICS: DWORD = 0x2;
-pub const FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE: DWORD = 0x10;
-
-#[repr(C)]
-pub struct FILE_DISPOSITION_INFO_EX {
- pub Flags: DWORD,
-}
-
-#[repr(C)]
-#[derive(Default)]
-pub struct FILE_ID_BOTH_DIR_INFO {
- pub NextEntryOffset: DWORD,
- pub FileIndex: DWORD,
- pub CreationTime: LARGE_INTEGER,
- pub LastAccessTime: LARGE_INTEGER,
- pub LastWriteTime: LARGE_INTEGER,
- pub ChangeTime: LARGE_INTEGER,
- pub EndOfFile: LARGE_INTEGER,
- pub AllocationSize: LARGE_INTEGER,
- pub FileAttributes: DWORD,
- pub FileNameLength: DWORD,
- pub EaSize: DWORD,
- pub ShortNameLength: CCHAR,
- pub ShortName: [WCHAR; 12],
- pub FileId: LARGE_INTEGER,
- pub FileName: [WCHAR; 1],
-}
-#[repr(C)]
-pub struct FILE_BASIC_INFO {
- pub CreationTime: LARGE_INTEGER,
- pub LastAccessTime: LARGE_INTEGER,
- pub LastWriteTime: LARGE_INTEGER,
- pub ChangeTime: LARGE_INTEGER,
- pub FileAttributes: DWORD,
-}
-
-#[repr(C)]
-pub struct FILE_END_OF_FILE_INFO {
- pub EndOfFile: LARGE_INTEGER,
-}
-
/// NB: Use carefully! In general using this as a reference is likely to get the
/// provenance wrong for the `rest` field!
#[repr(C)]
@@ -555,34 +142,6 @@ pub struct MOUNT_POINT_REPARSE_BUFFER {
pub PrintNameLength: c_ushort,
pub PathBuffer: WCHAR,
}
-
-pub type LPPROGRESS_ROUTINE = crate::option::Option<
- unsafe extern "system" fn(
- TotalFileSize: LARGE_INTEGER,
- TotalBytesTransferred: LARGE_INTEGER,
- StreamSize: LARGE_INTEGER,
- StreamBytesTransferred: LARGE_INTEGER,
- dwStreamNumber: DWORD,
- dwCallbackReason: DWORD,
- hSourceFile: HANDLE,
- hDestinationFile: HANDLE,
- lpData: LPVOID,
- ) -> DWORD,
->;
-
-#[repr(C)]
-pub struct CONDITION_VARIABLE {
- pub ptr: LPVOID,
-}
-#[repr(C)]
-pub struct SRWLOCK {
- pub ptr: LPVOID,
-}
-#[repr(C)]
-pub struct INIT_ONCE {
- pub ptr: LPVOID,
-}
-
#[repr(C)]
pub struct REPARSE_MOUNTPOINT_DATA_BUFFER {
pub ReparseTag: DWORD,
@@ -595,103 +154,6 @@ pub struct REPARSE_MOUNTPOINT_DATA_BUFFER {
}
#[repr(C)]
-pub struct GUID {
- pub Data1: DWORD,
- pub Data2: WORD,
- pub Data3: WORD,
- pub Data4: [BYTE; 8],
-}
-
-#[repr(C)]
-pub struct WSAPROTOCOLCHAIN {
- pub ChainLen: c_int,
- pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as usize],
-}
-
-#[repr(C)]
-pub struct SECURITY_ATTRIBUTES {
- pub nLength: DWORD,
- pub lpSecurityDescriptor: LPVOID,
- pub bInheritHandle: BOOL,
-}
-
-#[repr(C)]
-pub struct PROCESS_INFORMATION {
- pub hProcess: HANDLE,
- pub hThread: HANDLE,
- pub dwProcessId: DWORD,
- pub dwThreadId: DWORD,
-}
-
-#[repr(C)]
-pub struct STARTUPINFO {
- pub cb: DWORD,
- pub lpReserved: LPWSTR,
- pub lpDesktop: LPWSTR,
- pub lpTitle: LPWSTR,
- pub dwX: DWORD,
- pub dwY: DWORD,
- pub dwXSize: DWORD,
- pub dwYSize: DWORD,
- pub dwXCountChars: DWORD,
- pub dwYCountCharts: DWORD,
- pub dwFillAttribute: DWORD,
- pub dwFlags: DWORD,
- pub wShowWindow: WORD,
- pub cbReserved2: WORD,
- pub lpReserved2: LPBYTE,
- pub hStdInput: HANDLE,
- pub hStdOutput: HANDLE,
- pub hStdError: HANDLE,
-}
-
-#[repr(C)]
-pub struct SOCKADDR {
- pub sa_family: ADDRESS_FAMILY,
- pub sa_data: [CHAR; 14],
-}
-
-#[repr(C)]
-#[derive(Copy, Clone, Debug, Default)]
-pub struct FILETIME {
- pub dwLowDateTime: DWORD,
- pub dwHighDateTime: DWORD,
-}
-
-#[repr(C)]
-pub struct SYSTEM_INFO {
- pub wProcessorArchitecture: WORD,
- pub wReserved: WORD,
- pub dwPageSize: DWORD,
- pub lpMinimumApplicationAddress: LPVOID,
- pub lpMaximumApplicationAddress: LPVOID,
- pub dwActiveProcessorMask: DWORD_PTR,
- pub dwNumberOfProcessors: DWORD,
- pub dwProcessorType: DWORD,
- pub dwAllocationGranularity: DWORD,
- pub wProcessorLevel: WORD,
- pub wProcessorRevision: WORD,
-}
-
-#[repr(C)]
-pub struct OVERLAPPED {
- pub Internal: *mut c_ulong,
- pub InternalHigh: *mut c_ulong,
- pub Offset: DWORD,
- pub OffsetHigh: DWORD,
- pub hEvent: HANDLE,
-}
-
-#[repr(C)]
-#[allow(dead_code)] // we only use some variants
-pub enum ADDRESS_MODE {
- AddrMode1616,
- AddrMode1632,
- AddrModeReal,
- AddrModeFlat,
-}
-
-#[repr(C)]
pub struct SOCKADDR_STORAGE_LH {
pub ss_family: ADDRESS_FAMILY,
pub __ss_pad1: [CHAR; 6],
@@ -700,18 +162,6 @@ pub struct SOCKADDR_STORAGE_LH {
}
#[repr(C)]
-pub struct ADDRINFOA {
- pub ai_flags: c_int,
- pub ai_family: c_int,
- pub ai_socktype: c_int,
- pub ai_protocol: c_int,
- pub ai_addrlen: size_t,
- pub ai_canonname: *mut c_char,
- pub ai_addr: *mut SOCKADDR,
- pub ai_next: *mut ADDRINFOA,
-}
-
-#[repr(C)]
#[derive(Copy, Clone)]
pub struct sockaddr_in {
pub sin_family: ADDRESS_FAMILY,
@@ -742,583 +192,126 @@ pub struct in6_addr {
pub s6_addr: [u8; 16],
}
-#[repr(C)]
-#[derive(Copy, Clone)]
-#[allow(dead_code)] // we only use some variants
-pub enum EXCEPTION_DISPOSITION {
- ExceptionContinueExecution,
- ExceptionContinueSearch,
- ExceptionNestedException,
- ExceptionCollidedUnwind,
-}
-
-#[repr(C)]
-#[derive(Copy)]
-pub struct fd_set {
- pub fd_count: c_uint,
- pub fd_array: [SOCKET; FD_SETSIZE],
-}
-
-impl Clone for fd_set {
- fn clone(&self) -> fd_set {
- *self
- }
-}
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub struct timeval {
- pub tv_sec: c_long,
- pub tv_usec: c_long,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub struct CONSOLE_READCONSOLE_CONTROL {
- pub nLength: ULONG,
- pub nInitialChars: ULONG,
- pub dwCtrlWakeupMask: ULONG,
- pub dwControlKeyState: ULONG,
-}
-pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL;
-
// Desktop specific functions & types
cfg_if::cfg_if! {
if #[cfg(not(target_vendor = "uwp"))] {
- pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
- pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
- pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
-
- #[repr(C)]
- pub struct EXCEPTION_RECORD {
- pub ExceptionCode: DWORD,
- pub ExceptionFlags: DWORD,
- pub ExceptionRecord: *mut EXCEPTION_RECORD,
- pub ExceptionAddress: LPVOID,
- pub NumberParameters: DWORD,
- pub ExceptionInformation: [LPVOID; EXCEPTION_MAXIMUM_PARAMETERS],
- }
-
- pub enum CONTEXT {}
-
- #[repr(C)]
- pub struct EXCEPTION_POINTERS {
- pub ExceptionRecord: *mut EXCEPTION_RECORD,
- pub ContextRecord: *mut CONTEXT,
- }
-
- pub type PVECTORED_EXCEPTION_HANDLER =
- extern "system" fn(ExceptionInfo: *mut EXCEPTION_POINTERS) -> LONG;
-
- #[repr(C)]
- pub struct BY_HANDLE_FILE_INFORMATION {
- pub dwFileAttributes: DWORD,
- pub ftCreationTime: FILETIME,
- pub ftLastAccessTime: FILETIME,
- pub ftLastWriteTime: FILETIME,
- pub dwVolumeSerialNumber: DWORD,
- pub nFileSizeHigh: DWORD,
- pub nFileSizeLow: DWORD,
- pub nNumberOfLinks: DWORD,
- pub nFileIndexHigh: DWORD,
- pub nFileIndexLow: DWORD,
- }
-
- pub type LPBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION;
-
- pub const HANDLE_FLAG_INHERIT: DWORD = 0x00000001;
-
- pub const TOKEN_READ: DWORD = 0x20008;
-
- #[link(name = "advapi32")]
- extern "system" {
- // Forbidden when targeting UWP
- #[link_name = "SystemFunction036"]
- pub fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: ULONG) -> BOOLEAN;
-
- // Allowed but unused by UWP
- pub fn OpenProcessToken(
- ProcessHandle: HANDLE,
- DesiredAccess: DWORD,
- TokenHandle: *mut HANDLE,
- ) -> BOOL;
- }
-
- #[link(name = "userenv")]
- extern "system" {
- // Allowed but unused by UWP
- pub fn GetUserProfileDirectoryW(
- hToken: HANDLE,
- lpProfileDir: LPWSTR,
- lpcchSize: *mut DWORD,
- ) -> BOOL;
- }
-
- #[link(name = "kernel32")]
- extern "system" {
- // Allowed but unused by UWP
- pub fn GetFileInformationByHandle(
- hFile: HANDLE,
- lpFileInformation: LPBY_HANDLE_FILE_INFORMATION,
- ) -> BOOL;
- pub fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) -> BOOL;
- pub fn AddVectoredExceptionHandler(
- FirstHandler: ULONG,
- VectoredHandler: PVECTORED_EXCEPTION_HANDLER,
- ) -> LPVOID;
- pub fn CreateHardLinkW(
- lpSymlinkFileName: LPCWSTR,
- lpTargetFileName: LPCWSTR,
- lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
- ) -> BOOL;
- pub fn SetThreadStackGuarantee(_size: *mut c_ulong) -> BOOL;
- pub fn GetWindowsDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT;
- }
-}
-}
-
-// UWP specific functions & types
-cfg_if::cfg_if! {
-if #[cfg(target_vendor = "uwp")] {
- #[repr(C)]
- pub struct FILE_STANDARD_INFO {
- pub AllocationSize: LARGE_INTEGER,
- pub EndOfFile: LARGE_INTEGER,
- pub NumberOfLinks: DWORD,
- pub DeletePending: BOOLEAN,
- pub Directory: BOOLEAN,
- }
-}
-}
-
-// Shared between Desktop & UWP
-
-#[link(name = "kernel32")]
-extern "system" {
- pub fn GetCurrentProcessId() -> DWORD;
-
- pub fn ReadConsoleW(
- hConsoleInput: HANDLE,
- lpBuffer: LPVOID,
- nNumberOfCharsToRead: DWORD,
- lpNumberOfCharsRead: LPDWORD,
- pInputControl: PCONSOLE_READCONSOLE_CONTROL,
- ) -> BOOL;
- pub fn WriteConsoleW(
- hConsoleOutput: HANDLE,
- lpBuffer: LPCVOID,
- nNumberOfCharsToWrite: DWORD,
- lpNumberOfCharsWritten: LPDWORD,
- lpReserved: LPVOID,
- ) -> BOOL;
- pub fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: LPDWORD) -> BOOL;
-
- pub fn GetSystemDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT;
- pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
- pub fn SetFileAttributesW(lpFileName: LPCWSTR, dwFileAttributes: DWORD) -> BOOL;
- pub fn SetFileTime(
- hFile: BorrowedHandle<'_>,
- lpCreationTime: Option<&FILETIME>,
- lpLastAccessTime: Option<&FILETIME>,
- lpLastWriteTime: Option<&FILETIME>,
- ) -> BOOL;
- pub fn SetLastError(dwErrCode: DWORD);
- pub fn GetCommandLineW() -> LPWSTR;
- pub fn GetTempPathW(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD;
- pub fn GetCurrentProcess() -> HANDLE;
- pub fn GetCurrentThread() -> HANDLE;
- pub fn GetStdHandle(which: DWORD) -> HANDLE;
- pub fn ExitProcess(uExitCode: c_uint) -> !;
- pub fn DeviceIoControl(
- hDevice: HANDLE,
- dwIoControlCode: DWORD,
- lpInBuffer: LPVOID,
- nInBufferSize: DWORD,
- lpOutBuffer: LPVOID,
- nOutBufferSize: DWORD,
- lpBytesReturned: LPDWORD,
- lpOverlapped: LPOVERLAPPED,
- ) -> BOOL;
- pub fn CreateThread(
- lpThreadAttributes: LPSECURITY_ATTRIBUTES,
- dwStackSize: SIZE_T,
- lpStartAddress: extern "system" fn(*mut c_void) -> DWORD,
- lpParameter: LPVOID,
- dwCreationFlags: DWORD,
- lpThreadId: LPDWORD,
- ) -> HandleOrNull;
- pub fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD;
- pub fn SwitchToThread() -> BOOL;
- pub fn Sleep(dwMilliseconds: DWORD);
- pub fn SleepEx(dwMilliseconds: DWORD, bAlertable: BOOL) -> DWORD;
- pub fn GetProcessId(handle: HANDLE) -> DWORD;
- pub fn CopyFileExW(
- lpExistingFileName: LPCWSTR,
- lpNewFileName: LPCWSTR,
- lpProgressRoutine: LPPROGRESS_ROUTINE,
- lpData: LPVOID,
- pbCancel: LPBOOL,
- dwCopyFlags: DWORD,
- ) -> BOOL;
- pub fn FormatMessageW(
- flags: DWORD,
- lpSrc: LPVOID,
- msgId: DWORD,
- langId: DWORD,
- buf: LPWSTR,
- nsize: DWORD,
- args: *const c_void,
- ) -> DWORD;
- pub fn TlsAlloc() -> DWORD;
- pub fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID;
- pub fn TlsSetValue(dwTlsIndex: DWORD, lpTlsvalue: LPVOID) -> BOOL;
- pub fn TlsFree(dwTlsIndex: DWORD) -> BOOL;
- pub fn GetLastError() -> DWORD;
- pub fn QueryPerformanceFrequency(lpFrequency: *mut LARGE_INTEGER) -> BOOL;
- pub fn QueryPerformanceCounter(lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
- pub fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: LPDWORD) -> BOOL;
- pub fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) -> BOOL;
- pub fn CreateProcessW(
- lpApplicationName: LPCWSTR,
- lpCommandLine: LPWSTR,
- lpProcessAttributes: LPSECURITY_ATTRIBUTES,
- lpThreadAttributes: LPSECURITY_ATTRIBUTES,
- bInheritHandles: BOOL,
- dwCreationFlags: DWORD,
- lpEnvironment: LPVOID,
- lpCurrentDirectory: LPCWSTR,
- lpStartupInfo: LPSTARTUPINFO,
- lpProcessInformation: LPPROCESS_INFORMATION,
- ) -> BOOL;
- pub fn GetEnvironmentVariableW(n: LPCWSTR, v: LPWSTR, nsize: DWORD) -> DWORD;
- pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR) -> BOOL;
- pub fn GetEnvironmentStringsW() -> LPWCH;
- pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
- pub fn GetModuleFileNameW(hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD) -> DWORD;
- pub fn CreateDirectoryW(
- lpPathName: LPCWSTR,
- lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
- ) -> BOOL;
- pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
- pub fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD;
- pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
- pub fn DuplicateHandle(
- hSourceProcessHandle: HANDLE,
- hSourceHandle: HANDLE,
- hTargetProcessHandle: HANDLE,
- lpTargetHandle: LPHANDLE,
- dwDesiredAccess: DWORD,
- bInheritHandle: BOOL,
- dwOptions: DWORD,
- ) -> BOOL;
- pub fn ReadFile(
- hFile: BorrowedHandle<'_>,
- lpBuffer: LPVOID,
- nNumberOfBytesToRead: DWORD,
- lpNumberOfBytesRead: LPDWORD,
- lpOverlapped: LPOVERLAPPED,
- ) -> BOOL;
- pub fn ReadFileEx(
- hFile: BorrowedHandle<'_>,
- lpBuffer: LPVOID,
- nNumberOfBytesToRead: DWORD,
- lpOverlapped: LPOVERLAPPED,
- lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE,
- ) -> BOOL;
- pub fn WriteFileEx(
- hFile: BorrowedHandle<'_>,
- lpBuffer: LPVOID,
- nNumberOfBytesToWrite: DWORD,
- lpOverlapped: LPOVERLAPPED,
- lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE,
- ) -> BOOL;
- pub fn CloseHandle(hObject: HANDLE) -> BOOL;
- pub fn MoveFileExW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, dwFlags: DWORD)
- -> BOOL;
- pub fn SetFilePointerEx(
- hFile: HANDLE,
- liDistanceToMove: LARGE_INTEGER,
- lpNewFilePointer: PLARGE_INTEGER,
- dwMoveMethod: DWORD,
- ) -> BOOL;
- pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
- pub fn CreateFileW(
- lpFileName: LPCWSTR,
- dwDesiredAccess: DWORD,
- dwShareMode: DWORD,
- lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
- dwCreationDisposition: DWORD,
- dwFlagsAndAttributes: DWORD,
- hTemplateFile: HANDLE,
- ) -> HandleOrInvalid;
-
- pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW) -> HANDLE;
- pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW) -> BOOL;
- pub fn FindClose(findFile: HANDLE) -> BOOL;
-
- pub fn GetProcAddress(handle: HMODULE, name: LPCSTR) -> *mut c_void;
- pub fn GetModuleHandleA(lpModuleName: LPCSTR) -> HMODULE;
- pub fn GetModuleHandleW(lpModuleName: LPCWSTR) -> HMODULE;
-
- pub fn GetSystemTimeAsFileTime(lpSystemTimeAsFileTime: LPFILETIME);
- pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
-
- pub fn CreateEventW(
- lpEventAttributes: LPSECURITY_ATTRIBUTES,
- bManualReset: BOOL,
- bInitialState: BOOL,
- lpName: LPCWSTR,
- ) -> HANDLE;
- pub fn WaitForMultipleObjects(
- nCount: DWORD,
- lpHandles: *const HANDLE,
- bWaitAll: BOOL,
- dwMilliseconds: DWORD,
- ) -> DWORD;
- pub fn CreateNamedPipeW(
- lpName: LPCWSTR,
- dwOpenMode: DWORD,
- dwPipeMode: DWORD,
- nMaxInstances: DWORD,
- nOutBufferSize: DWORD,
- nInBufferSize: DWORD,
- nDefaultTimeOut: DWORD,
- lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
- ) -> HANDLE;
- pub fn CancelIo(handle: HANDLE) -> BOOL;
- pub fn GetOverlappedResult(
- hFile: HANDLE,
- lpOverlapped: LPOVERLAPPED,
- lpNumberOfBytesTransferred: LPDWORD,
- bWait: BOOL,
- ) -> BOOL;
- pub fn CreateSymbolicLinkW(
- lpSymlinkFileName: LPCWSTR,
- lpTargetFileName: LPCWSTR,
- dwFlags: DWORD,
- ) -> BOOLEAN;
- pub fn GetFinalPathNameByHandleW(
- hFile: HANDLE,
- lpszFilePath: LPCWSTR,
- cchFilePath: DWORD,
- dwFlags: DWORD,
- ) -> DWORD;
- pub fn GetFileInformationByHandleEx(
- hFile: HANDLE,
- fileInfoClass: FILE_INFO_BY_HANDLE_CLASS,
- lpFileInformation: LPVOID,
- dwBufferSize: DWORD,
- ) -> BOOL;
- pub fn SetFileInformationByHandle(
- hFile: HANDLE,
- FileInformationClass: FILE_INFO_BY_HANDLE_CLASS,
- lpFileInformation: LPVOID,
- dwBufferSize: DWORD,
- ) -> BOOL;
- pub fn GetFileType(hfile: HANDLE) -> DWORD;
- pub fn SleepConditionVariableSRW(
- ConditionVariable: PCONDITION_VARIABLE,
- SRWLock: PSRWLOCK,
- dwMilliseconds: DWORD,
- Flags: ULONG,
- ) -> BOOL;
-
- pub fn WakeConditionVariable(ConditionVariable: PCONDITION_VARIABLE);
- pub fn WakeAllConditionVariable(ConditionVariable: PCONDITION_VARIABLE);
-
- pub fn AcquireSRWLockExclusive(SRWLock: PSRWLOCK);
- pub fn AcquireSRWLockShared(SRWLock: PSRWLOCK);
- pub fn ReleaseSRWLockExclusive(SRWLock: PSRWLOCK);
- pub fn ReleaseSRWLockShared(SRWLock: PSRWLOCK);
- pub fn TryAcquireSRWLockExclusive(SRWLock: PSRWLOCK) -> BOOLEAN;
- pub fn TryAcquireSRWLockShared(SRWLock: PSRWLOCK) -> BOOLEAN;
-
- pub fn InitOnceBeginInitialize(
- lpInitOnce: LPINIT_ONCE,
- dwFlags: DWORD,
- fPending: LPBOOL,
- lpContext: *mut LPVOID,
- ) -> BOOL;
- pub fn InitOnceComplete(lpInitOnce: LPINIT_ONCE, dwFlags: DWORD, lpContext: LPVOID) -> BOOL;
-
- pub fn CompareStringOrdinal(
- lpString1: LPCWSTR,
- cchCount1: c_int,
- lpString2: LPCWSTR,
- cchCount2: c_int,
- bIgnoreCase: BOOL,
- ) -> c_int;
- pub fn GetFullPathNameW(
- lpFileName: LPCWSTR,
- nBufferLength: DWORD,
- lpBuffer: LPWSTR,
- lpFilePart: *mut LPWSTR,
- ) -> DWORD;
- pub fn GetFileAttributesW(lpFileName: LPCWSTR) -> DWORD;
-
- pub fn MultiByteToWideChar(
- CodePage: UINT,
- dwFlags: DWORD,
- lpMultiByteStr: LPCCH,
- cbMultiByte: c_int,
- lpWideCharStr: LPWSTR,
- cchWideChar: c_int,
- ) -> c_int;
- pub fn WideCharToMultiByte(
- CodePage: UINT,
- dwFlags: DWORD,
- lpWideCharStr: LPCWCH,
- cchWideChar: c_int,
- lpMultiByteStr: LPSTR,
- cbMultiByte: c_int,
- lpDefaultChar: LPCCH,
- lpUsedDefaultChar: LPBOOL,
- ) -> c_int;
+ pub const EXCEPTION_CONTINUE_SEARCH: i32 = 0;
}
-
-#[link(name = "ws2_32")]
-extern "system" {
- pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int;
- pub fn WSACleanup() -> c_int;
- pub fn WSAGetLastError() -> c_int;
- pub fn WSADuplicateSocketW(
- s: SOCKET,
- dwProcessId: DWORD,
- lpProtocolInfo: LPWSAPROTOCOL_INFO,
- ) -> c_int;
- pub fn WSASend(
- s: SOCKET,
- lpBuffers: LPWSABUF,
- dwBufferCount: DWORD,
- lpNumberOfBytesSent: LPDWORD,
- dwFlags: DWORD,
- lpOverlapped: LPWSAOVERLAPPED,
- lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
- ) -> c_int;
- pub fn WSARecv(
- s: SOCKET,
- lpBuffers: LPWSABUF,
- dwBufferCount: DWORD,
- lpNumberOfBytesRecvd: LPDWORD,
- lpFlags: LPDWORD,
- lpOverlapped: LPWSAOVERLAPPED,
- lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
- ) -> c_int;
- pub fn WSASocketW(
- af: c_int,
- kind: c_int,
- protocol: c_int,
- lpProtocolInfo: LPWSAPROTOCOL_INFO,
- g: GROUP,
- dwFlags: DWORD,
- ) -> SOCKET;
- pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
- pub fn closesocket(socket: SOCKET) -> c_int;
- pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int;
- pub fn send(socket: SOCKET, buf: *const c_void, len: c_int, flags: c_int) -> c_int;
- pub fn recvfrom(
- socket: SOCKET,
- buf: *mut c_void,
- len: c_int,
- flags: c_int,
- addr: *mut SOCKADDR,
- addrlen: *mut c_int,
- ) -> c_int;
- pub fn sendto(
- socket: SOCKET,
- buf: *const c_void,
- len: c_int,
- flags: c_int,
- addr: *const SOCKADDR,
- addrlen: c_int,
- ) -> c_int;
- pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
- pub fn accept(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> SOCKET;
- pub fn getsockopt(
- s: SOCKET,
- level: c_int,
- optname: c_int,
- optval: *mut c_char,
- optlen: *mut c_int,
- ) -> c_int;
- pub fn setsockopt(
- s: SOCKET,
- level: c_int,
- optname: c_int,
- optval: *const c_void,
- optlen: c_int,
- ) -> c_int;
- pub fn getsockname(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> c_int;
- pub fn getpeername(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> c_int;
- pub fn bind(socket: SOCKET, address: *const SOCKADDR, address_len: socklen_t) -> c_int;
- pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
- pub fn connect(socket: SOCKET, address: *const SOCKADDR, len: c_int) -> c_int;
- pub fn getaddrinfo(
- node: *const c_char,
- service: *const c_char,
- hints: *const ADDRINFOA,
- res: *mut *mut ADDRINFOA,
- ) -> c_int;
- pub fn freeaddrinfo(res: *mut ADDRINFOA);
- pub fn select(
- nfds: c_int,
- readfds: *mut fd_set,
- writefds: *mut fd_set,
- exceptfds: *mut fd_set,
- timeout: *const timeval,
- ) -> c_int;
-}
-
-#[link(name = "bcrypt")]
-extern "system" {
- // >= Vista / Server 2008
- // https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
- pub fn BCryptGenRandom(
- hAlgorithm: BCRYPT_ALG_HANDLE,
- pBuffer: *mut u8,
- cbBuffer: ULONG,
- dwFlags: ULONG,
- ) -> NTSTATUS;
}
-#[link(name = "ntdll")]
-extern "system" {
- pub fn NtCreateFile(
- FileHandle: *mut HANDLE,
- DesiredAccess: ACCESS_MASK,
- ObjectAttributes: *const OBJECT_ATTRIBUTES,
- IoStatusBlock: *mut IO_STATUS_BLOCK,
- AllocationSize: *mut i64,
- FileAttributes: ULONG,
- ShareAccess: ULONG,
- CreateDisposition: ULONG,
- CreateOptions: ULONG,
- EaBuffer: *mut c_void,
- EaLength: ULONG,
- ) -> NTSTATUS;
- pub fn NtReadFile(
- FileHandle: BorrowedHandle<'_>,
- Event: HANDLE,
- ApcRoutine: Option<IO_APC_ROUTINE>,
- ApcContext: *mut c_void,
- IoStatusBlock: &mut IO_STATUS_BLOCK,
- Buffer: *mut crate::mem::MaybeUninit<u8>,
- Length: ULONG,
- ByteOffset: Option<&LARGE_INTEGER>,
- Key: Option<&ULONG>,
- ) -> NTSTATUS;
- pub fn NtWriteFile(
- FileHandle: BorrowedHandle<'_>,
- Event: HANDLE,
- ApcRoutine: Option<IO_APC_ROUTINE>,
- ApcContext: *mut c_void,
- IoStatusBlock: &mut IO_STATUS_BLOCK,
- Buffer: *const u8,
- Length: ULONG,
- ByteOffset: Option<&LARGE_INTEGER>,
- Key: Option<&ULONG>,
- ) -> NTSTATUS;
- pub fn RtlNtStatusToDosError(Status: NTSTATUS) -> ULONG;
+pub unsafe extern "system" fn WriteFileEx(
+ hFile: BorrowedHandle<'_>,
+ lpBuffer: *mut ::core::ffi::c_void,
+ nNumberOfBytesToWrite: u32,
+ lpOverlapped: *mut OVERLAPPED,
+ lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE,
+) -> BOOL {
+ windows_sys::WriteFileEx(
+ hFile.as_raw_handle(),
+ lpBuffer.cast::<u8>(),
+ nNumberOfBytesToWrite,
+ lpOverlapped,
+ lpCompletionRoutine,
+ )
+}
+
+pub unsafe extern "system" fn ReadFileEx(
+ hFile: BorrowedHandle<'_>,
+ lpBuffer: *mut ::core::ffi::c_void,
+ nNumberOfBytesToRead: u32,
+ lpOverlapped: *mut OVERLAPPED,
+ lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE,
+) -> BOOL {
+ windows_sys::ReadFileEx(
+ hFile.as_raw_handle(),
+ lpBuffer,
+ nNumberOfBytesToRead,
+ lpOverlapped,
+ lpCompletionRoutine,
+ )
+}
+
+// POSIX compatibility shims.
+pub unsafe fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int {
+ windows_sys::recv(socket, buf.cast::<u8>(), len, flags)
+}
+pub unsafe fn send(socket: SOCKET, buf: *const c_void, len: c_int, flags: c_int) -> c_int {
+ windows_sys::send(socket, buf.cast::<u8>(), len, flags)
+}
+pub unsafe fn recvfrom(
+ socket: SOCKET,
+ buf: *mut c_void,
+ len: c_int,
+ flags: c_int,
+ addr: *mut SOCKADDR,
+ addrlen: *mut c_int,
+) -> c_int {
+ windows_sys::recvfrom(socket, buf.cast::<u8>(), len, flags, addr, addrlen)
+}
+pub unsafe fn sendto(
+ socket: SOCKET,
+ buf: *const c_void,
+ len: c_int,
+ flags: c_int,
+ addr: *const SOCKADDR,
+ addrlen: c_int,
+) -> c_int {
+ windows_sys::sendto(socket, buf.cast::<u8>(), len, flags, addr, addrlen)
+}
+pub unsafe fn getaddrinfo(
+ node: *const c_char,
+ service: *const c_char,
+ hints: *const ADDRINFOA,
+ res: *mut *mut ADDRINFOA,
+) -> c_int {
+ windows_sys::getaddrinfo(node.cast::<u8>(), service.cast::<u8>(), hints, res)
+}
+
+pub unsafe fn NtReadFile(
+ filehandle: BorrowedHandle<'_>,
+ event: HANDLE,
+ apcroutine: PIO_APC_ROUTINE,
+ apccontext: *mut c_void,
+ iostatusblock: &mut IO_STATUS_BLOCK,
+ buffer: *mut crate::mem::MaybeUninit<u8>,
+ length: ULONG,
+ byteoffset: Option<&LARGE_INTEGER>,
+ key: Option<&ULONG>,
+) -> NTSTATUS {
+ windows_sys::NtReadFile(
+ filehandle.as_raw_handle(),
+ event,
+ apcroutine,
+ apccontext,
+ iostatusblock,
+ buffer.cast::<c_void>(),
+ length,
+ byteoffset.map(|o| o as *const i64).unwrap_or(ptr::null()),
+ key.map(|k| k as *const u32).unwrap_or(ptr::null()),
+ )
+}
+pub unsafe fn NtWriteFile(
+ filehandle: BorrowedHandle<'_>,
+ event: HANDLE,
+ apcroutine: PIO_APC_ROUTINE,
+ apccontext: *mut c_void,
+ iostatusblock: &mut IO_STATUS_BLOCK,
+ buffer: *const u8,
+ length: ULONG,
+ byteoffset: Option<&LARGE_INTEGER>,
+ key: Option<&ULONG>,
+) -> NTSTATUS {
+ windows_sys::NtWriteFile(
+ filehandle.as_raw_handle(),
+ event,
+ apcroutine,
+ apccontext,
+ iostatusblock,
+ buffer.cast::<c_void>(),
+ length,
+ byteoffset.map(|o| o as *const i64).unwrap_or(ptr::null()),
+ key.map(|k| k as *const u32).unwrap_or(ptr::null()),
+ )
}
// Functions that aren't available on every version of Windows that we support,
@@ -1328,34 +321,32 @@ compat_fn_with_fallback! {
// >= Win10 1607
// https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription
- pub fn SetThreadDescription(hThread: HANDLE,
- lpThreadDescription: LPCWSTR) -> HRESULT {
+ pub fn SetThreadDescription(hthread: HANDLE, lpthreaddescription: PCWSTR) -> HRESULT {
SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); E_NOTIMPL
}
// >= Win8 / Server 2012
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
- pub fn GetSystemTimePreciseAsFileTime(lpSystemTimeAsFileTime: LPFILETIME)
- -> () {
- GetSystemTimeAsFileTime(lpSystemTimeAsFileTime)
+ pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> () {
+ GetSystemTimeAsFileTime(lpsystemtimeasfiletime)
}
// >= Win11 / Server 2022
// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2a
- pub fn GetTempPath2W(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD {
- GetTempPathW(nBufferLength, lpBuffer)
+ pub fn GetTempPath2W(bufferlength: u32, buffer: PWSTR) -> u32 {
+ GetTempPathW(bufferlength, buffer)
}
}
compat_fn_optional! {
crate::sys::compat::load_synch_functions();
pub fn WaitOnAddress(
- Address: LPVOID,
- CompareAddress: LPVOID,
- AddressSize: SIZE_T,
- dwMilliseconds: DWORD
- );
- pub fn WakeByAddressSingle(Address: LPVOID);
+ address: *const ::core::ffi::c_void,
+ compareaddress: *const ::core::ffi::c_void,
+ addresssize: usize,
+ dwmilliseconds: u32
+ ) -> BOOL;
+ pub fn WakeByAddressSingle(address: *const ::core::ffi::c_void);
}
compat_fn_with_fallback! {
diff --git a/library/std/src/sys/windows/c/errors.rs b/library/std/src/sys/windows/c/errors.rs
deleted file mode 100644
index ad8da19b6..000000000
--- a/library/std/src/sys/windows/c/errors.rs
+++ /dev/null
@@ -1,1883 +0,0 @@
-// List of Windows system error codes with descriptions:
-// https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes#system-error-codes
-
-#![allow(dead_code)]
-
-use super::{c_int, DWORD};
-
-pub const ERROR_DIRECTORY_NOT_SUPPORTED: DWORD = 336;
-pub const ERROR_DRIVER_CANCEL_TIMEOUT: DWORD = 594;
-pub const ERROR_DISK_QUOTA_EXCEEDED: DWORD = 1295;
-pub const ERROR_RESOURCE_CALL_TIMED_OUT: DWORD = 5910;
-pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: DWORD = 8014;
-pub const DNS_ERROR_RECORD_TIMED_OUT: DWORD = 9705;
-
-// The following list was obtained from
-// `/usr/x86_64-w64-mingw32/include/winerror.h`
-// in the Debian package
-// mingw-w64_6.0.0-3_all.deb
-//
-// The header of that file says:
-// * This file has no copyright assigned and is placed in the Public Domain.
-// * This file is part of the mingw-w64 runtime package.
-// * No warranty is given; refer to the file DISCLAIMER.PD within this package.
-//
-// The text here is the result of the following rune:
-// grep -P '#define ERROR' /usr/x86_64-w64-mingw32/include/winerror.h >>library/std/src/sys/windows/c/errors.rs
-// grep -P '#define WSA' /usr/x86_64-w64-mingw32/include/winerror.h >>library/std/src/sys/windows/c/errors.rs
-// and then using some manually-invented but rather obvious editor search-and-replace
-// invocations, plus some straightforward manual fixups, to turn it into Rust syntax
-// and remove all the duplicates from the manual table above.
-
-pub const ERROR_SUCCESS: DWORD = 0;
-pub const ERROR_INVALID_FUNCTION: DWORD = 1;
-pub const ERROR_FILE_NOT_FOUND: DWORD = 2;
-pub const ERROR_PATH_NOT_FOUND: DWORD = 3;
-pub const ERROR_TOO_MANY_OPEN_FILES: DWORD = 4;
-pub const ERROR_ACCESS_DENIED: DWORD = 5;
-pub const ERROR_INVALID_HANDLE: DWORD = 6;
-pub const ERROR_ARENA_TRASHED: DWORD = 7;
-pub const ERROR_NOT_ENOUGH_MEMORY: DWORD = 8;
-pub const ERROR_INVALID_BLOCK: DWORD = 9;
-pub const ERROR_BAD_ENVIRONMENT: DWORD = 10;
-pub const ERROR_BAD_FORMAT: DWORD = 11;
-pub const ERROR_INVALID_ACCESS: DWORD = 12;
-pub const ERROR_INVALID_DATA: DWORD = 13;
-pub const ERROR_OUTOFMEMORY: DWORD = 14;
-pub const ERROR_INVALID_DRIVE: DWORD = 15;
-pub const ERROR_CURRENT_DIRECTORY: DWORD = 16;
-pub const ERROR_NOT_SAME_DEVICE: DWORD = 17;
-pub const ERROR_NO_MORE_FILES: DWORD = 18;
-pub const ERROR_WRITE_PROTECT: DWORD = 19;
-pub const ERROR_BAD_UNIT: DWORD = 20;
-pub const ERROR_NOT_READY: DWORD = 21;
-pub const ERROR_BAD_COMMAND: DWORD = 22;
-pub const ERROR_CRC: DWORD = 23;
-pub const ERROR_BAD_LENGTH: DWORD = 24;
-pub const ERROR_SEEK: DWORD = 25;
-pub const ERROR_NOT_DOS_DISK: DWORD = 26;
-pub const ERROR_SECTOR_NOT_FOUND: DWORD = 27;
-pub const ERROR_OUT_OF_PAPER: DWORD = 28;
-pub const ERROR_WRITE_FAULT: DWORD = 29;
-pub const ERROR_READ_FAULT: DWORD = 30;
-pub const ERROR_GEN_FAILURE: DWORD = 31;
-pub const ERROR_SHARING_VIOLATION: DWORD = 32;
-pub const ERROR_LOCK_VIOLATION: DWORD = 33;
-pub const ERROR_WRONG_DISK: DWORD = 34;
-pub const ERROR_SHARING_BUFFER_EXCEEDED: DWORD = 36;
-pub const ERROR_HANDLE_EOF: DWORD = 38;
-pub const ERROR_HANDLE_DISK_FULL: DWORD = 39;
-pub const ERROR_NOT_SUPPORTED: DWORD = 50;
-pub const ERROR_REM_NOT_LIST: DWORD = 51;
-pub const ERROR_DUP_NAME: DWORD = 52;
-pub const ERROR_BAD_NETPATH: DWORD = 53;
-pub const ERROR_NETWORK_BUSY: DWORD = 54;
-pub const ERROR_DEV_NOT_EXIST: DWORD = 55;
-pub const ERROR_TOO_MANY_CMDS: DWORD = 56;
-pub const ERROR_ADAP_HDW_ERR: DWORD = 57;
-pub const ERROR_BAD_NET_RESP: DWORD = 58;
-pub const ERROR_UNEXP_NET_ERR: DWORD = 59;
-pub const ERROR_BAD_REM_ADAP: DWORD = 60;
-pub const ERROR_PRINTQ_FULL: DWORD = 61;
-pub const ERROR_NO_SPOOL_SPACE: DWORD = 62;
-pub const ERROR_PRINT_CANCELLED: DWORD = 63;
-pub const ERROR_NETNAME_DELETED: DWORD = 64;
-pub const ERROR_NETWORK_ACCESS_DENIED: DWORD = 65;
-pub const ERROR_BAD_DEV_TYPE: DWORD = 66;
-pub const ERROR_BAD_NET_NAME: DWORD = 67;
-pub const ERROR_TOO_MANY_NAMES: DWORD = 68;
-pub const ERROR_TOO_MANY_SESS: DWORD = 69;
-pub const ERROR_SHARING_PAUSED: DWORD = 70;
-pub const ERROR_REQ_NOT_ACCEP: DWORD = 71;
-pub const ERROR_REDIR_PAUSED: DWORD = 72;
-pub const ERROR_FILE_EXISTS: DWORD = 80;
-pub const ERROR_CANNOT_MAKE: DWORD = 82;
-pub const ERROR_FAIL_I24: DWORD = 83;
-pub const ERROR_OUT_OF_STRUCTURES: DWORD = 84;
-pub const ERROR_ALREADY_ASSIGNED: DWORD = 85;
-pub const ERROR_INVALID_PASSWORD: DWORD = 86;
-pub const ERROR_INVALID_PARAMETER: DWORD = 87;
-pub const ERROR_NET_WRITE_FAULT: DWORD = 88;
-pub const ERROR_NO_PROC_SLOTS: DWORD = 89;
-pub const ERROR_TOO_MANY_SEMAPHORES: DWORD = 100;
-pub const ERROR_EXCL_SEM_ALREADY_OWNED: DWORD = 101;
-pub const ERROR_SEM_IS_SET: DWORD = 102;
-pub const ERROR_TOO_MANY_SEM_REQUESTS: DWORD = 103;
-pub const ERROR_INVALID_AT_INTERRUPT_TIME: DWORD = 104;
-pub const ERROR_SEM_OWNER_DIED: DWORD = 105;
-pub const ERROR_SEM_USER_LIMIT: DWORD = 106;
-pub const ERROR_DISK_CHANGE: DWORD = 107;
-pub const ERROR_DRIVE_LOCKED: DWORD = 108;
-pub const ERROR_BROKEN_PIPE: DWORD = 109;
-pub const ERROR_OPEN_FAILED: DWORD = 110;
-pub const ERROR_BUFFER_OVERFLOW: DWORD = 111;
-pub const ERROR_DISK_FULL: DWORD = 112;
-pub const ERROR_NO_MORE_SEARCH_HANDLES: DWORD = 113;
-pub const ERROR_INVALID_TARGET_HANDLE: DWORD = 114;
-pub const ERROR_INVALID_CATEGORY: DWORD = 117;
-pub const ERROR_INVALID_VERIFY_SWITCH: DWORD = 118;
-pub const ERROR_BAD_DRIVER_LEVEL: DWORD = 119;
-pub const ERROR_CALL_NOT_IMPLEMENTED: DWORD = 120;
-pub const ERROR_SEM_TIMEOUT: DWORD = 121;
-pub const ERROR_INSUFFICIENT_BUFFER: DWORD = 122;
-pub const ERROR_INVALID_NAME: DWORD = 123;
-pub const ERROR_INVALID_LEVEL: DWORD = 124;
-pub const ERROR_NO_VOLUME_LABEL: DWORD = 125;
-pub const ERROR_MOD_NOT_FOUND: DWORD = 126;
-pub const ERROR_PROC_NOT_FOUND: DWORD = 127;
-pub const ERROR_WAIT_NO_CHILDREN: DWORD = 128;
-pub const ERROR_CHILD_NOT_COMPLETE: DWORD = 129;
-pub const ERROR_DIRECT_ACCESS_HANDLE: DWORD = 130;
-pub const ERROR_NEGATIVE_SEEK: DWORD = 131;
-pub const ERROR_SEEK_ON_DEVICE: DWORD = 132;
-pub const ERROR_IS_JOIN_TARGET: DWORD = 133;
-pub const ERROR_IS_JOINED: DWORD = 134;
-pub const ERROR_IS_SUBSTED: DWORD = 135;
-pub const ERROR_NOT_JOINED: DWORD = 136;
-pub const ERROR_NOT_SUBSTED: DWORD = 137;
-pub const ERROR_JOIN_TO_JOIN: DWORD = 138;
-pub const ERROR_SUBST_TO_SUBST: DWORD = 139;
-pub const ERROR_JOIN_TO_SUBST: DWORD = 140;
-pub const ERROR_SUBST_TO_JOIN: DWORD = 141;
-pub const ERROR_BUSY_DRIVE: DWORD = 142;
-pub const ERROR_SAME_DRIVE: DWORD = 143;
-pub const ERROR_DIR_NOT_ROOT: DWORD = 144;
-pub const ERROR_DIR_NOT_EMPTY: DWORD = 145;
-pub const ERROR_IS_SUBST_PATH: DWORD = 146;
-pub const ERROR_IS_JOIN_PATH: DWORD = 147;
-pub const ERROR_PATH_BUSY: DWORD = 148;
-pub const ERROR_IS_SUBST_TARGET: DWORD = 149;
-pub const ERROR_SYSTEM_TRACE: DWORD = 150;
-pub const ERROR_INVALID_EVENT_COUNT: DWORD = 151;
-pub const ERROR_TOO_MANY_MUXWAITERS: DWORD = 152;
-pub const ERROR_INVALID_LIST_FORMAT: DWORD = 153;
-pub const ERROR_LABEL_TOO_LONG: DWORD = 154;
-pub const ERROR_TOO_MANY_TCBS: DWORD = 155;
-pub const ERROR_SIGNAL_REFUSED: DWORD = 156;
-pub const ERROR_DISCARDED: DWORD = 157;
-pub const ERROR_NOT_LOCKED: DWORD = 158;
-pub const ERROR_BAD_THREADID_ADDR: DWORD = 159;
-pub const ERROR_BAD_ARGUMENTS: DWORD = 160;
-pub const ERROR_BAD_PATHNAME: DWORD = 161;
-pub const ERROR_SIGNAL_PENDING: DWORD = 162;
-pub const ERROR_MAX_THRDS_REACHED: DWORD = 164;
-pub const ERROR_LOCK_FAILED: DWORD = 167;
-pub const ERROR_BUSY: DWORD = 170;
-pub const ERROR_CANCEL_VIOLATION: DWORD = 173;
-pub const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED: DWORD = 174;
-pub const ERROR_INVALID_SEGMENT_NUMBER: DWORD = 180;
-pub const ERROR_INVALID_ORDINAL: DWORD = 182;
-pub const ERROR_ALREADY_EXISTS: DWORD = 183;
-pub const ERROR_INVALID_FLAG_NUMBER: DWORD = 186;
-pub const ERROR_SEM_NOT_FOUND: DWORD = 187;
-pub const ERROR_INVALID_STARTING_CODESEG: DWORD = 188;
-pub const ERROR_INVALID_STACKSEG: DWORD = 189;
-pub const ERROR_INVALID_MODULETYPE: DWORD = 190;
-pub const ERROR_INVALID_EXE_SIGNATURE: DWORD = 191;
-pub const ERROR_EXE_MARKED_INVALID: DWORD = 192;
-pub const ERROR_BAD_EXE_FORMAT: DWORD = 193;
-pub const ERROR_ITERATED_DATA_EXCEEDS_64k: DWORD = 194;
-pub const ERROR_INVALID_MINALLOCSIZE: DWORD = 195;
-pub const ERROR_DYNLINK_FROM_INVALID_RING: DWORD = 196;
-pub const ERROR_IOPL_NOT_ENABLED: DWORD = 197;
-pub const ERROR_INVALID_SEGDPL: DWORD = 198;
-pub const ERROR_AUTODATASEG_EXCEEDS_64k: DWORD = 199;
-pub const ERROR_RING2SEG_MUST_BE_MOVABLE: DWORD = 200;
-pub const ERROR_RELOC_CHAIN_XEEDS_SEGLIM: DWORD = 201;
-pub const ERROR_INFLOOP_IN_RELOC_CHAIN: DWORD = 202;
-pub const ERROR_ENVVAR_NOT_FOUND: DWORD = 203;
-pub const ERROR_NO_SIGNAL_SENT: DWORD = 205;
-pub const ERROR_FILENAME_EXCED_RANGE: DWORD = 206;
-pub const ERROR_RING2_STACK_IN_USE: DWORD = 207;
-pub const ERROR_META_EXPANSION_TOO_LONG: DWORD = 208;
-pub const ERROR_INVALID_SIGNAL_NUMBER: DWORD = 209;
-pub const ERROR_THREAD_1_INACTIVE: DWORD = 210;
-pub const ERROR_LOCKED: DWORD = 212;
-pub const ERROR_TOO_MANY_MODULES: DWORD = 214;
-pub const ERROR_NESTING_NOT_ALLOWED: DWORD = 215;
-pub const ERROR_EXE_MACHINE_TYPE_MISMATCH: DWORD = 216;
-pub const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY: DWORD = 217;
-pub const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY: DWORD = 218;
-pub const ERROR_FILE_CHECKED_OUT: DWORD = 220;
-pub const ERROR_CHECKOUT_REQUIRED: DWORD = 221;
-pub const ERROR_BAD_FILE_TYPE: DWORD = 222;
-pub const ERROR_FILE_TOO_LARGE: DWORD = 223;
-pub const ERROR_FORMS_AUTH_REQUIRED: DWORD = 224;
-pub const ERROR_PIPE_LOCAL: DWORD = 229;
-pub const ERROR_BAD_PIPE: DWORD = 230;
-pub const ERROR_PIPE_BUSY: DWORD = 231;
-pub const ERROR_NO_DATA: DWORD = 232;
-pub const ERROR_PIPE_NOT_CONNECTED: DWORD = 233;
-pub const ERROR_MORE_DATA: DWORD = 234;
-pub const ERROR_VC_DISCONNECTED: DWORD = 240;
-pub const ERROR_INVALID_EA_NAME: DWORD = 254;
-pub const ERROR_EA_LIST_INCONSISTENT: DWORD = 255;
-pub const ERROR_NO_MORE_ITEMS: DWORD = 259;
-pub const ERROR_CANNOT_COPY: DWORD = 266;
-pub const ERROR_DIRECTORY: DWORD = 267;
-pub const ERROR_EAS_DIDNT_FIT: DWORD = 275;
-pub const ERROR_EA_FILE_CORRUPT: DWORD = 276;
-pub const ERROR_EA_TABLE_FULL: DWORD = 277;
-pub const ERROR_INVALID_EA_HANDLE: DWORD = 278;
-pub const ERROR_EAS_NOT_SUPPORTED: DWORD = 282;
-pub const ERROR_NOT_OWNER: DWORD = 288;
-pub const ERROR_TOO_MANY_POSTS: DWORD = 298;
-pub const ERROR_PARTIAL_COPY: DWORD = 299;
-pub const ERROR_OPLOCK_NOT_GRANTED: DWORD = 300;
-pub const ERROR_INVALID_OPLOCK_PROTOCOL: DWORD = 301;
-pub const ERROR_DISK_TOO_FRAGMENTED: DWORD = 302;
-pub const ERROR_DELETE_PENDING: DWORD = 303;
-pub const ERROR_INVALID_TOKEN: DWORD = 315;
-pub const ERROR_MR_MID_NOT_FOUND: DWORD = 317;
-pub const ERROR_SCOPE_NOT_FOUND: DWORD = 318;
-pub const ERROR_INVALID_ADDRESS: DWORD = 487;
-pub const ERROR_ARITHMETIC_OVERFLOW: DWORD = 534;
-pub const ERROR_PIPE_CONNECTED: DWORD = 535;
-pub const ERROR_PIPE_LISTENING: DWORD = 536;
-pub const ERROR_WAKE_SYSTEM: DWORD = 730;
-pub const ERROR_WAIT_1: DWORD = 731;
-pub const ERROR_WAIT_2: DWORD = 732;
-pub const ERROR_WAIT_3: DWORD = 733;
-pub const ERROR_WAIT_63: DWORD = 734;
-pub const ERROR_ABANDONED_WAIT_0: DWORD = 735;
-pub const ERROR_ABANDONED_WAIT_63: DWORD = 736;
-pub const ERROR_USER_APC: DWORD = 737;
-pub const ERROR_KERNEL_APC: DWORD = 738;
-pub const ERROR_ALERTED: DWORD = 739;
-pub const ERROR_EA_ACCESS_DENIED: DWORD = 994;
-pub const ERROR_OPERATION_ABORTED: DWORD = 995;
-pub const ERROR_IO_INCOMPLETE: DWORD = 996;
-pub const ERROR_IO_PENDING: DWORD = 997;
-pub const ERROR_NOACCESS: DWORD = 998;
-pub const ERROR_SWAPERROR: DWORD = 999;
-pub const ERROR_STACK_OVERFLOW: DWORD = 1001;
-pub const ERROR_INVALID_MESSAGE: DWORD = 1002;
-pub const ERROR_CAN_NOT_COMPLETE: DWORD = 1003;
-pub const ERROR_INVALID_FLAGS: DWORD = 1004;
-pub const ERROR_UNRECOGNIZED_VOLUME: DWORD = 1005;
-pub const ERROR_FILE_INVALID: DWORD = 1006;
-pub const ERROR_FULLSCREEN_MODE: DWORD = 1007;
-pub const ERROR_NO_TOKEN: DWORD = 1008;
-pub const ERROR_BADDB: DWORD = 1009;
-pub const ERROR_BADKEY: DWORD = 1010;
-pub const ERROR_CANTOPEN: DWORD = 1011;
-pub const ERROR_CANTREAD: DWORD = 1012;
-pub const ERROR_CANTWRITE: DWORD = 1013;
-pub const ERROR_REGISTRY_RECOVERED: DWORD = 1014;
-pub const ERROR_REGISTRY_CORRUPT: DWORD = 1015;
-pub const ERROR_REGISTRY_IO_FAILED: DWORD = 1016;
-pub const ERROR_NOT_REGISTRY_FILE: DWORD = 1017;
-pub const ERROR_KEY_DELETED: DWORD = 1018;
-pub const ERROR_NO_LOG_SPACE: DWORD = 1019;
-pub const ERROR_KEY_HAS_CHILDREN: DWORD = 1020;
-pub const ERROR_CHILD_MUST_BE_VOLATILE: DWORD = 1021;
-pub const ERROR_NOTIFY_ENUM_DIR: DWORD = 1022;
-pub const ERROR_DEPENDENT_SERVICES_RUNNING: DWORD = 1051;
-pub const ERROR_INVALID_SERVICE_CONTROL: DWORD = 1052;
-pub const ERROR_SERVICE_REQUEST_TIMEOUT: DWORD = 1053;
-pub const ERROR_SERVICE_NO_THREAD: DWORD = 1054;
-pub const ERROR_SERVICE_DATABASE_LOCKED: DWORD = 1055;
-pub const ERROR_SERVICE_ALREADY_RUNNING: DWORD = 1056;
-pub const ERROR_INVALID_SERVICE_ACCOUNT: DWORD = 1057;
-pub const ERROR_SERVICE_DISABLED: DWORD = 1058;
-pub const ERROR_CIRCULAR_DEPENDENCY: DWORD = 1059;
-pub const ERROR_SERVICE_DOES_NOT_EXIST: DWORD = 1060;
-pub const ERROR_SERVICE_CANNOT_ACCEPT_CTRL: DWORD = 1061;
-pub const ERROR_SERVICE_NOT_ACTIVE: DWORD = 1062;
-pub const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: DWORD = 1063;
-pub const ERROR_EXCEPTION_IN_SERVICE: DWORD = 1064;
-pub const ERROR_DATABASE_DOES_NOT_EXIST: DWORD = 1065;
-pub const ERROR_SERVICE_SPECIFIC_ERROR: DWORD = 1066;
-pub const ERROR_PROCESS_ABORTED: DWORD = 1067;
-pub const ERROR_SERVICE_DEPENDENCY_FAIL: DWORD = 1068;
-pub const ERROR_SERVICE_LOGON_FAILED: DWORD = 1069;
-pub const ERROR_SERVICE_START_HANG: DWORD = 1070;
-pub const ERROR_INVALID_SERVICE_LOCK: DWORD = 1071;
-pub const ERROR_SERVICE_MARKED_FOR_DELETE: DWORD = 1072;
-pub const ERROR_SERVICE_EXISTS: DWORD = 1073;
-pub const ERROR_ALREADY_RUNNING_LKG: DWORD = 1074;
-pub const ERROR_SERVICE_DEPENDENCY_DELETED: DWORD = 1075;
-pub const ERROR_BOOT_ALREADY_ACCEPTED: DWORD = 1076;
-pub const ERROR_SERVICE_NEVER_STARTED: DWORD = 1077;
-pub const ERROR_DUPLICATE_SERVICE_NAME: DWORD = 1078;
-pub const ERROR_DIFFERENT_SERVICE_ACCOUNT: DWORD = 1079;
-pub const ERROR_CANNOT_DETECT_DRIVER_FAILURE: DWORD = 1080;
-pub const ERROR_CANNOT_DETECT_PROCESS_ABORT: DWORD = 1081;
-pub const ERROR_NO_RECOVERY_PROGRAM: DWORD = 1082;
-pub const ERROR_SERVICE_NOT_IN_EXE: DWORD = 1083;
-pub const ERROR_NOT_SAFEBOOT_SERVICE: DWORD = 1084;
-pub const ERROR_END_OF_MEDIA: DWORD = 1100;
-pub const ERROR_FILEMARK_DETECTED: DWORD = 1101;
-pub const ERROR_BEGINNING_OF_MEDIA: DWORD = 1102;
-pub const ERROR_SETMARK_DETECTED: DWORD = 1103;
-pub const ERROR_NO_DATA_DETECTED: DWORD = 1104;
-pub const ERROR_PARTITION_FAILURE: DWORD = 1105;
-pub const ERROR_INVALID_BLOCK_LENGTH: DWORD = 1106;
-pub const ERROR_DEVICE_NOT_PARTITIONED: DWORD = 1107;
-pub const ERROR_UNABLE_TO_LOCK_MEDIA: DWORD = 1108;
-pub const ERROR_UNABLE_TO_UNLOAD_MEDIA: DWORD = 1109;
-pub const ERROR_MEDIA_CHANGED: DWORD = 1110;
-pub const ERROR_BUS_RESET: DWORD = 1111;
-pub const ERROR_NO_MEDIA_IN_DRIVE: DWORD = 1112;
-pub const ERROR_NO_UNICODE_TRANSLATION: DWORD = 1113;
-pub const ERROR_DLL_INIT_FAILED: DWORD = 1114;
-pub const ERROR_SHUTDOWN_IN_PROGRESS: DWORD = 1115;
-pub const ERROR_NO_SHUTDOWN_IN_PROGRESS: DWORD = 1116;
-pub const ERROR_IO_DEVICE: DWORD = 1117;
-pub const ERROR_SERIAL_NO_DEVICE: DWORD = 1118;
-pub const ERROR_IRQ_BUSY: DWORD = 1119;
-pub const ERROR_MORE_WRITES: DWORD = 1120;
-pub const ERROR_COUNTER_TIMEOUT: DWORD = 1121;
-pub const ERROR_FLOPPY_ID_MARK_NOT_FOUND: DWORD = 1122;
-pub const ERROR_FLOPPY_WRONG_CYLINDER: DWORD = 1123;
-pub const ERROR_FLOPPY_UNKNOWN_ERROR: DWORD = 1124;
-pub const ERROR_FLOPPY_BAD_REGISTERS: DWORD = 1125;
-pub const ERROR_DISK_RECALIBRATE_FAILED: DWORD = 1126;
-pub const ERROR_DISK_OPERATION_FAILED: DWORD = 1127;
-pub const ERROR_DISK_RESET_FAILED: DWORD = 1128;
-pub const ERROR_EOM_OVERFLOW: DWORD = 1129;
-pub const ERROR_NOT_ENOUGH_SERVER_MEMORY: DWORD = 1130;
-pub const ERROR_POSSIBLE_DEADLOCK: DWORD = 1131;
-pub const ERROR_MAPPED_ALIGNMENT: DWORD = 1132;
-pub const ERROR_SET_POWER_STATE_VETOED: DWORD = 1140;
-pub const ERROR_SET_POWER_STATE_FAILED: DWORD = 1141;
-pub const ERROR_TOO_MANY_LINKS: DWORD = 1142;
-pub const ERROR_OLD_WIN_VERSION: DWORD = 1150;
-pub const ERROR_APP_WRONG_OS: DWORD = 1151;
-pub const ERROR_SINGLE_INSTANCE_APP: DWORD = 1152;
-pub const ERROR_RMODE_APP: DWORD = 1153;
-pub const ERROR_INVALID_DLL: DWORD = 1154;
-pub const ERROR_NO_ASSOCIATION: DWORD = 1155;
-pub const ERROR_DDE_FAIL: DWORD = 1156;
-pub const ERROR_DLL_NOT_FOUND: DWORD = 1157;
-pub const ERROR_NO_MORE_USER_HANDLES: DWORD = 1158;
-pub const ERROR_MESSAGE_SYNC_ONLY: DWORD = 1159;
-pub const ERROR_SOURCE_ELEMENT_EMPTY: DWORD = 1160;
-pub const ERROR_DESTINATION_ELEMENT_FULL: DWORD = 1161;
-pub const ERROR_ILLEGAL_ELEMENT_ADDRESS: DWORD = 1162;
-pub const ERROR_MAGAZINE_NOT_PRESENT: DWORD = 1163;
-pub const ERROR_DEVICE_REINITIALIZATION_NEEDED: DWORD = 1164;
-pub const ERROR_DEVICE_REQUIRES_CLEANING: DWORD = 1165;
-pub const ERROR_DEVICE_DOOR_OPEN: DWORD = 1166;
-pub const ERROR_DEVICE_NOT_CONNECTED: DWORD = 1167;
-pub const ERROR_NOT_FOUND: DWORD = 1168;
-pub const ERROR_NO_MATCH: DWORD = 1169;
-pub const ERROR_SET_NOT_FOUND: DWORD = 1170;
-pub const ERROR_POINT_NOT_FOUND: DWORD = 1171;
-pub const ERROR_NO_TRACKING_SERVICE: DWORD = 1172;
-pub const ERROR_NO_VOLUME_ID: DWORD = 1173;
-pub const ERROR_UNABLE_TO_REMOVE_REPLACED: DWORD = 1175;
-pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT: DWORD = 1176;
-pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2: DWORD = 1177;
-pub const ERROR_JOURNAL_DELETE_IN_PROGRESS: DWORD = 1178;
-pub const ERROR_JOURNAL_NOT_ACTIVE: DWORD = 1179;
-pub const ERROR_POTENTIAL_FILE_FOUND: DWORD = 1180;
-pub const ERROR_JOURNAL_ENTRY_DELETED: DWORD = 1181;
-pub const ERROR_BAD_DEVICE: DWORD = 1200;
-pub const ERROR_CONNECTION_UNAVAIL: DWORD = 1201;
-pub const ERROR_DEVICE_ALREADY_REMEMBERED: DWORD = 1202;
-pub const ERROR_NO_NET_OR_BAD_PATH: DWORD = 1203;
-pub const ERROR_BAD_PROVIDER: DWORD = 1204;
-pub const ERROR_CANNOT_OPEN_PROFILE: DWORD = 1205;
-pub const ERROR_BAD_PROFILE: DWORD = 1206;
-pub const ERROR_NOT_CONTAINER: DWORD = 1207;
-pub const ERROR_EXTENDED_ERROR: DWORD = 1208;
-pub const ERROR_INVALID_GROUPNAME: DWORD = 1209;
-pub const ERROR_INVALID_COMPUTERNAME: DWORD = 1210;
-pub const ERROR_INVALID_EVENTNAME: DWORD = 1211;
-pub const ERROR_INVALID_DOMAINNAME: DWORD = 1212;
-pub const ERROR_INVALID_SERVICENAME: DWORD = 1213;
-pub const ERROR_INVALID_NETNAME: DWORD = 1214;
-pub const ERROR_INVALID_SHARENAME: DWORD = 1215;
-pub const ERROR_INVALID_PASSWORDNAME: DWORD = 1216;
-pub const ERROR_INVALID_MESSAGENAME: DWORD = 1217;
-pub const ERROR_INVALID_MESSAGEDEST: DWORD = 1218;
-pub const ERROR_SESSION_CREDENTIAL_CONFLICT: DWORD = 1219;
-pub const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED: DWORD = 1220;
-pub const ERROR_DUP_DOMAINNAME: DWORD = 1221;
-pub const ERROR_NO_NETWORK: DWORD = 1222;
-pub const ERROR_CANCELLED: DWORD = 1223;
-pub const ERROR_USER_MAPPED_FILE: DWORD = 1224;
-pub const ERROR_CONNECTION_REFUSED: DWORD = 1225;
-pub const ERROR_GRACEFUL_DISCONNECT: DWORD = 1226;
-pub const ERROR_ADDRESS_ALREADY_ASSOCIATED: DWORD = 1227;
-pub const ERROR_ADDRESS_NOT_ASSOCIATED: DWORD = 1228;
-pub const ERROR_CONNECTION_INVALID: DWORD = 1229;
-pub const ERROR_CONNECTION_ACTIVE: DWORD = 1230;
-pub const ERROR_NETWORK_UNREACHABLE: DWORD = 1231;
-pub const ERROR_HOST_UNREACHABLE: DWORD = 1232;
-pub const ERROR_PROTOCOL_UNREACHABLE: DWORD = 1233;
-pub const ERROR_PORT_UNREACHABLE: DWORD = 1234;
-pub const ERROR_REQUEST_ABORTED: DWORD = 1235;
-pub const ERROR_CONNECTION_ABORTED: DWORD = 1236;
-pub const ERROR_RETRY: DWORD = 1237;
-pub const ERROR_CONNECTION_COUNT_LIMIT: DWORD = 1238;
-pub const ERROR_LOGIN_TIME_RESTRICTION: DWORD = 1239;
-pub const ERROR_LOGIN_WKSTA_RESTRICTION: DWORD = 1240;
-pub const ERROR_INCORRECT_ADDRESS: DWORD = 1241;
-pub const ERROR_ALREADY_REGISTERED: DWORD = 1242;
-pub const ERROR_SERVICE_NOT_FOUND: DWORD = 1243;
-pub const ERROR_NOT_AUTHENTICATED: DWORD = 1244;
-pub const ERROR_NOT_LOGGED_ON: DWORD = 1245;
-pub const ERROR_CONTINUE: DWORD = 1246;
-pub const ERROR_ALREADY_INITIALIZED: DWORD = 1247;
-pub const ERROR_NO_MORE_DEVICES: DWORD = 1248;
-pub const ERROR_NO_SUCH_SITE: DWORD = 1249;
-pub const ERROR_DOMAIN_CONTROLLER_EXISTS: DWORD = 1250;
-pub const ERROR_ONLY_IF_CONNECTED: DWORD = 1251;
-pub const ERROR_OVERRIDE_NOCHANGES: DWORD = 1252;
-pub const ERROR_BAD_USER_PROFILE: DWORD = 1253;
-pub const ERROR_NOT_SUPPORTED_ON_SBS: DWORD = 1254;
-pub const ERROR_SERVER_SHUTDOWN_IN_PROGRESS: DWORD = 1255;
-pub const ERROR_HOST_DOWN: DWORD = 1256;
-pub const ERROR_NON_ACCOUNT_SID: DWORD = 1257;
-pub const ERROR_NON_DOMAIN_SID: DWORD = 1258;
-pub const ERROR_APPHELP_BLOCK: DWORD = 1259;
-pub const ERROR_ACCESS_DISABLED_BY_POLICY: DWORD = 1260;
-pub const ERROR_REG_NAT_CONSUMPTION: DWORD = 1261;
-pub const ERROR_CSCSHARE_OFFLINE: DWORD = 1262;
-pub const ERROR_PKINIT_FAILURE: DWORD = 1263;
-pub const ERROR_SMARTCARD_SUBSYSTEM_FAILURE: DWORD = 1264;
-pub const ERROR_DOWNGRADE_DETECTED: DWORD = 1265;
-pub const ERROR_MACHINE_LOCKED: DWORD = 1271;
-pub const ERROR_CALLBACK_SUPPLIED_INVALID_DATA: DWORD = 1273;
-pub const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED: DWORD = 1274;
-pub const ERROR_DRIVER_BLOCKED: DWORD = 1275;
-pub const ERROR_INVALID_IMPORT_OF_NON_DLL: DWORD = 1276;
-pub const ERROR_ACCESS_DISABLED_WEBBLADE: DWORD = 1277;
-pub const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER: DWORD = 1278;
-pub const ERROR_RECOVERY_FAILURE: DWORD = 1279;
-pub const ERROR_ALREADY_FIBER: DWORD = 1280;
-pub const ERROR_ALREADY_THREAD: DWORD = 1281;
-pub const ERROR_STACK_BUFFER_OVERRUN: DWORD = 1282;
-pub const ERROR_PARAMETER_QUOTA_EXCEEDED: DWORD = 1283;
-pub const ERROR_DEBUGGER_INACTIVE: DWORD = 1284;
-pub const ERROR_DELAY_LOAD_FAILED: DWORD = 1285;
-pub const ERROR_VDM_DISALLOWED: DWORD = 1286;
-pub const ERROR_UNIDENTIFIED_ERROR: DWORD = 1287;
-pub const ERROR_NOT_ALL_ASSIGNED: DWORD = 1300;
-pub const ERROR_SOME_NOT_MAPPED: DWORD = 1301;
-pub const ERROR_NO_QUOTAS_FOR_ACCOUNT: DWORD = 1302;
-pub const ERROR_LOCAL_USER_SESSION_KEY: DWORD = 1303;
-pub const ERROR_NULL_LM_PASSWORD: DWORD = 1304;
-pub const ERROR_UNKNOWN_REVISION: DWORD = 1305;
-pub const ERROR_REVISION_MISMATCH: DWORD = 1306;
-pub const ERROR_INVALID_OWNER: DWORD = 1307;
-pub const ERROR_INVALID_PRIMARY_GROUP: DWORD = 1308;
-pub const ERROR_NO_IMPERSONATION_TOKEN: DWORD = 1309;
-pub const ERROR_CANT_DISABLE_MANDATORY: DWORD = 1310;
-pub const ERROR_NO_LOGON_SERVERS: DWORD = 1311;
-pub const ERROR_NO_SUCH_LOGON_SESSION: DWORD = 1312;
-pub const ERROR_NO_SUCH_PRIVILEGE: DWORD = 1313;
-pub const ERROR_PRIVILEGE_NOT_HELD: DWORD = 1314;
-pub const ERROR_INVALID_ACCOUNT_NAME: DWORD = 1315;
-pub const ERROR_USER_EXISTS: DWORD = 1316;
-pub const ERROR_NO_SUCH_USER: DWORD = 1317;
-pub const ERROR_GROUP_EXISTS: DWORD = 1318;
-pub const ERROR_NO_SUCH_GROUP: DWORD = 1319;
-pub const ERROR_MEMBER_IN_GROUP: DWORD = 1320;
-pub const ERROR_MEMBER_NOT_IN_GROUP: DWORD = 1321;
-pub const ERROR_LAST_ADMIN: DWORD = 1322;
-pub const ERROR_WRONG_PASSWORD: DWORD = 1323;
-pub const ERROR_ILL_FORMED_PASSWORD: DWORD = 1324;
-pub const ERROR_PASSWORD_RESTRICTION: DWORD = 1325;
-pub const ERROR_LOGON_FAILURE: DWORD = 1326;
-pub const ERROR_ACCOUNT_RESTRICTION: DWORD = 1327;
-pub const ERROR_INVALID_LOGON_HOURS: DWORD = 1328;
-pub const ERROR_INVALID_WORKSTATION: DWORD = 1329;
-pub const ERROR_PASSWORD_EXPIRED: DWORD = 1330;
-pub const ERROR_ACCOUNT_DISABLED: DWORD = 1331;
-pub const ERROR_NONE_MAPPED: DWORD = 1332;
-pub const ERROR_TOO_MANY_LUIDS_REQUESTED: DWORD = 1333;
-pub const ERROR_LUIDS_EXHAUSTED: DWORD = 1334;
-pub const ERROR_INVALID_SUB_AUTHORITY: DWORD = 1335;
-pub const ERROR_INVALID_ACL: DWORD = 1336;
-pub const ERROR_INVALID_SID: DWORD = 1337;
-pub const ERROR_INVALID_SECURITY_DESCR: DWORD = 1338;
-pub const ERROR_BAD_INHERITANCE_ACL: DWORD = 1340;
-pub const ERROR_SERVER_DISABLED: DWORD = 1341;
-pub const ERROR_SERVER_NOT_DISABLED: DWORD = 1342;
-pub const ERROR_INVALID_ID_AUTHORITY: DWORD = 1343;
-pub const ERROR_ALLOTTED_SPACE_EXCEEDED: DWORD = 1344;
-pub const ERROR_INVALID_GROUP_ATTRIBUTES: DWORD = 1345;
-pub const ERROR_BAD_IMPERSONATION_LEVEL: DWORD = 1346;
-pub const ERROR_CANT_OPEN_ANONYMOUS: DWORD = 1347;
-pub const ERROR_BAD_VALIDATION_CLASS: DWORD = 1348;
-pub const ERROR_BAD_TOKEN_TYPE: DWORD = 1349;
-pub const ERROR_NO_SECURITY_ON_OBJECT: DWORD = 1350;
-pub const ERROR_CANT_ACCESS_DOMAIN_INFO: DWORD = 1351;
-pub const ERROR_INVALID_SERVER_STATE: DWORD = 1352;
-pub const ERROR_INVALID_DOMAIN_STATE: DWORD = 1353;
-pub const ERROR_INVALID_DOMAIN_ROLE: DWORD = 1354;
-pub const ERROR_NO_SUCH_DOMAIN: DWORD = 1355;
-pub const ERROR_DOMAIN_EXISTS: DWORD = 1356;
-pub const ERROR_DOMAIN_LIMIT_EXCEEDED: DWORD = 1357;
-pub const ERROR_INTERNAL_DB_CORRUPTION: DWORD = 1358;
-pub const ERROR_INTERNAL_ERROR: DWORD = 1359;
-pub const ERROR_GENERIC_NOT_MAPPED: DWORD = 1360;
-pub const ERROR_BAD_DESCRIPTOR_FORMAT: DWORD = 1361;
-pub const ERROR_NOT_LOGON_PROCESS: DWORD = 1362;
-pub const ERROR_LOGON_SESSION_EXISTS: DWORD = 1363;
-pub const ERROR_NO_SUCH_PACKAGE: DWORD = 1364;
-pub const ERROR_BAD_LOGON_SESSION_STATE: DWORD = 1365;
-pub const ERROR_LOGON_SESSION_COLLISION: DWORD = 1366;
-pub const ERROR_INVALID_LOGON_TYPE: DWORD = 1367;
-pub const ERROR_CANNOT_IMPERSONATE: DWORD = 1368;
-pub const ERROR_RXACT_INVALID_STATE: DWORD = 1369;
-pub const ERROR_RXACT_COMMIT_FAILURE: DWORD = 1370;
-pub const ERROR_SPECIAL_ACCOUNT: DWORD = 1371;
-pub const ERROR_SPECIAL_GROUP: DWORD = 1372;
-pub const ERROR_SPECIAL_USER: DWORD = 1373;
-pub const ERROR_MEMBERS_PRIMARY_GROUP: DWORD = 1374;
-pub const ERROR_TOKEN_ALREADY_IN_USE: DWORD = 1375;
-pub const ERROR_NO_SUCH_ALIAS: DWORD = 1376;
-pub const ERROR_MEMBER_NOT_IN_ALIAS: DWORD = 1377;
-pub const ERROR_MEMBER_IN_ALIAS: DWORD = 1378;
-pub const ERROR_ALIAS_EXISTS: DWORD = 1379;
-pub const ERROR_LOGON_NOT_GRANTED: DWORD = 1380;
-pub const ERROR_TOO_MANY_SECRETS: DWORD = 1381;
-pub const ERROR_SECRET_TOO_LONG: DWORD = 1382;
-pub const ERROR_INTERNAL_DB_ERROR: DWORD = 1383;
-pub const ERROR_TOO_MANY_CONTEXT_IDS: DWORD = 1384;
-pub const ERROR_LOGON_TYPE_NOT_GRANTED: DWORD = 1385;
-pub const ERROR_NT_CROSS_ENCRYPTION_REQUIRED: DWORD = 1386;
-pub const ERROR_NO_SUCH_MEMBER: DWORD = 1387;
-pub const ERROR_INVALID_MEMBER: DWORD = 1388;
-pub const ERROR_TOO_MANY_SIDS: DWORD = 1389;
-pub const ERROR_LM_CROSS_ENCRYPTION_REQUIRED: DWORD = 1390;
-pub const ERROR_NO_INHERITANCE: DWORD = 1391;
-pub const ERROR_FILE_CORRUPT: DWORD = 1392;
-pub const ERROR_DISK_CORRUPT: DWORD = 1393;
-pub const ERROR_NO_USER_SESSION_KEY: DWORD = 1394;
-pub const ERROR_LICENSE_QUOTA_EXCEEDED: DWORD = 1395;
-pub const ERROR_WRONG_TARGET_NAME: DWORD = 1396;
-pub const ERROR_MUTUAL_AUTH_FAILED: DWORD = 1397;
-pub const ERROR_TIME_SKEW: DWORD = 1398;
-pub const ERROR_CURRENT_DOMAIN_NOT_ALLOWED: DWORD = 1399;
-pub const ERROR_INVALID_WINDOW_HANDLE: DWORD = 1400;
-pub const ERROR_INVALID_MENU_HANDLE: DWORD = 1401;
-pub const ERROR_INVALID_CURSOR_HANDLE: DWORD = 1402;
-pub const ERROR_INVALID_ACCEL_HANDLE: DWORD = 1403;
-pub const ERROR_INVALID_HOOK_HANDLE: DWORD = 1404;
-pub const ERROR_INVALID_DWP_HANDLE: DWORD = 1405;
-pub const ERROR_TLW_WITH_WSCHILD: DWORD = 1406;
-pub const ERROR_CANNOT_FIND_WND_CLASS: DWORD = 1407;
-pub const ERROR_WINDOW_OF_OTHER_THREAD: DWORD = 1408;
-pub const ERROR_HOTKEY_ALREADY_REGISTERED: DWORD = 1409;
-pub const ERROR_CLASS_ALREADY_EXISTS: DWORD = 1410;
-pub const ERROR_CLASS_DOES_NOT_EXIST: DWORD = 1411;
-pub const ERROR_CLASS_HAS_WINDOWS: DWORD = 1412;
-pub const ERROR_INVALID_INDEX: DWORD = 1413;
-pub const ERROR_INVALID_ICON_HANDLE: DWORD = 1414;
-pub const ERROR_PRIVATE_DIALOG_INDEX: DWORD = 1415;
-pub const ERROR_LISTBOX_ID_NOT_FOUND: DWORD = 1416;
-pub const ERROR_NO_WILDCARD_CHARACTERS: DWORD = 1417;
-pub const ERROR_CLIPBOARD_NOT_OPEN: DWORD = 1418;
-pub const ERROR_HOTKEY_NOT_REGISTERED: DWORD = 1419;
-pub const ERROR_WINDOW_NOT_DIALOG: DWORD = 1420;
-pub const ERROR_CONTROL_ID_NOT_FOUND: DWORD = 1421;
-pub const ERROR_INVALID_COMBOBOX_MESSAGE: DWORD = 1422;
-pub const ERROR_WINDOW_NOT_COMBOBOX: DWORD = 1423;
-pub const ERROR_INVALID_EDIT_HEIGHT: DWORD = 1424;
-pub const ERROR_DC_NOT_FOUND: DWORD = 1425;
-pub const ERROR_INVALID_HOOK_FILTER: DWORD = 1426;
-pub const ERROR_INVALID_FILTER_PROC: DWORD = 1427;
-pub const ERROR_HOOK_NEEDS_HMOD: DWORD = 1428;
-pub const ERROR_GLOBAL_ONLY_HOOK: DWORD = 1429;
-pub const ERROR_JOURNAL_HOOK_SET: DWORD = 1430;
-pub const ERROR_HOOK_NOT_INSTALLED: DWORD = 1431;
-pub const ERROR_INVALID_LB_MESSAGE: DWORD = 1432;
-pub const ERROR_SETCOUNT_ON_BAD_LB: DWORD = 1433;
-pub const ERROR_LB_WITHOUT_TABSTOPS: DWORD = 1434;
-pub const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD: DWORD = 1435;
-pub const ERROR_CHILD_WINDOW_MENU: DWORD = 1436;
-pub const ERROR_NO_SYSTEM_MENU: DWORD = 1437;
-pub const ERROR_INVALID_MSGBOX_STYLE: DWORD = 1438;
-pub const ERROR_INVALID_SPI_VALUE: DWORD = 1439;
-pub const ERROR_SCREEN_ALREADY_LOCKED: DWORD = 1440;
-pub const ERROR_HWNDS_HAVE_DIFF_PARENT: DWORD = 1441;
-pub const ERROR_NOT_CHILD_WINDOW: DWORD = 1442;
-pub const ERROR_INVALID_GW_COMMAND: DWORD = 1443;
-pub const ERROR_INVALID_THREAD_ID: DWORD = 1444;
-pub const ERROR_NON_MDICHILD_WINDOW: DWORD = 1445;
-pub const ERROR_POPUP_ALREADY_ACTIVE: DWORD = 1446;
-pub const ERROR_NO_SCROLLBARS: DWORD = 1447;
-pub const ERROR_INVALID_SCROLLBAR_RANGE: DWORD = 1448;
-pub const ERROR_INVALID_SHOWWIN_COMMAND: DWORD = 1449;
-pub const ERROR_NO_SYSTEM_RESOURCES: DWORD = 1450;
-pub const ERROR_NONPAGED_SYSTEM_RESOURCES: DWORD = 1451;
-pub const ERROR_PAGED_SYSTEM_RESOURCES: DWORD = 1452;
-pub const ERROR_WORKING_SET_QUOTA: DWORD = 1453;
-pub const ERROR_PAGEFILE_QUOTA: DWORD = 1454;
-pub const ERROR_COMMITMENT_LIMIT: DWORD = 1455;
-pub const ERROR_MENU_ITEM_NOT_FOUND: DWORD = 1456;
-pub const ERROR_INVALID_KEYBOARD_HANDLE: DWORD = 1457;
-pub const ERROR_HOOK_TYPE_NOT_ALLOWED: DWORD = 1458;
-pub const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION: DWORD = 1459;
-pub const ERROR_TIMEOUT: DWORD = 1460;
-pub const ERROR_INVALID_MONITOR_HANDLE: DWORD = 1461;
-pub const ERROR_INCORRECT_SIZE: DWORD = 1462;
-pub const ERROR_SYMLINK_CLASS_DISABLED: DWORD = 1463;
-pub const ERROR_SYMLINK_NOT_SUPPORTED: DWORD = 1464;
-pub const ERROR_XML_PARSE_ERROR: DWORD = 1465;
-pub const ERROR_XMLDSIG_ERROR: DWORD = 1466;
-pub const ERROR_RESTART_APPLICATION: DWORD = 1467;
-pub const ERROR_WRONG_COMPARTMENT: DWORD = 1468;
-pub const ERROR_AUTHIP_FAILURE: DWORD = 1469;
-pub const ERROR_NO_NVRAM_RESOURCES: DWORD = 1470;
-pub const ERROR_NOT_GUI_PROCESS: DWORD = 1471;
-pub const ERROR_EVENTLOG_FILE_CORRUPT: DWORD = 1500;
-pub const ERROR_EVENTLOG_CANT_START: DWORD = 1501;
-pub const ERROR_LOG_FILE_FULL: DWORD = 1502;
-pub const ERROR_EVENTLOG_FILE_CHANGED: DWORD = 1503;
-pub const ERROR_INSTALL_SERVICE_FAILURE: DWORD = 1601;
-pub const ERROR_INSTALL_USEREXIT: DWORD = 1602;
-pub const ERROR_INSTALL_FAILURE: DWORD = 1603;
-pub const ERROR_INSTALL_SUSPEND: DWORD = 1604;
-pub const ERROR_UNKNOWN_PRODUCT: DWORD = 1605;
-pub const ERROR_UNKNOWN_FEATURE: DWORD = 1606;
-pub const ERROR_UNKNOWN_COMPONENT: DWORD = 1607;
-pub const ERROR_UNKNOWN_PROPERTY: DWORD = 1608;
-pub const ERROR_INVALID_HANDLE_STATE: DWORD = 1609;
-pub const ERROR_BAD_CONFIGURATION: DWORD = 1610;
-pub const ERROR_INDEX_ABSENT: DWORD = 1611;
-pub const ERROR_INSTALL_SOURCE_ABSENT: DWORD = 1612;
-pub const ERROR_INSTALL_PACKAGE_VERSION: DWORD = 1613;
-pub const ERROR_PRODUCT_UNINSTALLED: DWORD = 1614;
-pub const ERROR_BAD_QUERY_SYNTAX: DWORD = 1615;
-pub const ERROR_INVALID_FIELD: DWORD = 1616;
-pub const ERROR_DEVICE_REMOVED: DWORD = 1617;
-pub const ERROR_INSTALL_ALREADY_RUNNING: DWORD = 1618;
-pub const ERROR_INSTALL_PACKAGE_OPEN_FAILED: DWORD = 1619;
-pub const ERROR_INSTALL_PACKAGE_INVALID: DWORD = 1620;
-pub const ERROR_INSTALL_UI_FAILURE: DWORD = 1621;
-pub const ERROR_INSTALL_LOG_FAILURE: DWORD = 1622;
-pub const ERROR_INSTALL_LANGUAGE_UNSUPPORTED: DWORD = 1623;
-pub const ERROR_INSTALL_TRANSFORM_FAILURE: DWORD = 1624;
-pub const ERROR_INSTALL_PACKAGE_REJECTED: DWORD = 1625;
-pub const ERROR_FUNCTION_NOT_CALLED: DWORD = 1626;
-pub const ERROR_FUNCTION_FAILED: DWORD = 1627;
-pub const ERROR_INVALID_TABLE: DWORD = 1628;
-pub const ERROR_DATATYPE_MISMATCH: DWORD = 1629;
-pub const ERROR_UNSUPPORTED_TYPE: DWORD = 1630;
-pub const ERROR_CREATE_FAILED: DWORD = 1631;
-pub const ERROR_INSTALL_TEMP_UNWRITABLE: DWORD = 1632;
-pub const ERROR_INSTALL_PLATFORM_UNSUPPORTED: DWORD = 1633;
-pub const ERROR_INSTALL_NOTUSED: DWORD = 1634;
-pub const ERROR_PATCH_PACKAGE_OPEN_FAILED: DWORD = 1635;
-pub const ERROR_PATCH_PACKAGE_INVALID: DWORD = 1636;
-pub const ERROR_PATCH_PACKAGE_UNSUPPORTED: DWORD = 1637;
-pub const ERROR_PRODUCT_VERSION: DWORD = 1638;
-pub const ERROR_INVALID_COMMAND_LINE: DWORD = 1639;
-pub const ERROR_INSTALL_REMOTE_DISALLOWED: DWORD = 1640;
-pub const ERROR_SUCCESS_REBOOT_INITIATED: DWORD = 1641;
-pub const ERROR_PATCH_TARGET_NOT_FOUND: DWORD = 1642;
-pub const ERROR_PATCH_PACKAGE_REJECTED: DWORD = 1643;
-pub const ERROR_INSTALL_TRANSFORM_REJECTED: DWORD = 1644;
-pub const ERROR_INSTALL_REMOTE_PROHIBITED: DWORD = 1645;
-pub const ERROR_INVALID_USER_BUFFER: DWORD = 1784;
-pub const ERROR_UNRECOGNIZED_MEDIA: DWORD = 1785;
-pub const ERROR_NO_TRUST_LSA_SECRET: DWORD = 1786;
-pub const ERROR_NO_TRUST_SAM_ACCOUNT: DWORD = 1787;
-pub const ERROR_TRUSTED_DOMAIN_FAILURE: DWORD = 1788;
-pub const ERROR_TRUSTED_RELATIONSHIP_FAILURE: DWORD = 1789;
-pub const ERROR_TRUST_FAILURE: DWORD = 1790;
-pub const ERROR_NETLOGON_NOT_STARTED: DWORD = 1792;
-pub const ERROR_ACCOUNT_EXPIRED: DWORD = 1793;
-pub const ERROR_REDIRECTOR_HAS_OPEN_HANDLES: DWORD = 1794;
-pub const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED: DWORD = 1795;
-pub const ERROR_UNKNOWN_PORT: DWORD = 1796;
-pub const ERROR_UNKNOWN_PRINTER_DRIVER: DWORD = 1797;
-pub const ERROR_UNKNOWN_PRINTPROCESSOR: DWORD = 1798;
-pub const ERROR_INVALID_SEPARATOR_FILE: DWORD = 1799;
-pub const ERROR_INVALID_PRIORITY: DWORD = 1800;
-pub const ERROR_INVALID_PRINTER_NAME: DWORD = 1801;
-pub const ERROR_PRINTER_ALREADY_EXISTS: DWORD = 1802;
-pub const ERROR_INVALID_PRINTER_COMMAND: DWORD = 1803;
-pub const ERROR_INVALID_DATATYPE: DWORD = 1804;
-pub const ERROR_INVALID_ENVIRONMENT: DWORD = 1805;
-pub const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: DWORD = 1807;
-pub const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT: DWORD = 1808;
-pub const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT: DWORD = 1809;
-pub const ERROR_DOMAIN_TRUST_INCONSISTENT: DWORD = 1810;
-pub const ERROR_SERVER_HAS_OPEN_HANDLES: DWORD = 1811;
-pub const ERROR_RESOURCE_DATA_NOT_FOUND: DWORD = 1812;
-pub const ERROR_RESOURCE_TYPE_NOT_FOUND: DWORD = 1813;
-pub const ERROR_RESOURCE_NAME_NOT_FOUND: DWORD = 1814;
-pub const ERROR_RESOURCE_LANG_NOT_FOUND: DWORD = 1815;
-pub const ERROR_NOT_ENOUGH_QUOTA: DWORD = 1816;
-pub const ERROR_INVALID_TIME: DWORD = 1901;
-pub const ERROR_INVALID_FORM_NAME: DWORD = 1902;
-pub const ERROR_INVALID_FORM_SIZE: DWORD = 1903;
-pub const ERROR_ALREADY_WAITING: DWORD = 1904;
-pub const ERROR_PRINTER_DELETED: DWORD = 1905;
-pub const ERROR_INVALID_PRINTER_STATE: DWORD = 1906;
-pub const ERROR_PASSWORD_MUST_CHANGE: DWORD = 1907;
-pub const ERROR_DOMAIN_CONTROLLER_NOT_FOUND: DWORD = 1908;
-pub const ERROR_ACCOUNT_LOCKED_OUT: DWORD = 1909;
-pub const ERROR_NO_SITENAME: DWORD = 1919;
-pub const ERROR_CANT_ACCESS_FILE: DWORD = 1920;
-pub const ERROR_CANT_RESOLVE_FILENAME: DWORD = 1921;
-pub const ERROR_KM_DRIVER_BLOCKED: DWORD = 1930;
-pub const ERROR_CONTEXT_EXPIRED: DWORD = 1931;
-pub const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED: DWORD = 1932;
-pub const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED: DWORD = 1933;
-pub const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED: DWORD = 1934;
-pub const ERROR_AUTHENTICATION_FIREWALL_FAILED: DWORD = 1935;
-pub const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED: DWORD = 1936;
-pub const ERROR_INVALID_PIXEL_FORMAT: DWORD = 2000;
-pub const ERROR_BAD_DRIVER: DWORD = 2001;
-pub const ERROR_INVALID_WINDOW_STYLE: DWORD = 2002;
-pub const ERROR_METAFILE_NOT_SUPPORTED: DWORD = 2003;
-pub const ERROR_TRANSFORM_NOT_SUPPORTED: DWORD = 2004;
-pub const ERROR_CLIPPING_NOT_SUPPORTED: DWORD = 2005;
-pub const ERROR_INVALID_CMM: DWORD = 2010;
-pub const ERROR_INVALID_PROFILE: DWORD = 2011;
-pub const ERROR_TAG_NOT_FOUND: DWORD = 2012;
-pub const ERROR_TAG_NOT_PRESENT: DWORD = 2013;
-pub const ERROR_DUPLICATE_TAG: DWORD = 2014;
-pub const ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE: DWORD = 2015;
-pub const ERROR_PROFILE_NOT_FOUND: DWORD = 2016;
-pub const ERROR_INVALID_COLORSPACE: DWORD = 2017;
-pub const ERROR_ICM_NOT_ENABLED: DWORD = 2018;
-pub const ERROR_DELETING_ICM_XFORM: DWORD = 2019;
-pub const ERROR_INVALID_TRANSFORM: DWORD = 2020;
-pub const ERROR_COLORSPACE_MISMATCH: DWORD = 2021;
-pub const ERROR_INVALID_COLORINDEX: DWORD = 2022;
-pub const ERROR_CONNECTED_OTHER_PASSWORD: DWORD = 2108;
-pub const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT: DWORD = 2109;
-pub const ERROR_BAD_USERNAME: DWORD = 2202;
-pub const ERROR_NOT_CONNECTED: DWORD = 2250;
-pub const ERROR_OPEN_FILES: DWORD = 2401;
-pub const ERROR_ACTIVE_CONNECTIONS: DWORD = 2402;
-pub const ERROR_DEVICE_IN_USE: DWORD = 2404;
-pub const ERROR_UNKNOWN_PRINT_MONITOR: DWORD = 3000;
-pub const ERROR_PRINTER_DRIVER_IN_USE: DWORD = 3001;
-pub const ERROR_SPOOL_FILE_NOT_FOUND: DWORD = 3002;
-pub const ERROR_SPL_NO_STARTDOC: DWORD = 3003;
-pub const ERROR_SPL_NO_ADDJOB: DWORD = 3004;
-pub const ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED: DWORD = 3005;
-pub const ERROR_PRINT_MONITOR_ALREADY_INSTALLED: DWORD = 3006;
-pub const ERROR_INVALID_PRINT_MONITOR: DWORD = 3007;
-pub const ERROR_PRINT_MONITOR_IN_USE: DWORD = 3008;
-pub const ERROR_PRINTER_HAS_JOBS_QUEUED: DWORD = 3009;
-pub const ERROR_SUCCESS_REBOOT_REQUIRED: DWORD = 3010;
-pub const ERROR_SUCCESS_RESTART_REQUIRED: DWORD = 3011;
-pub const ERROR_PRINTER_NOT_FOUND: DWORD = 3012;
-pub const ERROR_PRINTER_DRIVER_WARNED: DWORD = 3013;
-pub const ERROR_PRINTER_DRIVER_BLOCKED: DWORD = 3014;
-pub const ERROR_WINS_INTERNAL: DWORD = 4000;
-pub const ERROR_CAN_NOT_DEL_LOCAL_WINS: DWORD = 4001;
-pub const ERROR_STATIC_INIT: DWORD = 4002;
-pub const ERROR_INC_BACKUP: DWORD = 4003;
-pub const ERROR_FULL_BACKUP: DWORD = 4004;
-pub const ERROR_REC_NON_EXISTENT: DWORD = 4005;
-pub const ERROR_RPL_NOT_ALLOWED: DWORD = 4006;
-pub const ERROR_DHCP_ADDRESS_CONFLICT: DWORD = 4100;
-pub const ERROR_WMI_GUID_NOT_FOUND: DWORD = 4200;
-pub const ERROR_WMI_INSTANCE_NOT_FOUND: DWORD = 4201;
-pub const ERROR_WMI_ITEMID_NOT_FOUND: DWORD = 4202;
-pub const ERROR_WMI_TRY_AGAIN: DWORD = 4203;
-pub const ERROR_WMI_DP_NOT_FOUND: DWORD = 4204;
-pub const ERROR_WMI_UNRESOLVED_INSTANCE_REF: DWORD = 4205;
-pub const ERROR_WMI_ALREADY_ENABLED: DWORD = 4206;
-pub const ERROR_WMI_GUID_DISCONNECTED: DWORD = 4207;
-pub const ERROR_WMI_SERVER_UNAVAILABLE: DWORD = 4208;
-pub const ERROR_WMI_DP_FAILED: DWORD = 4209;
-pub const ERROR_WMI_INVALID_MOF: DWORD = 4210;
-pub const ERROR_WMI_INVALID_REGINFO: DWORD = 4211;
-pub const ERROR_WMI_ALREADY_DISABLED: DWORD = 4212;
-pub const ERROR_WMI_READ_ONLY: DWORD = 4213;
-pub const ERROR_WMI_SET_FAILURE: DWORD = 4214;
-pub const ERROR_INVALID_MEDIA: DWORD = 4300;
-pub const ERROR_INVALID_LIBRARY: DWORD = 4301;
-pub const ERROR_INVALID_MEDIA_POOL: DWORD = 4302;
-pub const ERROR_DRIVE_MEDIA_MISMATCH: DWORD = 4303;
-pub const ERROR_MEDIA_OFFLINE: DWORD = 4304;
-pub const ERROR_LIBRARY_OFFLINE: DWORD = 4305;
-pub const ERROR_EMPTY: DWORD = 4306;
-pub const ERROR_NOT_EMPTY: DWORD = 4307;
-pub const ERROR_MEDIA_UNAVAILABLE: DWORD = 4308;
-pub const ERROR_RESOURCE_DISABLED: DWORD = 4309;
-pub const ERROR_INVALID_CLEANER: DWORD = 4310;
-pub const ERROR_UNABLE_TO_CLEAN: DWORD = 4311;
-pub const ERROR_OBJECT_NOT_FOUND: DWORD = 4312;
-pub const ERROR_DATABASE_FAILURE: DWORD = 4313;
-pub const ERROR_DATABASE_FULL: DWORD = 4314;
-pub const ERROR_MEDIA_INCOMPATIBLE: DWORD = 4315;
-pub const ERROR_RESOURCE_NOT_PRESENT: DWORD = 4316;
-pub const ERROR_INVALID_OPERATION: DWORD = 4317;
-pub const ERROR_MEDIA_NOT_AVAILABLE: DWORD = 4318;
-pub const ERROR_DEVICE_NOT_AVAILABLE: DWORD = 4319;
-pub const ERROR_REQUEST_REFUSED: DWORD = 4320;
-pub const ERROR_INVALID_DRIVE_OBJECT: DWORD = 4321;
-pub const ERROR_LIBRARY_FULL: DWORD = 4322;
-pub const ERROR_MEDIUM_NOT_ACCESSIBLE: DWORD = 4323;
-pub const ERROR_UNABLE_TO_LOAD_MEDIUM: DWORD = 4324;
-pub const ERROR_UNABLE_TO_INVENTORY_DRIVE: DWORD = 4325;
-pub const ERROR_UNABLE_TO_INVENTORY_SLOT: DWORD = 4326;
-pub const ERROR_UNABLE_TO_INVENTORY_TRANSPORT: DWORD = 4327;
-pub const ERROR_TRANSPORT_FULL: DWORD = 4328;
-pub const ERROR_CONTROLLING_IEPORT: DWORD = 4329;
-pub const ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA: DWORD = 4330;
-pub const ERROR_CLEANER_SLOT_SET: DWORD = 4331;
-pub const ERROR_CLEANER_SLOT_NOT_SET: DWORD = 4332;
-pub const ERROR_CLEANER_CARTRIDGE_SPENT: DWORD = 4333;
-pub const ERROR_UNEXPECTED_OMID: DWORD = 4334;
-pub const ERROR_CANT_DELETE_LAST_ITEM: DWORD = 4335;
-pub const ERROR_MESSAGE_EXCEEDS_MAX_SIZE: DWORD = 4336;
-pub const ERROR_VOLUME_CONTAINS_SYS_FILES: DWORD = 4337;
-pub const ERROR_INDIGENOUS_TYPE: DWORD = 4338;
-pub const ERROR_NO_SUPPORTING_DRIVES: DWORD = 4339;
-pub const ERROR_CLEANER_CARTRIDGE_INSTALLED: DWORD = 4340;
-pub const ERROR_IEPORT_FULL: DWORD = 4341;
-pub const ERROR_FILE_OFFLINE: DWORD = 4350;
-pub const ERROR_REMOTE_STORAGE_NOT_ACTIVE: DWORD = 4351;
-pub const ERROR_REMOTE_STORAGE_MEDIA_ERROR: DWORD = 4352;
-pub const ERROR_NOT_A_REPARSE_POINT: DWORD = 4390;
-pub const ERROR_REPARSE_ATTRIBUTE_CONFLICT: DWORD = 4391;
-pub const ERROR_INVALID_REPARSE_DATA: DWORD = 4392;
-pub const ERROR_REPARSE_TAG_INVALID: DWORD = 4393;
-pub const ERROR_REPARSE_TAG_MISMATCH: DWORD = 4394;
-pub const ERROR_VOLUME_NOT_SIS_ENABLED: DWORD = 4500;
-pub const ERROR_DEPENDENT_RESOURCE_EXISTS: DWORD = 5001;
-pub const ERROR_DEPENDENCY_NOT_FOUND: DWORD = 5002;
-pub const ERROR_DEPENDENCY_ALREADY_EXISTS: DWORD = 5003;
-pub const ERROR_RESOURCE_NOT_ONLINE: DWORD = 5004;
-pub const ERROR_HOST_NODE_NOT_AVAILABLE: DWORD = 5005;
-pub const ERROR_RESOURCE_NOT_AVAILABLE: DWORD = 5006;
-pub const ERROR_RESOURCE_NOT_FOUND: DWORD = 5007;
-pub const ERROR_SHUTDOWN_CLUSTER: DWORD = 5008;
-pub const ERROR_CANT_EVICT_ACTIVE_NODE: DWORD = 5009;
-pub const ERROR_OBJECT_ALREADY_EXISTS: DWORD = 5010;
-pub const ERROR_OBJECT_IN_LIST: DWORD = 5011;
-pub const ERROR_GROUP_NOT_AVAILABLE: DWORD = 5012;
-pub const ERROR_GROUP_NOT_FOUND: DWORD = 5013;
-pub const ERROR_GROUP_NOT_ONLINE: DWORD = 5014;
-pub const ERROR_HOST_NODE_NOT_RESOURCE_OWNER: DWORD = 5015;
-pub const ERROR_HOST_NODE_NOT_GROUP_OWNER: DWORD = 5016;
-pub const ERROR_RESMON_CREATE_FAILED: DWORD = 5017;
-pub const ERROR_RESMON_ONLINE_FAILED: DWORD = 5018;
-pub const ERROR_RESOURCE_ONLINE: DWORD = 5019;
-pub const ERROR_QUORUM_RESOURCE: DWORD = 5020;
-pub const ERROR_NOT_QUORUM_CAPABLE: DWORD = 5021;
-pub const ERROR_CLUSTER_SHUTTING_DOWN: DWORD = 5022;
-pub const ERROR_INVALID_STATE: DWORD = 5023;
-pub const ERROR_RESOURCE_PROPERTIES_STORED: DWORD = 5024;
-pub const ERROR_NOT_QUORUM_CLASS: DWORD = 5025;
-pub const ERROR_CORE_RESOURCE: DWORD = 5026;
-pub const ERROR_QUORUM_RESOURCE_ONLINE_FAILED: DWORD = 5027;
-pub const ERROR_QUORUMLOG_OPEN_FAILED: DWORD = 5028;
-pub const ERROR_CLUSTERLOG_CORRUPT: DWORD = 5029;
-pub const ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE: DWORD = 5030;
-pub const ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE: DWORD = 5031;
-pub const ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND: DWORD = 5032;
-pub const ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE: DWORD = 5033;
-pub const ERROR_QUORUM_OWNER_ALIVE: DWORD = 5034;
-pub const ERROR_NETWORK_NOT_AVAILABLE: DWORD = 5035;
-pub const ERROR_NODE_NOT_AVAILABLE: DWORD = 5036;
-pub const ERROR_ALL_NODES_NOT_AVAILABLE: DWORD = 5037;
-pub const ERROR_RESOURCE_FAILED: DWORD = 5038;
-pub const ERROR_CLUSTER_INVALID_NODE: DWORD = 5039;
-pub const ERROR_CLUSTER_NODE_EXISTS: DWORD = 5040;
-pub const ERROR_CLUSTER_JOIN_IN_PROGRESS: DWORD = 5041;
-pub const ERROR_CLUSTER_NODE_NOT_FOUND: DWORD = 5042;
-pub const ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND: DWORD = 5043;
-pub const ERROR_CLUSTER_NETWORK_EXISTS: DWORD = 5044;
-pub const ERROR_CLUSTER_NETWORK_NOT_FOUND: DWORD = 5045;
-pub const ERROR_CLUSTER_NETINTERFACE_EXISTS: DWORD = 5046;
-pub const ERROR_CLUSTER_NETINTERFACE_NOT_FOUND: DWORD = 5047;
-pub const ERROR_CLUSTER_INVALID_REQUEST: DWORD = 5048;
-pub const ERROR_CLUSTER_INVALID_NETWORK_PROVIDER: DWORD = 5049;
-pub const ERROR_CLUSTER_NODE_DOWN: DWORD = 5050;
-pub const ERROR_CLUSTER_NODE_UNREACHABLE: DWORD = 5051;
-pub const ERROR_CLUSTER_NODE_NOT_MEMBER: DWORD = 5052;
-pub const ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS: DWORD = 5053;
-pub const ERROR_CLUSTER_INVALID_NETWORK: DWORD = 5054;
-pub const ERROR_CLUSTER_NODE_UP: DWORD = 5056;
-pub const ERROR_CLUSTER_IPADDR_IN_USE: DWORD = 5057;
-pub const ERROR_CLUSTER_NODE_NOT_PAUSED: DWORD = 5058;
-pub const ERROR_CLUSTER_NO_SECURITY_CONTEXT: DWORD = 5059;
-pub const ERROR_CLUSTER_NETWORK_NOT_INTERNAL: DWORD = 5060;
-pub const ERROR_CLUSTER_NODE_ALREADY_UP: DWORD = 5061;
-pub const ERROR_CLUSTER_NODE_ALREADY_DOWN: DWORD = 5062;
-pub const ERROR_CLUSTER_NETWORK_ALREADY_ONLINE: DWORD = 5063;
-pub const ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE: DWORD = 5064;
-pub const ERROR_CLUSTER_NODE_ALREADY_MEMBER: DWORD = 5065;
-pub const ERROR_CLUSTER_LAST_INTERNAL_NETWORK: DWORD = 5066;
-pub const ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS: DWORD = 5067;
-pub const ERROR_INVALID_OPERATION_ON_QUORUM: DWORD = 5068;
-pub const ERROR_DEPENDENCY_NOT_ALLOWED: DWORD = 5069;
-pub const ERROR_CLUSTER_NODE_PAUSED: DWORD = 5070;
-pub const ERROR_NODE_CANT_HOST_RESOURCE: DWORD = 5071;
-pub const ERROR_CLUSTER_NODE_NOT_READY: DWORD = 5072;
-pub const ERROR_CLUSTER_NODE_SHUTTING_DOWN: DWORD = 5073;
-pub const ERROR_CLUSTER_JOIN_ABORTED: DWORD = 5074;
-pub const ERROR_CLUSTER_INCOMPATIBLE_VERSIONS: DWORD = 5075;
-pub const ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED: DWORD = 5076;
-pub const ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED: DWORD = 5077;
-pub const ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND: DWORD = 5078;
-pub const ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED: DWORD = 5079;
-pub const ERROR_CLUSTER_RESNAME_NOT_FOUND: DWORD = 5080;
-pub const ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED: DWORD = 5081;
-pub const ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST: DWORD = 5082;
-pub const ERROR_CLUSTER_DATABASE_SEQMISMATCH: DWORD = 5083;
-pub const ERROR_RESMON_INVALID_STATE: DWORD = 5084;
-pub const ERROR_CLUSTER_GUM_NOT_LOCKER: DWORD = 5085;
-pub const ERROR_QUORUM_DISK_NOT_FOUND: DWORD = 5086;
-pub const ERROR_DATABASE_BACKUP_CORRUPT: DWORD = 5087;
-pub const ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT: DWORD = 5088;
-pub const ERROR_RESOURCE_PROPERTY_UNCHANGEABLE: DWORD = 5089;
-pub const ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE: DWORD = 5890;
-pub const ERROR_CLUSTER_QUORUMLOG_NOT_FOUND: DWORD = 5891;
-pub const ERROR_CLUSTER_MEMBERSHIP_HALT: DWORD = 5892;
-pub const ERROR_CLUSTER_INSTANCE_ID_MISMATCH: DWORD = 5893;
-pub const ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP: DWORD = 5894;
-pub const ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH: DWORD = 5895;
-pub const ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP: DWORD = 5896;
-pub const ERROR_CLUSTER_PARAMETER_MISMATCH: DWORD = 5897;
-pub const ERROR_NODE_CANNOT_BE_CLUSTERED: DWORD = 5898;
-pub const ERROR_CLUSTER_WRONG_OS_VERSION: DWORD = 5899;
-pub const ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME: DWORD = 5900;
-pub const ERROR_CLUSCFG_ALREADY_COMMITTED: DWORD = 5901;
-pub const ERROR_CLUSCFG_ROLLBACK_FAILED: DWORD = 5902;
-pub const ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT: DWORD = 5903;
-pub const ERROR_CLUSTER_OLD_VERSION: DWORD = 5904;
-pub const ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME: DWORD = 5905;
-pub const ERROR_ENCRYPTION_FAILED: DWORD = 6000;
-pub const ERROR_DECRYPTION_FAILED: DWORD = 6001;
-pub const ERROR_FILE_ENCRYPTED: DWORD = 6002;
-pub const ERROR_NO_RECOVERY_POLICY: DWORD = 6003;
-pub const ERROR_NO_EFS: DWORD = 6004;
-pub const ERROR_WRONG_EFS: DWORD = 6005;
-pub const ERROR_NO_USER_KEYS: DWORD = 6006;
-pub const ERROR_FILE_NOT_ENCRYPTED: DWORD = 6007;
-pub const ERROR_NOT_EXPORT_FORMAT: DWORD = 6008;
-pub const ERROR_FILE_READ_ONLY: DWORD = 6009;
-pub const ERROR_DIR_EFS_DISALLOWED: DWORD = 6010;
-pub const ERROR_EFS_SERVER_NOT_TRUSTED: DWORD = 6011;
-pub const ERROR_BAD_RECOVERY_POLICY: DWORD = 6012;
-pub const ERROR_EFS_ALG_BLOB_TOO_BIG: DWORD = 6013;
-pub const ERROR_VOLUME_NOT_SUPPORT_EFS: DWORD = 6014;
-pub const ERROR_EFS_DISABLED: DWORD = 6015;
-pub const ERROR_EFS_VERSION_NOT_SUPPORT: DWORD = 6016;
-pub const ERROR_NO_BROWSER_SERVERS_FOUND: DWORD = 6118;
-pub const ERROR_CTX_WINSTATION_NAME_INVALID: DWORD = 7001;
-pub const ERROR_CTX_INVALID_PD: DWORD = 7002;
-pub const ERROR_CTX_PD_NOT_FOUND: DWORD = 7003;
-pub const ERROR_CTX_WD_NOT_FOUND: DWORD = 7004;
-pub const ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY: DWORD = 7005;
-pub const ERROR_CTX_SERVICE_NAME_COLLISION: DWORD = 7006;
-pub const ERROR_CTX_CLOSE_PENDING: DWORD = 7007;
-pub const ERROR_CTX_NO_OUTBUF: DWORD = 7008;
-pub const ERROR_CTX_MODEM_INF_NOT_FOUND: DWORD = 7009;
-pub const ERROR_CTX_INVALID_MODEMNAME: DWORD = 7010;
-pub const ERROR_CTX_MODEM_RESPONSE_ERROR: DWORD = 7011;
-pub const ERROR_CTX_MODEM_RESPONSE_TIMEOUT: DWORD = 7012;
-pub const ERROR_CTX_MODEM_RESPONSE_NO_CARRIER: DWORD = 7013;
-pub const ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE: DWORD = 7014;
-pub const ERROR_CTX_MODEM_RESPONSE_BUSY: DWORD = 7015;
-pub const ERROR_CTX_MODEM_RESPONSE_VOICE: DWORD = 7016;
-pub const ERROR_CTX_TD_ERROR: DWORD = 7017;
-pub const ERROR_CTX_WINSTATION_NOT_FOUND: DWORD = 7022;
-pub const ERROR_CTX_WINSTATION_ALREADY_EXISTS: DWORD = 7023;
-pub const ERROR_CTX_WINSTATION_BUSY: DWORD = 7024;
-pub const ERROR_CTX_BAD_VIDEO_MODE: DWORD = 7025;
-pub const ERROR_CTX_GRAPHICS_INVALID: DWORD = 7035;
-pub const ERROR_CTX_LOGON_DISABLED: DWORD = 7037;
-pub const ERROR_CTX_NOT_CONSOLE: DWORD = 7038;
-pub const ERROR_CTX_CLIENT_QUERY_TIMEOUT: DWORD = 7040;
-pub const ERROR_CTX_CONSOLE_DISCONNECT: DWORD = 7041;
-pub const ERROR_CTX_CONSOLE_CONNECT: DWORD = 7042;
-pub const ERROR_CTX_SHADOW_DENIED: DWORD = 7044;
-pub const ERROR_CTX_WINSTATION_ACCESS_DENIED: DWORD = 7045;
-pub const ERROR_CTX_INVALID_WD: DWORD = 7049;
-pub const ERROR_CTX_SHADOW_INVALID: DWORD = 7050;
-pub const ERROR_CTX_SHADOW_DISABLED: DWORD = 7051;
-pub const ERROR_CTX_CLIENT_LICENSE_IN_USE: DWORD = 7052;
-pub const ERROR_CTX_CLIENT_LICENSE_NOT_SET: DWORD = 7053;
-pub const ERROR_CTX_LICENSE_NOT_AVAILABLE: DWORD = 7054;
-pub const ERROR_CTX_LICENSE_CLIENT_INVALID: DWORD = 7055;
-pub const ERROR_CTX_LICENSE_EXPIRED: DWORD = 7056;
-pub const ERROR_CTX_SHADOW_NOT_RUNNING: DWORD = 7057;
-pub const ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE: DWORD = 7058;
-pub const ERROR_ACTIVATION_COUNT_EXCEEDED: DWORD = 7059;
-pub const ERROR_DS_NOT_INSTALLED: DWORD = 8200;
-pub const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY: DWORD = 8201;
-pub const ERROR_DS_NO_ATTRIBUTE_OR_VALUE: DWORD = 8202;
-pub const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX: DWORD = 8203;
-pub const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED: DWORD = 8204;
-pub const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS: DWORD = 8205;
-pub const ERROR_DS_BUSY: DWORD = 8206;
-pub const ERROR_DS_UNAVAILABLE: DWORD = 8207;
-pub const ERROR_DS_NO_RIDS_ALLOCATED: DWORD = 8208;
-pub const ERROR_DS_NO_MORE_RIDS: DWORD = 8209;
-pub const ERROR_DS_INCORRECT_ROLE_OWNER: DWORD = 8210;
-pub const ERROR_DS_RIDMGR_INIT_ERROR: DWORD = 8211;
-pub const ERROR_DS_OBJ_CLASS_VIOLATION: DWORD = 8212;
-pub const ERROR_DS_CANT_ON_NON_LEAF: DWORD = 8213;
-pub const ERROR_DS_CANT_ON_RDN: DWORD = 8214;
-pub const ERROR_DS_CANT_MOD_OBJ_CLASS: DWORD = 8215;
-pub const ERROR_DS_CROSS_DOM_MOVE_ERROR: DWORD = 8216;
-pub const ERROR_DS_GC_NOT_AVAILABLE: DWORD = 8217;
-pub const ERROR_SHARED_POLICY: DWORD = 8218;
-pub const ERROR_POLICY_OBJECT_NOT_FOUND: DWORD = 8219;
-pub const ERROR_POLICY_ONLY_IN_DS: DWORD = 8220;
-pub const ERROR_PROMOTION_ACTIVE: DWORD = 8221;
-pub const ERROR_NO_PROMOTION_ACTIVE: DWORD = 8222;
-pub const ERROR_DS_OPERATIONS_ERROR: DWORD = 8224;
-pub const ERROR_DS_PROTOCOL_ERROR: DWORD = 8225;
-pub const ERROR_DS_TIMELIMIT_EXCEEDED: DWORD = 8226;
-pub const ERROR_DS_SIZELIMIT_EXCEEDED: DWORD = 8227;
-pub const ERROR_DS_ADMIN_LIMIT_EXCEEDED: DWORD = 8228;
-pub const ERROR_DS_COMPARE_FALSE: DWORD = 8229;
-pub const ERROR_DS_COMPARE_TRUE: DWORD = 8230;
-pub const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED: DWORD = 8231;
-pub const ERROR_DS_STRONG_AUTH_REQUIRED: DWORD = 8232;
-pub const ERROR_DS_INAPPROPRIATE_AUTH: DWORD = 8233;
-pub const ERROR_DS_AUTH_UNKNOWN: DWORD = 8234;
-pub const ERROR_DS_REFERRAL: DWORD = 8235;
-pub const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION: DWORD = 8236;
-pub const ERROR_DS_CONFIDENTIALITY_REQUIRED: DWORD = 8237;
-pub const ERROR_DS_INAPPROPRIATE_MATCHING: DWORD = 8238;
-pub const ERROR_DS_CONSTRAINT_VIOLATION: DWORD = 8239;
-pub const ERROR_DS_NO_SUCH_OBJECT: DWORD = 8240;
-pub const ERROR_DS_ALIAS_PROBLEM: DWORD = 8241;
-pub const ERROR_DS_INVALID_DN_SYNTAX: DWORD = 8242;
-pub const ERROR_DS_IS_LEAF: DWORD = 8243;
-pub const ERROR_DS_ALIAS_DEREF_PROBLEM: DWORD = 8244;
-pub const ERROR_DS_UNWILLING_TO_PERFORM: DWORD = 8245;
-pub const ERROR_DS_LOOP_DETECT: DWORD = 8246;
-pub const ERROR_DS_NAMING_VIOLATION: DWORD = 8247;
-pub const ERROR_DS_OBJECT_RESULTS_TOO_LARGE: DWORD = 8248;
-pub const ERROR_DS_AFFECTS_MULTIPLE_DSAS: DWORD = 8249;
-pub const ERROR_DS_SERVER_DOWN: DWORD = 8250;
-pub const ERROR_DS_LOCAL_ERROR: DWORD = 8251;
-pub const ERROR_DS_ENCODING_ERROR: DWORD = 8252;
-pub const ERROR_DS_DECODING_ERROR: DWORD = 8253;
-pub const ERROR_DS_FILTER_UNKNOWN: DWORD = 8254;
-pub const ERROR_DS_PARAM_ERROR: DWORD = 8255;
-pub const ERROR_DS_NOT_SUPPORTED: DWORD = 8256;
-pub const ERROR_DS_NO_RESULTS_RETURNED: DWORD = 8257;
-pub const ERROR_DS_CONTROL_NOT_FOUND: DWORD = 8258;
-pub const ERROR_DS_CLIENT_LOOP: DWORD = 8259;
-pub const ERROR_DS_REFERRAL_LIMIT_EXCEEDED: DWORD = 8260;
-pub const ERROR_DS_SORT_CONTROL_MISSING: DWORD = 8261;
-pub const ERROR_DS_OFFSET_RANGE_ERROR: DWORD = 8262;
-pub const ERROR_DS_ROOT_MUST_BE_NC: DWORD = 8301;
-pub const ERROR_DS_ADD_REPLICA_INHIBITED: DWORD = 8302;
-pub const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA: DWORD = 8303;
-pub const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED: DWORD = 8304;
-pub const ERROR_DS_OBJ_STRING_NAME_EXISTS: DWORD = 8305;
-pub const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA: DWORD = 8306;
-pub const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA: DWORD = 8307;
-pub const ERROR_DS_NO_REQUESTED_ATTS_FOUND: DWORD = 8308;
-pub const ERROR_DS_USER_BUFFER_TO_SMALL: DWORD = 8309;
-pub const ERROR_DS_ATT_IS_NOT_ON_OBJ: DWORD = 8310;
-pub const ERROR_DS_ILLEGAL_MOD_OPERATION: DWORD = 8311;
-pub const ERROR_DS_OBJ_TOO_LARGE: DWORD = 8312;
-pub const ERROR_DS_BAD_INSTANCE_TYPE: DWORD = 8313;
-pub const ERROR_DS_MASTERDSA_REQUIRED: DWORD = 8314;
-pub const ERROR_DS_OBJECT_CLASS_REQUIRED: DWORD = 8315;
-pub const ERROR_DS_MISSING_REQUIRED_ATT: DWORD = 8316;
-pub const ERROR_DS_ATT_NOT_DEF_FOR_CLASS: DWORD = 8317;
-pub const ERROR_DS_ATT_ALREADY_EXISTS: DWORD = 8318;
-pub const ERROR_DS_CANT_ADD_ATT_VALUES: DWORD = 8320;
-pub const ERROR_DS_SINGLE_VALUE_CONSTRAINT: DWORD = 8321;
-pub const ERROR_DS_RANGE_CONSTRAINT: DWORD = 8322;
-pub const ERROR_DS_ATT_VAL_ALREADY_EXISTS: DWORD = 8323;
-pub const ERROR_DS_CANT_REM_MISSING_ATT: DWORD = 8324;
-pub const ERROR_DS_CANT_REM_MISSING_ATT_VAL: DWORD = 8325;
-pub const ERROR_DS_ROOT_CANT_BE_SUBREF: DWORD = 8326;
-pub const ERROR_DS_NO_CHAINING: DWORD = 8327;
-pub const ERROR_DS_NO_CHAINED_EVAL: DWORD = 8328;
-pub const ERROR_DS_NO_PARENT_OBJECT: DWORD = 8329;
-pub const ERROR_DS_PARENT_IS_AN_ALIAS: DWORD = 8330;
-pub const ERROR_DS_CANT_MIX_MASTER_AND_REPS: DWORD = 8331;
-pub const ERROR_DS_CHILDREN_EXIST: DWORD = 8332;
-pub const ERROR_DS_OBJ_NOT_FOUND: DWORD = 8333;
-pub const ERROR_DS_ALIASED_OBJ_MISSING: DWORD = 8334;
-pub const ERROR_DS_BAD_NAME_SYNTAX: DWORD = 8335;
-pub const ERROR_DS_ALIAS_POINTS_TO_ALIAS: DWORD = 8336;
-pub const ERROR_DS_CANT_DEREF_ALIAS: DWORD = 8337;
-pub const ERROR_DS_OUT_OF_SCOPE: DWORD = 8338;
-pub const ERROR_DS_OBJECT_BEING_REMOVED: DWORD = 8339;
-pub const ERROR_DS_CANT_DELETE_DSA_OBJ: DWORD = 8340;
-pub const ERROR_DS_GENERIC_ERROR: DWORD = 8341;
-pub const ERROR_DS_DSA_MUST_BE_INT_MASTER: DWORD = 8342;
-pub const ERROR_DS_CLASS_NOT_DSA: DWORD = 8343;
-pub const ERROR_DS_INSUFF_ACCESS_RIGHTS: DWORD = 8344;
-pub const ERROR_DS_ILLEGAL_SUPERIOR: DWORD = 8345;
-pub const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM: DWORD = 8346;
-pub const ERROR_DS_NAME_TOO_MANY_PARTS: DWORD = 8347;
-pub const ERROR_DS_NAME_TOO_LONG: DWORD = 8348;
-pub const ERROR_DS_NAME_VALUE_TOO_LONG: DWORD = 8349;
-pub const ERROR_DS_NAME_UNPARSEABLE: DWORD = 8350;
-pub const ERROR_DS_NAME_TYPE_UNKNOWN: DWORD = 8351;
-pub const ERROR_DS_NOT_AN_OBJECT: DWORD = 8352;
-pub const ERROR_DS_SEC_DESC_TOO_SHORT: DWORD = 8353;
-pub const ERROR_DS_SEC_DESC_INVALID: DWORD = 8354;
-pub const ERROR_DS_NO_DELETED_NAME: DWORD = 8355;
-pub const ERROR_DS_SUBREF_MUST_HAVE_PARENT: DWORD = 8356;
-pub const ERROR_DS_NCNAME_MUST_BE_NC: DWORD = 8357;
-pub const ERROR_DS_CANT_ADD_SYSTEM_ONLY: DWORD = 8358;
-pub const ERROR_DS_CLASS_MUST_BE_CONCRETE: DWORD = 8359;
-pub const ERROR_DS_INVALID_DMD: DWORD = 8360;
-pub const ERROR_DS_OBJ_GUID_EXISTS: DWORD = 8361;
-pub const ERROR_DS_NOT_ON_BACKLINK: DWORD = 8362;
-pub const ERROR_DS_NO_CROSSREF_FOR_NC: DWORD = 8363;
-pub const ERROR_DS_SHUTTING_DOWN: DWORD = 8364;
-pub const ERROR_DS_UNKNOWN_OPERATION: DWORD = 8365;
-pub const ERROR_DS_INVALID_ROLE_OWNER: DWORD = 8366;
-pub const ERROR_DS_COULDNT_CONTACT_FSMO: DWORD = 8367;
-pub const ERROR_DS_CROSS_NC_DN_RENAME: DWORD = 8368;
-pub const ERROR_DS_CANT_MOD_SYSTEM_ONLY: DWORD = 8369;
-pub const ERROR_DS_REPLICATOR_ONLY: DWORD = 8370;
-pub const ERROR_DS_OBJ_CLASS_NOT_DEFINED: DWORD = 8371;
-pub const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS: DWORD = 8372;
-pub const ERROR_DS_NAME_REFERENCE_INVALID: DWORD = 8373;
-pub const ERROR_DS_CROSS_REF_EXISTS: DWORD = 8374;
-pub const ERROR_DS_CANT_DEL_MASTER_CROSSREF: DWORD = 8375;
-pub const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD: DWORD = 8376;
-pub const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX: DWORD = 8377;
-pub const ERROR_DS_DUP_RDN: DWORD = 8378;
-pub const ERROR_DS_DUP_OID: DWORD = 8379;
-pub const ERROR_DS_DUP_MAPI_ID: DWORD = 8380;
-pub const ERROR_DS_DUP_SCHEMA_ID_GUID: DWORD = 8381;
-pub const ERROR_DS_DUP_LDAP_DISPLAY_NAME: DWORD = 8382;
-pub const ERROR_DS_SEMANTIC_ATT_TEST: DWORD = 8383;
-pub const ERROR_DS_SYNTAX_MISMATCH: DWORD = 8384;
-pub const ERROR_DS_EXISTS_IN_MUST_HAVE: DWORD = 8385;
-pub const ERROR_DS_EXISTS_IN_MAY_HAVE: DWORD = 8386;
-pub const ERROR_DS_NONEXISTENT_MAY_HAVE: DWORD = 8387;
-pub const ERROR_DS_NONEXISTENT_MUST_HAVE: DWORD = 8388;
-pub const ERROR_DS_AUX_CLS_TEST_FAIL: DWORD = 8389;
-pub const ERROR_DS_NONEXISTENT_POSS_SUP: DWORD = 8390;
-pub const ERROR_DS_SUB_CLS_TEST_FAIL: DWORD = 8391;
-pub const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX: DWORD = 8392;
-pub const ERROR_DS_EXISTS_IN_AUX_CLS: DWORD = 8393;
-pub const ERROR_DS_EXISTS_IN_SUB_CLS: DWORD = 8394;
-pub const ERROR_DS_EXISTS_IN_POSS_SUP: DWORD = 8395;
-pub const ERROR_DS_RECALCSCHEMA_FAILED: DWORD = 8396;
-pub const ERROR_DS_TREE_DELETE_NOT_FINISHED: DWORD = 8397;
-pub const ERROR_DS_CANT_DELETE: DWORD = 8398;
-pub const ERROR_DS_ATT_SCHEMA_REQ_ID: DWORD = 8399;
-pub const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX: DWORD = 8400;
-pub const ERROR_DS_CANT_CACHE_ATT: DWORD = 8401;
-pub const ERROR_DS_CANT_CACHE_CLASS: DWORD = 8402;
-pub const ERROR_DS_CANT_REMOVE_ATT_CACHE: DWORD = 8403;
-pub const ERROR_DS_CANT_REMOVE_CLASS_CACHE: DWORD = 8404;
-pub const ERROR_DS_CANT_RETRIEVE_DN: DWORD = 8405;
-pub const ERROR_DS_MISSING_SUPREF: DWORD = 8406;
-pub const ERROR_DS_CANT_RETRIEVE_INSTANCE: DWORD = 8407;
-pub const ERROR_DS_CODE_INCONSISTENCY: DWORD = 8408;
-pub const ERROR_DS_DATABASE_ERROR: DWORD = 8409;
-pub const ERROR_DS_GOVERNSID_MISSING: DWORD = 8410;
-pub const ERROR_DS_MISSING_EXPECTED_ATT: DWORD = 8411;
-pub const ERROR_DS_NCNAME_MISSING_CR_REF: DWORD = 8412;
-pub const ERROR_DS_SECURITY_CHECKING_ERROR: DWORD = 8413;
-pub const ERROR_DS_SCHEMA_NOT_LOADED: DWORD = 8414;
-pub const ERROR_DS_SCHEMA_ALLOC_FAILED: DWORD = 8415;
-pub const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX: DWORD = 8416;
-pub const ERROR_DS_GCVERIFY_ERROR: DWORD = 8417;
-pub const ERROR_DS_DRA_SCHEMA_MISMATCH: DWORD = 8418;
-pub const ERROR_DS_CANT_FIND_DSA_OBJ: DWORD = 8419;
-pub const ERROR_DS_CANT_FIND_EXPECTED_NC: DWORD = 8420;
-pub const ERROR_DS_CANT_FIND_NC_IN_CACHE: DWORD = 8421;
-pub const ERROR_DS_CANT_RETRIEVE_CHILD: DWORD = 8422;
-pub const ERROR_DS_SECURITY_ILLEGAL_MODIFY: DWORD = 8423;
-pub const ERROR_DS_CANT_REPLACE_HIDDEN_REC: DWORD = 8424;
-pub const ERROR_DS_BAD_HIERARCHY_FILE: DWORD = 8425;
-pub const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED: DWORD = 8426;
-pub const ERROR_DS_CONFIG_PARAM_MISSING: DWORD = 8427;
-pub const ERROR_DS_COUNTING_AB_INDICES_FAILED: DWORD = 8428;
-pub const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED: DWORD = 8429;
-pub const ERROR_DS_INTERNAL_FAILURE: DWORD = 8430;
-pub const ERROR_DS_UNKNOWN_ERROR: DWORD = 8431;
-pub const ERROR_DS_ROOT_REQUIRES_CLASS_TOP: DWORD = 8432;
-pub const ERROR_DS_REFUSING_FSMO_ROLES: DWORD = 8433;
-pub const ERROR_DS_MISSING_FSMO_SETTINGS: DWORD = 8434;
-pub const ERROR_DS_UNABLE_TO_SURRENDER_ROLES: DWORD = 8435;
-pub const ERROR_DS_DRA_GENERIC: DWORD = 8436;
-pub const ERROR_DS_DRA_INVALID_PARAMETER: DWORD = 8437;
-pub const ERROR_DS_DRA_BUSY: DWORD = 8438;
-pub const ERROR_DS_DRA_BAD_DN: DWORD = 8439;
-pub const ERROR_DS_DRA_BAD_NC: DWORD = 8440;
-pub const ERROR_DS_DRA_DN_EXISTS: DWORD = 8441;
-pub const ERROR_DS_DRA_INTERNAL_ERROR: DWORD = 8442;
-pub const ERROR_DS_DRA_INCONSISTENT_DIT: DWORD = 8443;
-pub const ERROR_DS_DRA_CONNECTION_FAILED: DWORD = 8444;
-pub const ERROR_DS_DRA_BAD_INSTANCE_TYPE: DWORD = 8445;
-pub const ERROR_DS_DRA_OUT_OF_MEM: DWORD = 8446;
-pub const ERROR_DS_DRA_MAIL_PROBLEM: DWORD = 8447;
-pub const ERROR_DS_DRA_REF_ALREADY_EXISTS: DWORD = 8448;
-pub const ERROR_DS_DRA_REF_NOT_FOUND: DWORD = 8449;
-pub const ERROR_DS_DRA_OBJ_IS_REP_SOURCE: DWORD = 8450;
-pub const ERROR_DS_DRA_DB_ERROR: DWORD = 8451;
-pub const ERROR_DS_DRA_NO_REPLICA: DWORD = 8452;
-pub const ERROR_DS_DRA_ACCESS_DENIED: DWORD = 8453;
-pub const ERROR_DS_DRA_NOT_SUPPORTED: DWORD = 8454;
-pub const ERROR_DS_DRA_RPC_CANCELLED: DWORD = 8455;
-pub const ERROR_DS_DRA_SOURCE_DISABLED: DWORD = 8456;
-pub const ERROR_DS_DRA_SINK_DISABLED: DWORD = 8457;
-pub const ERROR_DS_DRA_NAME_COLLISION: DWORD = 8458;
-pub const ERROR_DS_DRA_SOURCE_REINSTALLED: DWORD = 8459;
-pub const ERROR_DS_DRA_MISSING_PARENT: DWORD = 8460;
-pub const ERROR_DS_DRA_PREEMPTED: DWORD = 8461;
-pub const ERROR_DS_DRA_ABANDON_SYNC: DWORD = 8462;
-pub const ERROR_DS_DRA_SHUTDOWN: DWORD = 8463;
-pub const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET: DWORD = 8464;
-pub const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA: DWORD = 8465;
-pub const ERROR_DS_DRA_EXTN_CONNECTION_FAILED: DWORD = 8466;
-pub const ERROR_DS_INSTALL_SCHEMA_MISMATCH: DWORD = 8467;
-pub const ERROR_DS_DUP_LINK_ID: DWORD = 8468;
-pub const ERROR_DS_NAME_ERROR_RESOLVING: DWORD = 8469;
-pub const ERROR_DS_NAME_ERROR_NOT_FOUND: DWORD = 8470;
-pub const ERROR_DS_NAME_ERROR_NOT_UNIQUE: DWORD = 8471;
-pub const ERROR_DS_NAME_ERROR_NO_MAPPING: DWORD = 8472;
-pub const ERROR_DS_NAME_ERROR_DOMAIN_ONLY: DWORD = 8473;
-pub const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: DWORD = 8474;
-pub const ERROR_DS_CONSTRUCTED_ATT_MOD: DWORD = 8475;
-pub const ERROR_DS_WRONG_OM_OBJ_CLASS: DWORD = 8476;
-pub const ERROR_DS_DRA_REPL_PENDING: DWORD = 8477;
-pub const ERROR_DS_DS_REQUIRED: DWORD = 8478;
-pub const ERROR_DS_INVALID_LDAP_DISPLAY_NAME: DWORD = 8479;
-pub const ERROR_DS_NON_BASE_SEARCH: DWORD = 8480;
-pub const ERROR_DS_CANT_RETRIEVE_ATTS: DWORD = 8481;
-pub const ERROR_DS_BACKLINK_WITHOUT_LINK: DWORD = 8482;
-pub const ERROR_DS_EPOCH_MISMATCH: DWORD = 8483;
-pub const ERROR_DS_SRC_NAME_MISMATCH: DWORD = 8484;
-pub const ERROR_DS_SRC_AND_DST_NC_IDENTICAL: DWORD = 8485;
-pub const ERROR_DS_DST_NC_MISMATCH: DWORD = 8486;
-pub const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC: DWORD = 8487;
-pub const ERROR_DS_SRC_GUID_MISMATCH: DWORD = 8488;
-pub const ERROR_DS_CANT_MOVE_DELETED_OBJECT: DWORD = 8489;
-pub const ERROR_DS_PDC_OPERATION_IN_PROGRESS: DWORD = 8490;
-pub const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD: DWORD = 8491;
-pub const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION: DWORD = 8492;
-pub const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS: DWORD = 8493;
-pub const ERROR_DS_NC_MUST_HAVE_NC_PARENT: DWORD = 8494;
-pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE: DWORD = 8495;
-pub const ERROR_DS_DST_DOMAIN_NOT_NATIVE: DWORD = 8496;
-pub const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER: DWORD = 8497;
-pub const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP: DWORD = 8498;
-pub const ERROR_DS_CANT_MOVE_RESOURCE_GROUP: DWORD = 8499;
-pub const ERROR_DS_INVALID_SEARCH_FLAG: DWORD = 8500;
-pub const ERROR_DS_NO_TREE_DELETE_ABOVE_NC: DWORD = 8501;
-pub const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE: DWORD = 8502;
-pub const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE: DWORD = 8503;
-pub const ERROR_DS_SAM_INIT_FAILURE: DWORD = 8504;
-pub const ERROR_DS_SENSITIVE_GROUP_VIOLATION: DWORD = 8505;
-pub const ERROR_DS_CANT_MOD_PRIMARYGROUPID: DWORD = 8506;
-pub const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD: DWORD = 8507;
-pub const ERROR_DS_NONSAFE_SCHEMA_CHANGE: DWORD = 8508;
-pub const ERROR_DS_SCHEMA_UPDATE_DISALLOWED: DWORD = 8509;
-pub const ERROR_DS_CANT_CREATE_UNDER_SCHEMA: DWORD = 8510;
-pub const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION: DWORD = 8511;
-pub const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE: DWORD = 8512;
-pub const ERROR_DS_INVALID_GROUP_TYPE: DWORD = 8513;
-pub const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: DWORD = 8514;
-pub const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: DWORD = 8515;
-pub const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: DWORD = 8516;
-pub const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: DWORD = 8517;
-pub const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: DWORD = 8518;
-pub const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: DWORD = 8519;
-pub const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: DWORD = 8520;
-pub const ERROR_DS_HAVE_PRIMARY_MEMBERS: DWORD = 8521;
-pub const ERROR_DS_STRING_SD_CONVERSION_FAILED: DWORD = 8522;
-pub const ERROR_DS_NAMING_MASTER_GC: DWORD = 8523;
-pub const ERROR_DS_DNS_LOOKUP_FAILURE: DWORD = 8524;
-pub const ERROR_DS_COULDNT_UPDATE_SPNS: DWORD = 8525;
-pub const ERROR_DS_CANT_RETRIEVE_SD: DWORD = 8526;
-pub const ERROR_DS_KEY_NOT_UNIQUE: DWORD = 8527;
-pub const ERROR_DS_WRONG_LINKED_ATT_SYNTAX: DWORD = 8528;
-pub const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD: DWORD = 8529;
-pub const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY: DWORD = 8530;
-pub const ERROR_DS_CANT_START: DWORD = 8531;
-pub const ERROR_DS_INIT_FAILURE: DWORD = 8532;
-pub const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION: DWORD = 8533;
-pub const ERROR_DS_SOURCE_DOMAIN_IN_FOREST: DWORD = 8534;
-pub const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST: DWORD = 8535;
-pub const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED: DWORD = 8536;
-pub const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN: DWORD = 8537;
-pub const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER: DWORD = 8538;
-pub const ERROR_DS_SRC_SID_EXISTS_IN_FOREST: DWORD = 8539;
-pub const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH: DWORD = 8540;
-pub const ERROR_SAM_INIT_FAILURE: DWORD = 8541;
-pub const ERROR_DS_DRA_SCHEMA_INFO_SHIP: DWORD = 8542;
-pub const ERROR_DS_DRA_SCHEMA_CONFLICT: DWORD = 8543;
-pub const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT: DWORD = 8544;
-pub const ERROR_DS_DRA_OBJ_NC_MISMATCH: DWORD = 8545;
-pub const ERROR_DS_NC_STILL_HAS_DSAS: DWORD = 8546;
-pub const ERROR_DS_GC_REQUIRED: DWORD = 8547;
-pub const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: DWORD = 8548;
-pub const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS: DWORD = 8549;
-pub const ERROR_DS_CANT_ADD_TO_GC: DWORD = 8550;
-pub const ERROR_DS_NO_CHECKPOINT_WITH_PDC: DWORD = 8551;
-pub const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED: DWORD = 8552;
-pub const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC: DWORD = 8553;
-pub const ERROR_DS_INVALID_NAME_FOR_SPN: DWORD = 8554;
-pub const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS: DWORD = 8555;
-pub const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES: DWORD = 8556;
-pub const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: DWORD = 8557;
-pub const ERROR_DS_MUST_BE_RUN_ON_DST_DC: DWORD = 8558;
-pub const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER: DWORD = 8559;
-pub const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ: DWORD = 8560;
-pub const ERROR_DS_INIT_FAILURE_CONSOLE: DWORD = 8561;
-pub const ERROR_DS_SAM_INIT_FAILURE_CONSOLE: DWORD = 8562;
-pub const ERROR_DS_FOREST_VERSION_TOO_HIGH: DWORD = 8563;
-pub const ERROR_DS_DOMAIN_VERSION_TOO_HIGH: DWORD = 8564;
-pub const ERROR_DS_FOREST_VERSION_TOO_LOW: DWORD = 8565;
-pub const ERROR_DS_DOMAIN_VERSION_TOO_LOW: DWORD = 8566;
-pub const ERROR_DS_INCOMPATIBLE_VERSION: DWORD = 8567;
-pub const ERROR_DS_LOW_DSA_VERSION: DWORD = 8568;
-pub const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN: DWORD = 8569;
-pub const ERROR_DS_NOT_SUPPORTED_SORT_ORDER: DWORD = 8570;
-pub const ERROR_DS_NAME_NOT_UNIQUE: DWORD = 8571;
-pub const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4: DWORD = 8572;
-pub const ERROR_DS_OUT_OF_VERSION_STORE: DWORD = 8573;
-pub const ERROR_DS_INCOMPATIBLE_CONTROLS_USED: DWORD = 8574;
-pub const ERROR_DS_NO_REF_DOMAIN: DWORD = 8575;
-pub const ERROR_DS_RESERVED_LINK_ID: DWORD = 8576;
-pub const ERROR_DS_LINK_ID_NOT_AVAILABLE: DWORD = 8577;
-pub const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: DWORD = 8578;
-pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE: DWORD = 8579;
-pub const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC: DWORD = 8580;
-pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG: DWORD = 8581;
-pub const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT: DWORD = 8582;
-pub const ERROR_DS_NAME_ERROR_TRUST_REFERRAL: DWORD = 8583;
-pub const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER: DWORD = 8584;
-pub const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD: DWORD = 8585;
-pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2: DWORD = 8586;
-pub const ERROR_DS_THREAD_LIMIT_EXCEEDED: DWORD = 8587;
-pub const ERROR_DS_NOT_CLOSEST: DWORD = 8588;
-pub const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF: DWORD = 8589;
-pub const ERROR_DS_SINGLE_USER_MODE_FAILED: DWORD = 8590;
-pub const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR: DWORD = 8591;
-pub const ERROR_DS_NTDSCRIPT_PROCESS_ERROR: DWORD = 8592;
-pub const ERROR_DS_DIFFERENT_REPL_EPOCHS: DWORD = 8593;
-pub const ERROR_DS_DRS_EXTENSIONS_CHANGED: DWORD = 8594;
-pub const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR: DWORD = 8595;
-pub const ERROR_DS_NO_MSDS_INTID: DWORD = 8596;
-pub const ERROR_DS_DUP_MSDS_INTID: DWORD = 8597;
-pub const ERROR_DS_EXISTS_IN_RDNATTID: DWORD = 8598;
-pub const ERROR_DS_AUTHORIZATION_FAILED: DWORD = 8599;
-pub const ERROR_DS_INVALID_SCRIPT: DWORD = 8600;
-pub const ERROR_DS_REMOTE_CROSSREF_OP_FAILED: DWORD = 8601;
-pub const ERROR_DS_CROSS_REF_BUSY: DWORD = 8602;
-pub const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN: DWORD = 8603;
-pub const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC: DWORD = 8604;
-pub const ERROR_DS_DUPLICATE_ID_FOUND: DWORD = 8605;
-pub const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT: DWORD = 8606;
-pub const ERROR_DS_GROUP_CONVERSION_ERROR: DWORD = 8607;
-pub const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP: DWORD = 8608;
-pub const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP: DWORD = 8609;
-pub const ERROR_DS_ROLE_NOT_VERIFIED: DWORD = 8610;
-pub const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL: DWORD = 8611;
-pub const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS: DWORD = 8612;
-pub const ERROR_DS_EXISTING_AD_CHILD_NC: DWORD = 8613;
-pub const ERROR_DS_REPL_LIFETIME_EXCEEDED: DWORD = 8614;
-pub const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER: DWORD = 8615;
-pub const ERROR_DS_LDAP_SEND_QUEUE_FULL: DWORD = 8616;
-pub const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW: DWORD = 8617;
-pub const ERROR_SXS_SECTION_NOT_FOUND: DWORD = 14000;
-pub const ERROR_SXS_CANT_GEN_ACTCTX: DWORD = 14001;
-pub const ERROR_SXS_INVALID_ACTCTXDATA_FORMAT: DWORD = 14002;
-pub const ERROR_SXS_ASSEMBLY_NOT_FOUND: DWORD = 14003;
-pub const ERROR_SXS_MANIFEST_FORMAT_ERROR: DWORD = 14004;
-pub const ERROR_SXS_MANIFEST_PARSE_ERROR: DWORD = 14005;
-pub const ERROR_SXS_ACTIVATION_CONTEXT_DISABLED: DWORD = 14006;
-pub const ERROR_SXS_KEY_NOT_FOUND: DWORD = 14007;
-pub const ERROR_SXS_VERSION_CONFLICT: DWORD = 14008;
-pub const ERROR_SXS_WRONG_SECTION_TYPE: DWORD = 14009;
-pub const ERROR_SXS_THREAD_QUERIES_DISABLED: DWORD = 14010;
-pub const ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET: DWORD = 14011;
-pub const ERROR_SXS_UNKNOWN_ENCODING_GROUP: DWORD = 14012;
-pub const ERROR_SXS_UNKNOWN_ENCODING: DWORD = 14013;
-pub const ERROR_SXS_INVALID_XML_NAMESPACE_URI: DWORD = 14014;
-pub const ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED: DWORD = 14015;
-pub const ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED: DWORD = 14016;
-pub const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE: DWORD = 14017;
-pub const ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE: DWORD = 14018;
-pub const ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE: DWORD = 14019;
-pub const ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT: DWORD = 14020;
-pub const ERROR_SXS_DUPLICATE_DLL_NAME: DWORD = 14021;
-pub const ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME: DWORD = 14022;
-pub const ERROR_SXS_DUPLICATE_CLSID: DWORD = 14023;
-pub const ERROR_SXS_DUPLICATE_IID: DWORD = 14024;
-pub const ERROR_SXS_DUPLICATE_TLBID: DWORD = 14025;
-pub const ERROR_SXS_DUPLICATE_PROGID: DWORD = 14026;
-pub const ERROR_SXS_DUPLICATE_ASSEMBLY_NAME: DWORD = 14027;
-pub const ERROR_SXS_FILE_HASH_MISMATCH: DWORD = 14028;
-pub const ERROR_SXS_POLICY_PARSE_ERROR: DWORD = 14029;
-pub const ERROR_SXS_XML_E_MISSINGQUOTE: DWORD = 14030;
-pub const ERROR_SXS_XML_E_COMMENTSYNTAX: DWORD = 14031;
-pub const ERROR_SXS_XML_E_BADSTARTNAMECHAR: DWORD = 14032;
-pub const ERROR_SXS_XML_E_BADNAMECHAR: DWORD = 14033;
-pub const ERROR_SXS_XML_E_BADCHARINSTRING: DWORD = 14034;
-pub const ERROR_SXS_XML_E_XMLDECLSYNTAX: DWORD = 14035;
-pub const ERROR_SXS_XML_E_BADCHARDATA: DWORD = 14036;
-pub const ERROR_SXS_XML_E_MISSINGWHITESPACE: DWORD = 14037;
-pub const ERROR_SXS_XML_E_EXPECTINGTAGEND: DWORD = 14038;
-pub const ERROR_SXS_XML_E_MISSINGSEMICOLON: DWORD = 14039;
-pub const ERROR_SXS_XML_E_UNBALANCEDPAREN: DWORD = 14040;
-pub const ERROR_SXS_XML_E_INTERNALERROR: DWORD = 14041;
-pub const ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE: DWORD = 14042;
-pub const ERROR_SXS_XML_E_INCOMPLETE_ENCODING: DWORD = 14043;
-pub const ERROR_SXS_XML_E_MISSING_PAREN: DWORD = 14044;
-pub const ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE: DWORD = 14045;
-pub const ERROR_SXS_XML_E_MULTIPLE_COLONS: DWORD = 14046;
-pub const ERROR_SXS_XML_E_INVALID_DECIMAL: DWORD = 14047;
-pub const ERROR_SXS_XML_E_INVALID_HEXIDECIMAL: DWORD = 14048;
-pub const ERROR_SXS_XML_E_INVALID_UNICODE: DWORD = 14049;
-pub const ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK: DWORD = 14050;
-pub const ERROR_SXS_XML_E_UNEXPECTEDENDTAG: DWORD = 14051;
-pub const ERROR_SXS_XML_E_UNCLOSEDTAG: DWORD = 14052;
-pub const ERROR_SXS_XML_E_DUPLICATEATTRIBUTE: DWORD = 14053;
-pub const ERROR_SXS_XML_E_MULTIPLEROOTS: DWORD = 14054;
-pub const ERROR_SXS_XML_E_INVALIDATROOTLEVEL: DWORD = 14055;
-pub const ERROR_SXS_XML_E_BADXMLDECL: DWORD = 14056;
-pub const ERROR_SXS_XML_E_MISSINGROOT: DWORD = 14057;
-pub const ERROR_SXS_XML_E_UNEXPECTEDEOF: DWORD = 14058;
-pub const ERROR_SXS_XML_E_BADPEREFINSUBSET: DWORD = 14059;
-pub const ERROR_SXS_XML_E_UNCLOSEDSTARTTAG: DWORD = 14060;
-pub const ERROR_SXS_XML_E_UNCLOSEDENDTAG: DWORD = 14061;
-pub const ERROR_SXS_XML_E_UNCLOSEDSTRING: DWORD = 14062;
-pub const ERROR_SXS_XML_E_UNCLOSEDCOMMENT: DWORD = 14063;
-pub const ERROR_SXS_XML_E_UNCLOSEDDECL: DWORD = 14064;
-pub const ERROR_SXS_XML_E_UNCLOSEDCDATA: DWORD = 14065;
-pub const ERROR_SXS_XML_E_RESERVEDNAMESPACE: DWORD = 14066;
-pub const ERROR_SXS_XML_E_INVALIDENCODING: DWORD = 14067;
-pub const ERROR_SXS_XML_E_INVALIDSWITCH: DWORD = 14068;
-pub const ERROR_SXS_XML_E_BADXMLCASE: DWORD = 14069;
-pub const ERROR_SXS_XML_E_INVALID_STANDALONE: DWORD = 14070;
-pub const ERROR_SXS_XML_E_UNEXPECTED_STANDALONE: DWORD = 14071;
-pub const ERROR_SXS_XML_E_INVALID_VERSION: DWORD = 14072;
-pub const ERROR_SXS_XML_E_MISSINGEQUALS: DWORD = 14073;
-pub const ERROR_SXS_PROTECTION_RECOVERY_FAILED: DWORD = 14074;
-pub const ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT: DWORD = 14075;
-pub const ERROR_SXS_PROTECTION_CATALOG_NOT_VALID: DWORD = 14076;
-pub const ERROR_SXS_UNTRANSLATABLE_HRESULT: DWORD = 14077;
-pub const ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING: DWORD = 14078;
-pub const ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE: DWORD = 14079;
-pub const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME: DWORD = 14080;
-pub const ERROR_SXS_ASSEMBLY_MISSING: DWORD = 14081;
-pub const ERROR_SXS_CORRUPT_ACTIVATION_STACK: DWORD = 14082;
-pub const ERROR_SXS_CORRUPTION: DWORD = 14083;
-pub const ERROR_SXS_EARLY_DEACTIVATION: DWORD = 14084;
-pub const ERROR_SXS_INVALID_DEACTIVATION: DWORD = 14085;
-pub const ERROR_SXS_MULTIPLE_DEACTIVATION: DWORD = 14086;
-pub const ERROR_SXS_PROCESS_TERMINATION_REQUESTED: DWORD = 14087;
-pub const ERROR_SXS_RELEASE_ACTIVATION_CONTEXT: DWORD = 14088;
-pub const ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: DWORD = 14089;
-pub const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: DWORD = 14090;
-pub const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: DWORD = 14091;
-pub const ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: DWORD = 14092;
-pub const ERROR_SXS_IDENTITY_PARSE_ERROR: DWORD = 14093;
-pub const ERROR_MALFORMED_SUBSTITUTION_STRING: DWORD = 14094;
-pub const ERROR_SXS_INCORRECT_PUBLIC_KEY_TOKEN: DWORD = 14095;
-pub const ERROR_UNMAPPED_SUBSTITUTION_STRING: DWORD = 14096;
-pub const ERROR_SXS_ASSEMBLY_NOT_LOCKED: DWORD = 14097;
-pub const ERROR_SXS_COMPONENT_STORE_CORRUPT: DWORD = 14098;
-pub const ERROR_ADVANCED_INSTALLER_FAILED: DWORD = 14099;
-pub const ERROR_XML_ENCODING_MISMATCH: DWORD = 14100;
-pub const ERROR_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: DWORD = 14101;
-pub const ERROR_SXS_IDENTITIES_DIFFERENT: DWORD = 14102;
-pub const ERROR_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: DWORD = 14103;
-pub const ERROR_SXS_FILE_NOT_PART_OF_ASSEMBLY: DWORD = 14104;
-pub const ERROR_SXS_MANIFEST_TOO_BIG: DWORD = 14105;
-pub const ERROR_SXS_SETTING_NOT_REGISTERED: DWORD = 14106;
-pub const ERROR_SXS_TRANSACTION_CLOSURE_INCOMPLETE: DWORD = 14107;
-pub const ERROR_SMI_PRIMITIVE_INSTALLER_FAILED: DWORD = 14108;
-pub const ERROR_GENERIC_COMMAND_FAILED: DWORD = 14109;
-pub const ERROR_SXS_FILE_HASH_MISSING: DWORD = 14110;
-pub const ERROR_IPSEC_QM_POLICY_EXISTS: DWORD = 13000;
-pub const ERROR_IPSEC_QM_POLICY_NOT_FOUND: DWORD = 13001;
-pub const ERROR_IPSEC_QM_POLICY_IN_USE: DWORD = 13002;
-pub const ERROR_IPSEC_MM_POLICY_EXISTS: DWORD = 13003;
-pub const ERROR_IPSEC_MM_POLICY_NOT_FOUND: DWORD = 13004;
-pub const ERROR_IPSEC_MM_POLICY_IN_USE: DWORD = 13005;
-pub const ERROR_IPSEC_MM_FILTER_EXISTS: DWORD = 13006;
-pub const ERROR_IPSEC_MM_FILTER_NOT_FOUND: DWORD = 13007;
-pub const ERROR_IPSEC_TRANSPORT_FILTER_EXISTS: DWORD = 13008;
-pub const ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND: DWORD = 13009;
-pub const ERROR_IPSEC_MM_AUTH_EXISTS: DWORD = 13010;
-pub const ERROR_IPSEC_MM_AUTH_NOT_FOUND: DWORD = 13011;
-pub const ERROR_IPSEC_MM_AUTH_IN_USE: DWORD = 13012;
-pub const ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND: DWORD = 13013;
-pub const ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND: DWORD = 13014;
-pub const ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND: DWORD = 13015;
-pub const ERROR_IPSEC_TUNNEL_FILTER_EXISTS: DWORD = 13016;
-pub const ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND: DWORD = 13017;
-pub const ERROR_IPSEC_MM_FILTER_PENDING_DELETION: DWORD = 13018;
-pub const ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION: DWORD = 13019;
-pub const ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION: DWORD = 13020;
-pub const ERROR_IPSEC_MM_POLICY_PENDING_DELETION: DWORD = 13021;
-pub const ERROR_IPSEC_MM_AUTH_PENDING_DELETION: DWORD = 13022;
-pub const ERROR_IPSEC_QM_POLICY_PENDING_DELETION: DWORD = 13023;
-pub const ERROR_IPSEC_IKE_NEG_STATUS_BEGIN: DWORD = 13800;
-pub const ERROR_IPSEC_IKE_AUTH_FAIL: DWORD = 13801;
-pub const ERROR_IPSEC_IKE_ATTRIB_FAIL: DWORD = 13802;
-pub const ERROR_IPSEC_IKE_NEGOTIATION_PENDING: DWORD = 13803;
-pub const ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR: DWORD = 13804;
-pub const ERROR_IPSEC_IKE_TIMED_OUT: DWORD = 13805;
-pub const ERROR_IPSEC_IKE_NO_CERT: DWORD = 13806;
-pub const ERROR_IPSEC_IKE_SA_DELETED: DWORD = 13807;
-pub const ERROR_IPSEC_IKE_SA_REAPED: DWORD = 13808;
-pub const ERROR_IPSEC_IKE_MM_ACQUIRE_DROP: DWORD = 13809;
-pub const ERROR_IPSEC_IKE_QM_ACQUIRE_DROP: DWORD = 13810;
-pub const ERROR_IPSEC_IKE_QUEUE_DROP_MM: DWORD = 13811;
-pub const ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM: DWORD = 13812;
-pub const ERROR_IPSEC_IKE_DROP_NO_RESPONSE: DWORD = 13813;
-pub const ERROR_IPSEC_IKE_MM_DELAY_DROP: DWORD = 13814;
-pub const ERROR_IPSEC_IKE_QM_DELAY_DROP: DWORD = 13815;
-pub const ERROR_IPSEC_IKE_ERROR: DWORD = 13816;
-pub const ERROR_IPSEC_IKE_CRL_FAILED: DWORD = 13817;
-pub const ERROR_IPSEC_IKE_INVALID_KEY_USAGE: DWORD = 13818;
-pub const ERROR_IPSEC_IKE_INVALID_CERT_TYPE: DWORD = 13819;
-pub const ERROR_IPSEC_IKE_NO_PRIVATE_KEY: DWORD = 13820;
-pub const ERROR_IPSEC_IKE_DH_FAIL: DWORD = 13822;
-pub const ERROR_IPSEC_IKE_INVALID_HEADER: DWORD = 13824;
-pub const ERROR_IPSEC_IKE_NO_POLICY: DWORD = 13825;
-pub const ERROR_IPSEC_IKE_INVALID_SIGNATURE: DWORD = 13826;
-pub const ERROR_IPSEC_IKE_KERBEROS_ERROR: DWORD = 13827;
-pub const ERROR_IPSEC_IKE_NO_PUBLIC_KEY: DWORD = 13828;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR: DWORD = 13829;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_SA: DWORD = 13830;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_PROP: DWORD = 13831;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_TRANS: DWORD = 13832;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_KE: DWORD = 13833;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_ID: DWORD = 13834;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_CERT: DWORD = 13835;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ: DWORD = 13836;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_HASH: DWORD = 13837;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_SIG: DWORD = 13838;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_NONCE: DWORD = 13839;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY: DWORD = 13840;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_DELETE: DWORD = 13841;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR: DWORD = 13842;
-pub const ERROR_IPSEC_IKE_INVALID_PAYLOAD: DWORD = 13843;
-pub const ERROR_IPSEC_IKE_LOAD_SOFT_SA: DWORD = 13844;
-pub const ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN: DWORD = 13845;
-pub const ERROR_IPSEC_IKE_INVALID_COOKIE: DWORD = 13846;
-pub const ERROR_IPSEC_IKE_NO_PEER_CERT: DWORD = 13847;
-pub const ERROR_IPSEC_IKE_PEER_CRL_FAILED: DWORD = 13848;
-pub const ERROR_IPSEC_IKE_POLICY_CHANGE: DWORD = 13849;
-pub const ERROR_IPSEC_IKE_NO_MM_POLICY: DWORD = 13850;
-pub const ERROR_IPSEC_IKE_NOTCBPRIV: DWORD = 13851;
-pub const ERROR_IPSEC_IKE_SECLOADFAIL: DWORD = 13852;
-pub const ERROR_IPSEC_IKE_FAILSSPINIT: DWORD = 13853;
-pub const ERROR_IPSEC_IKE_FAILQUERYSSP: DWORD = 13854;
-pub const ERROR_IPSEC_IKE_SRVACQFAIL: DWORD = 13855;
-pub const ERROR_IPSEC_IKE_SRVQUERYCRED: DWORD = 13856;
-pub const ERROR_IPSEC_IKE_GETSPIFAIL: DWORD = 13857;
-pub const ERROR_IPSEC_IKE_INVALID_FILTER: DWORD = 13858;
-pub const ERROR_IPSEC_IKE_OUT_OF_MEMORY: DWORD = 13859;
-pub const ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED: DWORD = 13860;
-pub const ERROR_IPSEC_IKE_INVALID_POLICY: DWORD = 13861;
-pub const ERROR_IPSEC_IKE_UNKNOWN_DOI: DWORD = 13862;
-pub const ERROR_IPSEC_IKE_INVALID_SITUATION: DWORD = 13863;
-pub const ERROR_IPSEC_IKE_DH_FAILURE: DWORD = 13864;
-pub const ERROR_IPSEC_IKE_INVALID_GROUP: DWORD = 13865;
-pub const ERROR_IPSEC_IKE_ENCRYPT: DWORD = 13866;
-pub const ERROR_IPSEC_IKE_DECRYPT: DWORD = 13867;
-pub const ERROR_IPSEC_IKE_POLICY_MATCH: DWORD = 13868;
-pub const ERROR_IPSEC_IKE_UNSUPPORTED_ID: DWORD = 13869;
-pub const ERROR_IPSEC_IKE_INVALID_HASH: DWORD = 13870;
-pub const ERROR_IPSEC_IKE_INVALID_HASH_ALG: DWORD = 13871;
-pub const ERROR_IPSEC_IKE_INVALID_HASH_SIZE: DWORD = 13872;
-pub const ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG: DWORD = 13873;
-pub const ERROR_IPSEC_IKE_INVALID_AUTH_ALG: DWORD = 13874;
-pub const ERROR_IPSEC_IKE_INVALID_SIG: DWORD = 13875;
-pub const ERROR_IPSEC_IKE_LOAD_FAILED: DWORD = 13876;
-pub const ERROR_IPSEC_IKE_RPC_DELETE: DWORD = 13877;
-pub const ERROR_IPSEC_IKE_BENIGN_REINIT: DWORD = 13878;
-pub const ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY: DWORD = 13879;
-pub const ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN: DWORD = 13881;
-pub const ERROR_IPSEC_IKE_MM_LIMIT: DWORD = 13882;
-pub const ERROR_IPSEC_IKE_NEGOTIATION_DISABLED: DWORD = 13883;
-/*pub const ERROR_IPSEC_IKE_NEG_STATUS_END: DWORD = 13884)*/
-pub const ERROR_IPSEC_IKE_QM_LIMIT: DWORD = 13884;
-pub const ERROR_IPSEC_IKE_MM_EXPIRED: DWORD = 13885;
-pub const ERROR_IPSEC_IKE_PEER_MM_ASSUMED_INVALID: DWORD = 13886;
-pub const ERROR_IPSEC_IKE_CERT_CHAIN_POLICY_MISMATCH: DWORD = 13887;
-pub const ERROR_IPSEC_IKE_UNEXPECTED_MESSAGE_ID: DWORD = 13888;
-pub const ERROR_IPSEC_IKE_INVALID_AUTH_PAYLOAD: DWORD = 13889;
-pub const ERROR_IPSEC_IKE_DOS_COOKIE_SENT: DWORD = 13890;
-pub const ERROR_IPSEC_IKE_SHUTTING_DOWN: DWORD = 13891;
-pub const ERROR_IPSEC_IKE_CGA_AUTH_FAILED: DWORD = 13892;
-pub const ERROR_IPSEC_IKE_PROCESS_ERR_NATOA: DWORD = 13893;
-pub const ERROR_IPSEC_IKE_INVALID_MM_FOR_QM: DWORD = 13894;
-pub const ERROR_IPSEC_IKE_QM_EXPIRED: DWORD = 13895;
-pub const ERROR_IPSEC_IKE_TOO_MANY_FILTERS: DWORD = 13896;
-pub const ERROR_IPSEC_IKE_NEG_STATUS_END: DWORD = 13897;
-pub const ERROR_IPSEC_IKE_KILL_DUMMY_NAP_TUNNEL: DWORD = 13898;
-pub const ERROR_IPSEC_IKE_INNER_IP_ASSIGNMENT_FAILURE: DWORD = 13899;
-pub const ERROR_IPSEC_IKE_REQUIRE_CP_PAYLOAD_MISSING: DWORD = 13900;
-pub const ERROR_IPSEC_KEY_MODULE_IMPERSONATION_NEGOTIATION_PENDING: DWORD = 13901;
-pub const ERROR_IPSEC_IKE_COEXISTENCE_SUPPRESS: DWORD = 13902;
-pub const ERROR_IPSEC_IKE_RATELIMIT_DROP: DWORD = 13903;
-pub const ERROR_IPSEC_IKE_PEER_DOESNT_SUPPORT_MOBIKE: DWORD = 13904;
-pub const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE: DWORD = 13905;
-pub const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_FAILURE: DWORD = 13906;
-pub const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE_WITH_OPTIONAL_RETRY: DWORD = 13907;
-pub const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_AND_CERTMAP_FAILURE: DWORD = 13908;
-pub const ERROR_IPSEC_IKE_NEG_STATUS_EXTENDED_END: DWORD = 13909;
-pub const ERROR_IPSEC_BAD_SPI: DWORD = 13910;
-pub const ERROR_IPSEC_SA_LIFETIME_EXPIRED: DWORD = 13911;
-pub const ERROR_IPSEC_WRONG_SA: DWORD = 13912;
-pub const ERROR_IPSEC_REPLAY_CHECK_FAILED: DWORD = 13913;
-pub const ERROR_IPSEC_INVALID_PACKET: DWORD = 13914;
-pub const ERROR_IPSEC_INTEGRITY_CHECK_FAILED: DWORD = 13915;
-pub const ERROR_IPSEC_CLEAR_TEXT_DROP: DWORD = 13916;
-pub const ERROR_IPSEC_AUTH_FIREWALL_DROP: DWORD = 13917;
-pub const ERROR_IPSEC_THROTTLE_DROP: DWORD = 13918;
-pub const ERROR_IPSEC_DOSP_BLOCK: DWORD = 13925;
-pub const ERROR_IPSEC_DOSP_RECEIVED_MULTICAST: DWORD = 13926;
-pub const ERROR_IPSEC_DOSP_INVALID_PACKET: DWORD = 13927;
-pub const ERROR_IPSEC_DOSP_STATE_LOOKUP_FAILED: DWORD = 13928;
-pub const ERROR_IPSEC_DOSP_MAX_ENTRIES: DWORD = 13929;
-pub const ERROR_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: DWORD = 13930;
-pub const ERROR_IPSEC_DOSP_NOT_INSTALLED: DWORD = 13931;
-pub const ERROR_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: DWORD = 13932;
-pub const ERROR_EVT_INVALID_CHANNEL_PATH: DWORD = 15000;
-pub const ERROR_EVT_INVALID_QUERY: DWORD = 15001;
-pub const ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND: DWORD = 15002;
-pub const ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND: DWORD = 15003;
-pub const ERROR_EVT_INVALID_PUBLISHER_NAME: DWORD = 15004;
-pub const ERROR_EVT_INVALID_EVENT_DATA: DWORD = 15005;
-pub const ERROR_EVT_CHANNEL_NOT_FOUND: DWORD = 15007;
-pub const ERROR_EVT_MALFORMED_XML_TEXT: DWORD = 15008;
-pub const ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL: DWORD = 15009;
-pub const ERROR_EVT_CONFIGURATION_ERROR: DWORD = 15010;
-pub const ERROR_EVT_QUERY_RESULT_STALE: DWORD = 15011;
-pub const ERROR_EVT_QUERY_RESULT_INVALID_POSITION: DWORD = 15012;
-pub const ERROR_EVT_NON_VALIDATING_MSXML: DWORD = 15013;
-pub const ERROR_EVT_FILTER_ALREADYSCOPED: DWORD = 15014;
-pub const ERROR_EVT_FILTER_NOTELTSET: DWORD = 15015;
-pub const ERROR_EVT_FILTER_INVARG: DWORD = 15016;
-pub const ERROR_EVT_FILTER_INVTEST: DWORD = 15017;
-pub const ERROR_EVT_FILTER_INVTYPE: DWORD = 15018;
-pub const ERROR_EVT_FILTER_PARSEERR: DWORD = 15019;
-pub const ERROR_EVT_FILTER_UNSUPPORTEDOP: DWORD = 15020;
-pub const ERROR_EVT_FILTER_UNEXPECTEDTOKEN: DWORD = 15021;
-pub const ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL: DWORD = 15022;
-pub const ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE: DWORD = 15023;
-pub const ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE: DWORD = 15024;
-pub const ERROR_EVT_CHANNEL_CANNOT_ACTIVATE: DWORD = 15025;
-pub const ERROR_EVT_FILTER_TOO_COMPLEX: DWORD = 15026;
-pub const ERROR_EVT_MESSAGE_NOT_FOUND: DWORD = 15027;
-pub const ERROR_EVT_MESSAGE_ID_NOT_FOUND: DWORD = 15028;
-pub const ERROR_EVT_UNRESOLVED_VALUE_INSERT: DWORD = 15029;
-pub const ERROR_EVT_UNRESOLVED_PARAMETER_INSERT: DWORD = 15030;
-pub const ERROR_EVT_MAX_INSERTS_REACHED: DWORD = 15031;
-pub const ERROR_EVT_EVENT_DEFINITION_NOT_FOUND: DWORD = 15032;
-pub const ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND: DWORD = 15033;
-pub const ERROR_EVT_VERSION_TOO_OLD: DWORD = 15034;
-pub const ERROR_EVT_VERSION_TOO_NEW: DWORD = 15035;
-pub const ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY: DWORD = 15036;
-pub const ERROR_EVT_PUBLISHER_DISABLED: DWORD = 15037;
-pub const ERROR_EVT_FILTER_OUT_OF_RANGE: DWORD = 15038;
-pub const ERROR_EC_SUBSCRIPTION_CANNOT_ACTIVATE: DWORD = 15080;
-pub const ERROR_EC_LOG_DISABLED: DWORD = 15081;
-pub const ERROR_EC_CIRCULAR_FORWARDING: DWORD = 15082;
-pub const ERROR_EC_CREDSTORE_FULL: DWORD = 15083;
-pub const ERROR_EC_CRED_NOT_FOUND: DWORD = 15084;
-pub const ERROR_EC_NO_ACTIVE_CHANNEL: DWORD = 15085;
-pub const ERROR_MUI_FILE_NOT_FOUND: DWORD = 15100;
-pub const ERROR_MUI_INVALID_FILE: DWORD = 15101;
-pub const ERROR_MUI_INVALID_RC_CONFIG: DWORD = 15102;
-pub const ERROR_MUI_INVALID_LOCALE_NAME: DWORD = 15103;
-pub const ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME: DWORD = 15104;
-pub const ERROR_MUI_FILE_NOT_LOADED: DWORD = 15105;
-pub const ERROR_RESOURCE_ENUM_USER_STOP: DWORD = 15106;
-pub const ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED: DWORD = 15107;
-pub const ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME: DWORD = 15108;
-pub const ERROR_MRM_RUNTIME_NO_DEFAULT_OR_NEUTRAL_RESOURCE: DWORD = 15110;
-pub const ERROR_MRM_INVALID_PRICONFIG: DWORD = 15111;
-pub const ERROR_MRM_INVALID_FILE_TYPE: DWORD = 15112;
-pub const ERROR_MRM_UNKNOWN_QUALIFIER: DWORD = 15113;
-pub const ERROR_MRM_INVALID_QUALIFIER_VALUE: DWORD = 15114;
-pub const ERROR_MRM_NO_CANDIDATE: DWORD = 15115;
-pub const ERROR_MRM_NO_MATCH_OR_DEFAULT_CANDIDATE: DWORD = 15116;
-pub const ERROR_MRM_RESOURCE_TYPE_MISMATCH: DWORD = 15117;
-pub const ERROR_MRM_DUPLICATE_MAP_NAME: DWORD = 15118;
-pub const ERROR_MRM_DUPLICATE_ENTRY: DWORD = 15119;
-pub const ERROR_MRM_INVALID_RESOURCE_IDENTIFIER: DWORD = 15120;
-pub const ERROR_MRM_FILEPATH_TOO_LONG: DWORD = 15121;
-pub const ERROR_MRM_UNSUPPORTED_DIRECTORY_TYPE: DWORD = 15122;
-pub const ERROR_MRM_INVALID_PRI_FILE: DWORD = 15126;
-pub const ERROR_MRM_NAMED_RESOURCE_NOT_FOUND: DWORD = 15127;
-pub const ERROR_MRM_MAP_NOT_FOUND: DWORD = 15135;
-pub const ERROR_MRM_UNSUPPORTED_PROFILE_TYPE: DWORD = 15136;
-pub const ERROR_MRM_INVALID_QUALIFIER_OPERATOR: DWORD = 15137;
-pub const ERROR_MRM_INDETERMINATE_QUALIFIER_VALUE: DWORD = 15138;
-pub const ERROR_MRM_AUTOMERGE_ENABLED: DWORD = 15139;
-pub const ERROR_MRM_TOO_MANY_RESOURCES: DWORD = 15140;
-pub const ERROR_MCA_INVALID_CAPABILITIES_STRING: DWORD = 15200;
-pub const ERROR_MCA_INVALID_VCP_VERSION: DWORD = 15201;
-pub const ERROR_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION: DWORD = 15202;
-pub const ERROR_MCA_MCCS_VERSION_MISMATCH: DWORD = 15203;
-pub const ERROR_MCA_UNSUPPORTED_MCCS_VERSION: DWORD = 15204;
-pub const ERROR_MCA_INTERNAL_ERROR: DWORD = 15205;
-pub const ERROR_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED: DWORD = 15206;
-pub const ERROR_MCA_UNSUPPORTED_COLOR_TEMPERATURE: DWORD = 15207;
-pub const ERROR_AMBIGUOUS_SYSTEM_DEVICE: DWORD = 15250;
-pub const ERROR_SYSTEM_DEVICE_NOT_FOUND: DWORD = 15299;
-pub const ERROR_HASH_NOT_SUPPORTED: DWORD = 15300;
-pub const ERROR_HASH_NOT_PRESENT: DWORD = 15301;
-pub const ERROR_SECONDARY_IC_PROVIDER_NOT_REGISTERED: DWORD = 15321;
-pub const ERROR_GPIO_CLIENT_INFORMATION_INVALID: DWORD = 15322;
-pub const ERROR_GPIO_VERSION_NOT_SUPPORTED: DWORD = 15323;
-pub const ERROR_GPIO_INVALID_REGISTRATION_PACKET: DWORD = 15324;
-pub const ERROR_GPIO_OPERATION_DENIED: DWORD = 15325;
-pub const ERROR_GPIO_INCOMPATIBLE_CONNECT_MODE: DWORD = 15326;
-pub const ERROR_GPIO_INTERRUPT_ALREADY_UNMASKED: DWORD = 15327;
-pub const ERROR_CANNOT_SWITCH_RUNLEVEL: DWORD = 15400;
-pub const ERROR_INVALID_RUNLEVEL_SETTING: DWORD = 15401;
-pub const ERROR_RUNLEVEL_SWITCH_TIMEOUT: DWORD = 15402;
-pub const ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT: DWORD = 15403;
-pub const ERROR_RUNLEVEL_SWITCH_IN_PROGRESS: DWORD = 15404;
-pub const ERROR_SERVICES_FAILED_AUTOSTART: DWORD = 15405;
-pub const ERROR_COM_TASK_STOP_PENDING: DWORD = 15501;
-pub const ERROR_INSTALL_OPEN_PACKAGE_FAILED: DWORD = 15600;
-pub const ERROR_INSTALL_PACKAGE_NOT_FOUND: DWORD = 15601;
-pub const ERROR_INSTALL_INVALID_PACKAGE: DWORD = 15602;
-pub const ERROR_INSTALL_RESOLVE_DEPENDENCY_FAILED: DWORD = 15603;
-pub const ERROR_INSTALL_OUT_OF_DISK_SPACE: DWORD = 15604;
-pub const ERROR_INSTALL_NETWORK_FAILURE: DWORD = 15605;
-pub const ERROR_INSTALL_REGISTRATION_FAILURE: DWORD = 15606;
-pub const ERROR_INSTALL_DEREGISTRATION_FAILURE: DWORD = 15607;
-pub const ERROR_INSTALL_CANCEL: DWORD = 15608;
-pub const ERROR_INSTALL_FAILED: DWORD = 15609;
-pub const ERROR_REMOVE_FAILED: DWORD = 15610;
-pub const ERROR_PACKAGE_ALREADY_EXISTS: DWORD = 15611;
-pub const ERROR_NEEDS_REMEDIATION: DWORD = 15612;
-pub const ERROR_INSTALL_PREREQUISITE_FAILED: DWORD = 15613;
-pub const ERROR_PACKAGE_REPOSITORY_CORRUPTED: DWORD = 15614;
-pub const ERROR_INSTALL_POLICY_FAILURE: DWORD = 15615;
-pub const ERROR_PACKAGE_UPDATING: DWORD = 15616;
-pub const ERROR_DEPLOYMENT_BLOCKED_BY_POLICY: DWORD = 15617;
-pub const ERROR_PACKAGES_IN_USE: DWORD = 15618;
-pub const ERROR_RECOVERY_FILE_CORRUPT: DWORD = 15619;
-pub const ERROR_INVALID_STAGED_SIGNATURE: DWORD = 15620;
-pub const ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED: DWORD = 15621;
-pub const ERROR_INSTALL_PACKAGE_DOWNGRADE: DWORD = 15622;
-pub const ERROR_SYSTEM_NEEDS_REMEDIATION: DWORD = 15623;
-pub const ERROR_APPX_INTEGRITY_FAILURE_CLR_NGEN: DWORD = 15624;
-pub const ERROR_RESILIENCY_FILE_CORRUPT: DWORD = 15625;
-pub const ERROR_INSTALL_FIREWALL_SERVICE_NOT_RUNNING: DWORD = 15626;
-pub const ERROR_STATE_LOAD_STORE_FAILED: DWORD = 15800;
-pub const ERROR_STATE_GET_VERSION_FAILED: DWORD = 15801;
-pub const ERROR_STATE_SET_VERSION_FAILED: DWORD = 15802;
-pub const ERROR_STATE_STRUCTURED_RESET_FAILED: DWORD = 15803;
-pub const ERROR_STATE_OPEN_CONTAINER_FAILED: DWORD = 15804;
-pub const ERROR_STATE_CREATE_CONTAINER_FAILED: DWORD = 15805;
-pub const ERROR_STATE_DELETE_CONTAINER_FAILED: DWORD = 15806;
-pub const ERROR_STATE_READ_SETTING_FAILED: DWORD = 15807;
-pub const ERROR_STATE_WRITE_SETTING_FAILED: DWORD = 15808;
-pub const ERROR_STATE_DELETE_SETTING_FAILED: DWORD = 15809;
-pub const ERROR_STATE_QUERY_SETTING_FAILED: DWORD = 15810;
-pub const ERROR_STATE_READ_COMPOSITE_SETTING_FAILED: DWORD = 15811;
-pub const ERROR_STATE_WRITE_COMPOSITE_SETTING_FAILED: DWORD = 15812;
-pub const ERROR_STATE_ENUMERATE_CONTAINER_FAILED: DWORD = 15813;
-pub const ERROR_STATE_ENUMERATE_SETTINGS_FAILED: DWORD = 15814;
-pub const ERROR_STATE_COMPOSITE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED: DWORD = 15815;
-pub const ERROR_STATE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED: DWORD = 15816;
-pub const ERROR_STATE_SETTING_NAME_SIZE_LIMIT_EXCEEDED: DWORD = 15817;
-pub const ERROR_STATE_CONTAINER_NAME_SIZE_LIMIT_EXCEEDED: DWORD = 15818;
-pub const ERROR_API_UNAVAILABLE: DWORD = 15841;
-pub const ERROR_AUDITING_DISABLED: DWORD = 0xC0090001;
-pub const ERROR_ALL_SIDS_FILTERED: DWORD = 0xC0090002;
-
-pub const WSABASEERR: c_int = 10000;
-pub const WSAEINTR: c_int = WSABASEERR + 4;
-pub const WSAEBADF: c_int = WSABASEERR + 9;
-pub const WSAEACCES: c_int = WSABASEERR + 13;
-pub const WSAEFAULT: c_int = WSABASEERR + 14;
-pub const WSAEINVAL: c_int = WSABASEERR + 22;
-pub const WSAEMFILE: c_int = WSABASEERR + 24;
-pub const WSAEWOULDBLOCK: c_int = WSABASEERR + 35;
-pub const WSAEINPROGRESS: c_int = WSABASEERR + 36;
-pub const WSAEALREADY: c_int = WSABASEERR + 37;
-pub const WSAENOTSOCK: c_int = WSABASEERR + 38;
-pub const WSAEDESTADDRREQ: c_int = WSABASEERR + 39;
-pub const WSAEMSGSIZE: c_int = WSABASEERR + 40;
-pub const WSAEPROTOTYPE: c_int = WSABASEERR + 41;
-pub const WSAENOPROTOOPT: c_int = WSABASEERR + 42;
-pub const WSAEPROTONOSUPPORT: c_int = WSABASEERR + 43;
-pub const WSAESOCKTNOSUPPORT: c_int = WSABASEERR + 44;
-pub const WSAEOPNOTSUPP: c_int = WSABASEERR + 45;
-pub const WSAEPFNOSUPPORT: c_int = WSABASEERR + 46;
-pub const WSAEAFNOSUPPORT: c_int = WSABASEERR + 47;
-pub const WSAEADDRINUSE: c_int = WSABASEERR + 48;
-pub const WSAEADDRNOTAVAIL: c_int = WSABASEERR + 49;
-pub const WSAENETDOWN: c_int = WSABASEERR + 50;
-pub const WSAENETUNREACH: c_int = WSABASEERR + 51;
-pub const WSAENETRESET: c_int = WSABASEERR + 52;
-pub const WSAECONNABORTED: c_int = WSABASEERR + 53;
-pub const WSAECONNRESET: c_int = WSABASEERR + 54;
-pub const WSAENOBUFS: c_int = WSABASEERR + 55;
-pub const WSAEISCONN: c_int = WSABASEERR + 56;
-pub const WSAENOTCONN: c_int = WSABASEERR + 57;
-pub const WSAESHUTDOWN: c_int = WSABASEERR + 58;
-pub const WSAETOOMANYREFS: c_int = WSABASEERR + 59;
-pub const WSAETIMEDOUT: c_int = WSABASEERR + 60;
-pub const WSAECONNREFUSED: c_int = WSABASEERR + 61;
-pub const WSAELOOP: c_int = WSABASEERR + 62;
-pub const WSAENAMETOOLONG: c_int = WSABASEERR + 63;
-pub const WSAEHOSTDOWN: c_int = WSABASEERR + 64;
-pub const WSAEHOSTUNREACH: c_int = WSABASEERR + 65;
-pub const WSAENOTEMPTY: c_int = WSABASEERR + 66;
-pub const WSAEPROCLIM: c_int = WSABASEERR + 67;
-pub const WSAEUSERS: c_int = WSABASEERR + 68;
-pub const WSAEDQUOT: c_int = WSABASEERR + 69;
-pub const WSAESTALE: c_int = WSABASEERR + 70;
-pub const WSAEREMOTE: c_int = WSABASEERR + 71;
-pub const WSASYSNOTREADY: c_int = WSABASEERR + 91;
-pub const WSAVERNOTSUPPORTED: c_int = WSABASEERR + 92;
-pub const WSANOTINITIALISED: c_int = WSABASEERR + 93;
-pub const WSAEDISCON: c_int = WSABASEERR + 101;
-pub const WSAENOMORE: c_int = WSABASEERR + 102;
-pub const WSAECANCELLED: c_int = WSABASEERR + 103;
-pub const WSAEINVALIDPROCTABLE: c_int = WSABASEERR + 104;
-pub const WSAEINVALIDPROVIDER: c_int = WSABASEERR + 105;
-pub const WSAEPROVIDERFAILEDINIT: c_int = WSABASEERR + 106;
-pub const WSASYSCALLFAILURE: c_int = WSABASEERR + 107;
-pub const WSASERVICE_NOT_FOUND: c_int = WSABASEERR + 108;
-pub const WSATYPE_NOT_FOUND: c_int = WSABASEERR + 109;
-pub const WSA_E_NO_MORE: c_int = WSABASEERR + 110;
-pub const WSA_E_CANCELLED: c_int = WSABASEERR + 111;
-pub const WSAEREFUSED: c_int = WSABASEERR + 112;
-pub const WSAHOST_NOT_FOUND: c_int = WSABASEERR + 1001;
-pub const WSATRY_AGAIN: c_int = WSABASEERR + 1002;
-pub const WSANO_RECOVERY: c_int = WSABASEERR + 1003;
-pub const WSANO_DATA: c_int = WSABASEERR + 1004;
-pub const WSA_QOS_RECEIVERS: c_int = WSABASEERR + 1005;
-pub const WSA_QOS_SENDERS: c_int = WSABASEERR + 1006;
-pub const WSA_QOS_NO_SENDERS: c_int = WSABASEERR + 1007;
-pub const WSA_QOS_NO_RECEIVERS: c_int = WSABASEERR + 1008;
-pub const WSA_QOS_REQUEST_CONFIRMED: c_int = WSABASEERR + 1009;
-pub const WSA_QOS_ADMISSION_FAILURE: c_int = WSABASEERR + 1010;
-pub const WSA_QOS_POLICY_FAILURE: c_int = WSABASEERR + 1011;
-pub const WSA_QOS_BAD_STYLE: c_int = WSABASEERR + 1012;
-pub const WSA_QOS_BAD_OBJECT: c_int = WSABASEERR + 1013;
-pub const WSA_QOS_TRAFFIC_CTRL_ERROR: c_int = WSABASEERR + 1014;
-pub const WSA_QOS_GENERIC_ERROR: c_int = WSABASEERR + 1015;
-pub const WSA_QOS_ESERVICETYPE: c_int = WSABASEERR + 1016;
-pub const WSA_QOS_EFLOWSPEC: c_int = WSABASEERR + 1017;
-pub const WSA_QOS_EPROVSPECBUF: c_int = WSABASEERR + 1018;
-pub const WSA_QOS_EFILTERSTYLE: c_int = WSABASEERR + 1019;
-pub const WSA_QOS_EFILTERTYPE: c_int = WSABASEERR + 1020;
-pub const WSA_QOS_EFILTERCOUNT: c_int = WSABASEERR + 1021;
-pub const WSA_QOS_EOBJLENGTH: c_int = WSABASEERR + 1022;
-pub const WSA_QOS_EFLOWCOUNT: c_int = WSABASEERR + 1023;
-pub const WSA_QOS_EUNKNOWNPSOBJ: c_int = WSABASEERR + 1024;
-pub const WSA_QOS_EUNKOWNPSOBJ: c_int = WSA_QOS_EUNKNOWNPSOBJ;
-pub const WSA_QOS_EPOLICYOBJ: c_int = WSABASEERR + 1025;
-pub const WSA_QOS_EFLOWDESC: c_int = WSABASEERR + 1026;
-pub const WSA_QOS_EPSFLOWSPEC: c_int = WSABASEERR + 1027;
-pub const WSA_QOS_EPSFILTERSPEC: c_int = WSABASEERR + 1028;
-pub const WSA_QOS_ESDMODEOBJ: c_int = WSABASEERR + 1029;
-pub const WSA_QOS_ESHAPERATEOBJ: c_int = WSABASEERR + 1030;
-pub const WSA_QOS_RESERVED_PETYPE: c_int = WSABASEERR + 1031;
diff --git a/library/std/src/sys/windows/c/windows_sys.lst b/library/std/src/sys/windows/c/windows_sys.lst
new file mode 100644
index 000000000..3e454199f
--- /dev/null
+++ b/library/std/src/sys/windows/c/windows_sys.lst
@@ -0,0 +1,2590 @@
+// tidy-alphabetical-start
+Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED
+Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION
+Windows.Wdk.Storage.FileSystem.FILE_CREATE
+Windows.Wdk.Storage.FileSystem.FILE_CREATE_TREE_CONNECTION
+Windows.Wdk.Storage.FileSystem.FILE_DELETE_ON_CLOSE
+Windows.Wdk.Storage.FileSystem.FILE_DIRECTORY_FILE
+Windows.Wdk.Storage.FileSystem.FILE_DISALLOW_EXCLUSIVE
+Windows.Wdk.Storage.FileSystem.FILE_NO_COMPRESSION
+Windows.Wdk.Storage.FileSystem.FILE_NO_EA_KNOWLEDGE
+Windows.Wdk.Storage.FileSystem.FILE_NO_INTERMEDIATE_BUFFERING
+Windows.Wdk.Storage.FileSystem.FILE_NON_DIRECTORY_FILE
+Windows.Wdk.Storage.FileSystem.FILE_OPEN
+Windows.Wdk.Storage.FileSystem.FILE_OPEN_BY_FILE_ID
+Windows.Wdk.Storage.FileSystem.FILE_OPEN_FOR_BACKUP_INTENT
+Windows.Wdk.Storage.FileSystem.FILE_OPEN_FOR_FREE_SPACE_QUERY
+Windows.Wdk.Storage.FileSystem.FILE_OPEN_IF
+Windows.Wdk.Storage.FileSystem.FILE_OPEN_NO_RECALL
+Windows.Wdk.Storage.FileSystem.FILE_OPEN_REPARSE_POINT
+Windows.Wdk.Storage.FileSystem.FILE_OPEN_REQUIRING_OPLOCK
+Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE
+Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE_IF
+Windows.Wdk.Storage.FileSystem.FILE_RANDOM_ACCESS
+Windows.Wdk.Storage.FileSystem.FILE_RESERVE_OPFILTER
+Windows.Wdk.Storage.FileSystem.FILE_SEQUENTIAL_ONLY
+Windows.Wdk.Storage.FileSystem.FILE_SESSION_AWARE
+Windows.Wdk.Storage.FileSystem.FILE_SUPERSEDE
+Windows.Wdk.Storage.FileSystem.FILE_SYNCHRONOUS_IO_ALERT
+Windows.Wdk.Storage.FileSystem.FILE_SYNCHRONOUS_IO_NONALERT
+Windows.Wdk.Storage.FileSystem.FILE_WRITE_THROUGH
+Windows.Wdk.Storage.FileSystem.NtCreateFile
+Windows.Wdk.Storage.FileSystem.NTCREATEFILE_CREATE_DISPOSITION
+Windows.Wdk.Storage.FileSystem.NTCREATEFILE_CREATE_OPTIONS
+Windows.Wdk.Storage.FileSystem.NtReadFile
+Windows.Wdk.Storage.FileSystem.NtWriteFile
+Windows.Wdk.Storage.FileSystem.SYMLINK_FLAG_RELATIVE
+Windows.Win32.Foundation.BOOL
+Windows.Win32.Foundation.BOOLEAN
+Windows.Win32.Foundation.CloseHandle
+Windows.Win32.Foundation.DNS_ERROR_ADDRESS_REQUIRED
+Windows.Win32.Foundation.DNS_ERROR_ALIAS_LOOP
+Windows.Win32.Foundation.DNS_ERROR_AUTOZONE_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_AXFR
+Windows.Win32.Foundation.DNS_ERROR_BACKGROUND_LOADING
+Windows.Win32.Foundation.DNS_ERROR_BAD_KEYMASTER
+Windows.Win32.Foundation.DNS_ERROR_BAD_PACKET
+Windows.Win32.Foundation.DNS_ERROR_CANNOT_FIND_ROOT_HINTS
+Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED
+Windows.Win32.Foundation.DNS_ERROR_CNAME_COLLISION
+Windows.Win32.Foundation.DNS_ERROR_CNAME_LOOP
+Windows.Win32.Foundation.DNS_ERROR_DATAFILE_OPEN_FAILURE
+Windows.Win32.Foundation.DNS_ERROR_DATAFILE_PARSING
+Windows.Win32.Foundation.DNS_ERROR_DEFAULT_SCOPE
+Windows.Win32.Foundation.DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE
+Windows.Win32.Foundation.DNS_ERROR_DEFAULT_ZONESCOPE
+Windows.Win32.Foundation.DNS_ERROR_DELEGATION_REQUIRED
+Windows.Win32.Foundation.DNS_ERROR_DNAME_COLLISION
+Windows.Win32.Foundation.DNS_ERROR_DNSSEC_IS_DISABLED
+Windows.Win32.Foundation.DNS_ERROR_DP_ALREADY_ENLISTED
+Windows.Win32.Foundation.DNS_ERROR_DP_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_DP_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_DP_FSMO_ERROR
+Windows.Win32.Foundation.DNS_ERROR_DP_NOT_AVAILABLE
+Windows.Win32.Foundation.DNS_ERROR_DP_NOT_ENLISTED
+Windows.Win32.Foundation.DNS_ERROR_DS_UNAVAILABLE
+Windows.Win32.Foundation.DNS_ERROR_DS_ZONE_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_DWORD_VALUE_TOO_LARGE
+Windows.Win32.Foundation.DNS_ERROR_DWORD_VALUE_TOO_SMALL
+Windows.Win32.Foundation.DNS_ERROR_FILE_WRITEBACK_FAILED
+Windows.Win32.Foundation.DNS_ERROR_FORWARDER_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_INCONSISTENT_ROOT_HINTS
+Windows.Win32.Foundation.DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME
+Windows.Win32.Foundation.DNS_ERROR_INVALID_CLIENT_SUBNET_NAME
+Windows.Win32.Foundation.DNS_ERROR_INVALID_DATA
+Windows.Win32.Foundation.DNS_ERROR_INVALID_DATAFILE_NAME
+Windows.Win32.Foundation.DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET
+Windows.Win32.Foundation.DNS_ERROR_INVALID_IP_ADDRESS
+Windows.Win32.Foundation.DNS_ERROR_INVALID_KEY_SIZE
+Windows.Win32.Foundation.DNS_ERROR_INVALID_NAME
+Windows.Win32.Foundation.DNS_ERROR_INVALID_NAME_CHAR
+Windows.Win32.Foundation.DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT
+Windows.Win32.Foundation.DNS_ERROR_INVALID_POLICY_TABLE
+Windows.Win32.Foundation.DNS_ERROR_INVALID_PROPERTY
+Windows.Win32.Foundation.DNS_ERROR_INVALID_ROLLOVER_PERIOD
+Windows.Win32.Foundation.DNS_ERROR_INVALID_SCOPE_NAME
+Windows.Win32.Foundation.DNS_ERROR_INVALID_SCOPE_OPERATION
+Windows.Win32.Foundation.DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD
+Windows.Win32.Foundation.DNS_ERROR_INVALID_TYPE
+Windows.Win32.Foundation.DNS_ERROR_INVALID_XML
+Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONE_OPERATION
+Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONE_TYPE
+Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONESCOPE_NAME
+Windows.Win32.Foundation.DNS_ERROR_KEYMASTER_REQUIRED
+Windows.Win32.Foundation.DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION
+Windows.Win32.Foundation.DNS_ERROR_KSP_NOT_ACCESSIBLE
+Windows.Win32.Foundation.DNS_ERROR_LOAD_ZONESCOPE_FAILED
+Windows.Win32.Foundation.DNS_ERROR_NAME_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_NAME_NOT_IN_ZONE
+Windows.Win32.Foundation.DNS_ERROR_NBSTAT_INIT_FAILED
+Windows.Win32.Foundation.DNS_ERROR_NEED_SECONDARY_ADDRESSES
+Windows.Win32.Foundation.DNS_ERROR_NEED_WINS_SERVERS
+Windows.Win32.Foundation.DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE
+Windows.Win32.Foundation.DNS_ERROR_NO_CREATE_CACHE_DATA
+Windows.Win32.Foundation.DNS_ERROR_NO_DNS_SERVERS
+Windows.Win32.Foundation.DNS_ERROR_NO_MEMORY
+Windows.Win32.Foundation.DNS_ERROR_NO_PACKET
+Windows.Win32.Foundation.DNS_ERROR_NO_TCPIP
+Windows.Win32.Foundation.DNS_ERROR_NO_VALID_TRUST_ANCHORS
+Windows.Win32.Foundation.DNS_ERROR_NO_ZONE_INFO
+Windows.Win32.Foundation.DNS_ERROR_NODE_CREATION_FAILED
+Windows.Win32.Foundation.DNS_ERROR_NODE_IS_CNAME
+Windows.Win32.Foundation.DNS_ERROR_NODE_IS_DNAME
+Windows.Win32.Foundation.DNS_ERROR_NON_RFC_NAME
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_RODC
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ZSK
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_UNDER_DNAME
+Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES
+Windows.Win32.Foundation.DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS
+Windows.Win32.Foundation.DNS_ERROR_NOT_UNIQUE
+Windows.Win32.Foundation.DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1
+Windows.Win32.Foundation.DNS_ERROR_NSEC3_NAME_COLLISION
+Windows.Win32.Foundation.DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1
+Windows.Win32.Foundation.DNS_ERROR_NUMERIC_NAME
+Windows.Win32.Foundation.DNS_ERROR_POLICY_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_POLICY_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_NAME
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_SETTINGS
+Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_WEIGHT
+Windows.Win32.Foundation.DNS_ERROR_POLICY_LOCKED
+Windows.Win32.Foundation.DNS_ERROR_POLICY_MISSING_CRITERIA
+Windows.Win32.Foundation.DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID
+Windows.Win32.Foundation.DNS_ERROR_POLICY_SCOPE_MISSING
+Windows.Win32.Foundation.DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED
+Windows.Win32.Foundation.DNS_ERROR_PRIMARY_REQUIRES_DATAFILE
+Windows.Win32.Foundation.DNS_ERROR_RCODE
+Windows.Win32.Foundation.DNS_ERROR_RCODE_BADKEY
+Windows.Win32.Foundation.DNS_ERROR_RCODE_BADSIG
+Windows.Win32.Foundation.DNS_ERROR_RCODE_BADTIME
+Windows.Win32.Foundation.DNS_ERROR_RCODE_FORMAT_ERROR
+Windows.Win32.Foundation.DNS_ERROR_RCODE_NAME_ERROR
+Windows.Win32.Foundation.DNS_ERROR_RCODE_NOT_IMPLEMENTED
+Windows.Win32.Foundation.DNS_ERROR_RCODE_NOTAUTH
+Windows.Win32.Foundation.DNS_ERROR_RCODE_NOTZONE
+Windows.Win32.Foundation.DNS_ERROR_RCODE_NXRRSET
+Windows.Win32.Foundation.DNS_ERROR_RCODE_REFUSED
+Windows.Win32.Foundation.DNS_ERROR_RCODE_SERVER_FAILURE
+Windows.Win32.Foundation.DNS_ERROR_RCODE_YXDOMAIN
+Windows.Win32.Foundation.DNS_ERROR_RCODE_YXRRSET
+Windows.Win32.Foundation.DNS_ERROR_RECORD_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_RECORD_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_RECORD_FORMAT
+Windows.Win32.Foundation.DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT
+Windows.Win32.Foundation.DNS_ERROR_RECORD_TIMED_OUT
+Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_ALREADY_QUEUED
+Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_IN_PROGRESS
+Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_NOT_POKEABLE
+Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_IPV4_PREFIX
+Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_IPV6_PREFIX
+Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_LEAK_RATE
+Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_TC_RATE
+Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_WINDOW_SIZE
+Windows.Win32.Foundation.DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE
+Windows.Win32.Foundation.DNS_ERROR_RRL_NOT_ENABLED
+Windows.Win32.Foundation.DNS_ERROR_SCOPE_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_SCOPE_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_SCOPE_LOCKED
+Windows.Win32.Foundation.DNS_ERROR_SECONDARY_DATA
+Windows.Win32.Foundation.DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP
+Windows.Win32.Foundation.DNS_ERROR_SERVERSCOPE_IS_REFERENCED
+Windows.Win32.Foundation.DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE
+Windows.Win32.Foundation.DNS_ERROR_SOA_DELETE_INVALID
+Windows.Win32.Foundation.DNS_ERROR_STANDBY_KEY_NOT_PRESENT
+Windows.Win32.Foundation.DNS_ERROR_SUBNET_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_SUBNET_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_TOO_MANY_SKDS
+Windows.Win32.Foundation.DNS_ERROR_TRY_AGAIN_LATER
+Windows.Win32.Foundation.DNS_ERROR_UNEXPECTED_CNG_ERROR
+Windows.Win32.Foundation.DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR
+Windows.Win32.Foundation.DNS_ERROR_UNKNOWN_RECORD_TYPE
+Windows.Win32.Foundation.DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION
+Windows.Win32.Foundation.DNS_ERROR_UNSECURE_PACKET
+Windows.Win32.Foundation.DNS_ERROR_UNSUPPORTED_ALGORITHM
+Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_TREE_LOCKED
+Windows.Win32.Foundation.DNS_ERROR_WINS_INIT_FAILED
+Windows.Win32.Foundation.DNS_ERROR_ZONE_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_ZONE_CONFIGURATION_ERROR
+Windows.Win32.Foundation.DNS_ERROR_ZONE_CREATION_FAILED
+Windows.Win32.Foundation.DNS_ERROR_ZONE_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_ZONE_HAS_NO_NS_RECORDS
+Windows.Win32.Foundation.DNS_ERROR_ZONE_HAS_NO_SOA_RECORD
+Windows.Win32.Foundation.DNS_ERROR_ZONE_IS_SHUTDOWN
+Windows.Win32.Foundation.DNS_ERROR_ZONE_LOCKED
+Windows.Win32.Foundation.DNS_ERROR_ZONE_LOCKED_FOR_SIGNING
+Windows.Win32.Foundation.DNS_ERROR_ZONE_NOT_SECONDARY
+Windows.Win32.Foundation.DNS_ERROR_ZONE_REQUIRES_MASTER_IP
+Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_ALREADY_EXISTS
+Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST
+Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED
+Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_IS_REFERENCED
+Windows.Win32.Foundation.DUPLICATE_CLOSE_SOURCE
+Windows.Win32.Foundation.DUPLICATE_HANDLE_OPTIONS
+Windows.Win32.Foundation.DUPLICATE_SAME_ACCESS
+Windows.Win32.Foundation.DuplicateHandle
+Windows.Win32.Foundation.E_NOTIMPL
+Windows.Win32.Foundation.ERROR_ABANDON_HIBERFILE
+Windows.Win32.Foundation.ERROR_ABANDONED_WAIT_0
+Windows.Win32.Foundation.ERROR_ABANDONED_WAIT_63
+Windows.Win32.Foundation.ERROR_ABIOS_ERROR
+Windows.Win32.Foundation.ERROR_ACCESS_AUDIT_BY_POLICY
+Windows.Win32.Foundation.ERROR_ACCESS_DENIED
+Windows.Win32.Foundation.ERROR_ACCESS_DENIED_APPDATA
+Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_BY_POLICY
+Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY
+Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_WEBBLADE
+Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER
+Windows.Win32.Foundation.ERROR_ACCOUNT_DISABLED
+Windows.Win32.Foundation.ERROR_ACCOUNT_EXPIRED
+Windows.Win32.Foundation.ERROR_ACCOUNT_LOCKED_OUT
+Windows.Win32.Foundation.ERROR_ACCOUNT_RESTRICTION
+Windows.Win32.Foundation.ERROR_ACPI_ERROR
+Windows.Win32.Foundation.ERROR_ACTIVE_CONNECTIONS
+Windows.Win32.Foundation.ERROR_ADAP_HDW_ERR
+Windows.Win32.Foundation.ERROR_ADDRESS_ALREADY_ASSOCIATED
+Windows.Win32.Foundation.ERROR_ADDRESS_NOT_ASSOCIATED
+Windows.Win32.Foundation.ERROR_ALERTED
+Windows.Win32.Foundation.ERROR_ALIAS_EXISTS
+Windows.Win32.Foundation.ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED
+Windows.Win32.Foundation.ERROR_ALLOCATE_BUCKET
+Windows.Win32.Foundation.ERROR_ALLOTTED_SPACE_EXCEEDED
+Windows.Win32.Foundation.ERROR_ALREADY_ASSIGNED
+Windows.Win32.Foundation.ERROR_ALREADY_EXISTS
+Windows.Win32.Foundation.ERROR_ALREADY_FIBER
+Windows.Win32.Foundation.ERROR_ALREADY_HAS_STREAM_ID
+Windows.Win32.Foundation.ERROR_ALREADY_INITIALIZED
+Windows.Win32.Foundation.ERROR_ALREADY_REGISTERED
+Windows.Win32.Foundation.ERROR_ALREADY_RUNNING_LKG
+Windows.Win32.Foundation.ERROR_ALREADY_THREAD
+Windows.Win32.Foundation.ERROR_ALREADY_WAITING
+Windows.Win32.Foundation.ERROR_ALREADY_WIN32
+Windows.Win32.Foundation.ERROR_API_UNAVAILABLE
+Windows.Win32.Foundation.ERROR_APP_HANG
+Windows.Win32.Foundation.ERROR_APP_INIT_FAILURE
+Windows.Win32.Foundation.ERROR_APP_WRONG_OS
+Windows.Win32.Foundation.ERROR_APPCONTAINER_REQUIRED
+Windows.Win32.Foundation.ERROR_APPEXEC_APP_COMPAT_BLOCK
+Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT
+Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_LICENSING
+Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_RESOURCES
+Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_TERMINATION
+Windows.Win32.Foundation.ERROR_APPEXEC_CONDITION_NOT_SATISFIED
+Windows.Win32.Foundation.ERROR_APPEXEC_HANDLE_INVALIDATED
+Windows.Win32.Foundation.ERROR_APPEXEC_HOST_ID_MISMATCH
+Windows.Win32.Foundation.ERROR_APPEXEC_INVALID_HOST_GENERATION
+Windows.Win32.Foundation.ERROR_APPEXEC_INVALID_HOST_STATE
+Windows.Win32.Foundation.ERROR_APPEXEC_NO_DONOR
+Windows.Win32.Foundation.ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION
+Windows.Win32.Foundation.ERROR_APPEXEC_UNKNOWN_USER
+Windows.Win32.Foundation.ERROR_APPHELP_BLOCK
+Windows.Win32.Foundation.ERROR_APPX_FILE_NOT_ENCRYPTED
+Windows.Win32.Foundation.ERROR_ARBITRATION_UNHANDLED
+Windows.Win32.Foundation.ERROR_ARENA_TRASHED
+Windows.Win32.Foundation.ERROR_ARITHMETIC_OVERFLOW
+Windows.Win32.Foundation.ERROR_ASSERTION_FAILURE
+Windows.Win32.Foundation.ERROR_ATOMIC_LOCKS_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_AUDIT_FAILED
+Windows.Win32.Foundation.ERROR_AUTHENTICATION_FIREWALL_FAILED
+Windows.Win32.Foundation.ERROR_AUTHIP_FAILURE
+Windows.Win32.Foundation.ERROR_AUTODATASEG_EXCEEDS_64k
+Windows.Win32.Foundation.ERROR_BACKUP_CONTROLLER
+Windows.Win32.Foundation.ERROR_BAD_ACCESSOR_FLAGS
+Windows.Win32.Foundation.ERROR_BAD_ARGUMENTS
+Windows.Win32.Foundation.ERROR_BAD_COMMAND
+Windows.Win32.Foundation.ERROR_BAD_COMPRESSION_BUFFER
+Windows.Win32.Foundation.ERROR_BAD_CONFIGURATION
+Windows.Win32.Foundation.ERROR_BAD_CURRENT_DIRECTORY
+Windows.Win32.Foundation.ERROR_BAD_DESCRIPTOR_FORMAT
+Windows.Win32.Foundation.ERROR_BAD_DEV_TYPE
+Windows.Win32.Foundation.ERROR_BAD_DEVICE
+Windows.Win32.Foundation.ERROR_BAD_DEVICE_PATH
+Windows.Win32.Foundation.ERROR_BAD_DLL_ENTRYPOINT
+Windows.Win32.Foundation.ERROR_BAD_DRIVER_LEVEL
+Windows.Win32.Foundation.ERROR_BAD_ENVIRONMENT
+Windows.Win32.Foundation.ERROR_BAD_EXE_FORMAT
+Windows.Win32.Foundation.ERROR_BAD_FILE_TYPE
+Windows.Win32.Foundation.ERROR_BAD_FORMAT
+Windows.Win32.Foundation.ERROR_BAD_FUNCTION_TABLE
+Windows.Win32.Foundation.ERROR_BAD_IMPERSONATION_LEVEL
+Windows.Win32.Foundation.ERROR_BAD_INHERITANCE_ACL
+Windows.Win32.Foundation.ERROR_BAD_LENGTH
+Windows.Win32.Foundation.ERROR_BAD_LOGON_SESSION_STATE
+Windows.Win32.Foundation.ERROR_BAD_MCFG_TABLE
+Windows.Win32.Foundation.ERROR_BAD_NET_NAME
+Windows.Win32.Foundation.ERROR_BAD_NET_RESP
+Windows.Win32.Foundation.ERROR_BAD_NETPATH
+Windows.Win32.Foundation.ERROR_BAD_PATHNAME
+Windows.Win32.Foundation.ERROR_BAD_PIPE
+Windows.Win32.Foundation.ERROR_BAD_PROFILE
+Windows.Win32.Foundation.ERROR_BAD_PROVIDER
+Windows.Win32.Foundation.ERROR_BAD_QUERY_SYNTAX
+Windows.Win32.Foundation.ERROR_BAD_RECOVERY_POLICY
+Windows.Win32.Foundation.ERROR_BAD_REM_ADAP
+Windows.Win32.Foundation.ERROR_BAD_SERVICE_ENTRYPOINT
+Windows.Win32.Foundation.ERROR_BAD_STACK
+Windows.Win32.Foundation.ERROR_BAD_THREADID_ADDR
+Windows.Win32.Foundation.ERROR_BAD_TOKEN_TYPE
+Windows.Win32.Foundation.ERROR_BAD_UNIT
+Windows.Win32.Foundation.ERROR_BAD_USER_PROFILE
+Windows.Win32.Foundation.ERROR_BAD_USERNAME
+Windows.Win32.Foundation.ERROR_BAD_VALIDATION_CLASS
+Windows.Win32.Foundation.ERROR_BADDB
+Windows.Win32.Foundation.ERROR_BADKEY
+Windows.Win32.Foundation.ERROR_BADSTARTPOSITION
+Windows.Win32.Foundation.ERROR_BEGINNING_OF_MEDIA
+Windows.Win32.Foundation.ERROR_BEYOND_VDL
+Windows.Win32.Foundation.ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT
+Windows.Win32.Foundation.ERROR_BLOCK_SHARED
+Windows.Win32.Foundation.ERROR_BLOCK_SOURCE_WEAK_REFERENCE_INVALID
+Windows.Win32.Foundation.ERROR_BLOCK_TARGET_WEAK_REFERENCE_INVALID
+Windows.Win32.Foundation.ERROR_BLOCK_TOO_MANY_REFERENCES
+Windows.Win32.Foundation.ERROR_BLOCK_WEAK_REFERENCE_INVALID
+Windows.Win32.Foundation.ERROR_BLOCKED_BY_PARENTAL_CONTROLS
+Windows.Win32.Foundation.ERROR_BOOT_ALREADY_ACCEPTED
+Windows.Win32.Foundation.ERROR_BROKEN_PIPE
+Windows.Win32.Foundation.ERROR_BUFFER_ALL_ZEROS
+Windows.Win32.Foundation.ERROR_BUFFER_OVERFLOW
+Windows.Win32.Foundation.ERROR_BUS_RESET
+Windows.Win32.Foundation.ERROR_BUSY
+Windows.Win32.Foundation.ERROR_BUSY_DRIVE
+Windows.Win32.Foundation.ERROR_BYPASSIO_FLT_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_CACHE_PAGE_LOCKED
+Windows.Win32.Foundation.ERROR_CALL_NOT_IMPLEMENTED
+Windows.Win32.Foundation.ERROR_CALLBACK_INVOKE_INLINE
+Windows.Win32.Foundation.ERROR_CALLBACK_POP_STACK
+Windows.Win32.Foundation.ERROR_CALLBACK_SUPPLIED_INVALID_DATA
+Windows.Win32.Foundation.ERROR_CAN_NOT_COMPLETE
+Windows.Win32.Foundation.ERROR_CANCEL_VIOLATION
+Windows.Win32.Foundation.ERROR_CANCELLED
+Windows.Win32.Foundation.ERROR_CANNOT_BREAK_OPLOCK
+Windows.Win32.Foundation.ERROR_CANNOT_COPY
+Windows.Win32.Foundation.ERROR_CANNOT_DETECT_DRIVER_FAILURE
+Windows.Win32.Foundation.ERROR_CANNOT_DETECT_PROCESS_ABORT
+Windows.Win32.Foundation.ERROR_CANNOT_FIND_WND_CLASS
+Windows.Win32.Foundation.ERROR_CANNOT_GRANT_REQUESTED_OPLOCK
+Windows.Win32.Foundation.ERROR_CANNOT_IMPERSONATE
+Windows.Win32.Foundation.ERROR_CANNOT_LOAD_REGISTRY_FILE
+Windows.Win32.Foundation.ERROR_CANNOT_MAKE
+Windows.Win32.Foundation.ERROR_CANNOT_OPEN_PROFILE
+Windows.Win32.Foundation.ERROR_CANT_ACCESS_DOMAIN_INFO
+Windows.Win32.Foundation.ERROR_CANT_ACCESS_FILE
+Windows.Win32.Foundation.ERROR_CANT_CLEAR_ENCRYPTION_FLAG
+Windows.Win32.Foundation.ERROR_CANT_DISABLE_MANDATORY
+Windows.Win32.Foundation.ERROR_CANT_ENABLE_DENY_ONLY
+Windows.Win32.Foundation.ERROR_CANT_OPEN_ANONYMOUS
+Windows.Win32.Foundation.ERROR_CANT_RESOLVE_FILENAME
+Windows.Win32.Foundation.ERROR_CANT_TERMINATE_SELF
+Windows.Win32.Foundation.ERROR_CANT_WAIT
+Windows.Win32.Foundation.ERROR_CANTFETCHBACKWARDS
+Windows.Win32.Foundation.ERROR_CANTOPEN
+Windows.Win32.Foundation.ERROR_CANTREAD
+Windows.Win32.Foundation.ERROR_CANTSCROLLBACKWARDS
+Windows.Win32.Foundation.ERROR_CANTWRITE
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_CHANGE_TYPE
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_DB_CORRUPTED
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_NO_POLICY
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_AUTHORIZED
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_DEVUNLOCKED
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_PROVISIONED
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH
+Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_PARSE_ERROR
+Windows.Win32.Foundation.ERROR_CARDBUS_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_CASE_DIFFERING_NAMES_IN_DIR
+Windows.Win32.Foundation.ERROR_CASE_SENSITIVE_PATH
+Windows.Win32.Foundation.ERROR_CERTIFICATE_VALIDATION_PREFERENCE_CONFLICT
+Windows.Win32.Foundation.ERROR_CHECKING_FILE_SYSTEM
+Windows.Win32.Foundation.ERROR_CHECKOUT_REQUIRED
+Windows.Win32.Foundation.ERROR_CHILD_MUST_BE_VOLATILE
+Windows.Win32.Foundation.ERROR_CHILD_NOT_COMPLETE
+Windows.Win32.Foundation.ERROR_CHILD_PROCESS_BLOCKED
+Windows.Win32.Foundation.ERROR_CHILD_WINDOW_MENU
+Windows.Win32.Foundation.ERROR_CIMFS_IMAGE_CORRUPT
+Windows.Win32.Foundation.ERROR_CIMFS_IMAGE_VERSION_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_CIRCULAR_DEPENDENCY
+Windows.Win32.Foundation.ERROR_CLASS_ALREADY_EXISTS
+Windows.Win32.Foundation.ERROR_CLASS_DOES_NOT_EXIST
+Windows.Win32.Foundation.ERROR_CLASS_HAS_WINDOWS
+Windows.Win32.Foundation.ERROR_CLIENT_SERVER_PARAMETERS_INVALID
+Windows.Win32.Foundation.ERROR_CLIPBOARD_NOT_OPEN
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_ACCESS_DENIED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_ALREADY_CONNECTED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_AUTHENTICATION_FAILED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_DEHYDRATION_DISALLOWED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_IN_USE
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_INVALID_REQUEST
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_METADATA_CORRUPT
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_METADATA_TOO_LARGE
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_IN_SYNC
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_PINNED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_CORRUPT
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROVIDER_TERMINATED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_READ_ONLY_VOLUME
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_ABORTED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_CANCELED
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_TIMEOUT
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_UNSUCCESSFUL
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_US_MESSAGE_TIMEOUT
+Windows.Win32.Foundation.ERROR_CLOUD_FILE_VALIDATION_FAILED
+Windows.Win32.Foundation.ERROR_COMMITMENT_LIMIT
+Windows.Win32.Foundation.ERROR_COMMITMENT_MINIMUM
+Windows.Win32.Foundation.ERROR_COMPRESSED_FILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_COMPRESSION_DISABLED
+Windows.Win32.Foundation.ERROR_COMPRESSION_NOT_BENEFICIAL
+Windows.Win32.Foundation.ERROR_CONNECTED_OTHER_PASSWORD
+Windows.Win32.Foundation.ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT
+Windows.Win32.Foundation.ERROR_CONNECTION_ABORTED
+Windows.Win32.Foundation.ERROR_CONNECTION_ACTIVE
+Windows.Win32.Foundation.ERROR_CONNECTION_COUNT_LIMIT
+Windows.Win32.Foundation.ERROR_CONNECTION_INVALID
+Windows.Win32.Foundation.ERROR_CONNECTION_REFUSED
+Windows.Win32.Foundation.ERROR_CONNECTION_UNAVAIL
+Windows.Win32.Foundation.ERROR_CONTAINER_ASSIGNED
+Windows.Win32.Foundation.ERROR_CONTENT_BLOCKED
+Windows.Win32.Foundation.ERROR_CONTEXT_EXPIRED
+Windows.Win32.Foundation.ERROR_CONTINUE
+Windows.Win32.Foundation.ERROR_CONTROL_C_EXIT
+Windows.Win32.Foundation.ERROR_CONTROL_ID_NOT_FOUND
+Windows.Win32.Foundation.ERROR_CONVERT_TO_LARGE
+Windows.Win32.Foundation.ERROR_CORRUPT_LOG_CLEARED
+Windows.Win32.Foundation.ERROR_CORRUPT_LOG_CORRUPTED
+Windows.Win32.Foundation.ERROR_CORRUPT_LOG_DELETED_FULL
+Windows.Win32.Foundation.ERROR_CORRUPT_LOG_OVERFULL
+Windows.Win32.Foundation.ERROR_CORRUPT_LOG_UNAVAILABLE
+Windows.Win32.Foundation.ERROR_CORRUPT_SYSTEM_FILE
+Windows.Win32.Foundation.ERROR_COULD_NOT_INTERPRET
+Windows.Win32.Foundation.ERROR_COUNTER_TIMEOUT
+Windows.Win32.Foundation.ERROR_CPU_SET_INVALID
+Windows.Win32.Foundation.ERROR_CRASH_DUMP
+Windows.Win32.Foundation.ERROR_CRC
+Windows.Win32.Foundation.ERROR_CREATE_FAILED
+Windows.Win32.Foundation.ERROR_CROSS_PARTITION_VIOLATION
+Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE
+Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_FILE_NOT_CSE
+Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE
+Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE
+Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER
+Windows.Win32.Foundation.ERROR_CSCSHARE_OFFLINE
+Windows.Win32.Foundation.ERROR_CTX_CLIENT_QUERY_TIMEOUT
+Windows.Win32.Foundation.ERROR_CTX_MODEM_RESPONSE_TIMEOUT
+Windows.Win32.Foundation.ERROR_CURRENT_DIRECTORY
+Windows.Win32.Foundation.ERROR_CURRENT_DOMAIN_NOT_ALLOWED
+Windows.Win32.Foundation.ERROR_DATA_CHECKSUM_ERROR
+Windows.Win32.Foundation.ERROR_DATA_NOT_ACCEPTED
+Windows.Win32.Foundation.ERROR_DATABASE_DOES_NOT_EXIST
+Windows.Win32.Foundation.ERROR_DATATYPE_MISMATCH
+Windows.Win32.Foundation.ERROR_DAX_MAPPING_EXISTS
+Windows.Win32.Foundation.ERROR_DBG_COMMAND_EXCEPTION
+Windows.Win32.Foundation.ERROR_DBG_CONTINUE
+Windows.Win32.Foundation.ERROR_DBG_CONTROL_BREAK
+Windows.Win32.Foundation.ERROR_DBG_CONTROL_C
+Windows.Win32.Foundation.ERROR_DBG_EXCEPTION_HANDLED
+Windows.Win32.Foundation.ERROR_DBG_EXCEPTION_NOT_HANDLED
+Windows.Win32.Foundation.ERROR_DBG_PRINTEXCEPTION_C
+Windows.Win32.Foundation.ERROR_DBG_REPLY_LATER
+Windows.Win32.Foundation.ERROR_DBG_RIPEXCEPTION
+Windows.Win32.Foundation.ERROR_DBG_TERMINATE_PROCESS
+Windows.Win32.Foundation.ERROR_DBG_TERMINATE_THREAD
+Windows.Win32.Foundation.ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE
+Windows.Win32.Foundation.ERROR_DC_NOT_FOUND
+Windows.Win32.Foundation.ERROR_DDE_FAIL
+Windows.Win32.Foundation.ERROR_DEBUG_ATTACH_FAILED
+Windows.Win32.Foundation.ERROR_DEBUGGER_INACTIVE
+Windows.Win32.Foundation.ERROR_DECRYPTION_FAILED
+Windows.Win32.Foundation.ERROR_DELAY_LOAD_FAILED
+Windows.Win32.Foundation.ERROR_DELETE_PENDING
+Windows.Win32.Foundation.ERROR_DEPENDENT_SERVICES_RUNNING
+Windows.Win32.Foundation.ERROR_DESTINATION_ELEMENT_FULL
+Windows.Win32.Foundation.ERROR_DESTROY_OBJECT_OF_OTHER_THREAD
+Windows.Win32.Foundation.ERROR_DEV_NOT_EXIST
+Windows.Win32.Foundation.ERROR_DEVICE_ALREADY_ATTACHED
+Windows.Win32.Foundation.ERROR_DEVICE_ALREADY_REMEMBERED
+Windows.Win32.Foundation.ERROR_DEVICE_DOOR_OPEN
+Windows.Win32.Foundation.ERROR_DEVICE_ENUMERATION_ERROR
+Windows.Win32.Foundation.ERROR_DEVICE_FEATURE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_DEVICE_HARDWARE_ERROR
+Windows.Win32.Foundation.ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL
+Windows.Win32.Foundation.ERROR_DEVICE_IN_MAINTENANCE
+Windows.Win32.Foundation.ERROR_DEVICE_IN_USE
+Windows.Win32.Foundation.ERROR_DEVICE_NO_RESOURCES
+Windows.Win32.Foundation.ERROR_DEVICE_NOT_CONNECTED
+Windows.Win32.Foundation.ERROR_DEVICE_NOT_PARTITIONED
+Windows.Win32.Foundation.ERROR_DEVICE_REINITIALIZATION_NEEDED
+Windows.Win32.Foundation.ERROR_DEVICE_REMOVED
+Windows.Win32.Foundation.ERROR_DEVICE_REQUIRES_CLEANING
+Windows.Win32.Foundation.ERROR_DEVICE_RESET_REQUIRED
+Windows.Win32.Foundation.ERROR_DEVICE_SUPPORT_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_DEVICE_UNREACHABLE
+Windows.Win32.Foundation.ERROR_DHCP_ADDRESS_CONFLICT
+Windows.Win32.Foundation.ERROR_DIFFERENT_SERVICE_ACCOUNT
+Windows.Win32.Foundation.ERROR_DIR_EFS_DISALLOWED
+Windows.Win32.Foundation.ERROR_DIR_NOT_EMPTY
+Windows.Win32.Foundation.ERROR_DIR_NOT_ROOT
+Windows.Win32.Foundation.ERROR_DIRECT_ACCESS_HANDLE
+Windows.Win32.Foundation.ERROR_DIRECTORY
+Windows.Win32.Foundation.ERROR_DIRECTORY_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_DISCARDED
+Windows.Win32.Foundation.ERROR_DISK_CHANGE
+Windows.Win32.Foundation.ERROR_DISK_CORRUPT
+Windows.Win32.Foundation.ERROR_DISK_FULL
+Windows.Win32.Foundation.ERROR_DISK_OPERATION_FAILED
+Windows.Win32.Foundation.ERROR_DISK_QUOTA_EXCEEDED
+Windows.Win32.Foundation.ERROR_DISK_RECALIBRATE_FAILED
+Windows.Win32.Foundation.ERROR_DISK_REPAIR_DISABLED
+Windows.Win32.Foundation.ERROR_DISK_REPAIR_REDIRECTED
+Windows.Win32.Foundation.ERROR_DISK_REPAIR_UNSUCCESSFUL
+Windows.Win32.Foundation.ERROR_DISK_RESET_FAILED
+Windows.Win32.Foundation.ERROR_DISK_RESOURCES_EXHAUSTED
+Windows.Win32.Foundation.ERROR_DISK_TOO_FRAGMENTED
+Windows.Win32.Foundation.ERROR_DLL_INIT_FAILED
+Windows.Win32.Foundation.ERROR_DLL_INIT_FAILED_LOGOFF
+Windows.Win32.Foundation.ERROR_DLL_MIGHT_BE_INCOMPATIBLE
+Windows.Win32.Foundation.ERROR_DLL_MIGHT_BE_INSECURE
+Windows.Win32.Foundation.ERROR_DLL_NOT_FOUND
+Windows.Win32.Foundation.ERROR_DLP_POLICY_DENIES_OPERATION
+Windows.Win32.Foundation.ERROR_DLP_POLICY_SILENTLY_FAIL
+Windows.Win32.Foundation.ERROR_DLP_POLICY_WARNS_AGAINST_OPERATION
+Windows.Win32.Foundation.ERROR_DOMAIN_CONTROLLER_EXISTS
+Windows.Win32.Foundation.ERROR_DOMAIN_CONTROLLER_NOT_FOUND
+Windows.Win32.Foundation.ERROR_DOMAIN_CTRLR_CONFIG_ERROR
+Windows.Win32.Foundation.ERROR_DOMAIN_EXISTS
+Windows.Win32.Foundation.ERROR_DOMAIN_LIMIT_EXCEEDED
+Windows.Win32.Foundation.ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION
+Windows.Win32.Foundation.ERROR_DOMAIN_TRUST_INCONSISTENT
+Windows.Win32.Foundation.ERROR_DOWNGRADE_DETECTED
+Windows.Win32.Foundation.ERROR_DPL_NOT_SUPPORTED_FOR_USER
+Windows.Win32.Foundation.ERROR_DRIVE_LOCKED
+Windows.Win32.Foundation.ERROR_DRIVER_BLOCKED
+Windows.Win32.Foundation.ERROR_DRIVER_CANCEL_TIMEOUT
+Windows.Win32.Foundation.ERROR_DRIVER_DATABASE_ERROR
+Windows.Win32.Foundation.ERROR_DRIVER_FAILED_PRIOR_UNLOAD
+Windows.Win32.Foundation.ERROR_DRIVER_FAILED_SLEEP
+Windows.Win32.Foundation.ERROR_DRIVER_PROCESS_TERMINATED
+Windows.Win32.Foundation.ERROR_DRIVERS_LEAKING_LOCKED_PAGES
+Windows.Win32.Foundation.ERROR_DS_ADD_REPLICA_INHIBITED
+Windows.Win32.Foundation.ERROR_DS_ADMIN_LIMIT_EXCEEDED
+Windows.Win32.Foundation.ERROR_DS_AFFECTS_MULTIPLE_DSAS
+Windows.Win32.Foundation.ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER
+Windows.Win32.Foundation.ERROR_DS_ALIAS_DEREF_PROBLEM
+Windows.Win32.Foundation.ERROR_DS_ALIAS_POINTS_TO_ALIAS
+Windows.Win32.Foundation.ERROR_DS_ALIAS_PROBLEM
+Windows.Win32.Foundation.ERROR_DS_ALIASED_OBJ_MISSING
+Windows.Win32.Foundation.ERROR_DS_ATT_ALREADY_EXISTS
+Windows.Win32.Foundation.ERROR_DS_ATT_IS_NOT_ON_OBJ
+Windows.Win32.Foundation.ERROR_DS_ATT_NOT_DEF_FOR_CLASS
+Windows.Win32.Foundation.ERROR_DS_ATT_NOT_DEF_IN_SCHEMA
+Windows.Win32.Foundation.ERROR_DS_ATT_SCHEMA_REQ_ID
+Windows.Win32.Foundation.ERROR_DS_ATT_SCHEMA_REQ_SYNTAX
+Windows.Win32.Foundation.ERROR_DS_ATT_VAL_ALREADY_EXISTS
+Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS
+Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_OWNED_BY_SAM
+Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED
+Windows.Win32.Foundation.ERROR_DS_AUDIT_FAILURE
+Windows.Win32.Foundation.ERROR_DS_AUTH_METHOD_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_DS_AUTH_UNKNOWN
+Windows.Win32.Foundation.ERROR_DS_AUTHORIZATION_FAILED
+Windows.Win32.Foundation.ERROR_DS_AUX_CLS_TEST_FAIL
+Windows.Win32.Foundation.ERROR_DS_BACKLINK_WITHOUT_LINK
+Windows.Win32.Foundation.ERROR_DS_BAD_ATT_SCHEMA_SYNTAX
+Windows.Win32.Foundation.ERROR_DS_BAD_HIERARCHY_FILE
+Windows.Win32.Foundation.ERROR_DS_BAD_INSTANCE_TYPE
+Windows.Win32.Foundation.ERROR_DS_BAD_NAME_SYNTAX
+Windows.Win32.Foundation.ERROR_DS_BAD_RDN_ATT_ID_SYNTAX
+Windows.Win32.Foundation.ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED
+Windows.Win32.Foundation.ERROR_DS_BUSY
+Windows.Win32.Foundation.ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD
+Windows.Win32.Foundation.ERROR_DS_CANT_ADD_ATT_VALUES
+Windows.Win32.Foundation.ERROR_DS_CANT_ADD_SYSTEM_ONLY
+Windows.Win32.Foundation.ERROR_DS_CANT_ADD_TO_GC
+Windows.Win32.Foundation.ERROR_DS_CANT_CACHE_ATT
+Windows.Win32.Foundation.ERROR_DS_CANT_CACHE_CLASS
+Windows.Win32.Foundation.ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC
+Windows.Win32.Foundation.ERROR_DS_CANT_CREATE_UNDER_SCHEMA
+Windows.Win32.Foundation.ERROR_DS_CANT_DEL_MASTER_CROSSREF
+Windows.Win32.Foundation.ERROR_DS_CANT_DELETE
+Windows.Win32.Foundation.ERROR_DS_CANT_DELETE_DSA_OBJ
+Windows.Win32.Foundation.ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC
+Windows.Win32.Foundation.ERROR_DS_CANT_DEREF_ALIAS
+Windows.Win32.Foundation.ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN
+Windows.Win32.Foundation.ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF
+Windows.Win32.Foundation.ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN
+Windows.Win32.Foundation.ERROR_DS_CANT_FIND_DSA_OBJ
+Windows.Win32.Foundation.ERROR_DS_CANT_FIND_EXPECTED_NC
+Windows.Win32.Foundation.ERROR_DS_CANT_FIND_NC_IN_CACHE
+Windows.Win32.Foundation.ERROR_DS_CANT_MIX_MASTER_AND_REPS
+Windows.Win32.Foundation.ERROR_DS_CANT_MOD_OBJ_CLASS
+Windows.Win32.Foundation.ERROR_DS_CANT_MOD_PRIMARYGROUPID
+Windows.Win32.Foundation.ERROR_DS_CANT_MOD_SYSTEM_ONLY
+Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_ACCOUNT_GROUP
+Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_APP_BASIC_GROUP
+Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_APP_QUERY_GROUP
+Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_DELETED_OBJECT
+Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_RESOURCE_GROUP
+Windows.Win32.Foundation.ERROR_DS_CANT_ON_NON_LEAF
+Windows.Win32.Foundation.ERROR_DS_CANT_ON_RDN
+Windows.Win32.Foundation.ERROR_DS_CANT_REM_MISSING_ATT
+Windows.Win32.Foundation.ERROR_DS_CANT_REM_MISSING_ATT_VAL
+Windows.Win32.Foundation.ERROR_DS_CANT_REMOVE_ATT_CACHE
+Windows.Win32.Foundation.ERROR_DS_CANT_REMOVE_CLASS_CACHE
+Windows.Win32.Foundation.ERROR_DS_CANT_REPLACE_HIDDEN_REC
+Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_ATTS
+Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_CHILD
+Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_DN
+Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_INSTANCE
+Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_SD
+Windows.Win32.Foundation.ERROR_DS_CANT_START
+Windows.Win32.Foundation.ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ
+Windows.Win32.Foundation.ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS
+Windows.Win32.Foundation.ERROR_DS_CHILDREN_EXIST
+Windows.Win32.Foundation.ERROR_DS_CLASS_MUST_BE_CONCRETE
+Windows.Win32.Foundation.ERROR_DS_CLASS_NOT_DSA
+Windows.Win32.Foundation.ERROR_DS_CLIENT_LOOP
+Windows.Win32.Foundation.ERROR_DS_CODE_INCONSISTENCY
+Windows.Win32.Foundation.ERROR_DS_COMPARE_FALSE
+Windows.Win32.Foundation.ERROR_DS_COMPARE_TRUE
+Windows.Win32.Foundation.ERROR_DS_CONFIDENTIALITY_REQUIRED
+Windows.Win32.Foundation.ERROR_DS_CONFIG_PARAM_MISSING
+Windows.Win32.Foundation.ERROR_DS_CONSTRAINT_VIOLATION
+Windows.Win32.Foundation.ERROR_DS_CONSTRUCTED_ATT_MOD
+Windows.Win32.Foundation.ERROR_DS_CONTROL_NOT_FOUND
+Windows.Win32.Foundation.ERROR_DS_COULDNT_CONTACT_FSMO
+Windows.Win32.Foundation.ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE
+Windows.Win32.Foundation.ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE
+Windows.Win32.Foundation.ERROR_DS_COULDNT_UPDATE_SPNS
+Windows.Win32.Foundation.ERROR_DS_COUNTING_AB_INDICES_FAILED
+Windows.Win32.Foundation.ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE
+Windows.Win32.Foundation.ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2
+Windows.Win32.Foundation.ERROR_DS_CROSS_DOM_MOVE_ERROR
+Windows.Win32.Foundation.ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD
+Windows.Win32.Foundation.ERROR_DS_CROSS_NC_DN_RENAME
+Windows.Win32.Foundation.ERROR_DS_CROSS_REF_BUSY
+Windows.Win32.Foundation.ERROR_DS_CROSS_REF_EXISTS
+Windows.Win32.Foundation.ERROR_DS_DATABASE_ERROR
+Windows.Win32.Foundation.ERROR_DS_DECODING_ERROR
+Windows.Win32.Foundation.ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED
+Windows.Win32.Foundation.ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST
+Windows.Win32.Foundation.ERROR_DS_DIFFERENT_REPL_EPOCHS
+Windows.Win32.Foundation.ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER
+Windows.Win32.Foundation.ERROR_DS_DISALLOWED_NC_REDIRECT
+Windows.Win32.Foundation.ERROR_DS_DNS_LOOKUP_FAILURE
+Windows.Win32.Foundation.ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST
+Windows.Win32.Foundation.ERROR_DS_DOMAIN_RENAME_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_DS_DOMAIN_VERSION_TOO_HIGH
+Windows.Win32.Foundation.ERROR_DS_DOMAIN_VERSION_TOO_LOW
+Windows.Win32.Foundation.ERROR_DS_DRA_ABANDON_SYNC
+Windows.Win32.Foundation.ERROR_DS_DRA_ACCESS_DENIED
+Windows.Win32.Foundation.ERROR_DS_DRA_BAD_DN
+Windows.Win32.Foundation.ERROR_DS_DRA_BAD_INSTANCE_TYPE
+Windows.Win32.Foundation.ERROR_DS_DRA_BAD_NC
+Windows.Win32.Foundation.ERROR_DS_DRA_BUSY
+Windows.Win32.Foundation.ERROR_DS_DRA_CONNECTION_FAILED
+Windows.Win32.Foundation.ERROR_DS_DRA_CORRUPT_UTD_VECTOR
+Windows.Win32.Foundation.ERROR_DS_DRA_DB_ERROR
+Windows.Win32.Foundation.ERROR_DS_DRA_DN_EXISTS
+Windows.Win32.Foundation.ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT
+Windows.Win32.Foundation.ERROR_DS_DRA_EXTN_CONNECTION_FAILED
+Windows.Win32.Foundation.ERROR_DS_DRA_GENERIC
+Windows.Win32.Foundation.ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET
+Windows.Win32.Foundation.ERROR_DS_DRA_INCONSISTENT_DIT
+Windows.Win32.Foundation.ERROR_DS_DRA_INTERNAL_ERROR
+Windows.Win32.Foundation.ERROR_DS_DRA_INVALID_PARAMETER
+Windows.Win32.Foundation.ERROR_DS_DRA_MAIL_PROBLEM
+Windows.Win32.Foundation.ERROR_DS_DRA_MISSING_KRBTGT_SECRET
+Windows.Win32.Foundation.ERROR_DS_DRA_MISSING_PARENT
+Windows.Win32.Foundation.ERROR_DS_DRA_NAME_COLLISION
+Windows.Win32.Foundation.ERROR_DS_DRA_NO_REPLICA
+Windows.Win32.Foundation.ERROR_DS_DRA_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_DS_DRA_OBJ_IS_REP_SOURCE
+Windows.Win32.Foundation.ERROR_DS_DRA_OBJ_NC_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_DRA_OUT_OF_MEM
+Windows.Win32.Foundation.ERROR_DS_DRA_OUT_SCHEDULE_WINDOW
+Windows.Win32.Foundation.ERROR_DS_DRA_PREEMPTED
+Windows.Win32.Foundation.ERROR_DS_DRA_RECYCLED_TARGET
+Windows.Win32.Foundation.ERROR_DS_DRA_REF_ALREADY_EXISTS
+Windows.Win32.Foundation.ERROR_DS_DRA_REF_NOT_FOUND
+Windows.Win32.Foundation.ERROR_DS_DRA_REPL_PENDING
+Windows.Win32.Foundation.ERROR_DS_DRA_RPC_CANCELLED
+Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_CONFLICT
+Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_INFO_SHIP
+Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_DRA_SECRETS_DENIED
+Windows.Win32.Foundation.ERROR_DS_DRA_SHUTDOWN
+Windows.Win32.Foundation.ERROR_DS_DRA_SINK_DISABLED
+Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_DISABLED
+Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA
+Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_REINSTALLED
+Windows.Win32.Foundation.ERROR_DS_DRS_EXTENSIONS_CHANGED
+Windows.Win32.Foundation.ERROR_DS_DS_REQUIRED
+Windows.Win32.Foundation.ERROR_DS_DSA_MUST_BE_INT_MASTER
+Windows.Win32.Foundation.ERROR_DS_DST_DOMAIN_NOT_NATIVE
+Windows.Win32.Foundation.ERROR_DS_DST_NC_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_DUP_LDAP_DISPLAY_NAME
+Windows.Win32.Foundation.ERROR_DS_DUP_LINK_ID
+Windows.Win32.Foundation.ERROR_DS_DUP_MAPI_ID
+Windows.Win32.Foundation.ERROR_DS_DUP_MSDS_INTID
+Windows.Win32.Foundation.ERROR_DS_DUP_OID
+Windows.Win32.Foundation.ERROR_DS_DUP_RDN
+Windows.Win32.Foundation.ERROR_DS_DUP_SCHEMA_ID_GUID
+Windows.Win32.Foundation.ERROR_DS_DUPLICATE_ID_FOUND
+Windows.Win32.Foundation.ERROR_DS_ENCODING_ERROR
+Windows.Win32.Foundation.ERROR_DS_EPOCH_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_EXISTING_AD_CHILD_NC
+Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_AUX_CLS
+Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_MAY_HAVE
+Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_MUST_HAVE
+Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_POSS_SUP
+Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_RDNATTID
+Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_SUB_CLS
+Windows.Win32.Foundation.ERROR_DS_FILTER_UNKNOWN
+Windows.Win32.Foundation.ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS
+Windows.Win32.Foundation.ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST
+Windows.Win32.Foundation.ERROR_DS_FOREST_VERSION_TOO_HIGH
+Windows.Win32.Foundation.ERROR_DS_FOREST_VERSION_TOO_LOW
+Windows.Win32.Foundation.ERROR_DS_GC_NOT_AVAILABLE
+Windows.Win32.Foundation.ERROR_DS_GC_REQUIRED
+Windows.Win32.Foundation.ERROR_DS_GCVERIFY_ERROR
+Windows.Win32.Foundation.ERROR_DS_GENERIC_ERROR
+Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER
+Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER
+Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER
+Windows.Win32.Foundation.ERROR_DS_GOVERNSID_MISSING
+Windows.Win32.Foundation.ERROR_DS_GROUP_CONVERSION_ERROR
+Windows.Win32.Foundation.ERROR_DS_HAVE_PRIMARY_MEMBERS
+Windows.Win32.Foundation.ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED
+Windows.Win32.Foundation.ERROR_DS_HIERARCHY_TABLE_TOO_DEEP
+Windows.Win32.Foundation.ERROR_DS_HIGH_ADLDS_FFL
+Windows.Win32.Foundation.ERROR_DS_HIGH_DSA_VERSION
+Windows.Win32.Foundation.ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD
+Windows.Win32.Foundation.ERROR_DS_ILLEGAL_MOD_OPERATION
+Windows.Win32.Foundation.ERROR_DS_ILLEGAL_SUPERIOR
+Windows.Win32.Foundation.ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION
+Windows.Win32.Foundation.ERROR_DS_INAPPROPRIATE_AUTH
+Windows.Win32.Foundation.ERROR_DS_INAPPROPRIATE_MATCHING
+Windows.Win32.Foundation.ERROR_DS_INCOMPATIBLE_CONTROLS_USED
+Windows.Win32.Foundation.ERROR_DS_INCOMPATIBLE_VERSION
+Windows.Win32.Foundation.ERROR_DS_INCORRECT_ROLE_OWNER
+Windows.Win32.Foundation.ERROR_DS_INIT_FAILURE
+Windows.Win32.Foundation.ERROR_DS_INIT_FAILURE_CONSOLE
+Windows.Win32.Foundation.ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE
+Windows.Win32.Foundation.ERROR_DS_INSTALL_NO_SRC_SCH_VERSION
+Windows.Win32.Foundation.ERROR_DS_INSTALL_SCHEMA_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_INSUFF_ACCESS_RIGHTS
+Windows.Win32.Foundation.ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT
+Windows.Win32.Foundation.ERROR_DS_INTERNAL_FAILURE
+Windows.Win32.Foundation.ERROR_DS_INVALID_ATTRIBUTE_SYNTAX
+Windows.Win32.Foundation.ERROR_DS_INVALID_DMD
+Windows.Win32.Foundation.ERROR_DS_INVALID_DN_SYNTAX
+Windows.Win32.Foundation.ERROR_DS_INVALID_GROUP_TYPE
+Windows.Win32.Foundation.ERROR_DS_INVALID_LDAP_DISPLAY_NAME
+Windows.Win32.Foundation.ERROR_DS_INVALID_NAME_FOR_SPN
+Windows.Win32.Foundation.ERROR_DS_INVALID_ROLE_OWNER
+Windows.Win32.Foundation.ERROR_DS_INVALID_SCRIPT
+Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG
+Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE
+Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG_TUPLE
+Windows.Win32.Foundation.ERROR_DS_IS_LEAF
+Windows.Win32.Foundation.ERROR_DS_KEY_NOT_UNIQUE
+Windows.Win32.Foundation.ERROR_DS_LDAP_SEND_QUEUE_FULL
+Windows.Win32.Foundation.ERROR_DS_LINK_ID_NOT_AVAILABLE
+Windows.Win32.Foundation.ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER
+Windows.Win32.Foundation.ERROR_DS_LOCAL_ERROR
+Windows.Win32.Foundation.ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY
+Windows.Win32.Foundation.ERROR_DS_LOOP_DETECT
+Windows.Win32.Foundation.ERROR_DS_LOW_ADLDS_FFL
+Windows.Win32.Foundation.ERROR_DS_LOW_DSA_VERSION
+Windows.Win32.Foundation.ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4
+Windows.Win32.Foundation.ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED
+Windows.Win32.Foundation.ERROR_DS_MAPI_ID_NOT_AVAILABLE
+Windows.Win32.Foundation.ERROR_DS_MASTERDSA_REQUIRED
+Windows.Win32.Foundation.ERROR_DS_MAX_OBJ_SIZE_EXCEEDED
+Windows.Win32.Foundation.ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY
+Windows.Win32.Foundation.ERROR_DS_MISSING_EXPECTED_ATT
+Windows.Win32.Foundation.ERROR_DS_MISSING_FOREST_TRUST
+Windows.Win32.Foundation.ERROR_DS_MISSING_FSMO_SETTINGS
+Windows.Win32.Foundation.ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER
+Windows.Win32.Foundation.ERROR_DS_MISSING_REQUIRED_ATT
+Windows.Win32.Foundation.ERROR_DS_MISSING_SUPREF
+Windows.Win32.Foundation.ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG
+Windows.Win32.Foundation.ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE
+Windows.Win32.Foundation.ERROR_DS_MODIFYDN_WRONG_GRANDPARENT
+Windows.Win32.Foundation.ERROR_DS_MUST_BE_RUN_ON_DST_DC
+Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_DOMAIN_ONLY
+Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NO_MAPPING
+Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING
+Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NOT_FOUND
+Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NOT_UNIQUE
+Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_RESOLVING
+Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_TRUST_REFERRAL
+Windows.Win32.Foundation.ERROR_DS_NAME_NOT_UNIQUE
+Windows.Win32.Foundation.ERROR_DS_NAME_REFERENCE_INVALID
+Windows.Win32.Foundation.ERROR_DS_NAME_TOO_LONG
+Windows.Win32.Foundation.ERROR_DS_NAME_TOO_MANY_PARTS
+Windows.Win32.Foundation.ERROR_DS_NAME_TYPE_UNKNOWN
+Windows.Win32.Foundation.ERROR_DS_NAME_UNPARSEABLE
+Windows.Win32.Foundation.ERROR_DS_NAME_VALUE_TOO_LONG
+Windows.Win32.Foundation.ERROR_DS_NAMING_MASTER_GC
+Windows.Win32.Foundation.ERROR_DS_NAMING_VIOLATION
+Windows.Win32.Foundation.ERROR_DS_NC_MUST_HAVE_NC_PARENT
+Windows.Win32.Foundation.ERROR_DS_NC_STILL_HAS_DSAS
+Windows.Win32.Foundation.ERROR_DS_NCNAME_MISSING_CR_REF
+Windows.Win32.Foundation.ERROR_DS_NCNAME_MUST_BE_NC
+Windows.Win32.Foundation.ERROR_DS_NO_ATTRIBUTE_OR_VALUE
+Windows.Win32.Foundation.ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN
+Windows.Win32.Foundation.ERROR_DS_NO_CHAINED_EVAL
+Windows.Win32.Foundation.ERROR_DS_NO_CHAINING
+Windows.Win32.Foundation.ERROR_DS_NO_CHECKPOINT_WITH_PDC
+Windows.Win32.Foundation.ERROR_DS_NO_CROSSREF_FOR_NC
+Windows.Win32.Foundation.ERROR_DS_NO_DELETED_NAME
+Windows.Win32.Foundation.ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS
+Windows.Win32.Foundation.ERROR_DS_NO_MORE_RIDS
+Windows.Win32.Foundation.ERROR_DS_NO_MSDS_INTID
+Windows.Win32.Foundation.ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN
+Windows.Win32.Foundation.ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN
+Windows.Win32.Foundation.ERROR_DS_NO_NTDSA_OBJECT
+Windows.Win32.Foundation.ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC
+Windows.Win32.Foundation.ERROR_DS_NO_PARENT_OBJECT
+Windows.Win32.Foundation.ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION
+Windows.Win32.Foundation.ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA
+Windows.Win32.Foundation.ERROR_DS_NO_REF_DOMAIN
+Windows.Win32.Foundation.ERROR_DS_NO_REQUESTED_ATTS_FOUND
+Windows.Win32.Foundation.ERROR_DS_NO_RESULTS_RETURNED
+Windows.Win32.Foundation.ERROR_DS_NO_RIDS_ALLOCATED
+Windows.Win32.Foundation.ERROR_DS_NO_SERVER_OBJECT
+Windows.Win32.Foundation.ERROR_DS_NO_SUCH_OBJECT
+Windows.Win32.Foundation.ERROR_DS_NO_TREE_DELETE_ABOVE_NC
+Windows.Win32.Foundation.ERROR_DS_NON_ASQ_SEARCH
+Windows.Win32.Foundation.ERROR_DS_NON_BASE_SEARCH
+Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_MAY_HAVE
+Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_MUST_HAVE
+Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_POSS_SUP
+Windows.Win32.Foundation.ERROR_DS_NONSAFE_SCHEMA_CHANGE
+Windows.Win32.Foundation.ERROR_DS_NOT_AN_OBJECT
+Windows.Win32.Foundation.ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC
+Windows.Win32.Foundation.ERROR_DS_NOT_CLOSEST
+Windows.Win32.Foundation.ERROR_DS_NOT_INSTALLED
+Windows.Win32.Foundation.ERROR_DS_NOT_ON_BACKLINK
+Windows.Win32.Foundation.ERROR_DS_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_DS_NOT_SUPPORTED_SORT_ORDER
+Windows.Win32.Foundation.ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX
+Windows.Win32.Foundation.ERROR_DS_NTDSCRIPT_PROCESS_ERROR
+Windows.Win32.Foundation.ERROR_DS_NTDSCRIPT_SYNTAX_ERROR
+Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_NOT_DEFINED
+Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_NOT_SUBCLASS
+Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_VIOLATION
+Windows.Win32.Foundation.ERROR_DS_OBJ_GUID_EXISTS
+Windows.Win32.Foundation.ERROR_DS_OBJ_NOT_FOUND
+Windows.Win32.Foundation.ERROR_DS_OBJ_STRING_NAME_EXISTS
+Windows.Win32.Foundation.ERROR_DS_OBJ_TOO_LARGE
+Windows.Win32.Foundation.ERROR_DS_OBJECT_BEING_REMOVED
+Windows.Win32.Foundation.ERROR_DS_OBJECT_CLASS_REQUIRED
+Windows.Win32.Foundation.ERROR_DS_OBJECT_RESULTS_TOO_LARGE
+Windows.Win32.Foundation.ERROR_DS_OFFSET_RANGE_ERROR
+Windows.Win32.Foundation.ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS
+Windows.Win32.Foundation.ERROR_DS_OID_NOT_FOUND
+Windows.Win32.Foundation.ERROR_DS_OPERATIONS_ERROR
+Windows.Win32.Foundation.ERROR_DS_OUT_OF_SCOPE
+Windows.Win32.Foundation.ERROR_DS_OUT_OF_VERSION_STORE
+Windows.Win32.Foundation.ERROR_DS_PARAM_ERROR
+Windows.Win32.Foundation.ERROR_DS_PARENT_IS_AN_ALIAS
+Windows.Win32.Foundation.ERROR_DS_PDC_OPERATION_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_DS_PER_ATTRIBUTE_AUTHZ_FAILED_DURING_ADD
+Windows.Win32.Foundation.ERROR_DS_POLICY_NOT_KNOWN
+Windows.Win32.Foundation.ERROR_DS_PROTOCOL_ERROR
+Windows.Win32.Foundation.ERROR_DS_RANGE_CONSTRAINT
+Windows.Win32.Foundation.ERROR_DS_RDN_DOESNT_MATCH_SCHEMA
+Windows.Win32.Foundation.ERROR_DS_RECALCSCHEMA_FAILED
+Windows.Win32.Foundation.ERROR_DS_REFERRAL
+Windows.Win32.Foundation.ERROR_DS_REFERRAL_LIMIT_EXCEEDED
+Windows.Win32.Foundation.ERROR_DS_REFUSING_FSMO_ROLES
+Windows.Win32.Foundation.ERROR_DS_REMOTE_CROSSREF_OP_FAILED
+Windows.Win32.Foundation.ERROR_DS_REPL_LIFETIME_EXCEEDED
+Windows.Win32.Foundation.ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR
+Windows.Win32.Foundation.ERROR_DS_REPLICATOR_ONLY
+Windows.Win32.Foundation.ERROR_DS_RESERVED_LINK_ID
+Windows.Win32.Foundation.ERROR_DS_RESERVED_MAPI_ID
+Windows.Win32.Foundation.ERROR_DS_RIDMGR_DISABLED
+Windows.Win32.Foundation.ERROR_DS_RIDMGR_INIT_ERROR
+Windows.Win32.Foundation.ERROR_DS_ROLE_NOT_VERIFIED
+Windows.Win32.Foundation.ERROR_DS_ROOT_CANT_BE_SUBREF
+Windows.Win32.Foundation.ERROR_DS_ROOT_MUST_BE_NC
+Windows.Win32.Foundation.ERROR_DS_ROOT_REQUIRES_CLASS_TOP
+Windows.Win32.Foundation.ERROR_DS_SAM_INIT_FAILURE
+Windows.Win32.Foundation.ERROR_DS_SAM_INIT_FAILURE_CONSOLE
+Windows.Win32.Foundation.ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY
+Windows.Win32.Foundation.ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD
+Windows.Win32.Foundation.ERROR_DS_SCHEMA_ALLOC_FAILED
+Windows.Win32.Foundation.ERROR_DS_SCHEMA_NOT_LOADED
+Windows.Win32.Foundation.ERROR_DS_SCHEMA_UPDATE_DISALLOWED
+Windows.Win32.Foundation.ERROR_DS_SEC_DESC_INVALID
+Windows.Win32.Foundation.ERROR_DS_SEC_DESC_TOO_SHORT
+Windows.Win32.Foundation.ERROR_DS_SECURITY_CHECKING_ERROR
+Windows.Win32.Foundation.ERROR_DS_SECURITY_ILLEGAL_MODIFY
+Windows.Win32.Foundation.ERROR_DS_SEMANTIC_ATT_TEST
+Windows.Win32.Foundation.ERROR_DS_SENSITIVE_GROUP_VIOLATION
+Windows.Win32.Foundation.ERROR_DS_SERVER_DOWN
+Windows.Win32.Foundation.ERROR_DS_SHUTTING_DOWN
+Windows.Win32.Foundation.ERROR_DS_SINGLE_USER_MODE_FAILED
+Windows.Win32.Foundation.ERROR_DS_SINGLE_VALUE_CONSTRAINT
+Windows.Win32.Foundation.ERROR_DS_SIZELIMIT_EXCEEDED
+Windows.Win32.Foundation.ERROR_DS_SORT_CONTROL_MISSING
+Windows.Win32.Foundation.ERROR_DS_SOURCE_AUDITING_NOT_ENABLED
+Windows.Win32.Foundation.ERROR_DS_SOURCE_DOMAIN_IN_FOREST
+Windows.Win32.Foundation.ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST
+Windows.Win32.Foundation.ERROR_DS_SRC_AND_DST_NC_IDENTICAL
+Windows.Win32.Foundation.ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER
+Windows.Win32.Foundation.ERROR_DS_SRC_GUID_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_SRC_NAME_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER
+Windows.Win32.Foundation.ERROR_DS_SRC_SID_EXISTS_IN_FOREST
+Windows.Win32.Foundation.ERROR_DS_STRING_SD_CONVERSION_FAILED
+Windows.Win32.Foundation.ERROR_DS_STRONG_AUTH_REQUIRED
+Windows.Win32.Foundation.ERROR_DS_SUB_CLS_TEST_FAIL
+Windows.Win32.Foundation.ERROR_DS_SUBREF_MUST_HAVE_PARENT
+Windows.Win32.Foundation.ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD
+Windows.Win32.Foundation.ERROR_DS_SYNTAX_MISMATCH
+Windows.Win32.Foundation.ERROR_DS_THREAD_LIMIT_EXCEEDED
+Windows.Win32.Foundation.ERROR_DS_TIMELIMIT_EXCEEDED
+Windows.Win32.Foundation.ERROR_DS_TREE_DELETE_NOT_FINISHED
+Windows.Win32.Foundation.ERROR_DS_UNABLE_TO_SURRENDER_ROLES
+Windows.Win32.Foundation.ERROR_DS_UNAVAILABLE
+Windows.Win32.Foundation.ERROR_DS_UNAVAILABLE_CRIT_EXTENSION
+Windows.Win32.Foundation.ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED
+Windows.Win32.Foundation.ERROR_DS_UNICODEPWD_NOT_IN_QUOTES
+Windows.Win32.Foundation.ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER
+Windows.Win32.Foundation.ERROR_DS_UNKNOWN_ERROR
+Windows.Win32.Foundation.ERROR_DS_UNKNOWN_OPERATION
+Windows.Win32.Foundation.ERROR_DS_UNWILLING_TO_PERFORM
+Windows.Win32.Foundation.ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST
+Windows.Win32.Foundation.ERROR_DS_USER_BUFFER_TO_SMALL
+Windows.Win32.Foundation.ERROR_DS_VALUE_KEY_NOT_UNIQUE
+Windows.Win32.Foundation.ERROR_DS_VERSION_CHECK_FAILURE
+Windows.Win32.Foundation.ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL
+Windows.Win32.Foundation.ERROR_DS_WRONG_LINKED_ATT_SYNTAX
+Windows.Win32.Foundation.ERROR_DS_WRONG_OM_OBJ_CLASS
+Windows.Win32.Foundation.ERROR_DUP_DOMAINNAME
+Windows.Win32.Foundation.ERROR_DUP_NAME
+Windows.Win32.Foundation.ERROR_DUPLICATE_PRIVILEGES
+Windows.Win32.Foundation.ERROR_DUPLICATE_SERVICE_NAME
+Windows.Win32.Foundation.ERROR_DYNAMIC_CODE_BLOCKED
+Windows.Win32.Foundation.ERROR_DYNLINK_FROM_INVALID_RING
+Windows.Win32.Foundation.ERROR_EA_ACCESS_DENIED
+Windows.Win32.Foundation.ERROR_EA_FILE_CORRUPT
+Windows.Win32.Foundation.ERROR_EA_LIST_INCONSISTENT
+Windows.Win32.Foundation.ERROR_EA_TABLE_FULL
+Windows.Win32.Foundation.ERROR_EAS_DIDNT_FIT
+Windows.Win32.Foundation.ERROR_EAS_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED
+Windows.Win32.Foundation.ERROR_EDP_POLICY_DENIES_OPERATION
+Windows.Win32.Foundation.ERROR_EFS_ALG_BLOB_TOO_BIG
+Windows.Win32.Foundation.ERROR_EFS_DISABLED
+Windows.Win32.Foundation.ERROR_EFS_SERVER_NOT_TRUSTED
+Windows.Win32.Foundation.ERROR_EFS_VERSION_NOT_SUPPORT
+Windows.Win32.Foundation.ERROR_ELEVATION_REQUIRED
+Windows.Win32.Foundation.ERROR_ENCLAVE_FAILURE
+Windows.Win32.Foundation.ERROR_ENCLAVE_NOT_TERMINATED
+Windows.Win32.Foundation.ERROR_ENCLAVE_VIOLATION
+Windows.Win32.Foundation.ERROR_ENCRYPTED_FILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_ENCRYPTED_IO_NOT_POSSIBLE
+Windows.Win32.Foundation.ERROR_ENCRYPTING_METADATA_DISALLOWED
+Windows.Win32.Foundation.ERROR_ENCRYPTION_DISABLED
+Windows.Win32.Foundation.ERROR_ENCRYPTION_FAILED
+Windows.Win32.Foundation.ERROR_ENCRYPTION_POLICY_DENIES_OPERATION
+Windows.Win32.Foundation.ERROR_END_OF_MEDIA
+Windows.Win32.Foundation.ERROR_ENVVAR_NOT_FOUND
+Windows.Win32.Foundation.ERROR_EOM_OVERFLOW
+Windows.Win32.Foundation.ERROR_ERRORS_ENCOUNTERED
+Windows.Win32.Foundation.ERROR_EVALUATION_EXPIRATION
+Windows.Win32.Foundation.ERROR_EVENT_DONE
+Windows.Win32.Foundation.ERROR_EVENT_PENDING
+Windows.Win32.Foundation.ERROR_EVENTLOG_CANT_START
+Windows.Win32.Foundation.ERROR_EVENTLOG_FILE_CHANGED
+Windows.Win32.Foundation.ERROR_EVENTLOG_FILE_CORRUPT
+Windows.Win32.Foundation.ERROR_EXCEPTION_IN_SERVICE
+Windows.Win32.Foundation.ERROR_EXCL_SEM_ALREADY_OWNED
+Windows.Win32.Foundation.ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY
+Windows.Win32.Foundation.ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY
+Windows.Win32.Foundation.ERROR_EXE_MACHINE_TYPE_MISMATCH
+Windows.Win32.Foundation.ERROR_EXE_MARKED_INVALID
+Windows.Win32.Foundation.ERROR_EXTENDED_ERROR
+Windows.Win32.Foundation.ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN
+Windows.Win32.Foundation.ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_EXTRANEOUS_INFORMATION
+Windows.Win32.Foundation.ERROR_FAIL_FAST_EXCEPTION
+Windows.Win32.Foundation.ERROR_FAIL_I24
+Windows.Win32.Foundation.ERROR_FAIL_NOACTION_REBOOT
+Windows.Win32.Foundation.ERROR_FAIL_RESTART
+Windows.Win32.Foundation.ERROR_FAIL_SHUTDOWN
+Windows.Win32.Foundation.ERROR_FAILED_DRIVER_ENTRY
+Windows.Win32.Foundation.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT
+Windows.Win32.Foundation.ERROR_FATAL_APP_EXIT
+Windows.Win32.Foundation.ERROR_FILE_CHECKED_OUT
+Windows.Win32.Foundation.ERROR_FILE_CORRUPT
+Windows.Win32.Foundation.ERROR_FILE_ENCRYPTED
+Windows.Win32.Foundation.ERROR_FILE_EXISTS
+Windows.Win32.Foundation.ERROR_FILE_HANDLE_REVOKED
+Windows.Win32.Foundation.ERROR_FILE_INVALID
+Windows.Win32.Foundation.ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_FILE_NOT_ENCRYPTED
+Windows.Win32.Foundation.ERROR_FILE_NOT_FOUND
+Windows.Win32.Foundation.ERROR_FILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_FILE_OFFLINE
+Windows.Win32.Foundation.ERROR_FILE_PROTECTED_UNDER_DPL
+Windows.Win32.Foundation.ERROR_FILE_READ_ONLY
+Windows.Win32.Foundation.ERROR_FILE_SNAP_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_FILE_SNAP_INVALID_PARAMETER
+Windows.Win32.Foundation.ERROR_FILE_SNAP_IO_NOT_COORDINATED
+Windows.Win32.Foundation.ERROR_FILE_SNAP_MODIFY_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_FILE_SNAP_UNEXPECTED_ERROR
+Windows.Win32.Foundation.ERROR_FILE_SNAP_USER_SECTION_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_FILE_SYSTEM_LIMITATION
+Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY
+Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION
+Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT
+Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN
+Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE
+Windows.Win32.Foundation.ERROR_FILE_TOO_LARGE
+Windows.Win32.Foundation.ERROR_FILEMARK_DETECTED
+Windows.Win32.Foundation.ERROR_FILENAME_EXCED_RANGE
+Windows.Win32.Foundation.ERROR_FIRMWARE_UPDATED
+Windows.Win32.Foundation.ERROR_FLOAT_MULTIPLE_FAULTS
+Windows.Win32.Foundation.ERROR_FLOAT_MULTIPLE_TRAPS
+Windows.Win32.Foundation.ERROR_FLOPPY_BAD_REGISTERS
+Windows.Win32.Foundation.ERROR_FLOPPY_ID_MARK_NOT_FOUND
+Windows.Win32.Foundation.ERROR_FLOPPY_UNKNOWN_ERROR
+Windows.Win32.Foundation.ERROR_FLOPPY_VOLUME
+Windows.Win32.Foundation.ERROR_FLOPPY_WRONG_CYLINDER
+Windows.Win32.Foundation.ERROR_FORMS_AUTH_REQUIRED
+Windows.Win32.Foundation.ERROR_FOUND_OUT_OF_SCOPE
+Windows.Win32.Foundation.ERROR_FS_DRIVER_REQUIRED
+Windows.Win32.Foundation.ERROR_FS_METADATA_INCONSISTENT
+Windows.Win32.Foundation.ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY
+Windows.Win32.Foundation.ERROR_FT_DI_SCAN_REQUIRED
+Windows.Win32.Foundation.ERROR_FT_READ_FAILURE
+Windows.Win32.Foundation.ERROR_FT_READ_FROM_COPY_FAILURE
+Windows.Win32.Foundation.ERROR_FT_READ_RECOVERY_FROM_BACKUP
+Windows.Win32.Foundation.ERROR_FT_WRITE_FAILURE
+Windows.Win32.Foundation.ERROR_FT_WRITE_RECOVERY
+Windows.Win32.Foundation.ERROR_FULLSCREEN_MODE
+Windows.Win32.Foundation.ERROR_FUNCTION_FAILED
+Windows.Win32.Foundation.ERROR_FUNCTION_NOT_CALLED
+Windows.Win32.Foundation.ERROR_GDI_HANDLE_LEAK
+Windows.Win32.Foundation.ERROR_GEN_FAILURE
+Windows.Win32.Foundation.ERROR_GENERIC_NOT_MAPPED
+Windows.Win32.Foundation.ERROR_GLOBAL_ONLY_HOOK
+Windows.Win32.Foundation.ERROR_GRACEFUL_DISCONNECT
+Windows.Win32.Foundation.ERROR_GROUP_EXISTS
+Windows.Win32.Foundation.ERROR_GUID_SUBSTITUTION_MADE
+Windows.Win32.Foundation.ERROR_HANDLE_DISK_FULL
+Windows.Win32.Foundation.ERROR_HANDLE_EOF
+Windows.Win32.Foundation.ERROR_HANDLE_REVOKED
+Windows.Win32.Foundation.ERROR_HANDLES_CLOSED
+Windows.Win32.Foundation.ERROR_HAS_SYSTEM_CRITICAL_FILES
+Windows.Win32.Foundation.ERROR_HIBERNATED
+Windows.Win32.Foundation.ERROR_HIBERNATION_FAILURE
+Windows.Win32.Foundation.ERROR_HOOK_NEEDS_HMOD
+Windows.Win32.Foundation.ERROR_HOOK_NOT_INSTALLED
+Windows.Win32.Foundation.ERROR_HOOK_TYPE_NOT_ALLOWED
+Windows.Win32.Foundation.ERROR_HOST_DOWN
+Windows.Win32.Foundation.ERROR_HOST_UNREACHABLE
+Windows.Win32.Foundation.ERROR_HOTKEY_ALREADY_REGISTERED
+Windows.Win32.Foundation.ERROR_HOTKEY_NOT_REGISTERED
+Windows.Win32.Foundation.ERROR_HWNDS_HAVE_DIFF_PARENT
+Windows.Win32.Foundation.ERROR_ILL_FORMED_PASSWORD
+Windows.Win32.Foundation.ERROR_ILLEGAL_CHARACTER
+Windows.Win32.Foundation.ERROR_ILLEGAL_DLL_RELOCATION
+Windows.Win32.Foundation.ERROR_ILLEGAL_ELEMENT_ADDRESS
+Windows.Win32.Foundation.ERROR_ILLEGAL_FLOAT_CONTEXT
+Windows.Win32.Foundation.ERROR_IMAGE_AT_DIFFERENT_BASE
+Windows.Win32.Foundation.ERROR_IMAGE_MACHINE_TYPE_MISMATCH
+Windows.Win32.Foundation.ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE
+Windows.Win32.Foundation.ERROR_IMAGE_NOT_AT_BASE
+Windows.Win32.Foundation.ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT
+Windows.Win32.Foundation.ERROR_IMPLEMENTATION_LIMIT
+Windows.Win32.Foundation.ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE
+Windows.Win32.Foundation.ERROR_INCOMPATIBLE_SERVICE_SID_TYPE
+Windows.Win32.Foundation.ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING
+Windows.Win32.Foundation.ERROR_INCORRECT_ACCOUNT_TYPE
+Windows.Win32.Foundation.ERROR_INCORRECT_ADDRESS
+Windows.Win32.Foundation.ERROR_INCORRECT_SIZE
+Windows.Win32.Foundation.ERROR_INDEX_ABSENT
+Windows.Win32.Foundation.ERROR_INDEX_OUT_OF_BOUNDS
+Windows.Win32.Foundation.ERROR_INFLOOP_IN_RELOC_CHAIN
+Windows.Win32.Foundation.ERROR_INSTALL_ALREADY_RUNNING
+Windows.Win32.Foundation.ERROR_INSTALL_FAILURE
+Windows.Win32.Foundation.ERROR_INSTALL_LANGUAGE_UNSUPPORTED
+Windows.Win32.Foundation.ERROR_INSTALL_LOG_FAILURE
+Windows.Win32.Foundation.ERROR_INSTALL_NOTUSED
+Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_INVALID
+Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_OPEN_FAILED
+Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_REJECTED
+Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_VERSION
+Windows.Win32.Foundation.ERROR_INSTALL_PLATFORM_UNSUPPORTED
+Windows.Win32.Foundation.ERROR_INSTALL_REJECTED
+Windows.Win32.Foundation.ERROR_INSTALL_REMOTE_DISALLOWED
+Windows.Win32.Foundation.ERROR_INSTALL_REMOTE_PROHIBITED
+Windows.Win32.Foundation.ERROR_INSTALL_SERVICE_FAILURE
+Windows.Win32.Foundation.ERROR_INSTALL_SERVICE_SAFEBOOT
+Windows.Win32.Foundation.ERROR_INSTALL_SOURCE_ABSENT
+Windows.Win32.Foundation.ERROR_INSTALL_SUSPEND
+Windows.Win32.Foundation.ERROR_INSTALL_TEMP_UNWRITABLE
+Windows.Win32.Foundation.ERROR_INSTALL_TRANSFORM_FAILURE
+Windows.Win32.Foundation.ERROR_INSTALL_TRANSFORM_REJECTED
+Windows.Win32.Foundation.ERROR_INSTALL_UI_FAILURE
+Windows.Win32.Foundation.ERROR_INSTALL_USEREXIT
+Windows.Win32.Foundation.ERROR_INSTRUCTION_MISALIGNMENT
+Windows.Win32.Foundation.ERROR_INSUFFICIENT_BUFFER
+Windows.Win32.Foundation.ERROR_INSUFFICIENT_LOGON_INFO
+Windows.Win32.Foundation.ERROR_INSUFFICIENT_POWER
+Windows.Win32.Foundation.ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE
+Windows.Win32.Foundation.ERROR_INSUFFICIENT_VIRTUAL_ADDR_RESOURCES
+Windows.Win32.Foundation.ERROR_INTERMIXED_KERNEL_EA_OPERATION
+Windows.Win32.Foundation.ERROR_INTERNAL_DB_CORRUPTION
+Windows.Win32.Foundation.ERROR_INTERNAL_DB_ERROR
+Windows.Win32.Foundation.ERROR_INTERNAL_ERROR
+Windows.Win32.Foundation.ERROR_INTERRUPT_STILL_CONNECTED
+Windows.Win32.Foundation.ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED
+Windows.Win32.Foundation.ERROR_INVALID_ACCEL_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_ACCESS
+Windows.Win32.Foundation.ERROR_INVALID_ACCOUNT_NAME
+Windows.Win32.Foundation.ERROR_INVALID_ACE_CONDITION
+Windows.Win32.Foundation.ERROR_INVALID_ACL
+Windows.Win32.Foundation.ERROR_INVALID_ADDRESS
+Windows.Win32.Foundation.ERROR_INVALID_AT_INTERRUPT_TIME
+Windows.Win32.Foundation.ERROR_INVALID_BLOCK
+Windows.Win32.Foundation.ERROR_INVALID_BLOCK_LENGTH
+Windows.Win32.Foundation.ERROR_INVALID_CAP
+Windows.Win32.Foundation.ERROR_INVALID_CATEGORY
+Windows.Win32.Foundation.ERROR_INVALID_COMBOBOX_MESSAGE
+Windows.Win32.Foundation.ERROR_INVALID_COMMAND_LINE
+Windows.Win32.Foundation.ERROR_INVALID_COMPUTERNAME
+Windows.Win32.Foundation.ERROR_INVALID_CRUNTIME_PARAMETER
+Windows.Win32.Foundation.ERROR_INVALID_CURSOR_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_DATA
+Windows.Win32.Foundation.ERROR_INVALID_DATATYPE
+Windows.Win32.Foundation.ERROR_INVALID_DEVICE_OBJECT_PARAMETER
+Windows.Win32.Foundation.ERROR_INVALID_DLL
+Windows.Win32.Foundation.ERROR_INVALID_DOMAIN_ROLE
+Windows.Win32.Foundation.ERROR_INVALID_DOMAIN_STATE
+Windows.Win32.Foundation.ERROR_INVALID_DOMAINNAME
+Windows.Win32.Foundation.ERROR_INVALID_DRIVE
+Windows.Win32.Foundation.ERROR_INVALID_DWP_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_EA_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_EA_NAME
+Windows.Win32.Foundation.ERROR_INVALID_EDIT_HEIGHT
+Windows.Win32.Foundation.ERROR_INVALID_ENVIRONMENT
+Windows.Win32.Foundation.ERROR_INVALID_EVENT_COUNT
+Windows.Win32.Foundation.ERROR_INVALID_EVENTNAME
+Windows.Win32.Foundation.ERROR_INVALID_EXCEPTION_HANDLER
+Windows.Win32.Foundation.ERROR_INVALID_EXE_SIGNATURE
+Windows.Win32.Foundation.ERROR_INVALID_FIELD
+Windows.Win32.Foundation.ERROR_INVALID_FIELD_IN_PARAMETER_LIST
+Windows.Win32.Foundation.ERROR_INVALID_FILTER_PROC
+Windows.Win32.Foundation.ERROR_INVALID_FLAG_NUMBER
+Windows.Win32.Foundation.ERROR_INVALID_FLAGS
+Windows.Win32.Foundation.ERROR_INVALID_FORM_NAME
+Windows.Win32.Foundation.ERROR_INVALID_FORM_SIZE
+Windows.Win32.Foundation.ERROR_INVALID_FUNCTION
+Windows.Win32.Foundation.ERROR_INVALID_GROUP_ATTRIBUTES
+Windows.Win32.Foundation.ERROR_INVALID_GROUPNAME
+Windows.Win32.Foundation.ERROR_INVALID_GW_COMMAND
+Windows.Win32.Foundation.ERROR_INVALID_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_HANDLE_STATE
+Windows.Win32.Foundation.ERROR_INVALID_HOOK_FILTER
+Windows.Win32.Foundation.ERROR_INVALID_HOOK_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_HW_PROFILE
+Windows.Win32.Foundation.ERROR_INVALID_ICON_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_ID_AUTHORITY
+Windows.Win32.Foundation.ERROR_INVALID_IMAGE_HASH
+Windows.Win32.Foundation.ERROR_INVALID_IMPORT_OF_NON_DLL
+Windows.Win32.Foundation.ERROR_INVALID_INDEX
+Windows.Win32.Foundation.ERROR_INVALID_KERNEL_INFO_VERSION
+Windows.Win32.Foundation.ERROR_INVALID_KEYBOARD_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_LABEL
+Windows.Win32.Foundation.ERROR_INVALID_LB_MESSAGE
+Windows.Win32.Foundation.ERROR_INVALID_LDT_DESCRIPTOR
+Windows.Win32.Foundation.ERROR_INVALID_LDT_OFFSET
+Windows.Win32.Foundation.ERROR_INVALID_LDT_SIZE
+Windows.Win32.Foundation.ERROR_INVALID_LEVEL
+Windows.Win32.Foundation.ERROR_INVALID_LIST_FORMAT
+Windows.Win32.Foundation.ERROR_INVALID_LOCK_RANGE
+Windows.Win32.Foundation.ERROR_INVALID_LOGON_HOURS
+Windows.Win32.Foundation.ERROR_INVALID_LOGON_TYPE
+Windows.Win32.Foundation.ERROR_INVALID_MEMBER
+Windows.Win32.Foundation.ERROR_INVALID_MENU_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_MESSAGE
+Windows.Win32.Foundation.ERROR_INVALID_MESSAGEDEST
+Windows.Win32.Foundation.ERROR_INVALID_MESSAGENAME
+Windows.Win32.Foundation.ERROR_INVALID_MINALLOCSIZE
+Windows.Win32.Foundation.ERROR_INVALID_MODULETYPE
+Windows.Win32.Foundation.ERROR_INVALID_MONITOR_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_MSGBOX_STYLE
+Windows.Win32.Foundation.ERROR_INVALID_NAME
+Windows.Win32.Foundation.ERROR_INVALID_NETNAME
+Windows.Win32.Foundation.ERROR_INVALID_OPLOCK_PROTOCOL
+Windows.Win32.Foundation.ERROR_INVALID_ORDINAL
+Windows.Win32.Foundation.ERROR_INVALID_OWNER
+Windows.Win32.Foundation.ERROR_INVALID_PACKAGE_SID_LENGTH
+Windows.Win32.Foundation.ERROR_INVALID_PARAMETER
+Windows.Win32.Foundation.ERROR_INVALID_PASSWORD
+Windows.Win32.Foundation.ERROR_INVALID_PASSWORDNAME
+Windows.Win32.Foundation.ERROR_INVALID_PATCH_XML
+Windows.Win32.Foundation.ERROR_INVALID_PEP_INFO_VERSION
+Windows.Win32.Foundation.ERROR_INVALID_PLUGPLAY_DEVICE_PATH
+Windows.Win32.Foundation.ERROR_INVALID_PORT_ATTRIBUTES
+Windows.Win32.Foundation.ERROR_INVALID_PRIMARY_GROUP
+Windows.Win32.Foundation.ERROR_INVALID_PRINTER_COMMAND
+Windows.Win32.Foundation.ERROR_INVALID_PRINTER_NAME
+Windows.Win32.Foundation.ERROR_INVALID_PRINTER_STATE
+Windows.Win32.Foundation.ERROR_INVALID_PRIORITY
+Windows.Win32.Foundation.ERROR_INVALID_QUOTA_LOWER
+Windows.Win32.Foundation.ERROR_INVALID_REPARSE_DATA
+Windows.Win32.Foundation.ERROR_INVALID_SCROLLBAR_RANGE
+Windows.Win32.Foundation.ERROR_INVALID_SECURITY_DESCR
+Windows.Win32.Foundation.ERROR_INVALID_SEGDPL
+Windows.Win32.Foundation.ERROR_INVALID_SEGMENT_NUMBER
+Windows.Win32.Foundation.ERROR_INVALID_SEPARATOR_FILE
+Windows.Win32.Foundation.ERROR_INVALID_SERVER_STATE
+Windows.Win32.Foundation.ERROR_INVALID_SERVICE_ACCOUNT
+Windows.Win32.Foundation.ERROR_INVALID_SERVICE_CONTROL
+Windows.Win32.Foundation.ERROR_INVALID_SERVICE_LOCK
+Windows.Win32.Foundation.ERROR_INVALID_SERVICENAME
+Windows.Win32.Foundation.ERROR_INVALID_SHARENAME
+Windows.Win32.Foundation.ERROR_INVALID_SHOWWIN_COMMAND
+Windows.Win32.Foundation.ERROR_INVALID_SID
+Windows.Win32.Foundation.ERROR_INVALID_SIGNAL_NUMBER
+Windows.Win32.Foundation.ERROR_INVALID_SPI_VALUE
+Windows.Win32.Foundation.ERROR_INVALID_STACKSEG
+Windows.Win32.Foundation.ERROR_INVALID_STARTING_CODESEG
+Windows.Win32.Foundation.ERROR_INVALID_SUB_AUTHORITY
+Windows.Win32.Foundation.ERROR_INVALID_TABLE
+Windows.Win32.Foundation.ERROR_INVALID_TARGET_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_TASK_INDEX
+Windows.Win32.Foundation.ERROR_INVALID_TASK_NAME
+Windows.Win32.Foundation.ERROR_INVALID_THREAD_ID
+Windows.Win32.Foundation.ERROR_INVALID_TIME
+Windows.Win32.Foundation.ERROR_INVALID_TOKEN
+Windows.Win32.Foundation.ERROR_INVALID_UNWIND_TARGET
+Windows.Win32.Foundation.ERROR_INVALID_USER_BUFFER
+Windows.Win32.Foundation.ERROR_INVALID_USER_PRINCIPAL_NAME
+Windows.Win32.Foundation.ERROR_INVALID_VARIANT
+Windows.Win32.Foundation.ERROR_INVALID_VERIFY_SWITCH
+Windows.Win32.Foundation.ERROR_INVALID_WINDOW_HANDLE
+Windows.Win32.Foundation.ERROR_INVALID_WORKSTATION
+Windows.Win32.Foundation.ERROR_IO_DEVICE
+Windows.Win32.Foundation.ERROR_IO_INCOMPLETE
+Windows.Win32.Foundation.ERROR_IO_PENDING
+Windows.Win32.Foundation.ERROR_IO_PRIVILEGE_FAILED
+Windows.Win32.Foundation.ERROR_IO_REISSUE_AS_CACHED
+Windows.Win32.Foundation.ERROR_IOPL_NOT_ENABLED
+Windows.Win32.Foundation.ERROR_IP_ADDRESS_CONFLICT1
+Windows.Win32.Foundation.ERROR_IP_ADDRESS_CONFLICT2
+Windows.Win32.Foundation.ERROR_IPSEC_IKE_TIMED_OUT
+Windows.Win32.Foundation.ERROR_IRQ_BUSY
+Windows.Win32.Foundation.ERROR_IS_JOIN_PATH
+Windows.Win32.Foundation.ERROR_IS_JOIN_TARGET
+Windows.Win32.Foundation.ERROR_IS_JOINED
+Windows.Win32.Foundation.ERROR_IS_SUBST_PATH
+Windows.Win32.Foundation.ERROR_IS_SUBST_TARGET
+Windows.Win32.Foundation.ERROR_IS_SUBSTED
+Windows.Win32.Foundation.ERROR_ITERATED_DATA_EXCEEDS_64k
+Windows.Win32.Foundation.ERROR_JOB_NO_CONTAINER
+Windows.Win32.Foundation.ERROR_JOIN_TO_JOIN
+Windows.Win32.Foundation.ERROR_JOIN_TO_SUBST
+Windows.Win32.Foundation.ERROR_JOURNAL_DELETE_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_JOURNAL_ENTRY_DELETED
+Windows.Win32.Foundation.ERROR_JOURNAL_HOOK_SET
+Windows.Win32.Foundation.ERROR_JOURNAL_NOT_ACTIVE
+Windows.Win32.Foundation.ERROR_KERNEL_APC
+Windows.Win32.Foundation.ERROR_KEY_DELETED
+Windows.Win32.Foundation.ERROR_KEY_HAS_CHILDREN
+Windows.Win32.Foundation.ERROR_KM_DRIVER_BLOCKED
+Windows.Win32.Foundation.ERROR_LABEL_TOO_LONG
+Windows.Win32.Foundation.ERROR_LAST_ADMIN
+Windows.Win32.Foundation.ERROR_LB_WITHOUT_TABSTOPS
+Windows.Win32.Foundation.ERROR_LICENSE_QUOTA_EXCEEDED
+Windows.Win32.Foundation.ERROR_LINUX_SUBSYSTEM_NOT_PRESENT
+Windows.Win32.Foundation.ERROR_LINUX_SUBSYSTEM_UPDATE_REQUIRED
+Windows.Win32.Foundation.ERROR_LISTBOX_ID_NOT_FOUND
+Windows.Win32.Foundation.ERROR_LM_CROSS_ENCRYPTION_REQUIRED
+Windows.Win32.Foundation.ERROR_LOCAL_POLICY_MODIFICATION_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_LOCAL_USER_SESSION_KEY
+Windows.Win32.Foundation.ERROR_LOCK_FAILED
+Windows.Win32.Foundation.ERROR_LOCK_VIOLATION
+Windows.Win32.Foundation.ERROR_LOCKED
+Windows.Win32.Foundation.ERROR_LOG_FILE_FULL
+Windows.Win32.Foundation.ERROR_LOG_HARD_ERROR
+Windows.Win32.Foundation.ERROR_LOGIN_TIME_RESTRICTION
+Windows.Win32.Foundation.ERROR_LOGIN_WKSTA_RESTRICTION
+Windows.Win32.Foundation.ERROR_LOGON_FAILURE
+Windows.Win32.Foundation.ERROR_LOGON_NOT_GRANTED
+Windows.Win32.Foundation.ERROR_LOGON_SERVER_CONFLICT
+Windows.Win32.Foundation.ERROR_LOGON_SESSION_COLLISION
+Windows.Win32.Foundation.ERROR_LOGON_SESSION_EXISTS
+Windows.Win32.Foundation.ERROR_LOGON_TYPE_NOT_GRANTED
+Windows.Win32.Foundation.ERROR_LONGJUMP
+Windows.Win32.Foundation.ERROR_LOST_MODE_LOGON_RESTRICTION
+Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA
+Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR
+Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED
+Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR
+Windows.Win32.Foundation.ERROR_LUIDS_EXHAUSTED
+Windows.Win32.Foundation.ERROR_MACHINE_LOCKED
+Windows.Win32.Foundation.ERROR_MAGAZINE_NOT_PRESENT
+Windows.Win32.Foundation.ERROR_MAPPED_ALIGNMENT
+Windows.Win32.Foundation.ERROR_MARKED_TO_DISALLOW_WRITES
+Windows.Win32.Foundation.ERROR_MARSHALL_OVERFLOW
+Windows.Win32.Foundation.ERROR_MAX_SESSIONS_REACHED
+Windows.Win32.Foundation.ERROR_MAX_THRDS_REACHED
+Windows.Win32.Foundation.ERROR_MCA_EXCEPTION
+Windows.Win32.Foundation.ERROR_MCA_OCCURED
+Windows.Win32.Foundation.ERROR_MEDIA_CHANGED
+Windows.Win32.Foundation.ERROR_MEDIA_CHECK
+Windows.Win32.Foundation.ERROR_MEMBER_IN_ALIAS
+Windows.Win32.Foundation.ERROR_MEMBER_IN_GROUP
+Windows.Win32.Foundation.ERROR_MEMBER_NOT_IN_ALIAS
+Windows.Win32.Foundation.ERROR_MEMBER_NOT_IN_GROUP
+Windows.Win32.Foundation.ERROR_MEMBERS_PRIMARY_GROUP
+Windows.Win32.Foundation.ERROR_MEMORY_HARDWARE
+Windows.Win32.Foundation.ERROR_MENU_ITEM_NOT_FOUND
+Windows.Win32.Foundation.ERROR_MESSAGE_SYNC_ONLY
+Windows.Win32.Foundation.ERROR_META_EXPANSION_TOO_LONG
+Windows.Win32.Foundation.ERROR_MISSING_SYSTEMFILE
+Windows.Win32.Foundation.ERROR_MOD_NOT_FOUND
+Windows.Win32.Foundation.ERROR_MORE_DATA
+Windows.Win32.Foundation.ERROR_MORE_WRITES
+Windows.Win32.Foundation.ERROR_MOUNT_POINT_NOT_RESOLVED
+Windows.Win32.Foundation.ERROR_MP_PROCESSOR_MISMATCH
+Windows.Win32.Foundation.ERROR_MR_MID_NOT_FOUND
+Windows.Win32.Foundation.ERROR_MULTIPLE_FAULT_VIOLATION
+Windows.Win32.Foundation.ERROR_MUTANT_LIMIT_EXCEEDED
+Windows.Win32.Foundation.ERROR_MUTUAL_AUTH_FAILED
+Windows.Win32.Foundation.ERROR_NEGATIVE_SEEK
+Windows.Win32.Foundation.ERROR_NESTING_NOT_ALLOWED
+Windows.Win32.Foundation.ERROR_NET_OPEN_FAILED
+Windows.Win32.Foundation.ERROR_NET_WRITE_FAULT
+Windows.Win32.Foundation.ERROR_NETLOGON_NOT_STARTED
+Windows.Win32.Foundation.ERROR_NETNAME_DELETED
+Windows.Win32.Foundation.ERROR_NETWORK_ACCESS_DENIED
+Windows.Win32.Foundation.ERROR_NETWORK_ACCESS_DENIED_EDP
+Windows.Win32.Foundation.ERROR_NETWORK_BUSY
+Windows.Win32.Foundation.ERROR_NETWORK_UNREACHABLE
+Windows.Win32.Foundation.ERROR_NO_ACE_CONDITION
+Windows.Win32.Foundation.ERROR_NO_ASSOCIATION
+Windows.Win32.Foundation.ERROR_NO_BYPASSIO_DRIVER_SUPPORT
+Windows.Win32.Foundation.ERROR_NO_CALLBACK_ACTIVE
+Windows.Win32.Foundation.ERROR_NO_DATA
+Windows.Win32.Foundation.ERROR_NO_DATA_DETECTED
+Windows.Win32.Foundation.ERROR_NO_EFS
+Windows.Win32.Foundation.ERROR_NO_EVENT_PAIR
+Windows.Win32.Foundation.ERROR_NO_GUID_TRANSLATION
+Windows.Win32.Foundation.ERROR_NO_IMPERSONATION_TOKEN
+Windows.Win32.Foundation.ERROR_NO_INHERITANCE
+Windows.Win32.Foundation.ERROR_NO_LOG_SPACE
+Windows.Win32.Foundation.ERROR_NO_LOGON_SERVERS
+Windows.Win32.Foundation.ERROR_NO_MATCH
+Windows.Win32.Foundation.ERROR_NO_MEDIA_IN_DRIVE
+Windows.Win32.Foundation.ERROR_NO_MORE_DEVICES
+Windows.Win32.Foundation.ERROR_NO_MORE_FILES
+Windows.Win32.Foundation.ERROR_NO_MORE_ITEMS
+Windows.Win32.Foundation.ERROR_NO_MORE_MATCHES
+Windows.Win32.Foundation.ERROR_NO_MORE_SEARCH_HANDLES
+Windows.Win32.Foundation.ERROR_NO_MORE_USER_HANDLES
+Windows.Win32.Foundation.ERROR_NO_NET_OR_BAD_PATH
+Windows.Win32.Foundation.ERROR_NO_NETWORK
+Windows.Win32.Foundation.ERROR_NO_NVRAM_RESOURCES
+Windows.Win32.Foundation.ERROR_NO_PAGEFILE
+Windows.Win32.Foundation.ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND
+Windows.Win32.Foundation.ERROR_NO_PROC_SLOTS
+Windows.Win32.Foundation.ERROR_NO_PROMOTION_ACTIVE
+Windows.Win32.Foundation.ERROR_NO_QUOTAS_FOR_ACCOUNT
+Windows.Win32.Foundation.ERROR_NO_RANGES_PROCESSED
+Windows.Win32.Foundation.ERROR_NO_RECOVERY_POLICY
+Windows.Win32.Foundation.ERROR_NO_RECOVERY_PROGRAM
+Windows.Win32.Foundation.ERROR_NO_SCROLLBARS
+Windows.Win32.Foundation.ERROR_NO_SECRETS
+Windows.Win32.Foundation.ERROR_NO_SECURITY_ON_OBJECT
+Windows.Win32.Foundation.ERROR_NO_SHUTDOWN_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_NO_SIGNAL_SENT
+Windows.Win32.Foundation.ERROR_NO_SITE_SETTINGS_OBJECT
+Windows.Win32.Foundation.ERROR_NO_SITENAME
+Windows.Win32.Foundation.ERROR_NO_SPOOL_SPACE
+Windows.Win32.Foundation.ERROR_NO_SUCH_ALIAS
+Windows.Win32.Foundation.ERROR_NO_SUCH_DEVICE
+Windows.Win32.Foundation.ERROR_NO_SUCH_DOMAIN
+Windows.Win32.Foundation.ERROR_NO_SUCH_GROUP
+Windows.Win32.Foundation.ERROR_NO_SUCH_LOGON_SESSION
+Windows.Win32.Foundation.ERROR_NO_SUCH_MEMBER
+Windows.Win32.Foundation.ERROR_NO_SUCH_PACKAGE
+Windows.Win32.Foundation.ERROR_NO_SUCH_PRIVILEGE
+Windows.Win32.Foundation.ERROR_NO_SUCH_SITE
+Windows.Win32.Foundation.ERROR_NO_SUCH_USER
+Windows.Win32.Foundation.ERROR_NO_SYSTEM_MENU
+Windows.Win32.Foundation.ERROR_NO_SYSTEM_RESOURCES
+Windows.Win32.Foundation.ERROR_NO_TASK_QUEUE
+Windows.Win32.Foundation.ERROR_NO_TOKEN
+Windows.Win32.Foundation.ERROR_NO_TRACKING_SERVICE
+Windows.Win32.Foundation.ERROR_NO_TRUST_LSA_SECRET
+Windows.Win32.Foundation.ERROR_NO_TRUST_SAM_ACCOUNT
+Windows.Win32.Foundation.ERROR_NO_UNICODE_TRANSLATION
+Windows.Win32.Foundation.ERROR_NO_USER_KEYS
+Windows.Win32.Foundation.ERROR_NO_USER_SESSION_KEY
+Windows.Win32.Foundation.ERROR_NO_VOLUME_ID
+Windows.Win32.Foundation.ERROR_NO_VOLUME_LABEL
+Windows.Win32.Foundation.ERROR_NO_WILDCARD_CHARACTERS
+Windows.Win32.Foundation.ERROR_NO_WORK_DONE
+Windows.Win32.Foundation.ERROR_NO_WRITABLE_DC_FOUND
+Windows.Win32.Foundation.ERROR_NO_YIELD_PERFORMED
+Windows.Win32.Foundation.ERROR_NOACCESS
+Windows.Win32.Foundation.ERROR_NOINTERFACE
+Windows.Win32.Foundation.ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT
+Windows.Win32.Foundation.ERROR_NOLOGON_SERVER_TRUST_ACCOUNT
+Windows.Win32.Foundation.ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT
+Windows.Win32.Foundation.ERROR_NON_ACCOUNT_SID
+Windows.Win32.Foundation.ERROR_NON_DOMAIN_SID
+Windows.Win32.Foundation.ERROR_NON_MDICHILD_WINDOW
+Windows.Win32.Foundation.ERROR_NONE_MAPPED
+Windows.Win32.Foundation.ERROR_NONPAGED_SYSTEM_RESOURCES
+Windows.Win32.Foundation.ERROR_NOT_A_CLOUD_FILE
+Windows.Win32.Foundation.ERROR_NOT_A_CLOUD_SYNC_ROOT
+Windows.Win32.Foundation.ERROR_NOT_A_DAX_VOLUME
+Windows.Win32.Foundation.ERROR_NOT_A_REPARSE_POINT
+Windows.Win32.Foundation.ERROR_NOT_ALL_ASSIGNED
+Windows.Win32.Foundation.ERROR_NOT_ALLOWED_ON_SYSTEM_FILE
+Windows.Win32.Foundation.ERROR_NOT_APPCONTAINER
+Windows.Win32.Foundation.ERROR_NOT_AUTHENTICATED
+Windows.Win32.Foundation.ERROR_NOT_CAPABLE
+Windows.Win32.Foundation.ERROR_NOT_CHILD_WINDOW
+Windows.Win32.Foundation.ERROR_NOT_CONNECTED
+Windows.Win32.Foundation.ERROR_NOT_CONTAINER
+Windows.Win32.Foundation.ERROR_NOT_DAX_MAPPABLE
+Windows.Win32.Foundation.ERROR_NOT_DOS_DISK
+Windows.Win32.Foundation.ERROR_NOT_ENOUGH_MEMORY
+Windows.Win32.Foundation.ERROR_NOT_ENOUGH_QUOTA
+Windows.Win32.Foundation.ERROR_NOT_ENOUGH_SERVER_MEMORY
+Windows.Win32.Foundation.ERROR_NOT_EXPORT_FORMAT
+Windows.Win32.Foundation.ERROR_NOT_FOUND
+Windows.Win32.Foundation.ERROR_NOT_GUI_PROCESS
+Windows.Win32.Foundation.ERROR_NOT_JOINED
+Windows.Win32.Foundation.ERROR_NOT_LOCKED
+Windows.Win32.Foundation.ERROR_NOT_LOGGED_ON
+Windows.Win32.Foundation.ERROR_NOT_LOGON_PROCESS
+Windows.Win32.Foundation.ERROR_NOT_OWNER
+Windows.Win32.Foundation.ERROR_NOT_READ_FROM_COPY
+Windows.Win32.Foundation.ERROR_NOT_READY
+Windows.Win32.Foundation.ERROR_NOT_REDUNDANT_STORAGE
+Windows.Win32.Foundation.ERROR_NOT_REGISTRY_FILE
+Windows.Win32.Foundation.ERROR_NOT_SAFE_MODE_DRIVER
+Windows.Win32.Foundation.ERROR_NOT_SAFEBOOT_SERVICE
+Windows.Win32.Foundation.ERROR_NOT_SAME_DEVICE
+Windows.Win32.Foundation.ERROR_NOT_SAME_OBJECT
+Windows.Win32.Foundation.ERROR_NOT_SUBSTED
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_IN_APPCONTAINER
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_DAX
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_SBS
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_AUDITING
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_BTT
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_BYPASSIO
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_CACHED_HANDLE
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_COMPRESSION
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_DEDUPLICATION
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_ENCRYPTION
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_MONITORING
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_REPLICATION
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_SNAPSHOT
+Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_VIRTUALIZATION
+Windows.Win32.Foundation.ERROR_NOT_TINY_STREAM
+Windows.Win32.Foundation.ERROR_NOTHING_TO_TERMINATE
+Windows.Win32.Foundation.ERROR_NOTIFICATION_GUID_ALREADY_DEFINED
+Windows.Win32.Foundation.ERROR_NOTIFY_CLEANUP
+Windows.Win32.Foundation.ERROR_NOTIFY_ENUM_DIR
+Windows.Win32.Foundation.ERROR_NT_CROSS_ENCRYPTION_REQUIRED
+Windows.Win32.Foundation.ERROR_NTLM_BLOCKED
+Windows.Win32.Foundation.ERROR_NULL_LM_PASSWORD
+Windows.Win32.Foundation.ERROR_OBJECT_IS_IMMUTABLE
+Windows.Win32.Foundation.ERROR_OBJECT_NAME_EXISTS
+Windows.Win32.Foundation.ERROR_OBJECT_NOT_EXTERNALLY_BACKED
+Windows.Win32.Foundation.ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_OFFSET_ALIGNMENT_VIOLATION
+Windows.Win32.Foundation.ERROR_OLD_WIN_VERSION
+Windows.Win32.Foundation.ERROR_ONLY_IF_CONNECTED
+Windows.Win32.Foundation.ERROR_OPEN_FAILED
+Windows.Win32.Foundation.ERROR_OPEN_FILES
+Windows.Win32.Foundation.ERROR_OPERATION_ABORTED
+Windows.Win32.Foundation.ERROR_OPERATION_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_OPLOCK_BREAK_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_OPLOCK_HANDLE_CLOSED
+Windows.Win32.Foundation.ERROR_OPLOCK_NOT_GRANTED
+Windows.Win32.Foundation.ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE
+Windows.Win32.Foundation.ERROR_ORPHAN_NAME_EXHAUSTED
+Windows.Win32.Foundation.ERROR_OUT_OF_PAPER
+Windows.Win32.Foundation.ERROR_OUT_OF_STRUCTURES
+Windows.Win32.Foundation.ERROR_OUTOFMEMORY
+Windows.Win32.Foundation.ERROR_OVERRIDE_NOCHANGES
+Windows.Win32.Foundation.ERROR_PAGE_FAULT_COPY_ON_WRITE
+Windows.Win32.Foundation.ERROR_PAGE_FAULT_DEMAND_ZERO
+Windows.Win32.Foundation.ERROR_PAGE_FAULT_GUARD_PAGE
+Windows.Win32.Foundation.ERROR_PAGE_FAULT_PAGING_FILE
+Windows.Win32.Foundation.ERROR_PAGE_FAULT_TRANSITION
+Windows.Win32.Foundation.ERROR_PAGED_SYSTEM_RESOURCES
+Windows.Win32.Foundation.ERROR_PAGEFILE_CREATE_FAILED
+Windows.Win32.Foundation.ERROR_PAGEFILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_PAGEFILE_QUOTA
+Windows.Win32.Foundation.ERROR_PAGEFILE_QUOTA_EXCEEDED
+Windows.Win32.Foundation.ERROR_PARAMETER_QUOTA_EXCEEDED
+Windows.Win32.Foundation.ERROR_PARTIAL_COPY
+Windows.Win32.Foundation.ERROR_PARTITION_FAILURE
+Windows.Win32.Foundation.ERROR_PARTITION_TERMINATING
+Windows.Win32.Foundation.ERROR_PASSWORD_CHANGE_REQUIRED
+Windows.Win32.Foundation.ERROR_PASSWORD_EXPIRED
+Windows.Win32.Foundation.ERROR_PASSWORD_MUST_CHANGE
+Windows.Win32.Foundation.ERROR_PASSWORD_RESTRICTION
+Windows.Win32.Foundation.ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT
+Windows.Win32.Foundation.ERROR_PATCH_NO_SEQUENCE
+Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_INVALID
+Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_OPEN_FAILED
+Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_REJECTED
+Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_UNSUPPORTED
+Windows.Win32.Foundation.ERROR_PATCH_REMOVAL_DISALLOWED
+Windows.Win32.Foundation.ERROR_PATCH_REMOVAL_UNSUPPORTED
+Windows.Win32.Foundation.ERROR_PATCH_TARGET_NOT_FOUND
+Windows.Win32.Foundation.ERROR_PATH_BUSY
+Windows.Win32.Foundation.ERROR_PATH_NOT_FOUND
+Windows.Win32.Foundation.ERROR_PER_USER_TRUST_QUOTA_EXCEEDED
+Windows.Win32.Foundation.ERROR_PIPE_BUSY
+Windows.Win32.Foundation.ERROR_PIPE_CONNECTED
+Windows.Win32.Foundation.ERROR_PIPE_LISTENING
+Windows.Win32.Foundation.ERROR_PIPE_LOCAL
+Windows.Win32.Foundation.ERROR_PIPE_NOT_CONNECTED
+Windows.Win32.Foundation.ERROR_PKINIT_FAILURE
+Windows.Win32.Foundation.ERROR_PLUGPLAY_QUERY_VETOED
+Windows.Win32.Foundation.ERROR_PNP_BAD_MPS_TABLE
+Windows.Win32.Foundation.ERROR_PNP_INVALID_ID
+Windows.Win32.Foundation.ERROR_PNP_IRQ_TRANSLATION_FAILED
+Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT
+Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT
+Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT
+Windows.Win32.Foundation.ERROR_PNP_REBOOT_REQUIRED
+Windows.Win32.Foundation.ERROR_PNP_RESTART_ENUMERATION
+Windows.Win32.Foundation.ERROR_PNP_TRANSLATION_FAILED
+Windows.Win32.Foundation.ERROR_POINT_NOT_FOUND
+Windows.Win32.Foundation.ERROR_POLICY_OBJECT_NOT_FOUND
+Windows.Win32.Foundation.ERROR_POLICY_ONLY_IN_DS
+Windows.Win32.Foundation.ERROR_POPUP_ALREADY_ACTIVE
+Windows.Win32.Foundation.ERROR_PORT_MESSAGE_TOO_LONG
+Windows.Win32.Foundation.ERROR_PORT_NOT_SET
+Windows.Win32.Foundation.ERROR_PORT_UNREACHABLE
+Windows.Win32.Foundation.ERROR_POSSIBLE_DEADLOCK
+Windows.Win32.Foundation.ERROR_POTENTIAL_FILE_FOUND
+Windows.Win32.Foundation.ERROR_PREDEFINED_HANDLE
+Windows.Win32.Foundation.ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED
+Windows.Win32.Foundation.ERROR_PRINT_CANCELLED
+Windows.Win32.Foundation.ERROR_PRINTER_ALREADY_EXISTS
+Windows.Win32.Foundation.ERROR_PRINTER_DELETED
+Windows.Win32.Foundation.ERROR_PRINTER_DRIVER_ALREADY_INSTALLED
+Windows.Win32.Foundation.ERROR_PRINTQ_FULL
+Windows.Win32.Foundation.ERROR_PRIVATE_DIALOG_INDEX
+Windows.Win32.Foundation.ERROR_PRIVILEGE_NOT_HELD
+Windows.Win32.Foundation.ERROR_PROC_NOT_FOUND
+Windows.Win32.Foundation.ERROR_PROCESS_ABORTED
+Windows.Win32.Foundation.ERROR_PROCESS_IN_JOB
+Windows.Win32.Foundation.ERROR_PROCESS_IS_PROTECTED
+Windows.Win32.Foundation.ERROR_PROCESS_MODE_ALREADY_BACKGROUND
+Windows.Win32.Foundation.ERROR_PROCESS_MODE_NOT_BACKGROUND
+Windows.Win32.Foundation.ERROR_PROCESS_NOT_IN_JOB
+Windows.Win32.Foundation.ERROR_PRODUCT_UNINSTALLED
+Windows.Win32.Foundation.ERROR_PRODUCT_VERSION
+Windows.Win32.Foundation.ERROR_PROFILING_AT_LIMIT
+Windows.Win32.Foundation.ERROR_PROFILING_NOT_STARTED
+Windows.Win32.Foundation.ERROR_PROFILING_NOT_STOPPED
+Windows.Win32.Foundation.ERROR_PROMOTION_ACTIVE
+Windows.Win32.Foundation.ERROR_PROTOCOL_UNREACHABLE
+Windows.Win32.Foundation.ERROR_PWD_HISTORY_CONFLICT
+Windows.Win32.Foundation.ERROR_PWD_TOO_LONG
+Windows.Win32.Foundation.ERROR_PWD_TOO_RECENT
+Windows.Win32.Foundation.ERROR_PWD_TOO_SHORT
+Windows.Win32.Foundation.ERROR_QUOTA_ACTIVITY
+Windows.Win32.Foundation.ERROR_QUOTA_LIST_INCONSISTENT
+Windows.Win32.Foundation.ERROR_RANGE_LIST_CONFLICT
+Windows.Win32.Foundation.ERROR_RANGE_NOT_FOUND
+Windows.Win32.Foundation.ERROR_READ_FAULT
+Windows.Win32.Foundation.ERROR_RECEIVE_EXPEDITED
+Windows.Win32.Foundation.ERROR_RECEIVE_PARTIAL
+Windows.Win32.Foundation.ERROR_RECEIVE_PARTIAL_EXPEDITED
+Windows.Win32.Foundation.ERROR_RECOVERY_FAILURE
+Windows.Win32.Foundation.ERROR_REDIR_PAUSED
+Windows.Win32.Foundation.ERROR_REDIRECTOR_HAS_OPEN_HANDLES
+Windows.Win32.Foundation.ERROR_REG_NAT_CONSUMPTION
+Windows.Win32.Foundation.ERROR_REGISTRY_CORRUPT
+Windows.Win32.Foundation.ERROR_REGISTRY_HIVE_RECOVERED
+Windows.Win32.Foundation.ERROR_REGISTRY_IO_FAILED
+Windows.Win32.Foundation.ERROR_REGISTRY_QUOTA_LIMIT
+Windows.Win32.Foundation.ERROR_REGISTRY_RECOVERED
+Windows.Win32.Foundation.ERROR_RELOC_CHAIN_XEEDS_SEGLIM
+Windows.Win32.Foundation.ERROR_REM_NOT_LIST
+Windows.Win32.Foundation.ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED
+Windows.Win32.Foundation.ERROR_REMOTE_SESSION_LIMIT_EXCEEDED
+Windows.Win32.Foundation.ERROR_REMOTE_STORAGE_MEDIA_ERROR
+Windows.Win32.Foundation.ERROR_REMOTE_STORAGE_NOT_ACTIVE
+Windows.Win32.Foundation.ERROR_REPARSE
+Windows.Win32.Foundation.ERROR_REPARSE_ATTRIBUTE_CONFLICT
+Windows.Win32.Foundation.ERROR_REPARSE_OBJECT
+Windows.Win32.Foundation.ERROR_REPARSE_POINT_ENCOUNTERED
+Windows.Win32.Foundation.ERROR_REPARSE_TAG_INVALID
+Windows.Win32.Foundation.ERROR_REPARSE_TAG_MISMATCH
+Windows.Win32.Foundation.ERROR_REPLY_MESSAGE_MISMATCH
+Windows.Win32.Foundation.ERROR_REQ_NOT_ACCEP
+Windows.Win32.Foundation.ERROR_REQUEST_ABORTED
+Windows.Win32.Foundation.ERROR_REQUEST_OUT_OF_SEQUENCE
+Windows.Win32.Foundation.ERROR_REQUEST_PAUSED
+Windows.Win32.Foundation.ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
+Windows.Win32.Foundation.ERROR_RESIDENT_FILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_RESOURCE_CALL_TIMED_OUT
+Windows.Win32.Foundation.ERROR_RESOURCE_DATA_NOT_FOUND
+Windows.Win32.Foundation.ERROR_RESOURCE_LANG_NOT_FOUND
+Windows.Win32.Foundation.ERROR_RESOURCE_NAME_NOT_FOUND
+Windows.Win32.Foundation.ERROR_RESOURCE_REQUIREMENTS_CHANGED
+Windows.Win32.Foundation.ERROR_RESOURCE_TYPE_NOT_FOUND
+Windows.Win32.Foundation.ERROR_RESTART_APPLICATION
+Windows.Win32.Foundation.ERROR_RESUME_HIBERNATION
+Windows.Win32.Foundation.ERROR_RETRY
+Windows.Win32.Foundation.ERROR_RETURN_ADDRESS_HIJACK_ATTEMPT
+Windows.Win32.Foundation.ERROR_REVISION_MISMATCH
+Windows.Win32.Foundation.ERROR_RING2_STACK_IN_USE
+Windows.Win32.Foundation.ERROR_RING2SEG_MUST_BE_MOVABLE
+Windows.Win32.Foundation.ERROR_RMODE_APP
+Windows.Win32.Foundation.ERROR_ROWSNOTRELEASED
+Windows.Win32.Foundation.ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT
+Windows.Win32.Foundation.ERROR_RUNLEVEL_SWITCH_TIMEOUT
+Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED
+Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET
+Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE
+Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER
+Windows.Win32.Foundation.ERROR_RXACT_COMMIT_FAILURE
+Windows.Win32.Foundation.ERROR_RXACT_COMMIT_NECESSARY
+Windows.Win32.Foundation.ERROR_RXACT_COMMITTED
+Windows.Win32.Foundation.ERROR_RXACT_INVALID_STATE
+Windows.Win32.Foundation.ERROR_RXACT_STATE_CREATED
+Windows.Win32.Foundation.ERROR_SAM_INIT_FAILURE
+Windows.Win32.Foundation.ERROR_SAME_DRIVE
+Windows.Win32.Foundation.ERROR_SCOPE_NOT_FOUND
+Windows.Win32.Foundation.ERROR_SCREEN_ALREADY_LOCKED
+Windows.Win32.Foundation.ERROR_SCRUB_DATA_DISABLED
+Windows.Win32.Foundation.ERROR_SECRET_TOO_LONG
+Windows.Win32.Foundation.ERROR_SECTION_DIRECT_MAP_ONLY
+Windows.Win32.Foundation.ERROR_SECTOR_NOT_FOUND
+Windows.Win32.Foundation.ERROR_SECURITY_DENIES_OPERATION
+Windows.Win32.Foundation.ERROR_SECURITY_STREAM_IS_INCONSISTENT
+Windows.Win32.Foundation.ERROR_SEEK
+Windows.Win32.Foundation.ERROR_SEEK_ON_DEVICE
+Windows.Win32.Foundation.ERROR_SEGMENT_NOTIFICATION
+Windows.Win32.Foundation.ERROR_SEM_IS_SET
+Windows.Win32.Foundation.ERROR_SEM_NOT_FOUND
+Windows.Win32.Foundation.ERROR_SEM_OWNER_DIED
+Windows.Win32.Foundation.ERROR_SEM_TIMEOUT
+Windows.Win32.Foundation.ERROR_SEM_USER_LIMIT
+Windows.Win32.Foundation.ERROR_SERIAL_NO_DEVICE
+Windows.Win32.Foundation.ERROR_SERVER_DISABLED
+Windows.Win32.Foundation.ERROR_SERVER_HAS_OPEN_HANDLES
+Windows.Win32.Foundation.ERROR_SERVER_NOT_DISABLED
+Windows.Win32.Foundation.ERROR_SERVER_SHUTDOWN_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_SERVER_SID_MISMATCH
+Windows.Win32.Foundation.ERROR_SERVER_TRANSPORT_CONFLICT
+Windows.Win32.Foundation.ERROR_SERVICE_ALREADY_RUNNING
+Windows.Win32.Foundation.ERROR_SERVICE_CANNOT_ACCEPT_CTRL
+Windows.Win32.Foundation.ERROR_SERVICE_DATABASE_LOCKED
+Windows.Win32.Foundation.ERROR_SERVICE_DEPENDENCY_DELETED
+Windows.Win32.Foundation.ERROR_SERVICE_DEPENDENCY_FAIL
+Windows.Win32.Foundation.ERROR_SERVICE_DISABLED
+Windows.Win32.Foundation.ERROR_SERVICE_DOES_NOT_EXIST
+Windows.Win32.Foundation.ERROR_SERVICE_EXISTS
+Windows.Win32.Foundation.ERROR_SERVICE_LOGON_FAILED
+Windows.Win32.Foundation.ERROR_SERVICE_MARKED_FOR_DELETE
+Windows.Win32.Foundation.ERROR_SERVICE_NEVER_STARTED
+Windows.Win32.Foundation.ERROR_SERVICE_NO_THREAD
+Windows.Win32.Foundation.ERROR_SERVICE_NOT_ACTIVE
+Windows.Win32.Foundation.ERROR_SERVICE_NOT_FOUND
+Windows.Win32.Foundation.ERROR_SERVICE_NOT_IN_EXE
+Windows.Win32.Foundation.ERROR_SERVICE_NOTIFICATION
+Windows.Win32.Foundation.ERROR_SERVICE_NOTIFY_CLIENT_LAGGING
+Windows.Win32.Foundation.ERROR_SERVICE_REQUEST_TIMEOUT
+Windows.Win32.Foundation.ERROR_SERVICE_SPECIFIC_ERROR
+Windows.Win32.Foundation.ERROR_SERVICE_START_HANG
+Windows.Win32.Foundation.ERROR_SESSION_CREDENTIAL_CONFLICT
+Windows.Win32.Foundation.ERROR_SESSION_KEY_TOO_SHORT
+Windows.Win32.Foundation.ERROR_SET_CONTEXT_DENIED
+Windows.Win32.Foundation.ERROR_SET_NOT_FOUND
+Windows.Win32.Foundation.ERROR_SET_POWER_STATE_FAILED
+Windows.Win32.Foundation.ERROR_SET_POWER_STATE_VETOED
+Windows.Win32.Foundation.ERROR_SETCOUNT_ON_BAD_LB
+Windows.Win32.Foundation.ERROR_SETMARK_DETECTED
+Windows.Win32.Foundation.ERROR_SHARED_POLICY
+Windows.Win32.Foundation.ERROR_SHARING_BUFFER_EXCEEDED
+Windows.Win32.Foundation.ERROR_SHARING_PAUSED
+Windows.Win32.Foundation.ERROR_SHARING_VIOLATION
+Windows.Win32.Foundation.ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME
+Windows.Win32.Foundation.ERROR_SHUTDOWN_DISKS_NOT_IN_MAINTENANCE_MODE
+Windows.Win32.Foundation.ERROR_SHUTDOWN_IN_PROGRESS
+Windows.Win32.Foundation.ERROR_SHUTDOWN_IS_SCHEDULED
+Windows.Win32.Foundation.ERROR_SHUTDOWN_USERS_LOGGED_ON
+Windows.Win32.Foundation.ERROR_SIGNAL_PENDING
+Windows.Win32.Foundation.ERROR_SIGNAL_REFUSED
+Windows.Win32.Foundation.ERROR_SINGLE_INSTANCE_APP
+Windows.Win32.Foundation.ERROR_SMARTCARD_SUBSYSTEM_FAILURE
+Windows.Win32.Foundation.ERROR_SMB1_NOT_AVAILABLE
+Windows.Win32.Foundation.ERROR_SMB_GUEST_LOGON_BLOCKED
+Windows.Win32.Foundation.ERROR_SMR_GARBAGE_COLLECTION_REQUIRED
+Windows.Win32.Foundation.ERROR_SOME_NOT_MAPPED
+Windows.Win32.Foundation.ERROR_SOURCE_ELEMENT_EMPTY
+Windows.Win32.Foundation.ERROR_SPARSE_FILE_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_SPECIAL_ACCOUNT
+Windows.Win32.Foundation.ERROR_SPECIAL_GROUP
+Windows.Win32.Foundation.ERROR_SPECIAL_USER
+Windows.Win32.Foundation.ERROR_SRC_SRV_DLL_LOAD_FAILED
+Windows.Win32.Foundation.ERROR_STACK_BUFFER_OVERRUN
+Windows.Win32.Foundation.ERROR_STACK_OVERFLOW
+Windows.Win32.Foundation.ERROR_STACK_OVERFLOW_READ
+Windows.Win32.Foundation.ERROR_STOPPED_ON_SYMLINK
+Windows.Win32.Foundation.ERROR_STORAGE_LOST_DATA_PERSISTENCE
+Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_ALREADY_EXISTS
+Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_DOES_NOT_EXIST
+Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_ID_INVALID
+Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_NOT_EMPTY
+Windows.Win32.Foundation.ERROR_STORAGE_STACK_ACCESS_DENIED
+Windows.Win32.Foundation.ERROR_STORAGE_TOPOLOGY_ID_MISMATCH
+Windows.Win32.Foundation.ERROR_STRICT_CFG_VIOLATION
+Windows.Win32.Foundation.ERROR_SUBST_TO_JOIN
+Windows.Win32.Foundation.ERROR_SUBST_TO_SUBST
+Windows.Win32.Foundation.ERROR_SUCCESS
+Windows.Win32.Foundation.ERROR_SUCCESS_REBOOT_INITIATED
+Windows.Win32.Foundation.ERROR_SWAPERROR
+Windows.Win32.Foundation.ERROR_SYMLINK_CLASS_DISABLED
+Windows.Win32.Foundation.ERROR_SYMLINK_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED
+Windows.Win32.Foundation.ERROR_SYNCHRONIZATION_REQUIRED
+Windows.Win32.Foundation.ERROR_SYSTEM_HIVE_TOO_LARGE
+Windows.Win32.Foundation.ERROR_SYSTEM_IMAGE_BAD_SIGNATURE
+Windows.Win32.Foundation.ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION
+Windows.Win32.Foundation.ERROR_SYSTEM_POWERSTATE_TRANSITION
+Windows.Win32.Foundation.ERROR_SYSTEM_PROCESS_TERMINATED
+Windows.Win32.Foundation.ERROR_SYSTEM_SHUTDOWN
+Windows.Win32.Foundation.ERROR_SYSTEM_TRACE
+Windows.Win32.Foundation.ERROR_THREAD_1_INACTIVE
+Windows.Win32.Foundation.ERROR_THREAD_ALREADY_IN_TASK
+Windows.Win32.Foundation.ERROR_THREAD_MODE_ALREADY_BACKGROUND
+Windows.Win32.Foundation.ERROR_THREAD_MODE_NOT_BACKGROUND
+Windows.Win32.Foundation.ERROR_THREAD_NOT_IN_PROCESS
+Windows.Win32.Foundation.ERROR_THREAD_WAS_SUSPENDED
+Windows.Win32.Foundation.ERROR_TIME_SENSITIVE_THREAD
+Windows.Win32.Foundation.ERROR_TIME_SKEW
+Windows.Win32.Foundation.ERROR_TIMEOUT
+Windows.Win32.Foundation.ERROR_TIMER_NOT_CANCELED
+Windows.Win32.Foundation.ERROR_TIMER_RESOLUTION_NOT_SET
+Windows.Win32.Foundation.ERROR_TIMER_RESUME_IGNORED
+Windows.Win32.Foundation.ERROR_TLW_WITH_WSCHILD
+Windows.Win32.Foundation.ERROR_TOKEN_ALREADY_IN_USE
+Windows.Win32.Foundation.ERROR_TOO_MANY_CMDS
+Windows.Win32.Foundation.ERROR_TOO_MANY_CONTEXT_IDS
+Windows.Win32.Foundation.ERROR_TOO_MANY_DESCRIPTORS
+Windows.Win32.Foundation.ERROR_TOO_MANY_LINKS
+Windows.Win32.Foundation.ERROR_TOO_MANY_LUIDS_REQUESTED
+Windows.Win32.Foundation.ERROR_TOO_MANY_MODULES
+Windows.Win32.Foundation.ERROR_TOO_MANY_MUXWAITERS
+Windows.Win32.Foundation.ERROR_TOO_MANY_NAMES
+Windows.Win32.Foundation.ERROR_TOO_MANY_OPEN_FILES
+Windows.Win32.Foundation.ERROR_TOO_MANY_POSTS
+Windows.Win32.Foundation.ERROR_TOO_MANY_SECRETS
+Windows.Win32.Foundation.ERROR_TOO_MANY_SEM_REQUESTS
+Windows.Win32.Foundation.ERROR_TOO_MANY_SEMAPHORES
+Windows.Win32.Foundation.ERROR_TOO_MANY_SESS
+Windows.Win32.Foundation.ERROR_TOO_MANY_SIDS
+Windows.Win32.Foundation.ERROR_TOO_MANY_TCBS
+Windows.Win32.Foundation.ERROR_TOO_MANY_THREADS
+Windows.Win32.Foundation.ERROR_TRANSLATION_COMPLETE
+Windows.Win32.Foundation.ERROR_TRUST_FAILURE
+Windows.Win32.Foundation.ERROR_TRUSTED_DOMAIN_FAILURE
+Windows.Win32.Foundation.ERROR_TRUSTED_RELATIONSHIP_FAILURE
+Windows.Win32.Foundation.ERROR_UNABLE_TO_LOCK_MEDIA
+Windows.Win32.Foundation.ERROR_UNABLE_TO_MOVE_REPLACEMENT
+Windows.Win32.Foundation.ERROR_UNABLE_TO_MOVE_REPLACEMENT_2
+Windows.Win32.Foundation.ERROR_UNABLE_TO_REMOVE_REPLACED
+Windows.Win32.Foundation.ERROR_UNABLE_TO_UNLOAD_MEDIA
+Windows.Win32.Foundation.ERROR_UNDEFINED_CHARACTER
+Windows.Win32.Foundation.ERROR_UNDEFINED_SCOPE
+Windows.Win32.Foundation.ERROR_UNEXP_NET_ERR
+Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_CREATE_ERR
+Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_EXTEND_ERR
+Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_MAP_ERROR
+Windows.Win32.Foundation.ERROR_UNEXPECTED_NTCACHEMANAGER_ERROR
+Windows.Win32.Foundation.ERROR_UNHANDLED_EXCEPTION
+Windows.Win32.Foundation.ERROR_UNIDENTIFIED_ERROR
+Windows.Win32.Foundation.ERROR_UNKNOWN_COMPONENT
+Windows.Win32.Foundation.ERROR_UNKNOWN_FEATURE
+Windows.Win32.Foundation.ERROR_UNKNOWN_PATCH
+Windows.Win32.Foundation.ERROR_UNKNOWN_PORT
+Windows.Win32.Foundation.ERROR_UNKNOWN_PRINTER_DRIVER
+Windows.Win32.Foundation.ERROR_UNKNOWN_PRINTPROCESSOR
+Windows.Win32.Foundation.ERROR_UNKNOWN_PRODUCT
+Windows.Win32.Foundation.ERROR_UNKNOWN_PROPERTY
+Windows.Win32.Foundation.ERROR_UNKNOWN_REVISION
+Windows.Win32.Foundation.ERROR_UNRECOGNIZED_MEDIA
+Windows.Win32.Foundation.ERROR_UNRECOGNIZED_VOLUME
+Windows.Win32.Foundation.ERROR_UNSATISFIED_DEPENDENCIES
+Windows.Win32.Foundation.ERROR_UNSUPPORTED_COMPRESSION
+Windows.Win32.Foundation.ERROR_UNSUPPORTED_TYPE
+Windows.Win32.Foundation.ERROR_UNTRUSTED_MOUNT_POINT
+Windows.Win32.Foundation.ERROR_UNWIND
+Windows.Win32.Foundation.ERROR_UNWIND_CONSOLIDATE
+Windows.Win32.Foundation.ERROR_USER_APC
+Windows.Win32.Foundation.ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED
+Windows.Win32.Foundation.ERROR_USER_EXISTS
+Windows.Win32.Foundation.ERROR_USER_MAPPED_FILE
+Windows.Win32.Foundation.ERROR_USER_PROFILE_LOAD
+Windows.Win32.Foundation.ERROR_VALIDATE_CONTINUE
+Windows.Win32.Foundation.ERROR_VC_DISCONNECTED
+Windows.Win32.Foundation.ERROR_VDM_DISALLOWED
+Windows.Win32.Foundation.ERROR_VDM_HARD_ERROR
+Windows.Win32.Foundation.ERROR_VERIFIER_STOP
+Windows.Win32.Foundation.ERROR_VERSION_PARSE_ERROR
+Windows.Win32.Foundation.ERROR_VIRUS_DELETED
+Windows.Win32.Foundation.ERROR_VIRUS_INFECTED
+Windows.Win32.Foundation.ERROR_VOLSNAP_HIBERNATE_READY
+Windows.Win32.Foundation.ERROR_VOLSNAP_PREPARE_HIBERNATE
+Windows.Win32.Foundation.ERROR_VOLUME_MOUNTED
+Windows.Win32.Foundation.ERROR_VOLUME_NOT_CLUSTER_ALIGNED
+Windows.Win32.Foundation.ERROR_VOLUME_NOT_SIS_ENABLED
+Windows.Win32.Foundation.ERROR_VOLUME_NOT_SUPPORT_EFS
+Windows.Win32.Foundation.ERROR_VOLUME_NOT_SUPPORTED
+Windows.Win32.Foundation.ERROR_VOLUME_WRITE_ACCESS_DENIED
+Windows.Win32.Foundation.ERROR_WAIT_1
+Windows.Win32.Foundation.ERROR_WAIT_2
+Windows.Win32.Foundation.ERROR_WAIT_3
+Windows.Win32.Foundation.ERROR_WAIT_63
+Windows.Win32.Foundation.ERROR_WAIT_FOR_OPLOCK
+Windows.Win32.Foundation.ERROR_WAIT_NO_CHILDREN
+Windows.Win32.Foundation.ERROR_WAKE_SYSTEM
+Windows.Win32.Foundation.ERROR_WAKE_SYSTEM_DEBUGGER
+Windows.Win32.Foundation.ERROR_WAS_LOCKED
+Windows.Win32.Foundation.ERROR_WAS_UNLOCKED
+Windows.Win32.Foundation.ERROR_WEAK_WHFBKEY_BLOCKED
+Windows.Win32.Foundation.ERROR_WINDOW_NOT_COMBOBOX
+Windows.Win32.Foundation.ERROR_WINDOW_NOT_DIALOG
+Windows.Win32.Foundation.ERROR_WINDOW_OF_OTHER_THREAD
+Windows.Win32.Foundation.ERROR_WIP_ENCRYPTION_FAILED
+Windows.Win32.Foundation.ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT
+Windows.Win32.Foundation.ERROR_WOF_WIM_HEADER_CORRUPT
+Windows.Win32.Foundation.ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT
+Windows.Win32.Foundation.ERROR_WORKING_SET_QUOTA
+Windows.Win32.Foundation.ERROR_WOW_ASSERTION
+Windows.Win32.Foundation.ERROR_WRITE_FAULT
+Windows.Win32.Foundation.ERROR_WRITE_PROTECT
+Windows.Win32.Foundation.ERROR_WRONG_COMPARTMENT
+Windows.Win32.Foundation.ERROR_WRONG_DISK
+Windows.Win32.Foundation.ERROR_WRONG_EFS
+Windows.Win32.Foundation.ERROR_WRONG_PASSWORD
+Windows.Win32.Foundation.ERROR_WRONG_TARGET_NAME
+Windows.Win32.Foundation.ERROR_WX86_ERROR
+Windows.Win32.Foundation.ERROR_WX86_WARNING
+Windows.Win32.Foundation.ERROR_XML_PARSE_ERROR
+Windows.Win32.Foundation.ERROR_XMLDSIG_ERROR
+Windows.Win32.Foundation.EXCEPTION_STACK_OVERFLOW
+Windows.Win32.Foundation.FALSE
+Windows.Win32.Foundation.FARPROC
+Windows.Win32.Foundation.FILETIME
+Windows.Win32.Foundation.FRS_ERR_SYSVOL_POPULATE_TIMEOUT
+Windows.Win32.Foundation.GENERIC_ACCESS_RIGHTS
+Windows.Win32.Foundation.GENERIC_ALL
+Windows.Win32.Foundation.GENERIC_EXECUTE
+Windows.Win32.Foundation.GENERIC_READ
+Windows.Win32.Foundation.GENERIC_WRITE
+Windows.Win32.Foundation.GetLastError
+Windows.Win32.Foundation.HANDLE
+Windows.Win32.Foundation.HANDLE_FLAG_INHERIT
+Windows.Win32.Foundation.HANDLE_FLAG_PROTECT_FROM_CLOSE
+Windows.Win32.Foundation.HANDLE_FLAGS
+Windows.Win32.Foundation.HMODULE
+Windows.Win32.Foundation.INVALID_HANDLE_VALUE
+Windows.Win32.Foundation.MAX_PATH
+Windows.Win32.Foundation.NO_ERROR
+Windows.Win32.Foundation.NTSTATUS
+Windows.Win32.Foundation.RtlNtStatusToDosError
+Windows.Win32.Foundation.SetHandleInformation
+Windows.Win32.Foundation.SetLastError
+Windows.Win32.Foundation.STATUS_DELETE_PENDING
+Windows.Win32.Foundation.STATUS_END_OF_FILE
+Windows.Win32.Foundation.STATUS_INVALID_PARAMETER
+Windows.Win32.Foundation.STATUS_PENDING
+Windows.Win32.Foundation.STATUS_SUCCESS
+Windows.Win32.Foundation.TRUE
+Windows.Win32.Foundation.UNICODE_STRING
+Windows.Win32.Foundation.WAIT_ABANDONED
+Windows.Win32.Foundation.WAIT_ABANDONED_0
+Windows.Win32.Foundation.WAIT_FAILED
+Windows.Win32.Foundation.WAIT_IO_COMPLETION
+Windows.Win32.Foundation.WAIT_OBJECT_0
+Windows.Win32.Foundation.WAIT_TIMEOUT
+Windows.Win32.Foundation.WIN32_ERROR
+Windows.Win32.Globalization.COMPARESTRING_RESULT
+Windows.Win32.Globalization.CompareStringOrdinal
+Windows.Win32.Globalization.CP_UTF8
+Windows.Win32.Globalization.CSTR_EQUAL
+Windows.Win32.Globalization.CSTR_GREATER_THAN
+Windows.Win32.Globalization.CSTR_LESS_THAN
+Windows.Win32.Globalization.MB_COMPOSITE
+Windows.Win32.Globalization.MB_ERR_INVALID_CHARS
+Windows.Win32.Globalization.MB_PRECOMPOSED
+Windows.Win32.Globalization.MB_USEGLYPHCHARS
+Windows.Win32.Globalization.MULTI_BYTE_TO_WIDE_CHAR_FLAGS
+Windows.Win32.Globalization.MultiByteToWideChar
+Windows.Win32.Globalization.WC_ERR_INVALID_CHARS
+Windows.Win32.Globalization.WideCharToMultiByte
+Windows.Win32.Networking.WinSock.accept
+Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
+Windows.Win32.Networking.WinSock.ADDRINFOA
+Windows.Win32.Networking.WinSock.AF_INET
+Windows.Win32.Networking.WinSock.AF_INET6
+Windows.Win32.Networking.WinSock.AF_UNSPEC
+Windows.Win32.Networking.WinSock.bind
+Windows.Win32.Networking.WinSock.closesocket
+Windows.Win32.Networking.WinSock.connect
+Windows.Win32.Networking.WinSock.FD_SET
+Windows.Win32.Networking.WinSock.FIONBIO
+Windows.Win32.Networking.WinSock.freeaddrinfo
+Windows.Win32.Networking.WinSock.getaddrinfo
+Windows.Win32.Networking.WinSock.getpeername
+Windows.Win32.Networking.WinSock.getsockname
+Windows.Win32.Networking.WinSock.getsockopt
+Windows.Win32.Networking.WinSock.IN6_ADDR
+Windows.Win32.Networking.WinSock.IN_ADDR
+Windows.Win32.Networking.WinSock.INVALID_SOCKET
+Windows.Win32.Networking.WinSock.ioctlsocket
+Windows.Win32.Networking.WinSock.IP_ADD_MEMBERSHIP
+Windows.Win32.Networking.WinSock.IP_DROP_MEMBERSHIP
+Windows.Win32.Networking.WinSock.IP_MREQ
+Windows.Win32.Networking.WinSock.IP_MULTICAST_LOOP
+Windows.Win32.Networking.WinSock.IP_MULTICAST_TTL
+Windows.Win32.Networking.WinSock.IP_TTL
+Windows.Win32.Networking.WinSock.IPPROTO
+Windows.Win32.Networking.WinSock.IPPROTO_AH
+Windows.Win32.Networking.WinSock.IPPROTO_CBT
+Windows.Win32.Networking.WinSock.IPPROTO_DSTOPTS
+Windows.Win32.Networking.WinSock.IPPROTO_EGP
+Windows.Win32.Networking.WinSock.IPPROTO_ESP
+Windows.Win32.Networking.WinSock.IPPROTO_FRAGMENT
+Windows.Win32.Networking.WinSock.IPPROTO_GGP
+Windows.Win32.Networking.WinSock.IPPROTO_HOPOPTS
+Windows.Win32.Networking.WinSock.IPPROTO_ICLFXBM
+Windows.Win32.Networking.WinSock.IPPROTO_ICMP
+Windows.Win32.Networking.WinSock.IPPROTO_ICMPV6
+Windows.Win32.Networking.WinSock.IPPROTO_IDP
+Windows.Win32.Networking.WinSock.IPPROTO_IGMP
+Windows.Win32.Networking.WinSock.IPPROTO_IGP
+Windows.Win32.Networking.WinSock.IPPROTO_IP
+Windows.Win32.Networking.WinSock.IPPROTO_IPV4
+Windows.Win32.Networking.WinSock.IPPROTO_IPV6
+Windows.Win32.Networking.WinSock.IPPROTO_L2TP
+Windows.Win32.Networking.WinSock.IPPROTO_MAX
+Windows.Win32.Networking.WinSock.IPPROTO_ND
+Windows.Win32.Networking.WinSock.IPPROTO_NONE
+Windows.Win32.Networking.WinSock.IPPROTO_PGM
+Windows.Win32.Networking.WinSock.IPPROTO_PIM
+Windows.Win32.Networking.WinSock.IPPROTO_PUP
+Windows.Win32.Networking.WinSock.IPPROTO_RAW
+Windows.Win32.Networking.WinSock.IPPROTO_RDP
+Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_IPSEC
+Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_IPSECOFFLOAD
+Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_MAX
+Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_RAW
+Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_WNV
+Windows.Win32.Networking.WinSock.IPPROTO_RM
+Windows.Win32.Networking.WinSock.IPPROTO_ROUTING
+Windows.Win32.Networking.WinSock.IPPROTO_SCTP
+Windows.Win32.Networking.WinSock.IPPROTO_ST
+Windows.Win32.Networking.WinSock.IPPROTO_TCP
+Windows.Win32.Networking.WinSock.IPPROTO_UDP
+Windows.Win32.Networking.WinSock.IPV6_ADD_MEMBERSHIP
+Windows.Win32.Networking.WinSock.IPV6_DROP_MEMBERSHIP
+Windows.Win32.Networking.WinSock.IPV6_MREQ
+Windows.Win32.Networking.WinSock.IPV6_MULTICAST_LOOP
+Windows.Win32.Networking.WinSock.IPV6_V6ONLY
+Windows.Win32.Networking.WinSock.LINGER
+Windows.Win32.Networking.WinSock.listen
+Windows.Win32.Networking.WinSock.LPWSAOVERLAPPED_COMPLETION_ROUTINE
+Windows.Win32.Networking.WinSock.MSG_DONTROUTE
+Windows.Win32.Networking.WinSock.MSG_OOB
+Windows.Win32.Networking.WinSock.MSG_PEEK
+Windows.Win32.Networking.WinSock.MSG_PUSH_IMMEDIATE
+Windows.Win32.Networking.WinSock.MSG_WAITALL
+Windows.Win32.Networking.WinSock.recv
+Windows.Win32.Networking.WinSock.recvfrom
+Windows.Win32.Networking.WinSock.SD_BOTH
+Windows.Win32.Networking.WinSock.SD_RECEIVE
+Windows.Win32.Networking.WinSock.SD_SEND
+Windows.Win32.Networking.WinSock.select
+Windows.Win32.Networking.WinSock.send
+Windows.Win32.Networking.WinSock.SEND_RECV_FLAGS
+Windows.Win32.Networking.WinSock.sendto
+Windows.Win32.Networking.WinSock.setsockopt
+Windows.Win32.Networking.WinSock.shutdown
+Windows.Win32.Networking.WinSock.SO_BROADCAST
+Windows.Win32.Networking.WinSock.SO_ERROR
+Windows.Win32.Networking.WinSock.SO_LINGER
+Windows.Win32.Networking.WinSock.SO_RCVTIMEO
+Windows.Win32.Networking.WinSock.SO_SNDTIMEO
+Windows.Win32.Networking.WinSock.SOCK_DGRAM
+Windows.Win32.Networking.WinSock.SOCK_RAW
+Windows.Win32.Networking.WinSock.SOCK_RDM
+Windows.Win32.Networking.WinSock.SOCK_SEQPACKET
+Windows.Win32.Networking.WinSock.SOCK_STREAM
+Windows.Win32.Networking.WinSock.SOCKADDR
+Windows.Win32.Networking.WinSock.SOCKET
+Windows.Win32.Networking.WinSock.SOCKET_ERROR
+Windows.Win32.Networking.WinSock.SOL_SOCKET
+Windows.Win32.Networking.WinSock.TCP_NODELAY
+Windows.Win32.Networking.WinSock.TIMEVAL
+Windows.Win32.Networking.WinSock.WINSOCK_SHUTDOWN_HOW
+Windows.Win32.Networking.WinSock.WINSOCK_SOCKET_TYPE
+Windows.Win32.Networking.WinSock.WSA_E_CANCELLED
+Windows.Win32.Networking.WinSock.WSA_E_NO_MORE
+Windows.Win32.Networking.WinSock.WSA_ERROR
+Windows.Win32.Networking.WinSock.WSA_FLAG_NO_HANDLE_INHERIT
+Windows.Win32.Networking.WinSock.WSA_FLAG_OVERLAPPED
+Windows.Win32.Networking.WinSock.WSA_INVALID_HANDLE
+Windows.Win32.Networking.WinSock.WSA_INVALID_PARAMETER
+Windows.Win32.Networking.WinSock.WSA_IO_INCOMPLETE
+Windows.Win32.Networking.WinSock.WSA_IO_PENDING
+Windows.Win32.Networking.WinSock.WSA_IPSEC_NAME_POLICY_ERROR
+Windows.Win32.Networking.WinSock.WSA_NOT_ENOUGH_MEMORY
+Windows.Win32.Networking.WinSock.WSA_OPERATION_ABORTED
+Windows.Win32.Networking.WinSock.WSA_QOS_ADMISSION_FAILURE
+Windows.Win32.Networking.WinSock.WSA_QOS_BAD_OBJECT
+Windows.Win32.Networking.WinSock.WSA_QOS_BAD_STYLE
+Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERCOUNT
+Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERSTYLE
+Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERTYPE
+Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWCOUNT
+Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWDESC
+Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWSPEC
+Windows.Win32.Networking.WinSock.WSA_QOS_EOBJLENGTH
+Windows.Win32.Networking.WinSock.WSA_QOS_EPOLICYOBJ
+Windows.Win32.Networking.WinSock.WSA_QOS_EPROVSPECBUF
+Windows.Win32.Networking.WinSock.WSA_QOS_EPSFILTERSPEC
+Windows.Win32.Networking.WinSock.WSA_QOS_EPSFLOWSPEC
+Windows.Win32.Networking.WinSock.WSA_QOS_ESDMODEOBJ
+Windows.Win32.Networking.WinSock.WSA_QOS_ESERVICETYPE
+Windows.Win32.Networking.WinSock.WSA_QOS_ESHAPERATEOBJ
+Windows.Win32.Networking.WinSock.WSA_QOS_EUNKOWNPSOBJ
+Windows.Win32.Networking.WinSock.WSA_QOS_GENERIC_ERROR
+Windows.Win32.Networking.WinSock.WSA_QOS_NO_RECEIVERS
+Windows.Win32.Networking.WinSock.WSA_QOS_NO_SENDERS
+Windows.Win32.Networking.WinSock.WSA_QOS_POLICY_FAILURE
+Windows.Win32.Networking.WinSock.WSA_QOS_RECEIVERS
+Windows.Win32.Networking.WinSock.WSA_QOS_REQUEST_CONFIRMED
+Windows.Win32.Networking.WinSock.WSA_QOS_RESERVED_PETYPE
+Windows.Win32.Networking.WinSock.WSA_QOS_SENDERS
+Windows.Win32.Networking.WinSock.WSA_QOS_TRAFFIC_CTRL_ERROR
+Windows.Win32.Networking.WinSock.WSA_SECURE_HOST_NOT_FOUND
+Windows.Win32.Networking.WinSock.WSA_WAIT_EVENT_0
+Windows.Win32.Networking.WinSock.WSA_WAIT_IO_COMPLETION
+Windows.Win32.Networking.WinSock.WSABASEERR
+Windows.Win32.Networking.WinSock.WSABUF
+Windows.Win32.Networking.WinSock.WSACleanup
+Windows.Win32.Networking.WinSock.WSADATA
+Windows.Win32.Networking.WinSock.WSADATA
+Windows.Win32.Networking.WinSock.WSADuplicateSocketW
+Windows.Win32.Networking.WinSock.WSAEACCES
+Windows.Win32.Networking.WinSock.WSAEADDRINUSE
+Windows.Win32.Networking.WinSock.WSAEADDRNOTAVAIL
+Windows.Win32.Networking.WinSock.WSAEAFNOSUPPORT
+Windows.Win32.Networking.WinSock.WSAEALREADY
+Windows.Win32.Networking.WinSock.WSAEBADF
+Windows.Win32.Networking.WinSock.WSAECANCELLED
+Windows.Win32.Networking.WinSock.WSAECONNABORTED
+Windows.Win32.Networking.WinSock.WSAECONNREFUSED
+Windows.Win32.Networking.WinSock.WSAECONNRESET
+Windows.Win32.Networking.WinSock.WSAEDESTADDRREQ
+Windows.Win32.Networking.WinSock.WSAEDISCON
+Windows.Win32.Networking.WinSock.WSAEDQUOT
+Windows.Win32.Networking.WinSock.WSAEFAULT
+Windows.Win32.Networking.WinSock.WSAEHOSTDOWN
+Windows.Win32.Networking.WinSock.WSAEHOSTUNREACH
+Windows.Win32.Networking.WinSock.WSAEINPROGRESS
+Windows.Win32.Networking.WinSock.WSAEINTR
+Windows.Win32.Networking.WinSock.WSAEINVAL
+Windows.Win32.Networking.WinSock.WSAEINVALIDPROCTABLE
+Windows.Win32.Networking.WinSock.WSAEINVALIDPROVIDER
+Windows.Win32.Networking.WinSock.WSAEISCONN
+Windows.Win32.Networking.WinSock.WSAELOOP
+Windows.Win32.Networking.WinSock.WSAEMFILE
+Windows.Win32.Networking.WinSock.WSAEMSGSIZE
+Windows.Win32.Networking.WinSock.WSAENAMETOOLONG
+Windows.Win32.Networking.WinSock.WSAENETDOWN
+Windows.Win32.Networking.WinSock.WSAENETRESET
+Windows.Win32.Networking.WinSock.WSAENETUNREACH
+Windows.Win32.Networking.WinSock.WSAENOBUFS
+Windows.Win32.Networking.WinSock.WSAENOMORE
+Windows.Win32.Networking.WinSock.WSAENOPROTOOPT
+Windows.Win32.Networking.WinSock.WSAENOTCONN
+Windows.Win32.Networking.WinSock.WSAENOTEMPTY
+Windows.Win32.Networking.WinSock.WSAENOTSOCK
+Windows.Win32.Networking.WinSock.WSAEOPNOTSUPP
+Windows.Win32.Networking.WinSock.WSAEPFNOSUPPORT
+Windows.Win32.Networking.WinSock.WSAEPROCLIM
+Windows.Win32.Networking.WinSock.WSAEPROTONOSUPPORT
+Windows.Win32.Networking.WinSock.WSAEPROTOTYPE
+Windows.Win32.Networking.WinSock.WSAEPROVIDERFAILEDINIT
+Windows.Win32.Networking.WinSock.WSAEREFUSED
+Windows.Win32.Networking.WinSock.WSAEREMOTE
+Windows.Win32.Networking.WinSock.WSAESHUTDOWN
+Windows.Win32.Networking.WinSock.WSAESOCKTNOSUPPORT
+Windows.Win32.Networking.WinSock.WSAESTALE
+Windows.Win32.Networking.WinSock.WSAETIMEDOUT
+Windows.Win32.Networking.WinSock.WSAETOOMANYREFS
+Windows.Win32.Networking.WinSock.WSAEUSERS
+Windows.Win32.Networking.WinSock.WSAEWOULDBLOCK
+Windows.Win32.Networking.WinSock.WSAGetLastError
+Windows.Win32.Networking.WinSock.WSAHOST_NOT_FOUND
+Windows.Win32.Networking.WinSock.WSANO_DATA
+Windows.Win32.Networking.WinSock.WSANO_RECOVERY
+Windows.Win32.Networking.WinSock.WSANOTINITIALISED
+Windows.Win32.Networking.WinSock.WSAPROTOCOL_INFOW
+Windows.Win32.Networking.WinSock.WSAPROTOCOLCHAIN
+Windows.Win32.Networking.WinSock.WSARecv
+Windows.Win32.Networking.WinSock.WSASend
+Windows.Win32.Networking.WinSock.WSASERVICE_NOT_FOUND
+Windows.Win32.Networking.WinSock.WSASocketW
+Windows.Win32.Networking.WinSock.WSAStartup
+Windows.Win32.Networking.WinSock.WSASYSCALLFAILURE
+Windows.Win32.Networking.WinSock.WSASYSNOTREADY
+Windows.Win32.Networking.WinSock.WSATRY_AGAIN
+Windows.Win32.Networking.WinSock.WSATYPE_NOT_FOUND
+Windows.Win32.Networking.WinSock.WSAVERNOTSUPPORTED
+Windows.Win32.Security.Authentication.Identity.RtlGenRandom
+Windows.Win32.Security.Cryptography.BCRYPT_ALG_HANDLE
+Windows.Win32.Security.Cryptography.BCRYPT_USE_SYSTEM_PREFERRED_RNG
+Windows.Win32.Security.Cryptography.BCryptGenRandom
+Windows.Win32.Security.Cryptography.BCRYPTGENRANDOM_FLAGS
+Windows.Win32.Security.SECURITY_ATTRIBUTES
+Windows.Win32.Security.TOKEN_ACCESS_MASK
+Windows.Win32.Security.TOKEN_ACCESS_PSEUDO_HANDLE
+Windows.Win32.Security.TOKEN_ACCESS_PSEUDO_HANDLE_WIN8
+Windows.Win32.Security.TOKEN_ACCESS_SYSTEM_SECURITY
+Windows.Win32.Security.TOKEN_ADJUST_DEFAULT
+Windows.Win32.Security.TOKEN_ADJUST_GROUPS
+Windows.Win32.Security.TOKEN_ADJUST_PRIVILEGES
+Windows.Win32.Security.TOKEN_ADJUST_SESSIONID
+Windows.Win32.Security.TOKEN_ALL_ACCESS
+Windows.Win32.Security.TOKEN_ASSIGN_PRIMARY
+Windows.Win32.Security.TOKEN_DELETE
+Windows.Win32.Security.TOKEN_DUPLICATE
+Windows.Win32.Security.TOKEN_EXECUTE
+Windows.Win32.Security.TOKEN_IMPERSONATE
+Windows.Win32.Security.TOKEN_QUERY
+Windows.Win32.Security.TOKEN_QUERY_SOURCE
+Windows.Win32.Security.TOKEN_READ
+Windows.Win32.Security.TOKEN_READ_CONTROL
+Windows.Win32.Security.TOKEN_TRUST_CONSTRAINT_MASK
+Windows.Win32.Security.TOKEN_WRITE
+Windows.Win32.Security.TOKEN_WRITE_DAC
+Windows.Win32.Security.TOKEN_WRITE_OWNER
+Windows.Win32.Storage.FileSystem.BY_HANDLE_FILE_INFORMATION
+Windows.Win32.Storage.FileSystem.CALLBACK_CHUNK_FINISHED
+Windows.Win32.Storage.FileSystem.CALLBACK_STREAM_SWITCH
+Windows.Win32.Storage.FileSystem.CopyFileExW
+Windows.Win32.Storage.FileSystem.CREATE_ALWAYS
+Windows.Win32.Storage.FileSystem.CREATE_NEW
+Windows.Win32.Storage.FileSystem.CreateDirectoryW
+Windows.Win32.Storage.FileSystem.CreateFileW
+Windows.Win32.Storage.FileSystem.CreateHardLinkW
+Windows.Win32.Storage.FileSystem.CreateSymbolicLinkW
+Windows.Win32.Storage.FileSystem.DELETE
+Windows.Win32.Storage.FileSystem.DeleteFileW
+Windows.Win32.Storage.FileSystem.FILE_ACCESS_RIGHTS
+Windows.Win32.Storage.FileSystem.FILE_ADD_FILE
+Windows.Win32.Storage.FileSystem.FILE_ADD_SUBDIRECTORY
+Windows.Win32.Storage.FileSystem.FILE_ALL_ACCESS
+Windows.Win32.Storage.FileSystem.FILE_APPEND_DATA
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_ARCHIVE
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_COMPRESSED
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_DEVICE
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_DIRECTORY
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_EA
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_ENCRYPTED
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_HIDDEN
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_INTEGRITY_STREAM
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NO_SCRUB_DATA
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NORMAL
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_OFFLINE
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_PINNED
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_READONLY
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_RECALL_ON_OPEN
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_REPARSE_POINT
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_SPARSE_FILE
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_SYSTEM
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_TAG_INFO
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_TEMPORARY
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_UNPINNED
+Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_VIRTUAL
+Windows.Win32.Storage.FileSystem.FILE_BASIC_INFO
+Windows.Win32.Storage.FileSystem.FILE_BEGIN
+Windows.Win32.Storage.FileSystem.FILE_CREATE_PIPE_INSTANCE
+Windows.Win32.Storage.FileSystem.FILE_CREATION_DISPOSITION
+Windows.Win32.Storage.FileSystem.FILE_CURRENT
+Windows.Win32.Storage.FileSystem.FILE_DELETE_CHILD
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_DELETE
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_DO_NOT_DELETE
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_FORCE_IMAGE_SECTION_CHECK
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_ON_CLOSE
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_POSIX_SEMANTICS
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO_EX
+Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO_EX_FLAGS
+Windows.Win32.Storage.FileSystem.FILE_END
+Windows.Win32.Storage.FileSystem.FILE_END_OF_FILE_INFO
+Windows.Win32.Storage.FileSystem.FILE_EXECUTE
+Windows.Win32.Storage.FileSystem.FILE_FLAG_BACKUP_SEMANTICS
+Windows.Win32.Storage.FileSystem.FILE_FLAG_DELETE_ON_CLOSE
+Windows.Win32.Storage.FileSystem.FILE_FLAG_FIRST_PIPE_INSTANCE
+Windows.Win32.Storage.FileSystem.FILE_FLAG_NO_BUFFERING
+Windows.Win32.Storage.FileSystem.FILE_FLAG_OPEN_NO_RECALL
+Windows.Win32.Storage.FileSystem.FILE_FLAG_OPEN_REPARSE_POINT
+Windows.Win32.Storage.FileSystem.FILE_FLAG_OVERLAPPED
+Windows.Win32.Storage.FileSystem.FILE_FLAG_POSIX_SEMANTICS
+Windows.Win32.Storage.FileSystem.FILE_FLAG_RANDOM_ACCESS
+Windows.Win32.Storage.FileSystem.FILE_FLAG_SEQUENTIAL_SCAN
+Windows.Win32.Storage.FileSystem.FILE_FLAG_SESSION_AWARE
+Windows.Win32.Storage.FileSystem.FILE_FLAG_WRITE_THROUGH
+Windows.Win32.Storage.FileSystem.FILE_FLAGS_AND_ATTRIBUTES
+Windows.Win32.Storage.FileSystem.FILE_GENERIC_EXECUTE
+Windows.Win32.Storage.FileSystem.FILE_GENERIC_READ
+Windows.Win32.Storage.FileSystem.FILE_GENERIC_WRITE
+Windows.Win32.Storage.FileSystem.FILE_ID_BOTH_DIR_INFO
+Windows.Win32.Storage.FileSystem.FILE_INFO_BY_HANDLE_CLASS
+Windows.Win32.Storage.FileSystem.FILE_LIST_DIRECTORY
+Windows.Win32.Storage.FileSystem.FILE_NAME_NORMALIZED
+Windows.Win32.Storage.FileSystem.FILE_NAME_OPENED
+Windows.Win32.Storage.FileSystem.FILE_READ_ATTRIBUTES
+Windows.Win32.Storage.FileSystem.FILE_READ_DATA
+Windows.Win32.Storage.FileSystem.FILE_READ_EA
+Windows.Win32.Storage.FileSystem.FILE_SHARE_DELETE
+Windows.Win32.Storage.FileSystem.FILE_SHARE_MODE
+Windows.Win32.Storage.FileSystem.FILE_SHARE_NONE
+Windows.Win32.Storage.FileSystem.FILE_SHARE_READ
+Windows.Win32.Storage.FileSystem.FILE_SHARE_WRITE
+Windows.Win32.Storage.FileSystem.FILE_STANDARD_INFO
+Windows.Win32.Storage.FileSystem.FILE_TRAVERSE
+Windows.Win32.Storage.FileSystem.FILE_TYPE
+Windows.Win32.Storage.FileSystem.FILE_TYPE_CHAR
+Windows.Win32.Storage.FileSystem.FILE_TYPE_DISK
+Windows.Win32.Storage.FileSystem.FILE_TYPE_PIPE
+Windows.Win32.Storage.FileSystem.FILE_TYPE_REMOTE
+Windows.Win32.Storage.FileSystem.FILE_TYPE_UNKNOWN
+Windows.Win32.Storage.FileSystem.FILE_WRITE_ATTRIBUTES
+Windows.Win32.Storage.FileSystem.FILE_WRITE_DATA
+Windows.Win32.Storage.FileSystem.FILE_WRITE_EA
+Windows.Win32.Storage.FileSystem.FileAlignmentInfo
+Windows.Win32.Storage.FileSystem.FileAllocationInfo
+Windows.Win32.Storage.FileSystem.FileAttributeTagInfo
+Windows.Win32.Storage.FileSystem.FileBasicInfo
+Windows.Win32.Storage.FileSystem.FileCaseSensitiveInfo
+Windows.Win32.Storage.FileSystem.FileCompressionInfo
+Windows.Win32.Storage.FileSystem.FileDispositionInfo
+Windows.Win32.Storage.FileSystem.FileDispositionInfoEx
+Windows.Win32.Storage.FileSystem.FileEndOfFileInfo
+Windows.Win32.Storage.FileSystem.FileFullDirectoryInfo
+Windows.Win32.Storage.FileSystem.FileFullDirectoryRestartInfo
+Windows.Win32.Storage.FileSystem.FileIdBothDirectoryInfo
+Windows.Win32.Storage.FileSystem.FileIdBothDirectoryRestartInfo
+Windows.Win32.Storage.FileSystem.FileIdExtdDirectoryInfo
+Windows.Win32.Storage.FileSystem.FileIdExtdDirectoryRestartInfo
+Windows.Win32.Storage.FileSystem.FileIdInfo
+Windows.Win32.Storage.FileSystem.FileIoPriorityHintInfo
+Windows.Win32.Storage.FileSystem.FileNameInfo
+Windows.Win32.Storage.FileSystem.FileNormalizedNameInfo
+Windows.Win32.Storage.FileSystem.FileRemoteProtocolInfo
+Windows.Win32.Storage.FileSystem.FileRenameInfo
+Windows.Win32.Storage.FileSystem.FileRenameInfoEx
+Windows.Win32.Storage.FileSystem.FileStandardInfo
+Windows.Win32.Storage.FileSystem.FileStorageInfo
+Windows.Win32.Storage.FileSystem.FileStreamInfo
+Windows.Win32.Storage.FileSystem.FindClose
+Windows.Win32.Storage.FileSystem.FindFileHandle
+Windows.Win32.Storage.FileSystem.FindFirstFileW
+Windows.Win32.Storage.FileSystem.FindNextFileW
+Windows.Win32.Storage.FileSystem.FlushFileBuffers
+Windows.Win32.Storage.FileSystem.GetFileAttributesW
+Windows.Win32.Storage.FileSystem.GetFileInformationByHandle
+Windows.Win32.Storage.FileSystem.GetFileInformationByHandleEx
+Windows.Win32.Storage.FileSystem.GetFileType
+Windows.Win32.Storage.FileSystem.GETFINALPATHNAMEBYHANDLE_FLAGS
+Windows.Win32.Storage.FileSystem.GetFinalPathNameByHandleW
+Windows.Win32.Storage.FileSystem.GetFullPathNameW
+Windows.Win32.Storage.FileSystem.GetTempPathW
+Windows.Win32.Storage.FileSystem.INVALID_FILE_ATTRIBUTES
+Windows.Win32.Storage.FileSystem.LPPROGRESS_ROUTINE
+Windows.Win32.Storage.FileSystem.LPPROGRESS_ROUTINE_CALLBACK_REASON
+Windows.Win32.Storage.FileSystem.MAXIMUM_REPARSE_DATA_BUFFER_SIZE
+Windows.Win32.Storage.FileSystem.MaximumFileInfoByHandleClass
+Windows.Win32.Storage.FileSystem.MOVE_FILE_FLAGS
+Windows.Win32.Storage.FileSystem.MOVEFILE_COPY_ALLOWED
+Windows.Win32.Storage.FileSystem.MOVEFILE_CREATE_HARDLINK
+Windows.Win32.Storage.FileSystem.MOVEFILE_DELAY_UNTIL_REBOOT
+Windows.Win32.Storage.FileSystem.MOVEFILE_FAIL_IF_NOT_TRACKABLE
+Windows.Win32.Storage.FileSystem.MOVEFILE_REPLACE_EXISTING
+Windows.Win32.Storage.FileSystem.MOVEFILE_WRITE_THROUGH
+Windows.Win32.Storage.FileSystem.MoveFileExW
+Windows.Win32.Storage.FileSystem.OPEN_ALWAYS
+Windows.Win32.Storage.FileSystem.OPEN_EXISTING
+Windows.Win32.Storage.FileSystem.PIPE_ACCESS_DUPLEX
+Windows.Win32.Storage.FileSystem.PIPE_ACCESS_INBOUND
+Windows.Win32.Storage.FileSystem.PIPE_ACCESS_OUTBOUND
+Windows.Win32.Storage.FileSystem.READ_CONTROL
+Windows.Win32.Storage.FileSystem.ReadFile
+Windows.Win32.Storage.FileSystem.ReadFileEx
+Windows.Win32.Storage.FileSystem.RemoveDirectoryW
+Windows.Win32.Storage.FileSystem.SECURITY_ANONYMOUS
+Windows.Win32.Storage.FileSystem.SECURITY_CONTEXT_TRACKING
+Windows.Win32.Storage.FileSystem.SECURITY_DELEGATION
+Windows.Win32.Storage.FileSystem.SECURITY_EFFECTIVE_ONLY
+Windows.Win32.Storage.FileSystem.SECURITY_IDENTIFICATION
+Windows.Win32.Storage.FileSystem.SECURITY_IMPERSONATION
+Windows.Win32.Storage.FileSystem.SECURITY_SQOS_PRESENT
+Windows.Win32.Storage.FileSystem.SECURITY_VALID_SQOS_FLAGS
+Windows.Win32.Storage.FileSystem.SET_FILE_POINTER_MOVE_METHOD
+Windows.Win32.Storage.FileSystem.SetFileAttributesW
+Windows.Win32.Storage.FileSystem.SetFileInformationByHandle
+Windows.Win32.Storage.FileSystem.SetFilePointerEx
+Windows.Win32.Storage.FileSystem.SetFileTime
+Windows.Win32.Storage.FileSystem.SPECIFIC_RIGHTS_ALL
+Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_ALL
+Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_EXECUTE
+Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_READ
+Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_REQUIRED
+Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_WRITE
+Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
+Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAG_DIRECTORY
+Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAGS
+Windows.Win32.Storage.FileSystem.SYNCHRONIZE
+Windows.Win32.Storage.FileSystem.TRUNCATE_EXISTING
+Windows.Win32.Storage.FileSystem.VOLUME_NAME_DOS
+Windows.Win32.Storage.FileSystem.VOLUME_NAME_GUID
+Windows.Win32.Storage.FileSystem.VOLUME_NAME_NONE
+Windows.Win32.Storage.FileSystem.WIN32_FIND_DATAW
+Windows.Win32.Storage.FileSystem.WRITE_DAC
+Windows.Win32.Storage.FileSystem.WRITE_OWNER
+Windows.Win32.Storage.FileSystem.WriteFileEx
+Windows.Win32.System.Console.CONSOLE_MODE
+Windows.Win32.System.Console.CONSOLE_READCONSOLE_CONTROL
+Windows.Win32.System.Console.DISABLE_NEWLINE_AUTO_RETURN
+Windows.Win32.System.Console.ENABLE_AUTO_POSITION
+Windows.Win32.System.Console.ENABLE_ECHO_INPUT
+Windows.Win32.System.Console.ENABLE_EXTENDED_FLAGS
+Windows.Win32.System.Console.ENABLE_INSERT_MODE
+Windows.Win32.System.Console.ENABLE_LINE_INPUT
+Windows.Win32.System.Console.ENABLE_LVB_GRID_WORLDWIDE
+Windows.Win32.System.Console.ENABLE_MOUSE_INPUT
+Windows.Win32.System.Console.ENABLE_PROCESSED_INPUT
+Windows.Win32.System.Console.ENABLE_PROCESSED_OUTPUT
+Windows.Win32.System.Console.ENABLE_QUICK_EDIT_MODE
+Windows.Win32.System.Console.ENABLE_VIRTUAL_TERMINAL_INPUT
+Windows.Win32.System.Console.ENABLE_VIRTUAL_TERMINAL_PROCESSING
+Windows.Win32.System.Console.ENABLE_WINDOW_INPUT
+Windows.Win32.System.Console.ENABLE_WRAP_AT_EOL_OUTPUT
+Windows.Win32.System.Console.GetConsoleMode
+Windows.Win32.System.Console.GetStdHandle
+Windows.Win32.System.Console.ReadConsoleW
+Windows.Win32.System.Console.STD_ERROR_HANDLE
+Windows.Win32.System.Console.STD_HANDLE
+Windows.Win32.System.Console.STD_INPUT_HANDLE
+Windows.Win32.System.Console.STD_OUTPUT_HANDLE
+Windows.Win32.System.Console.WriteConsoleW
+Windows.Win32.System.Diagnostics.Debug.AddVectoredExceptionHandler
+Windows.Win32.System.Diagnostics.Debug.ARM64_NT_NEON128
+Windows.Win32.System.Diagnostics.Debug.CONTEXT
+Windows.Win32.System.Diagnostics.Debug.CONTEXT
+Windows.Win32.System.Diagnostics.Debug.CONTEXT
+Windows.Win32.System.Diagnostics.Debug.EXCEPTION_POINTERS
+Windows.Win32.System.Diagnostics.Debug.EXCEPTION_RECORD
+Windows.Win32.System.Diagnostics.Debug.FACILITY_CODE
+Windows.Win32.System.Diagnostics.Debug.FACILITY_NT_BIT
+Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_ALLOCATE_BUFFER
+Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_ARGUMENT_ARRAY
+Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_HMODULE
+Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_STRING
+Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_SYSTEM
+Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_IGNORE_INSERTS
+Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_OPTIONS
+Windows.Win32.System.Diagnostics.Debug.FormatMessageW
+Windows.Win32.System.Diagnostics.Debug.M128A
+Windows.Win32.System.Diagnostics.Debug.PVECTORED_EXCEPTION_HANDLER
+Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT
+Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT
+Windows.Win32.System.Environment.FreeEnvironmentStringsW
+Windows.Win32.System.Environment.GetCommandLineW
+Windows.Win32.System.Environment.GetCurrentDirectoryW
+Windows.Win32.System.Environment.GetEnvironmentStringsW
+Windows.Win32.System.Environment.GetEnvironmentVariableW
+Windows.Win32.System.Environment.SetCurrentDirectoryW
+Windows.Win32.System.Environment.SetEnvironmentVariableW
+Windows.Win32.System.IO.CancelIo
+Windows.Win32.System.IO.DeviceIoControl
+Windows.Win32.System.IO.GetOverlappedResult
+Windows.Win32.System.IO.LPOVERLAPPED_COMPLETION_ROUTINE
+Windows.Win32.System.IO.OVERLAPPED
+Windows.Win32.System.Ioctl.FSCTL_GET_REPARSE_POINT
+Windows.Win32.System.Ioctl.FSCTL_SET_REPARSE_POINT
+Windows.Win32.System.Kernel.EXCEPTION_DISPOSITION
+Windows.Win32.System.Kernel.ExceptionCollidedUnwind
+Windows.Win32.System.Kernel.ExceptionContinueExecution
+Windows.Win32.System.Kernel.ExceptionContinueSearch
+Windows.Win32.System.Kernel.ExceptionNestedException
+Windows.Win32.System.Kernel.FLOATING_SAVE_AREA
+Windows.Win32.System.Kernel.FLOATING_SAVE_AREA
+Windows.Win32.System.Kernel.OBJ_DONT_REPARSE
+Windows.Win32.System.LibraryLoader.GetModuleFileNameW
+Windows.Win32.System.LibraryLoader.GetModuleHandleA
+Windows.Win32.System.LibraryLoader.GetModuleHandleW
+Windows.Win32.System.LibraryLoader.GetProcAddress
+Windows.Win32.System.Performance.QueryPerformanceCounter
+Windows.Win32.System.Performance.QueryPerformanceFrequency
+Windows.Win32.System.Pipes.CreateNamedPipeW
+Windows.Win32.System.Pipes.NAMED_PIPE_MODE
+Windows.Win32.System.Pipes.PIPE_ACCEPT_REMOTE_CLIENTS
+Windows.Win32.System.Pipes.PIPE_CLIENT_END
+Windows.Win32.System.Pipes.PIPE_NOWAIT
+Windows.Win32.System.Pipes.PIPE_READMODE_BYTE
+Windows.Win32.System.Pipes.PIPE_READMODE_MESSAGE
+Windows.Win32.System.Pipes.PIPE_REJECT_REMOTE_CLIENTS
+Windows.Win32.System.Pipes.PIPE_SERVER_END
+Windows.Win32.System.Pipes.PIPE_TYPE_BYTE
+Windows.Win32.System.Pipes.PIPE_TYPE_MESSAGE
+Windows.Win32.System.Pipes.PIPE_WAIT
+Windows.Win32.System.SystemInformation.GetSystemDirectoryW
+Windows.Win32.System.SystemInformation.GetSystemInfo
+Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime
+Windows.Win32.System.SystemInformation.GetWindowsDirectoryW
+Windows.Win32.System.SystemInformation.PROCESSOR_ARCHITECTURE
+Windows.Win32.System.SystemInformation.SYSTEM_INFO
+Windows.Win32.System.SystemServices.DLL_PROCESS_DETACH
+Windows.Win32.System.SystemServices.DLL_THREAD_DETACH
+Windows.Win32.System.SystemServices.EXCEPTION_MAXIMUM_PARAMETERS
+Windows.Win32.System.SystemServices.IO_REPARSE_TAG_MOUNT_POINT
+Windows.Win32.System.SystemServices.IO_REPARSE_TAG_SYMLINK
+Windows.Win32.System.Threading.ABOVE_NORMAL_PRIORITY_CLASS
+Windows.Win32.System.Threading.AcquireSRWLockExclusive
+Windows.Win32.System.Threading.AcquireSRWLockShared
+Windows.Win32.System.Threading.BELOW_NORMAL_PRIORITY_CLASS
+Windows.Win32.System.Threading.CREATE_BREAKAWAY_FROM_JOB
+Windows.Win32.System.Threading.CREATE_DEFAULT_ERROR_MODE
+Windows.Win32.System.Threading.CREATE_FORCEDOS
+Windows.Win32.System.Threading.CREATE_IGNORE_SYSTEM_DEFAULT
+Windows.Win32.System.Threading.CREATE_NEW_CONSOLE
+Windows.Win32.System.Threading.CREATE_NEW_PROCESS_GROUP
+Windows.Win32.System.Threading.CREATE_NO_WINDOW
+Windows.Win32.System.Threading.CREATE_PRESERVE_CODE_AUTHZ_LEVEL
+Windows.Win32.System.Threading.CREATE_PROTECTED_PROCESS
+Windows.Win32.System.Threading.CREATE_SECURE_PROCESS
+Windows.Win32.System.Threading.CREATE_SEPARATE_WOW_VDM
+Windows.Win32.System.Threading.CREATE_SHARED_WOW_VDM
+Windows.Win32.System.Threading.CREATE_SUSPENDED
+Windows.Win32.System.Threading.CREATE_UNICODE_ENVIRONMENT
+Windows.Win32.System.Threading.CreateEventW
+Windows.Win32.System.Threading.CreateProcessW
+Windows.Win32.System.Threading.CreateThread
+Windows.Win32.System.Threading.DEBUG_ONLY_THIS_PROCESS
+Windows.Win32.System.Threading.DEBUG_PROCESS
+Windows.Win32.System.Threading.DETACHED_PROCESS
+Windows.Win32.System.Threading.ExitProcess
+Windows.Win32.System.Threading.EXTENDED_STARTUPINFO_PRESENT
+Windows.Win32.System.Threading.GetCurrentProcess
+Windows.Win32.System.Threading.GetCurrentProcessId
+Windows.Win32.System.Threading.GetCurrentThread
+Windows.Win32.System.Threading.GetExitCodeProcess
+Windows.Win32.System.Threading.GetProcessId
+Windows.Win32.System.Threading.HIGH_PRIORITY_CLASS
+Windows.Win32.System.Threading.IDLE_PRIORITY_CLASS
+Windows.Win32.System.Threading.INFINITE
+Windows.Win32.System.Threading.INHERIT_CALLER_PRIORITY
+Windows.Win32.System.Threading.INHERIT_PARENT_AFFINITY
+Windows.Win32.System.Threading.INIT_ONCE_INIT_FAILED
+Windows.Win32.System.Threading.InitOnceBeginInitialize
+Windows.Win32.System.Threading.InitOnceComplete
+Windows.Win32.System.Threading.LPTHREAD_START_ROUTINE
+Windows.Win32.System.Threading.NORMAL_PRIORITY_CLASS
+Windows.Win32.System.Threading.OpenProcessToken
+Windows.Win32.System.Threading.PROCESS_CREATION_FLAGS
+Windows.Win32.System.Threading.PROCESS_INFORMATION
+Windows.Win32.System.Threading.PROCESS_MODE_BACKGROUND_BEGIN
+Windows.Win32.System.Threading.PROCESS_MODE_BACKGROUND_END
+Windows.Win32.System.Threading.PROFILE_KERNEL
+Windows.Win32.System.Threading.PROFILE_SERVER
+Windows.Win32.System.Threading.PROFILE_USER
+Windows.Win32.System.Threading.REALTIME_PRIORITY_CLASS
+Windows.Win32.System.Threading.ReleaseSRWLockExclusive
+Windows.Win32.System.Threading.ReleaseSRWLockShared
+Windows.Win32.System.Threading.RTL_CONDITION_VARIABLE
+Windows.Win32.System.Threading.RTL_RUN_ONCE
+Windows.Win32.System.Threading.RTL_SRWLOCK
+Windows.Win32.System.Threading.SetThreadStackGuarantee
+Windows.Win32.System.Threading.Sleep
+Windows.Win32.System.Threading.SleepConditionVariableSRW
+Windows.Win32.System.Threading.SleepEx
+Windows.Win32.System.Threading.STACK_SIZE_PARAM_IS_A_RESERVATION
+Windows.Win32.System.Threading.STARTF_FORCEOFFFEEDBACK
+Windows.Win32.System.Threading.STARTF_FORCEONFEEDBACK
+Windows.Win32.System.Threading.STARTF_PREVENTPINNING
+Windows.Win32.System.Threading.STARTF_RUNFULLSCREEN
+Windows.Win32.System.Threading.STARTF_TITLEISAPPID
+Windows.Win32.System.Threading.STARTF_TITLEISLINKNAME
+Windows.Win32.System.Threading.STARTF_UNTRUSTEDSOURCE
+Windows.Win32.System.Threading.STARTF_USECOUNTCHARS
+Windows.Win32.System.Threading.STARTF_USEFILLATTRIBUTE
+Windows.Win32.System.Threading.STARTF_USEHOTKEY
+Windows.Win32.System.Threading.STARTF_USEPOSITION
+Windows.Win32.System.Threading.STARTF_USESHOWWINDOW
+Windows.Win32.System.Threading.STARTF_USESIZE
+Windows.Win32.System.Threading.STARTF_USESTDHANDLES
+Windows.Win32.System.Threading.STARTUPINFOW
+Windows.Win32.System.Threading.STARTUPINFOW_FLAGS
+Windows.Win32.System.Threading.SwitchToThread
+Windows.Win32.System.Threading.TerminateProcess
+Windows.Win32.System.Threading.THREAD_CREATE_RUN_IMMEDIATELY
+Windows.Win32.System.Threading.THREAD_CREATE_SUSPENDED
+Windows.Win32.System.Threading.THREAD_CREATION_FLAGS
+Windows.Win32.System.Threading.TLS_OUT_OF_INDEXES
+Windows.Win32.System.Threading.TlsAlloc
+Windows.Win32.System.Threading.TlsFree
+Windows.Win32.System.Threading.TlsGetValue
+Windows.Win32.System.Threading.TlsSetValue
+Windows.Win32.System.Threading.TryAcquireSRWLockExclusive
+Windows.Win32.System.Threading.TryAcquireSRWLockShared
+Windows.Win32.System.Threading.WaitForMultipleObjects
+Windows.Win32.System.Threading.WaitForSingleObject
+Windows.Win32.System.Threading.WakeAllConditionVariable
+Windows.Win32.System.Threading.WakeConditionVariable
+Windows.Win32.System.WindowsProgramming.IO_STATUS_BLOCK
+Windows.Win32.System.WindowsProgramming.OBJECT_ATTRIBUTES
+Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE
+Windows.Win32.UI.Shell.GetUserProfileDirectoryW
+// tidy-alphabetical-end
+
diff --git a/library/std/src/sys/windows/c/windows_sys.rs b/library/std/src/sys/windows/c/windows_sys.rs
new file mode 100644
index 000000000..36a30f6ba
--- /dev/null
+++ b/library/std/src/sys/windows/c/windows_sys.rs
@@ -0,0 +1,4276 @@
+// This file is autogenerated.
+//
+// To add bindings, edit windows_sys.lst then use `./x run generate-windows-sys` to
+// regenerate the bindings.
+//
+// ignore-tidy-filelength
+// Bindings generated by `windows-bindgen` 0.49.0
+
+#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)]
+#[link(name = "advapi32")]
+extern "system" {
+ pub fn OpenProcessToken(
+ processhandle: HANDLE,
+ desiredaccess: TOKEN_ACCESS_MASK,
+ tokenhandle: *mut HANDLE,
+ ) -> BOOL;
+}
+#[link(name = "advapi32")]
+extern "system" {
+ #[link_name = "SystemFunction036"]
+ pub fn RtlGenRandom(randombuffer: *mut ::core::ffi::c_void, randombufferlength: u32)
+ -> BOOLEAN;
+}
+#[link(name = "bcrypt")]
+extern "system" {
+ pub fn BCryptGenRandom(
+ halgorithm: BCRYPT_ALG_HANDLE,
+ pbbuffer: *mut u8,
+ cbbuffer: u32,
+ dwflags: BCRYPTGENRANDOM_FLAGS,
+ ) -> NTSTATUS;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn AcquireSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn AcquireSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn AddVectoredExceptionHandler(
+ first: u32,
+ handler: PVECTORED_EXCEPTION_HANDLER,
+ ) -> *mut ::core::ffi::c_void;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CancelIo(hfile: HANDLE) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CloseHandle(hobject: HANDLE) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CompareStringOrdinal(
+ lpstring1: PCWSTR,
+ cchcount1: i32,
+ lpstring2: PCWSTR,
+ cchcount2: i32,
+ bignorecase: BOOL,
+ ) -> COMPARESTRING_RESULT;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CopyFileExW(
+ lpexistingfilename: PCWSTR,
+ lpnewfilename: PCWSTR,
+ lpprogressroutine: LPPROGRESS_ROUTINE,
+ lpdata: *const ::core::ffi::c_void,
+ pbcancel: *mut i32,
+ dwcopyflags: u32,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CreateDirectoryW(
+ lppathname: PCWSTR,
+ lpsecurityattributes: *const SECURITY_ATTRIBUTES,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CreateEventW(
+ lpeventattributes: *const SECURITY_ATTRIBUTES,
+ bmanualreset: BOOL,
+ binitialstate: BOOL,
+ lpname: PCWSTR,
+ ) -> HANDLE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CreateFileW(
+ lpfilename: PCWSTR,
+ dwdesiredaccess: u32,
+ dwsharemode: FILE_SHARE_MODE,
+ lpsecurityattributes: *const SECURITY_ATTRIBUTES,
+ dwcreationdisposition: FILE_CREATION_DISPOSITION,
+ dwflagsandattributes: FILE_FLAGS_AND_ATTRIBUTES,
+ htemplatefile: HANDLE,
+ ) -> HANDLE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CreateHardLinkW(
+ lpfilename: PCWSTR,
+ lpexistingfilename: PCWSTR,
+ lpsecurityattributes: *const SECURITY_ATTRIBUTES,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CreateNamedPipeW(
+ lpname: PCWSTR,
+ dwopenmode: FILE_FLAGS_AND_ATTRIBUTES,
+ dwpipemode: NAMED_PIPE_MODE,
+ nmaxinstances: u32,
+ noutbuffersize: u32,
+ ninbuffersize: u32,
+ ndefaulttimeout: u32,
+ lpsecurityattributes: *const SECURITY_ATTRIBUTES,
+ ) -> HANDLE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CreateProcessW(
+ lpapplicationname: PCWSTR,
+ lpcommandline: PWSTR,
+ lpprocessattributes: *const SECURITY_ATTRIBUTES,
+ lpthreadattributes: *const SECURITY_ATTRIBUTES,
+ binherithandles: BOOL,
+ dwcreationflags: PROCESS_CREATION_FLAGS,
+ lpenvironment: *const ::core::ffi::c_void,
+ lpcurrentdirectory: PCWSTR,
+ lpstartupinfo: *const STARTUPINFOW,
+ lpprocessinformation: *mut PROCESS_INFORMATION,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CreateSymbolicLinkW(
+ lpsymlinkfilename: PCWSTR,
+ lptargetfilename: PCWSTR,
+ dwflags: SYMBOLIC_LINK_FLAGS,
+ ) -> BOOLEAN;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn CreateThread(
+ lpthreadattributes: *const SECURITY_ATTRIBUTES,
+ dwstacksize: usize,
+ lpstartaddress: LPTHREAD_START_ROUTINE,
+ lpparameter: *const ::core::ffi::c_void,
+ dwcreationflags: THREAD_CREATION_FLAGS,
+ lpthreadid: *mut u32,
+ ) -> HANDLE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn DeleteFileW(lpfilename: PCWSTR) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn DeviceIoControl(
+ hdevice: HANDLE,
+ dwiocontrolcode: u32,
+ lpinbuffer: *const ::core::ffi::c_void,
+ ninbuffersize: u32,
+ lpoutbuffer: *mut ::core::ffi::c_void,
+ noutbuffersize: u32,
+ lpbytesreturned: *mut u32,
+ lpoverlapped: *mut OVERLAPPED,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn DuplicateHandle(
+ hsourceprocesshandle: HANDLE,
+ hsourcehandle: HANDLE,
+ htargetprocesshandle: HANDLE,
+ lptargethandle: *mut HANDLE,
+ dwdesiredaccess: u32,
+ binherithandle: BOOL,
+ dwoptions: DUPLICATE_HANDLE_OPTIONS,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn ExitProcess(uexitcode: u32) -> !;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn FindClose(hfindfile: FindFileHandle) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn FindFirstFileW(
+ lpfilename: PCWSTR,
+ lpfindfiledata: *mut WIN32_FIND_DATAW,
+ ) -> FindFileHandle;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn FindNextFileW(hfindfile: FindFileHandle, lpfindfiledata: *mut WIN32_FIND_DATAW) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn FlushFileBuffers(hfile: HANDLE) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn FormatMessageW(
+ dwflags: FORMAT_MESSAGE_OPTIONS,
+ lpsource: *const ::core::ffi::c_void,
+ dwmessageid: u32,
+ dwlanguageid: u32,
+ lpbuffer: PWSTR,
+ nsize: u32,
+ arguments: *const *const i8,
+ ) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetCommandLineW() -> PCWSTR;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetConsoleMode(hconsolehandle: HANDLE, lpmode: *mut CONSOLE_MODE) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetCurrentDirectoryW(nbufferlength: u32, lpbuffer: PWSTR) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetCurrentProcess() -> HANDLE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetCurrentProcessId() -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetCurrentThread() -> HANDLE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetEnvironmentStringsW() -> PWSTR;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetEnvironmentVariableW(lpname: PCWSTR, lpbuffer: PWSTR, nsize: u32) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetExitCodeProcess(hprocess: HANDLE, lpexitcode: *mut u32) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetFileAttributesW(lpfilename: PCWSTR) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetFileInformationByHandle(
+ hfile: HANDLE,
+ lpfileinformation: *mut BY_HANDLE_FILE_INFORMATION,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetFileInformationByHandleEx(
+ hfile: HANDLE,
+ fileinformationclass: FILE_INFO_BY_HANDLE_CLASS,
+ lpfileinformation: *mut ::core::ffi::c_void,
+ dwbuffersize: u32,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetFileType(hfile: HANDLE) -> FILE_TYPE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetFinalPathNameByHandleW(
+ hfile: HANDLE,
+ lpszfilepath: PWSTR,
+ cchfilepath: u32,
+ dwflags: GETFINALPATHNAMEBYHANDLE_FLAGS,
+ ) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetFullPathNameW(
+ lpfilename: PCWSTR,
+ nbufferlength: u32,
+ lpbuffer: PWSTR,
+ lpfilepart: *mut PWSTR,
+ ) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetLastError() -> WIN32_ERROR;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetModuleFileNameW(hmodule: HMODULE, lpfilename: PWSTR, nsize: u32) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetModuleHandleA(lpmodulename: PCSTR) -> HMODULE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetModuleHandleW(lpmodulename: PCWSTR) -> HMODULE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetOverlappedResult(
+ hfile: HANDLE,
+ lpoverlapped: *const OVERLAPPED,
+ lpnumberofbytestransferred: *mut u32,
+ bwait: BOOL,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetProcAddress(hmodule: HMODULE, lpprocname: PCSTR) -> FARPROC;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetProcessId(process: HANDLE) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetStdHandle(nstdhandle: STD_HANDLE) -> HANDLE;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetSystemDirectoryW(lpbuffer: PWSTR, usize: u32) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetSystemInfo(lpsysteminfo: *mut SYSTEM_INFO) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetTempPathW(nbufferlength: u32, lpbuffer: PWSTR) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn GetWindowsDirectoryW(lpbuffer: PWSTR, usize: u32) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn InitOnceBeginInitialize(
+ lpinitonce: *mut RTL_RUN_ONCE,
+ dwflags: u32,
+ fpending: *mut BOOL,
+ lpcontext: *mut *mut ::core::ffi::c_void,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn InitOnceComplete(
+ lpinitonce: *mut RTL_RUN_ONCE,
+ dwflags: u32,
+ lpcontext: *const ::core::ffi::c_void,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn MoveFileExW(
+ lpexistingfilename: PCWSTR,
+ lpnewfilename: PCWSTR,
+ dwflags: MOVE_FILE_FLAGS,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn MultiByteToWideChar(
+ codepage: u32,
+ dwflags: MULTI_BYTE_TO_WIDE_CHAR_FLAGS,
+ lpmultibytestr: PCSTR,
+ cbmultibyte: i32,
+ lpwidecharstr: PWSTR,
+ cchwidechar: i32,
+ ) -> i32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn QueryPerformanceCounter(lpperformancecount: *mut i64) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn QueryPerformanceFrequency(lpfrequency: *mut i64) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn ReadConsoleW(
+ hconsoleinput: HANDLE,
+ lpbuffer: *mut ::core::ffi::c_void,
+ nnumberofcharstoread: u32,
+ lpnumberofcharsread: *mut u32,
+ pinputcontrol: *const CONSOLE_READCONSOLE_CONTROL,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn ReadFile(
+ hfile: HANDLE,
+ lpbuffer: *mut ::core::ffi::c_void,
+ nnumberofbytestoread: u32,
+ lpnumberofbytesread: *mut u32,
+ lpoverlapped: *mut OVERLAPPED,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn ReadFileEx(
+ hfile: HANDLE,
+ lpbuffer: *mut ::core::ffi::c_void,
+ nnumberofbytestoread: u32,
+ lpoverlapped: *mut OVERLAPPED,
+ lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn ReleaseSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn ReleaseSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn RemoveDirectoryW(lppathname: PCWSTR) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetCurrentDirectoryW(lppathname: PCWSTR) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetEnvironmentVariableW(lpname: PCWSTR, lpvalue: PCWSTR) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetFileAttributesW(
+ lpfilename: PCWSTR,
+ dwfileattributes: FILE_FLAGS_AND_ATTRIBUTES,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetFileInformationByHandle(
+ hfile: HANDLE,
+ fileinformationclass: FILE_INFO_BY_HANDLE_CLASS,
+ lpfileinformation: *const ::core::ffi::c_void,
+ dwbuffersize: u32,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetFilePointerEx(
+ hfile: HANDLE,
+ lidistancetomove: i64,
+ lpnewfilepointer: *mut i64,
+ dwmovemethod: SET_FILE_POINTER_MOVE_METHOD,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetFileTime(
+ hfile: HANDLE,
+ lpcreationtime: *const FILETIME,
+ lplastaccesstime: *const FILETIME,
+ lplastwritetime: *const FILETIME,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetHandleInformation(hobject: HANDLE, dwmask: u32, dwflags: HANDLE_FLAGS) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetLastError(dwerrcode: WIN32_ERROR) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SetThreadStackGuarantee(stacksizeinbytes: *mut u32) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn Sleep(dwmilliseconds: u32) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SleepConditionVariableSRW(
+ conditionvariable: *mut RTL_CONDITION_VARIABLE,
+ srwlock: *mut RTL_SRWLOCK,
+ dwmilliseconds: u32,
+ flags: u32,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SleepEx(dwmilliseconds: u32, balertable: BOOL) -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn SwitchToThread() -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn TerminateProcess(hprocess: HANDLE, uexitcode: u32) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn TlsAlloc() -> u32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn TlsFree(dwtlsindex: u32) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn TlsGetValue(dwtlsindex: u32) -> *mut ::core::ffi::c_void;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn TlsSetValue(dwtlsindex: u32, lptlsvalue: *const ::core::ffi::c_void) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn TryAcquireSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> BOOLEAN;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn TryAcquireSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> BOOLEAN;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn WaitForMultipleObjects(
+ ncount: u32,
+ lphandles: *const HANDLE,
+ bwaitall: BOOL,
+ dwmilliseconds: u32,
+ ) -> WIN32_ERROR;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn WaitForSingleObject(hhandle: HANDLE, dwmilliseconds: u32) -> WIN32_ERROR;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn WakeAllConditionVariable(conditionvariable: *mut RTL_CONDITION_VARIABLE) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn WakeConditionVariable(conditionvariable: *mut RTL_CONDITION_VARIABLE) -> ();
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn WideCharToMultiByte(
+ codepage: u32,
+ dwflags: u32,
+ lpwidecharstr: PCWSTR,
+ cchwidechar: i32,
+ lpmultibytestr: PSTR,
+ cbmultibyte: i32,
+ lpdefaultchar: PCSTR,
+ lpuseddefaultchar: *mut i32,
+ ) -> i32;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn WriteConsoleW(
+ hconsoleoutput: HANDLE,
+ lpbuffer: *const ::core::ffi::c_void,
+ nnumberofcharstowrite: u32,
+ lpnumberofcharswritten: *mut u32,
+ lpreserved: *const ::core::ffi::c_void,
+ ) -> BOOL;
+}
+#[link(name = "kernel32")]
+extern "system" {
+ pub fn WriteFileEx(
+ hfile: HANDLE,
+ lpbuffer: *const u8,
+ nnumberofbytestowrite: u32,
+ lpoverlapped: *mut OVERLAPPED,
+ lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE,
+ ) -> BOOL;
+}
+#[link(name = "ntdll")]
+extern "system" {
+ pub fn NtCreateFile(
+ filehandle: *mut HANDLE,
+ desiredaccess: FILE_ACCESS_RIGHTS,
+ objectattributes: *const OBJECT_ATTRIBUTES,
+ iostatusblock: *mut IO_STATUS_BLOCK,
+ allocationsize: *const i64,
+ fileattributes: FILE_FLAGS_AND_ATTRIBUTES,
+ shareaccess: FILE_SHARE_MODE,
+ createdisposition: NTCREATEFILE_CREATE_DISPOSITION,
+ createoptions: NTCREATEFILE_CREATE_OPTIONS,
+ eabuffer: *const ::core::ffi::c_void,
+ ealength: u32,
+ ) -> NTSTATUS;
+}
+#[link(name = "ntdll")]
+extern "system" {
+ pub fn NtReadFile(
+ filehandle: HANDLE,
+ event: HANDLE,
+ apcroutine: PIO_APC_ROUTINE,
+ apccontext: *const ::core::ffi::c_void,
+ iostatusblock: *mut IO_STATUS_BLOCK,
+ buffer: *mut ::core::ffi::c_void,
+ length: u32,
+ byteoffset: *const i64,
+ key: *const u32,
+ ) -> NTSTATUS;
+}
+#[link(name = "ntdll")]
+extern "system" {
+ pub fn NtWriteFile(
+ filehandle: HANDLE,
+ event: HANDLE,
+ apcroutine: PIO_APC_ROUTINE,
+ apccontext: *const ::core::ffi::c_void,
+ iostatusblock: *mut IO_STATUS_BLOCK,
+ buffer: *const ::core::ffi::c_void,
+ length: u32,
+ byteoffset: *const i64,
+ key: *const u32,
+ ) -> NTSTATUS;
+}
+#[link(name = "ntdll")]
+extern "system" {
+ pub fn RtlNtStatusToDosError(status: NTSTATUS) -> u32;
+}
+#[link(name = "userenv")]
+extern "system" {
+ pub fn GetUserProfileDirectoryW(
+ htoken: HANDLE,
+ lpprofiledir: PWSTR,
+ lpcchsize: *mut u32,
+ ) -> BOOL;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn WSACleanup() -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn WSADuplicateSocketW(
+ s: SOCKET,
+ dwprocessid: u32,
+ lpprotocolinfo: *mut WSAPROTOCOL_INFOW,
+ ) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn WSAGetLastError() -> WSA_ERROR;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn WSARecv(
+ s: SOCKET,
+ lpbuffers: *const WSABUF,
+ dwbuffercount: u32,
+ lpnumberofbytesrecvd: *mut u32,
+ lpflags: *mut u32,
+ lpoverlapped: *mut OVERLAPPED,
+ lpcompletionroutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
+ ) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn WSASend(
+ s: SOCKET,
+ lpbuffers: *const WSABUF,
+ dwbuffercount: u32,
+ lpnumberofbytessent: *mut u32,
+ dwflags: u32,
+ lpoverlapped: *mut OVERLAPPED,
+ lpcompletionroutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
+ ) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn WSASocketW(
+ af: i32,
+ r#type: i32,
+ protocol: i32,
+ lpprotocolinfo: *const WSAPROTOCOL_INFOW,
+ g: u32,
+ dwflags: u32,
+ ) -> SOCKET;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn accept(s: SOCKET, addr: *mut SOCKADDR, addrlen: *mut i32) -> SOCKET;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn bind(s: SOCKET, name: *const SOCKADDR, namelen: i32) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn closesocket(s: SOCKET) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn connect(s: SOCKET, name: *const SOCKADDR, namelen: i32) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn freeaddrinfo(paddrinfo: *const ADDRINFOA) -> ();
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn getaddrinfo(
+ pnodename: PCSTR,
+ pservicename: PCSTR,
+ phints: *const ADDRINFOA,
+ ppresult: *mut *mut ADDRINFOA,
+ ) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn getpeername(s: SOCKET, name: *mut SOCKADDR, namelen: *mut i32) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn getsockname(s: SOCKET, name: *mut SOCKADDR, namelen: *mut i32) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn getsockopt(s: SOCKET, level: i32, optname: i32, optval: PSTR, optlen: *mut i32) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn ioctlsocket(s: SOCKET, cmd: i32, argp: *mut u32) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn listen(s: SOCKET, backlog: i32) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn recv(s: SOCKET, buf: PSTR, len: i32, flags: SEND_RECV_FLAGS) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn recvfrom(
+ s: SOCKET,
+ buf: PSTR,
+ len: i32,
+ flags: i32,
+ from: *mut SOCKADDR,
+ fromlen: *mut i32,
+ ) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn select(
+ nfds: i32,
+ readfds: *mut FD_SET,
+ writefds: *mut FD_SET,
+ exceptfds: *mut FD_SET,
+ timeout: *const TIMEVAL,
+ ) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn send(s: SOCKET, buf: PCSTR, len: i32, flags: SEND_RECV_FLAGS) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn sendto(
+ s: SOCKET,
+ buf: PCSTR,
+ len: i32,
+ flags: i32,
+ to: *const SOCKADDR,
+ tolen: i32,
+ ) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn setsockopt(s: SOCKET, level: i32, optname: i32, optval: PCSTR, optlen: i32) -> i32;
+}
+#[link(name = "ws2_32")]
+extern "system" {
+ pub fn shutdown(s: SOCKET, how: WINSOCK_SHUTDOWN_HOW) -> i32;
+}
+pub const ABOVE_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32768u32;
+pub type ADDRESS_FAMILY = u16;
+#[repr(C)]
+pub struct ADDRINFOA {
+ pub ai_flags: i32,
+ pub ai_family: i32,
+ pub ai_socktype: i32,
+ pub ai_protocol: i32,
+ pub ai_addrlen: usize,
+ pub ai_canonname: PSTR,
+ pub ai_addr: *mut SOCKADDR,
+ pub ai_next: *mut ADDRINFOA,
+}
+impl ::core::marker::Copy for ADDRINFOA {}
+impl ::core::clone::Clone for ADDRINFOA {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const AF_INET: ADDRESS_FAMILY = 2u16;
+pub const AF_INET6: ADDRESS_FAMILY = 23u16;
+pub const AF_UNSPEC: ADDRESS_FAMILY = 0u16;
+#[repr(C)]
+pub union ARM64_NT_NEON128 {
+ pub Anonymous: ARM64_NT_NEON128_0,
+ pub D: [f64; 2],
+ pub S: [f32; 4],
+ pub H: [u16; 8],
+ pub B: [u8; 16],
+}
+impl ::core::marker::Copy for ARM64_NT_NEON128 {}
+impl ::core::clone::Clone for ARM64_NT_NEON128 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct ARM64_NT_NEON128_0 {
+ pub Low: u64,
+ pub High: i64,
+}
+impl ::core::marker::Copy for ARM64_NT_NEON128_0 {}
+impl ::core::clone::Clone for ARM64_NT_NEON128_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type BCRYPTGENRANDOM_FLAGS = u32;
+pub type BCRYPT_ALG_HANDLE = *mut ::core::ffi::c_void;
+pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: BCRYPTGENRANDOM_FLAGS = 2u32;
+pub const BELOW_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 16384u32;
+pub type BOOL = i32;
+pub type BOOLEAN = u8;
+#[repr(C)]
+pub struct BY_HANDLE_FILE_INFORMATION {
+ pub dwFileAttributes: u32,
+ pub ftCreationTime: FILETIME,
+ pub ftLastAccessTime: FILETIME,
+ pub ftLastWriteTime: FILETIME,
+ pub dwVolumeSerialNumber: u32,
+ pub nFileSizeHigh: u32,
+ pub nFileSizeLow: u32,
+ pub nNumberOfLinks: u32,
+ pub nFileIndexHigh: u32,
+ pub nFileIndexLow: u32,
+}
+impl ::core::marker::Copy for BY_HANDLE_FILE_INFORMATION {}
+impl ::core::clone::Clone for BY_HANDLE_FILE_INFORMATION {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const CALLBACK_CHUNK_FINISHED: LPPROGRESS_ROUTINE_CALLBACK_REASON = 0u32;
+pub const CALLBACK_STREAM_SWITCH: LPPROGRESS_ROUTINE_CALLBACK_REASON = 1u32;
+pub type COMPARESTRING_RESULT = u32;
+pub type CONSOLE_MODE = u32;
+#[repr(C)]
+pub struct CONSOLE_READCONSOLE_CONTROL {
+ pub nLength: u32,
+ pub nInitialChars: u32,
+ pub dwCtrlWakeupMask: u32,
+ pub dwControlKeyState: u32,
+}
+impl ::core::marker::Copy for CONSOLE_READCONSOLE_CONTROL {}
+impl ::core::clone::Clone for CONSOLE_READCONSOLE_CONTROL {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "aarch64")]
+pub struct CONTEXT {
+ pub ContextFlags: u32,
+ pub Cpsr: u32,
+ pub Anonymous: CONTEXT_0,
+ pub Sp: u64,
+ pub Pc: u64,
+ pub V: [ARM64_NT_NEON128; 32],
+ pub Fpcr: u32,
+ pub Fpsr: u32,
+ pub Bcr: [u32; 8],
+ pub Bvr: [u64; 8],
+ pub Wcr: [u32; 2],
+ pub Wvr: [u64; 2],
+}
+#[cfg(target_arch = "aarch64")]
+impl ::core::marker::Copy for CONTEXT {}
+#[cfg(target_arch = "aarch64")]
+impl ::core::clone::Clone for CONTEXT {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "aarch64")]
+pub union CONTEXT_0 {
+ pub Anonymous: CONTEXT_0_0,
+ pub X: [u64; 31],
+}
+#[cfg(target_arch = "aarch64")]
+impl ::core::marker::Copy for CONTEXT_0 {}
+#[cfg(target_arch = "aarch64")]
+impl ::core::clone::Clone for CONTEXT_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "aarch64")]
+pub struct CONTEXT_0_0 {
+ pub X0: u64,
+ pub X1: u64,
+ pub X2: u64,
+ pub X3: u64,
+ pub X4: u64,
+ pub X5: u64,
+ pub X6: u64,
+ pub X7: u64,
+ pub X8: u64,
+ pub X9: u64,
+ pub X10: u64,
+ pub X11: u64,
+ pub X12: u64,
+ pub X13: u64,
+ pub X14: u64,
+ pub X15: u64,
+ pub X16: u64,
+ pub X17: u64,
+ pub X18: u64,
+ pub X19: u64,
+ pub X20: u64,
+ pub X21: u64,
+ pub X22: u64,
+ pub X23: u64,
+ pub X24: u64,
+ pub X25: u64,
+ pub X26: u64,
+ pub X27: u64,
+ pub X28: u64,
+ pub Fp: u64,
+ pub Lr: u64,
+}
+#[cfg(target_arch = "aarch64")]
+impl ::core::marker::Copy for CONTEXT_0_0 {}
+#[cfg(target_arch = "aarch64")]
+impl ::core::clone::Clone for CONTEXT_0_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "x86_64")]
+pub struct CONTEXT {
+ pub P1Home: u64,
+ pub P2Home: u64,
+ pub P3Home: u64,
+ pub P4Home: u64,
+ pub P5Home: u64,
+ pub P6Home: u64,
+ pub ContextFlags: u32,
+ pub MxCsr: u32,
+ pub SegCs: u16,
+ pub SegDs: u16,
+ pub SegEs: u16,
+ pub SegFs: u16,
+ pub SegGs: u16,
+ pub SegSs: u16,
+ pub EFlags: u32,
+ pub Dr0: u64,
+ pub Dr1: u64,
+ pub Dr2: u64,
+ pub Dr3: u64,
+ pub Dr6: u64,
+ pub Dr7: u64,
+ pub Rax: u64,
+ pub Rcx: u64,
+ pub Rdx: u64,
+ pub Rbx: u64,
+ pub Rsp: u64,
+ pub Rbp: u64,
+ pub Rsi: u64,
+ pub Rdi: u64,
+ pub R8: u64,
+ pub R9: u64,
+ pub R10: u64,
+ pub R11: u64,
+ pub R12: u64,
+ pub R13: u64,
+ pub R14: u64,
+ pub R15: u64,
+ pub Rip: u64,
+ pub Anonymous: CONTEXT_0,
+ pub VectorRegister: [M128A; 26],
+ pub VectorControl: u64,
+ pub DebugControl: u64,
+ pub LastBranchToRip: u64,
+ pub LastBranchFromRip: u64,
+ pub LastExceptionToRip: u64,
+ pub LastExceptionFromRip: u64,
+}
+#[cfg(target_arch = "x86_64")]
+impl ::core::marker::Copy for CONTEXT {}
+#[cfg(target_arch = "x86_64")]
+impl ::core::clone::Clone for CONTEXT {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "x86_64")]
+pub union CONTEXT_0 {
+ pub FltSave: XSAVE_FORMAT,
+ pub Anonymous: CONTEXT_0_0,
+}
+#[cfg(target_arch = "x86_64")]
+impl ::core::marker::Copy for CONTEXT_0 {}
+#[cfg(target_arch = "x86_64")]
+impl ::core::clone::Clone for CONTEXT_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "x86_64")]
+pub struct CONTEXT_0_0 {
+ pub Header: [M128A; 2],
+ pub Legacy: [M128A; 8],
+ pub Xmm0: M128A,
+ pub Xmm1: M128A,
+ pub Xmm2: M128A,
+ pub Xmm3: M128A,
+ pub Xmm4: M128A,
+ pub Xmm5: M128A,
+ pub Xmm6: M128A,
+ pub Xmm7: M128A,
+ pub Xmm8: M128A,
+ pub Xmm9: M128A,
+ pub Xmm10: M128A,
+ pub Xmm11: M128A,
+ pub Xmm12: M128A,
+ pub Xmm13: M128A,
+ pub Xmm14: M128A,
+ pub Xmm15: M128A,
+}
+#[cfg(target_arch = "x86_64")]
+impl ::core::marker::Copy for CONTEXT_0_0 {}
+#[cfg(target_arch = "x86_64")]
+impl ::core::clone::Clone for CONTEXT_0_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "x86")]
+pub struct CONTEXT {
+ pub ContextFlags: u32,
+ pub Dr0: u32,
+ pub Dr1: u32,
+ pub Dr2: u32,
+ pub Dr3: u32,
+ pub Dr6: u32,
+ pub Dr7: u32,
+ pub FloatSave: FLOATING_SAVE_AREA,
+ pub SegGs: u32,
+ pub SegFs: u32,
+ pub SegEs: u32,
+ pub SegDs: u32,
+ pub Edi: u32,
+ pub Esi: u32,
+ pub Ebx: u32,
+ pub Edx: u32,
+ pub Ecx: u32,
+ pub Eax: u32,
+ pub Ebp: u32,
+ pub Eip: u32,
+ pub SegCs: u32,
+ pub EFlags: u32,
+ pub Esp: u32,
+ pub SegSs: u32,
+ pub ExtendedRegisters: [u8; 512],
+}
+#[cfg(target_arch = "x86")]
+impl ::core::marker::Copy for CONTEXT {}
+#[cfg(target_arch = "x86")]
+impl ::core::clone::Clone for CONTEXT {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const CP_UTF8: u32 = 65001u32;
+pub const CREATE_ALWAYS: FILE_CREATION_DISPOSITION = 2u32;
+pub const CREATE_BREAKAWAY_FROM_JOB: PROCESS_CREATION_FLAGS = 16777216u32;
+pub const CREATE_DEFAULT_ERROR_MODE: PROCESS_CREATION_FLAGS = 67108864u32;
+pub const CREATE_FORCEDOS: PROCESS_CREATION_FLAGS = 8192u32;
+pub const CREATE_IGNORE_SYSTEM_DEFAULT: PROCESS_CREATION_FLAGS = 2147483648u32;
+pub const CREATE_NEW: FILE_CREATION_DISPOSITION = 1u32;
+pub const CREATE_NEW_CONSOLE: PROCESS_CREATION_FLAGS = 16u32;
+pub const CREATE_NEW_PROCESS_GROUP: PROCESS_CREATION_FLAGS = 512u32;
+pub const CREATE_NO_WINDOW: PROCESS_CREATION_FLAGS = 134217728u32;
+pub const CREATE_PRESERVE_CODE_AUTHZ_LEVEL: PROCESS_CREATION_FLAGS = 33554432u32;
+pub const CREATE_PROTECTED_PROCESS: PROCESS_CREATION_FLAGS = 262144u32;
+pub const CREATE_SECURE_PROCESS: PROCESS_CREATION_FLAGS = 4194304u32;
+pub const CREATE_SEPARATE_WOW_VDM: PROCESS_CREATION_FLAGS = 2048u32;
+pub const CREATE_SHARED_WOW_VDM: PROCESS_CREATION_FLAGS = 4096u32;
+pub const CREATE_SUSPENDED: PROCESS_CREATION_FLAGS = 4u32;
+pub const CREATE_UNICODE_ENVIRONMENT: PROCESS_CREATION_FLAGS = 1024u32;
+pub const CSTR_EQUAL: COMPARESTRING_RESULT = 2u32;
+pub const CSTR_GREATER_THAN: COMPARESTRING_RESULT = 3u32;
+pub const CSTR_LESS_THAN: COMPARESTRING_RESULT = 1u32;
+pub const DEBUG_ONLY_THIS_PROCESS: PROCESS_CREATION_FLAGS = 2u32;
+pub const DEBUG_PROCESS: PROCESS_CREATION_FLAGS = 1u32;
+pub const DELETE: FILE_ACCESS_RIGHTS = 65536u32;
+pub const DETACHED_PROCESS: PROCESS_CREATION_FLAGS = 8u32;
+pub const DISABLE_NEWLINE_AUTO_RETURN: CONSOLE_MODE = 8u32;
+pub const DLL_PROCESS_DETACH: u32 = 0u32;
+pub const DLL_THREAD_DETACH: u32 = 3u32;
+pub const DNS_ERROR_ADDRESS_REQUIRED: WIN32_ERROR = 9573u32;
+pub const DNS_ERROR_ALIAS_LOOP: WIN32_ERROR = 9722u32;
+pub const DNS_ERROR_AUTOZONE_ALREADY_EXISTS: WIN32_ERROR = 9610u32;
+pub const DNS_ERROR_AXFR: WIN32_ERROR = 9752u32;
+pub const DNS_ERROR_BACKGROUND_LOADING: WIN32_ERROR = 9568u32;
+pub const DNS_ERROR_BAD_KEYMASTER: WIN32_ERROR = 9122u32;
+pub const DNS_ERROR_BAD_PACKET: WIN32_ERROR = 9502u32;
+pub const DNS_ERROR_CANNOT_FIND_ROOT_HINTS: WIN32_ERROR = 9564u32;
+pub const DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS: WIN32_ERROR = 9977u32;
+pub const DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST: WIN32_ERROR = 9976u32;
+pub const DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED: WIN32_ERROR = 9975u32;
+pub const DNS_ERROR_CNAME_COLLISION: WIN32_ERROR = 9709u32;
+pub const DNS_ERROR_CNAME_LOOP: WIN32_ERROR = 9707u32;
+pub const DNS_ERROR_DATAFILE_OPEN_FAILURE: WIN32_ERROR = 9653u32;
+pub const DNS_ERROR_DATAFILE_PARSING: WIN32_ERROR = 9655u32;
+pub const DNS_ERROR_DEFAULT_SCOPE: WIN32_ERROR = 9960u32;
+pub const DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE: WIN32_ERROR = 9925u32;
+pub const DNS_ERROR_DEFAULT_ZONESCOPE: WIN32_ERROR = 9953u32;
+pub const DNS_ERROR_DELEGATION_REQUIRED: WIN32_ERROR = 9571u32;
+pub const DNS_ERROR_DNAME_COLLISION: WIN32_ERROR = 9721u32;
+pub const DNS_ERROR_DNSSEC_IS_DISABLED: WIN32_ERROR = 9125u32;
+pub const DNS_ERROR_DP_ALREADY_ENLISTED: WIN32_ERROR = 9904u32;
+pub const DNS_ERROR_DP_ALREADY_EXISTS: WIN32_ERROR = 9902u32;
+pub const DNS_ERROR_DP_DOES_NOT_EXIST: WIN32_ERROR = 9901u32;
+pub const DNS_ERROR_DP_FSMO_ERROR: WIN32_ERROR = 9906u32;
+pub const DNS_ERROR_DP_NOT_AVAILABLE: WIN32_ERROR = 9905u32;
+pub const DNS_ERROR_DP_NOT_ENLISTED: WIN32_ERROR = 9903u32;
+pub const DNS_ERROR_DS_UNAVAILABLE: WIN32_ERROR = 9717u32;
+pub const DNS_ERROR_DS_ZONE_ALREADY_EXISTS: WIN32_ERROR = 9718u32;
+pub const DNS_ERROR_DWORD_VALUE_TOO_LARGE: WIN32_ERROR = 9567u32;
+pub const DNS_ERROR_DWORD_VALUE_TOO_SMALL: WIN32_ERROR = 9566u32;
+pub const DNS_ERROR_FILE_WRITEBACK_FAILED: WIN32_ERROR = 9654u32;
+pub const DNS_ERROR_FORWARDER_ALREADY_EXISTS: WIN32_ERROR = 9619u32;
+pub const DNS_ERROR_INCONSISTENT_ROOT_HINTS: WIN32_ERROR = 9565u32;
+pub const DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME: WIN32_ERROR = 9924u32;
+pub const DNS_ERROR_INVALID_CLIENT_SUBNET_NAME: WIN32_ERROR = 9984u32;
+pub const DNS_ERROR_INVALID_DATA: WIN32_ERROR = 13u32;
+pub const DNS_ERROR_INVALID_DATAFILE_NAME: WIN32_ERROR = 9652u32;
+pub const DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET: WIN32_ERROR = 9115u32;
+pub const DNS_ERROR_INVALID_IP_ADDRESS: WIN32_ERROR = 9552u32;
+pub const DNS_ERROR_INVALID_KEY_SIZE: WIN32_ERROR = 9106u32;
+pub const DNS_ERROR_INVALID_NAME: WIN32_ERROR = 123u32;
+pub const DNS_ERROR_INVALID_NAME_CHAR: WIN32_ERROR = 9560u32;
+pub const DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT: WIN32_ERROR = 9124u32;
+pub const DNS_ERROR_INVALID_POLICY_TABLE: WIN32_ERROR = 9572u32;
+pub const DNS_ERROR_INVALID_PROPERTY: WIN32_ERROR = 9553u32;
+pub const DNS_ERROR_INVALID_ROLLOVER_PERIOD: WIN32_ERROR = 9114u32;
+pub const DNS_ERROR_INVALID_SCOPE_NAME: WIN32_ERROR = 9958u32;
+pub const DNS_ERROR_INVALID_SCOPE_OPERATION: WIN32_ERROR = 9961u32;
+pub const DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD: WIN32_ERROR = 9123u32;
+pub const DNS_ERROR_INVALID_TYPE: WIN32_ERROR = 9551u32;
+pub const DNS_ERROR_INVALID_XML: WIN32_ERROR = 9126u32;
+pub const DNS_ERROR_INVALID_ZONESCOPE_NAME: WIN32_ERROR = 9954u32;
+pub const DNS_ERROR_INVALID_ZONE_OPERATION: WIN32_ERROR = 9603u32;
+pub const DNS_ERROR_INVALID_ZONE_TYPE: WIN32_ERROR = 9611u32;
+pub const DNS_ERROR_KEYMASTER_REQUIRED: WIN32_ERROR = 9101u32;
+pub const DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION: WIN32_ERROR = 9108u32;
+pub const DNS_ERROR_KSP_NOT_ACCESSIBLE: WIN32_ERROR = 9112u32;
+pub const DNS_ERROR_LOAD_ZONESCOPE_FAILED: WIN32_ERROR = 9956u32;
+pub const DNS_ERROR_NAME_DOES_NOT_EXIST: WIN32_ERROR = 9714u32;
+pub const DNS_ERROR_NAME_NOT_IN_ZONE: WIN32_ERROR = 9706u32;
+pub const DNS_ERROR_NBSTAT_INIT_FAILED: WIN32_ERROR = 9617u32;
+pub const DNS_ERROR_NEED_SECONDARY_ADDRESSES: WIN32_ERROR = 9614u32;
+pub const DNS_ERROR_NEED_WINS_SERVERS: WIN32_ERROR = 9616u32;
+pub const DNS_ERROR_NODE_CREATION_FAILED: WIN32_ERROR = 9703u32;
+pub const DNS_ERROR_NODE_IS_CNAME: WIN32_ERROR = 9708u32;
+pub const DNS_ERROR_NODE_IS_DNAME: WIN32_ERROR = 9720u32;
+pub const DNS_ERROR_NON_RFC_NAME: WIN32_ERROR = 9556u32;
+pub const DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD: WIN32_ERROR = 9119u32;
+pub const DNS_ERROR_NOT_ALLOWED_ON_RODC: WIN32_ERROR = 9569u32;
+pub const DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER: WIN32_ERROR = 9562u32;
+pub const DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE: WIN32_ERROR = 9102u32;
+pub const DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE: WIN32_ERROR = 9121u32;
+pub const DNS_ERROR_NOT_ALLOWED_ON_ZSK: WIN32_ERROR = 9118u32;
+pub const DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION: WIN32_ERROR = 9563u32;
+pub const DNS_ERROR_NOT_ALLOWED_UNDER_DNAME: WIN32_ERROR = 9570u32;
+pub const DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES: WIN32_ERROR = 9955u32;
+pub const DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS: WIN32_ERROR = 9104u32;
+pub const DNS_ERROR_NOT_UNIQUE: WIN32_ERROR = 9555u32;
+pub const DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE: WIN32_ERROR = 9719u32;
+pub const DNS_ERROR_NO_CREATE_CACHE_DATA: WIN32_ERROR = 9713u32;
+pub const DNS_ERROR_NO_DNS_SERVERS: WIN32_ERROR = 9852u32;
+pub const DNS_ERROR_NO_MEMORY: WIN32_ERROR = 14u32;
+pub const DNS_ERROR_NO_PACKET: WIN32_ERROR = 9503u32;
+pub const DNS_ERROR_NO_TCPIP: WIN32_ERROR = 9851u32;
+pub const DNS_ERROR_NO_VALID_TRUST_ANCHORS: WIN32_ERROR = 9127u32;
+pub const DNS_ERROR_NO_ZONE_INFO: WIN32_ERROR = 9602u32;
+pub const DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1: WIN32_ERROR = 9103u32;
+pub const DNS_ERROR_NSEC3_NAME_COLLISION: WIN32_ERROR = 9129u32;
+pub const DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1: WIN32_ERROR = 9130u32;
+pub const DNS_ERROR_NUMERIC_NAME: WIN32_ERROR = 9561u32;
+pub const DNS_ERROR_POLICY_ALREADY_EXISTS: WIN32_ERROR = 9971u32;
+pub const DNS_ERROR_POLICY_DOES_NOT_EXIST: WIN32_ERROR = 9972u32;
+pub const DNS_ERROR_POLICY_INVALID_CRITERIA: WIN32_ERROR = 9973u32;
+pub const DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET: WIN32_ERROR = 9990u32;
+pub const DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN: WIN32_ERROR = 9994u32;
+pub const DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE: WIN32_ERROR = 9993u32;
+pub const DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL: WIN32_ERROR = 9992u32;
+pub const DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE: WIN32_ERROR = 9995u32;
+pub const DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY: WIN32_ERROR = 9996u32;
+pub const DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL: WIN32_ERROR = 9991u32;
+pub const DNS_ERROR_POLICY_INVALID_NAME: WIN32_ERROR = 9982u32;
+pub const DNS_ERROR_POLICY_INVALID_SETTINGS: WIN32_ERROR = 9974u32;
+pub const DNS_ERROR_POLICY_INVALID_WEIGHT: WIN32_ERROR = 9981u32;
+pub const DNS_ERROR_POLICY_LOCKED: WIN32_ERROR = 9980u32;
+pub const DNS_ERROR_POLICY_MISSING_CRITERIA: WIN32_ERROR = 9983u32;
+pub const DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID: WIN32_ERROR = 9985u32;
+pub const DNS_ERROR_POLICY_SCOPE_MISSING: WIN32_ERROR = 9986u32;
+pub const DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED: WIN32_ERROR = 9987u32;
+pub const DNS_ERROR_PRIMARY_REQUIRES_DATAFILE: WIN32_ERROR = 9651u32;
+pub const DNS_ERROR_RCODE: WIN32_ERROR = 9504u32;
+pub const DNS_ERROR_RCODE_BADKEY: WIN32_ERROR = 9017u32;
+pub const DNS_ERROR_RCODE_BADSIG: WIN32_ERROR = 9016u32;
+pub const DNS_ERROR_RCODE_BADTIME: WIN32_ERROR = 9018u32;
+pub const DNS_ERROR_RCODE_FORMAT_ERROR: WIN32_ERROR = 9001u32;
+pub const DNS_ERROR_RCODE_NAME_ERROR: WIN32_ERROR = 9003u32;
+pub const DNS_ERROR_RCODE_NOTAUTH: WIN32_ERROR = 9009u32;
+pub const DNS_ERROR_RCODE_NOTZONE: WIN32_ERROR = 9010u32;
+pub const DNS_ERROR_RCODE_NOT_IMPLEMENTED: WIN32_ERROR = 9004u32;
+pub const DNS_ERROR_RCODE_NXRRSET: WIN32_ERROR = 9008u32;
+pub const DNS_ERROR_RCODE_REFUSED: WIN32_ERROR = 9005u32;
+pub const DNS_ERROR_RCODE_SERVER_FAILURE: WIN32_ERROR = 9002u32;
+pub const DNS_ERROR_RCODE_YXDOMAIN: WIN32_ERROR = 9006u32;
+pub const DNS_ERROR_RCODE_YXRRSET: WIN32_ERROR = 9007u32;
+pub const DNS_ERROR_RECORD_ALREADY_EXISTS: WIN32_ERROR = 9711u32;
+pub const DNS_ERROR_RECORD_DOES_NOT_EXIST: WIN32_ERROR = 9701u32;
+pub const DNS_ERROR_RECORD_FORMAT: WIN32_ERROR = 9702u32;
+pub const DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT: WIN32_ERROR = 9710u32;
+pub const DNS_ERROR_RECORD_TIMED_OUT: WIN32_ERROR = 9705u32;
+pub const DNS_ERROR_ROLLOVER_ALREADY_QUEUED: WIN32_ERROR = 9120u32;
+pub const DNS_ERROR_ROLLOVER_IN_PROGRESS: WIN32_ERROR = 9116u32;
+pub const DNS_ERROR_ROLLOVER_NOT_POKEABLE: WIN32_ERROR = 9128u32;
+pub const DNS_ERROR_RRL_INVALID_IPV4_PREFIX: WIN32_ERROR = 9913u32;
+pub const DNS_ERROR_RRL_INVALID_IPV6_PREFIX: WIN32_ERROR = 9914u32;
+pub const DNS_ERROR_RRL_INVALID_LEAK_RATE: WIN32_ERROR = 9916u32;
+pub const DNS_ERROR_RRL_INVALID_TC_RATE: WIN32_ERROR = 9915u32;
+pub const DNS_ERROR_RRL_INVALID_WINDOW_SIZE: WIN32_ERROR = 9912u32;
+pub const DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE: WIN32_ERROR = 9917u32;
+pub const DNS_ERROR_RRL_NOT_ENABLED: WIN32_ERROR = 9911u32;
+pub const DNS_ERROR_SCOPE_ALREADY_EXISTS: WIN32_ERROR = 9963u32;
+pub const DNS_ERROR_SCOPE_DOES_NOT_EXIST: WIN32_ERROR = 9959u32;
+pub const DNS_ERROR_SCOPE_LOCKED: WIN32_ERROR = 9962u32;
+pub const DNS_ERROR_SECONDARY_DATA: WIN32_ERROR = 9712u32;
+pub const DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP: WIN32_ERROR = 9612u32;
+pub const DNS_ERROR_SERVERSCOPE_IS_REFERENCED: WIN32_ERROR = 9988u32;
+pub const DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE: WIN32_ERROR = 9107u32;
+pub const DNS_ERROR_SOA_DELETE_INVALID: WIN32_ERROR = 9618u32;
+pub const DNS_ERROR_STANDBY_KEY_NOT_PRESENT: WIN32_ERROR = 9117u32;
+pub const DNS_ERROR_SUBNET_ALREADY_EXISTS: WIN32_ERROR = 9979u32;
+pub const DNS_ERROR_SUBNET_DOES_NOT_EXIST: WIN32_ERROR = 9978u32;
+pub const DNS_ERROR_TOO_MANY_SKDS: WIN32_ERROR = 9113u32;
+pub const DNS_ERROR_TRY_AGAIN_LATER: WIN32_ERROR = 9554u32;
+pub const DNS_ERROR_UNEXPECTED_CNG_ERROR: WIN32_ERROR = 9110u32;
+pub const DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR: WIN32_ERROR = 9109u32;
+pub const DNS_ERROR_UNKNOWN_RECORD_TYPE: WIN32_ERROR = 9704u32;
+pub const DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION: WIN32_ERROR = 9111u32;
+pub const DNS_ERROR_UNSECURE_PACKET: WIN32_ERROR = 9505u32;
+pub const DNS_ERROR_UNSUPPORTED_ALGORITHM: WIN32_ERROR = 9105u32;
+pub const DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS: WIN32_ERROR = 9921u32;
+pub const DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST: WIN32_ERROR = 9922u32;
+pub const DNS_ERROR_VIRTUALIZATION_TREE_LOCKED: WIN32_ERROR = 9923u32;
+pub const DNS_ERROR_WINS_INIT_FAILED: WIN32_ERROR = 9615u32;
+pub const DNS_ERROR_ZONESCOPE_ALREADY_EXISTS: WIN32_ERROR = 9951u32;
+pub const DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST: WIN32_ERROR = 9952u32;
+pub const DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED: WIN32_ERROR = 9957u32;
+pub const DNS_ERROR_ZONESCOPE_IS_REFERENCED: WIN32_ERROR = 9989u32;
+pub const DNS_ERROR_ZONE_ALREADY_EXISTS: WIN32_ERROR = 9609u32;
+pub const DNS_ERROR_ZONE_CONFIGURATION_ERROR: WIN32_ERROR = 9604u32;
+pub const DNS_ERROR_ZONE_CREATION_FAILED: WIN32_ERROR = 9608u32;
+pub const DNS_ERROR_ZONE_DOES_NOT_EXIST: WIN32_ERROR = 9601u32;
+pub const DNS_ERROR_ZONE_HAS_NO_NS_RECORDS: WIN32_ERROR = 9606u32;
+pub const DNS_ERROR_ZONE_HAS_NO_SOA_RECORD: WIN32_ERROR = 9605u32;
+pub const DNS_ERROR_ZONE_IS_SHUTDOWN: WIN32_ERROR = 9621u32;
+pub const DNS_ERROR_ZONE_LOCKED: WIN32_ERROR = 9607u32;
+pub const DNS_ERROR_ZONE_LOCKED_FOR_SIGNING: WIN32_ERROR = 9622u32;
+pub const DNS_ERROR_ZONE_NOT_SECONDARY: WIN32_ERROR = 9613u32;
+pub const DNS_ERROR_ZONE_REQUIRES_MASTER_IP: WIN32_ERROR = 9620u32;
+pub const DUPLICATE_CLOSE_SOURCE: DUPLICATE_HANDLE_OPTIONS = 1u32;
+pub type DUPLICATE_HANDLE_OPTIONS = u32;
+pub const DUPLICATE_SAME_ACCESS: DUPLICATE_HANDLE_OPTIONS = 2u32;
+pub const ENABLE_AUTO_POSITION: CONSOLE_MODE = 256u32;
+pub const ENABLE_ECHO_INPUT: CONSOLE_MODE = 4u32;
+pub const ENABLE_EXTENDED_FLAGS: CONSOLE_MODE = 128u32;
+pub const ENABLE_INSERT_MODE: CONSOLE_MODE = 32u32;
+pub const ENABLE_LINE_INPUT: CONSOLE_MODE = 2u32;
+pub const ENABLE_LVB_GRID_WORLDWIDE: CONSOLE_MODE = 16u32;
+pub const ENABLE_MOUSE_INPUT: CONSOLE_MODE = 16u32;
+pub const ENABLE_PROCESSED_INPUT: CONSOLE_MODE = 1u32;
+pub const ENABLE_PROCESSED_OUTPUT: CONSOLE_MODE = 1u32;
+pub const ENABLE_QUICK_EDIT_MODE: CONSOLE_MODE = 64u32;
+pub const ENABLE_VIRTUAL_TERMINAL_INPUT: CONSOLE_MODE = 512u32;
+pub const ENABLE_VIRTUAL_TERMINAL_PROCESSING: CONSOLE_MODE = 4u32;
+pub const ENABLE_WINDOW_INPUT: CONSOLE_MODE = 8u32;
+pub const ENABLE_WRAP_AT_EOL_OUTPUT: CONSOLE_MODE = 2u32;
+pub const ERROR_ABANDONED_WAIT_0: WIN32_ERROR = 735u32;
+pub const ERROR_ABANDONED_WAIT_63: WIN32_ERROR = 736u32;
+pub const ERROR_ABANDON_HIBERFILE: WIN32_ERROR = 787u32;
+pub const ERROR_ABIOS_ERROR: WIN32_ERROR = 538u32;
+pub const ERROR_ACCESS_AUDIT_BY_POLICY: WIN32_ERROR = 785u32;
+pub const ERROR_ACCESS_DENIED: WIN32_ERROR = 5u32;
+pub const ERROR_ACCESS_DENIED_APPDATA: WIN32_ERROR = 502u32;
+pub const ERROR_ACCESS_DISABLED_BY_POLICY: WIN32_ERROR = 1260u32;
+pub const ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: WIN32_ERROR = 786u32;
+pub const ERROR_ACCESS_DISABLED_WEBBLADE: WIN32_ERROR = 1277u32;
+pub const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER: WIN32_ERROR = 1278u32;
+pub const ERROR_ACCOUNT_DISABLED: WIN32_ERROR = 1331u32;
+pub const ERROR_ACCOUNT_EXPIRED: WIN32_ERROR = 1793u32;
+pub const ERROR_ACCOUNT_LOCKED_OUT: WIN32_ERROR = 1909u32;
+pub const ERROR_ACCOUNT_RESTRICTION: WIN32_ERROR = 1327u32;
+pub const ERROR_ACPI_ERROR: WIN32_ERROR = 669u32;
+pub const ERROR_ACTIVE_CONNECTIONS: WIN32_ERROR = 2402u32;
+pub const ERROR_ADAP_HDW_ERR: WIN32_ERROR = 57u32;
+pub const ERROR_ADDRESS_ALREADY_ASSOCIATED: WIN32_ERROR = 1227u32;
+pub const ERROR_ADDRESS_NOT_ASSOCIATED: WIN32_ERROR = 1228u32;
+pub const ERROR_ALERTED: WIN32_ERROR = 739u32;
+pub const ERROR_ALIAS_EXISTS: WIN32_ERROR = 1379u32;
+pub const ERROR_ALLOCATE_BUCKET: WIN32_ERROR = 602u32;
+pub const ERROR_ALLOTTED_SPACE_EXCEEDED: WIN32_ERROR = 1344u32;
+pub const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1933u32;
+pub const ERROR_ALREADY_ASSIGNED: WIN32_ERROR = 85u32;
+pub const ERROR_ALREADY_EXISTS: WIN32_ERROR = 183u32;
+pub const ERROR_ALREADY_FIBER: WIN32_ERROR = 1280u32;
+pub const ERROR_ALREADY_HAS_STREAM_ID: WIN32_ERROR = 4444u32;
+pub const ERROR_ALREADY_INITIALIZED: WIN32_ERROR = 1247u32;
+pub const ERROR_ALREADY_REGISTERED: WIN32_ERROR = 1242u32;
+pub const ERROR_ALREADY_RUNNING_LKG: WIN32_ERROR = 1074u32;
+pub const ERROR_ALREADY_THREAD: WIN32_ERROR = 1281u32;
+pub const ERROR_ALREADY_WAITING: WIN32_ERROR = 1904u32;
+pub const ERROR_ALREADY_WIN32: WIN32_ERROR = 719u32;
+pub const ERROR_API_UNAVAILABLE: WIN32_ERROR = 15841u32;
+pub const ERROR_APPCONTAINER_REQUIRED: WIN32_ERROR = 4251u32;
+pub const ERROR_APPEXEC_APP_COMPAT_BLOCK: WIN32_ERROR = 3068u32;
+pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT: WIN32_ERROR = 3069u32;
+pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_LICENSING: WIN32_ERROR = 3071u32;
+pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_RESOURCES: WIN32_ERROR = 3072u32;
+pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_TERMINATION: WIN32_ERROR = 3070u32;
+pub const ERROR_APPEXEC_CONDITION_NOT_SATISFIED: WIN32_ERROR = 3060u32;
+pub const ERROR_APPEXEC_HANDLE_INVALIDATED: WIN32_ERROR = 3061u32;
+pub const ERROR_APPEXEC_HOST_ID_MISMATCH: WIN32_ERROR = 3066u32;
+pub const ERROR_APPEXEC_INVALID_HOST_GENERATION: WIN32_ERROR = 3062u32;
+pub const ERROR_APPEXEC_INVALID_HOST_STATE: WIN32_ERROR = 3064u32;
+pub const ERROR_APPEXEC_NO_DONOR: WIN32_ERROR = 3065u32;
+pub const ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION: WIN32_ERROR = 3063u32;
+pub const ERROR_APPEXEC_UNKNOWN_USER: WIN32_ERROR = 3067u32;
+pub const ERROR_APPHELP_BLOCK: WIN32_ERROR = 1259u32;
+pub const ERROR_APPX_FILE_NOT_ENCRYPTED: WIN32_ERROR = 409u32;
+pub const ERROR_APP_HANG: WIN32_ERROR = 1298u32;
+pub const ERROR_APP_INIT_FAILURE: WIN32_ERROR = 575u32;
+pub const ERROR_APP_WRONG_OS: WIN32_ERROR = 1151u32;
+pub const ERROR_ARBITRATION_UNHANDLED: WIN32_ERROR = 723u32;
+pub const ERROR_ARENA_TRASHED: WIN32_ERROR = 7u32;
+pub const ERROR_ARITHMETIC_OVERFLOW: WIN32_ERROR = 534u32;
+pub const ERROR_ASSERTION_FAILURE: WIN32_ERROR = 668u32;
+pub const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED: WIN32_ERROR = 174u32;
+pub const ERROR_AUDIT_FAILED: WIN32_ERROR = 606u32;
+pub const ERROR_AUTHENTICATION_FIREWALL_FAILED: WIN32_ERROR = 1935u32;
+pub const ERROR_AUTHIP_FAILURE: WIN32_ERROR = 1469u32;
+pub const ERROR_AUTODATASEG_EXCEEDS_64k: WIN32_ERROR = 199u32;
+pub const ERROR_BACKUP_CONTROLLER: WIN32_ERROR = 586u32;
+pub const ERROR_BADDB: WIN32_ERROR = 1009u32;
+pub const ERROR_BADKEY: WIN32_ERROR = 1010u32;
+pub const ERROR_BADSTARTPOSITION: WIN32_ERROR = 778u32;
+pub const ERROR_BAD_ACCESSOR_FLAGS: WIN32_ERROR = 773u32;
+pub const ERROR_BAD_ARGUMENTS: WIN32_ERROR = 160u32;
+pub const ERROR_BAD_COMMAND: WIN32_ERROR = 22u32;
+pub const ERROR_BAD_COMPRESSION_BUFFER: WIN32_ERROR = 605u32;
+pub const ERROR_BAD_CONFIGURATION: WIN32_ERROR = 1610u32;
+pub const ERROR_BAD_CURRENT_DIRECTORY: WIN32_ERROR = 703u32;
+pub const ERROR_BAD_DESCRIPTOR_FORMAT: WIN32_ERROR = 1361u32;
+pub const ERROR_BAD_DEVICE: WIN32_ERROR = 1200u32;
+pub const ERROR_BAD_DEVICE_PATH: WIN32_ERROR = 330u32;
+pub const ERROR_BAD_DEV_TYPE: WIN32_ERROR = 66u32;
+pub const ERROR_BAD_DLL_ENTRYPOINT: WIN32_ERROR = 609u32;
+pub const ERROR_BAD_DRIVER_LEVEL: WIN32_ERROR = 119u32;
+pub const ERROR_BAD_ENVIRONMENT: WIN32_ERROR = 10u32;
+pub const ERROR_BAD_EXE_FORMAT: WIN32_ERROR = 193u32;
+pub const ERROR_BAD_FILE_TYPE: WIN32_ERROR = 222u32;
+pub const ERROR_BAD_FORMAT: WIN32_ERROR = 11u32;
+pub const ERROR_BAD_FUNCTION_TABLE: WIN32_ERROR = 559u32;
+pub const ERROR_BAD_IMPERSONATION_LEVEL: WIN32_ERROR = 1346u32;
+pub const ERROR_BAD_INHERITANCE_ACL: WIN32_ERROR = 1340u32;
+pub const ERROR_BAD_LENGTH: WIN32_ERROR = 24u32;
+pub const ERROR_BAD_LOGON_SESSION_STATE: WIN32_ERROR = 1365u32;
+pub const ERROR_BAD_MCFG_TABLE: WIN32_ERROR = 791u32;
+pub const ERROR_BAD_NETPATH: WIN32_ERROR = 53u32;
+pub const ERROR_BAD_NET_NAME: WIN32_ERROR = 67u32;
+pub const ERROR_BAD_NET_RESP: WIN32_ERROR = 58u32;
+pub const ERROR_BAD_PATHNAME: WIN32_ERROR = 161u32;
+pub const ERROR_BAD_PIPE: WIN32_ERROR = 230u32;
+pub const ERROR_BAD_PROFILE: WIN32_ERROR = 1206u32;
+pub const ERROR_BAD_PROVIDER: WIN32_ERROR = 1204u32;
+pub const ERROR_BAD_QUERY_SYNTAX: WIN32_ERROR = 1615u32;
+pub const ERROR_BAD_RECOVERY_POLICY: WIN32_ERROR = 6012u32;
+pub const ERROR_BAD_REM_ADAP: WIN32_ERROR = 60u32;
+pub const ERROR_BAD_SERVICE_ENTRYPOINT: WIN32_ERROR = 610u32;
+pub const ERROR_BAD_STACK: WIN32_ERROR = 543u32;
+pub const ERROR_BAD_THREADID_ADDR: WIN32_ERROR = 159u32;
+pub const ERROR_BAD_TOKEN_TYPE: WIN32_ERROR = 1349u32;
+pub const ERROR_BAD_UNIT: WIN32_ERROR = 20u32;
+pub const ERROR_BAD_USERNAME: WIN32_ERROR = 2202u32;
+pub const ERROR_BAD_USER_PROFILE: WIN32_ERROR = 1253u32;
+pub const ERROR_BAD_VALIDATION_CLASS: WIN32_ERROR = 1348u32;
+pub const ERROR_BEGINNING_OF_MEDIA: WIN32_ERROR = 1102u32;
+pub const ERROR_BEYOND_VDL: WIN32_ERROR = 1289u32;
+pub const ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT: WIN32_ERROR = 585u32;
+pub const ERROR_BLOCKED_BY_PARENTAL_CONTROLS: WIN32_ERROR = 346u32;
+pub const ERROR_BLOCK_SHARED: WIN32_ERROR = 514u32;
+pub const ERROR_BLOCK_SOURCE_WEAK_REFERENCE_INVALID: WIN32_ERROR = 512u32;
+pub const ERROR_BLOCK_TARGET_WEAK_REFERENCE_INVALID: WIN32_ERROR = 513u32;
+pub const ERROR_BLOCK_TOO_MANY_REFERENCES: WIN32_ERROR = 347u32;
+pub const ERROR_BLOCK_WEAK_REFERENCE_INVALID: WIN32_ERROR = 511u32;
+pub const ERROR_BOOT_ALREADY_ACCEPTED: WIN32_ERROR = 1076u32;
+pub const ERROR_BROKEN_PIPE: WIN32_ERROR = 109u32;
+pub const ERROR_BUFFER_ALL_ZEROS: WIN32_ERROR = 754u32;
+pub const ERROR_BUFFER_OVERFLOW: WIN32_ERROR = 111u32;
+pub const ERROR_BUSY: WIN32_ERROR = 170u32;
+pub const ERROR_BUSY_DRIVE: WIN32_ERROR = 142u32;
+pub const ERROR_BUS_RESET: WIN32_ERROR = 1111u32;
+pub const ERROR_BYPASSIO_FLT_NOT_SUPPORTED: WIN32_ERROR = 506u32;
+pub const ERROR_CACHE_PAGE_LOCKED: WIN32_ERROR = 752u32;
+pub const ERROR_CALLBACK_INVOKE_INLINE: WIN32_ERROR = 812u32;
+pub const ERROR_CALLBACK_POP_STACK: WIN32_ERROR = 768u32;
+pub const ERROR_CALLBACK_SUPPLIED_INVALID_DATA: WIN32_ERROR = 1273u32;
+pub const ERROR_CALL_NOT_IMPLEMENTED: WIN32_ERROR = 120u32;
+pub const ERROR_CANCELLED: WIN32_ERROR = 1223u32;
+pub const ERROR_CANCEL_VIOLATION: WIN32_ERROR = 173u32;
+pub const ERROR_CANNOT_BREAK_OPLOCK: WIN32_ERROR = 802u32;
+pub const ERROR_CANNOT_COPY: WIN32_ERROR = 266u32;
+pub const ERROR_CANNOT_DETECT_DRIVER_FAILURE: WIN32_ERROR = 1080u32;
+pub const ERROR_CANNOT_DETECT_PROCESS_ABORT: WIN32_ERROR = 1081u32;
+pub const ERROR_CANNOT_FIND_WND_CLASS: WIN32_ERROR = 1407u32;
+pub const ERROR_CANNOT_GRANT_REQUESTED_OPLOCK: WIN32_ERROR = 801u32;
+pub const ERROR_CANNOT_IMPERSONATE: WIN32_ERROR = 1368u32;
+pub const ERROR_CANNOT_LOAD_REGISTRY_FILE: WIN32_ERROR = 589u32;
+pub const ERROR_CANNOT_MAKE: WIN32_ERROR = 82u32;
+pub const ERROR_CANNOT_OPEN_PROFILE: WIN32_ERROR = 1205u32;
+pub const ERROR_CANTFETCHBACKWARDS: WIN32_ERROR = 770u32;
+pub const ERROR_CANTOPEN: WIN32_ERROR = 1011u32;
+pub const ERROR_CANTREAD: WIN32_ERROR = 1012u32;
+pub const ERROR_CANTSCROLLBACKWARDS: WIN32_ERROR = 771u32;
+pub const ERROR_CANTWRITE: WIN32_ERROR = 1013u32;
+pub const ERROR_CANT_ACCESS_DOMAIN_INFO: WIN32_ERROR = 1351u32;
+pub const ERROR_CANT_ACCESS_FILE: WIN32_ERROR = 1920u32;
+pub const ERROR_CANT_CLEAR_ENCRYPTION_FLAG: WIN32_ERROR = 432u32;
+pub const ERROR_CANT_DISABLE_MANDATORY: WIN32_ERROR = 1310u32;
+pub const ERROR_CANT_ENABLE_DENY_ONLY: WIN32_ERROR = 629u32;
+pub const ERROR_CANT_OPEN_ANONYMOUS: WIN32_ERROR = 1347u32;
+pub const ERROR_CANT_RESOLVE_FILENAME: WIN32_ERROR = 1921u32;
+pub const ERROR_CANT_TERMINATE_SELF: WIN32_ERROR = 555u32;
+pub const ERROR_CANT_WAIT: WIN32_ERROR = 554u32;
+pub const ERROR_CAN_NOT_COMPLETE: WIN32_ERROR = 1003u32;
+pub const ERROR_CAPAUTHZ_CHANGE_TYPE: WIN32_ERROR = 451u32;
+pub const ERROR_CAPAUTHZ_DB_CORRUPTED: WIN32_ERROR = 455u32;
+pub const ERROR_CAPAUTHZ_NOT_AUTHORIZED: WIN32_ERROR = 453u32;
+pub const ERROR_CAPAUTHZ_NOT_DEVUNLOCKED: WIN32_ERROR = 450u32;
+pub const ERROR_CAPAUTHZ_NOT_PROVISIONED: WIN32_ERROR = 452u32;
+pub const ERROR_CAPAUTHZ_NO_POLICY: WIN32_ERROR = 454u32;
+pub const ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED: WIN32_ERROR = 459u32;
+pub const ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG: WIN32_ERROR = 456u32;
+pub const ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY: WIN32_ERROR = 457u32;
+pub const ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH: WIN32_ERROR = 460u32;
+pub const ERROR_CAPAUTHZ_SCCD_PARSE_ERROR: WIN32_ERROR = 458u32;
+pub const ERROR_CARDBUS_NOT_SUPPORTED: WIN32_ERROR = 724u32;
+pub const ERROR_CASE_DIFFERING_NAMES_IN_DIR: WIN32_ERROR = 424u32;
+pub const ERROR_CASE_SENSITIVE_PATH: WIN32_ERROR = 442u32;
+pub const ERROR_CERTIFICATE_VALIDATION_PREFERENCE_CONFLICT: WIN32_ERROR = 817u32;
+pub const ERROR_CHECKING_FILE_SYSTEM: WIN32_ERROR = 712u32;
+pub const ERROR_CHECKOUT_REQUIRED: WIN32_ERROR = 221u32;
+pub const ERROR_CHILD_MUST_BE_VOLATILE: WIN32_ERROR = 1021u32;
+pub const ERROR_CHILD_NOT_COMPLETE: WIN32_ERROR = 129u32;
+pub const ERROR_CHILD_PROCESS_BLOCKED: WIN32_ERROR = 367u32;
+pub const ERROR_CHILD_WINDOW_MENU: WIN32_ERROR = 1436u32;
+pub const ERROR_CIMFS_IMAGE_CORRUPT: WIN32_ERROR = 470u32;
+pub const ERROR_CIMFS_IMAGE_VERSION_NOT_SUPPORTED: WIN32_ERROR = 471u32;
+pub const ERROR_CIRCULAR_DEPENDENCY: WIN32_ERROR = 1059u32;
+pub const ERROR_CLASS_ALREADY_EXISTS: WIN32_ERROR = 1410u32;
+pub const ERROR_CLASS_DOES_NOT_EXIST: WIN32_ERROR = 1411u32;
+pub const ERROR_CLASS_HAS_WINDOWS: WIN32_ERROR = 1412u32;
+pub const ERROR_CLIENT_SERVER_PARAMETERS_INVALID: WIN32_ERROR = 597u32;
+pub const ERROR_CLIPBOARD_NOT_OPEN: WIN32_ERROR = 1418u32;
+pub const ERROR_CLOUD_FILE_ACCESS_DENIED: WIN32_ERROR = 395u32;
+pub const ERROR_CLOUD_FILE_ALREADY_CONNECTED: WIN32_ERROR = 378u32;
+pub const ERROR_CLOUD_FILE_AUTHENTICATION_FAILED: WIN32_ERROR = 386u32;
+pub const ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY: WIN32_ERROR = 382u32;
+pub const ERROR_CLOUD_FILE_DEHYDRATION_DISALLOWED: WIN32_ERROR = 434u32;
+pub const ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS: WIN32_ERROR = 396u32;
+pub const ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES: WIN32_ERROR = 387u32;
+pub const ERROR_CLOUD_FILE_INVALID_REQUEST: WIN32_ERROR = 380u32;
+pub const ERROR_CLOUD_FILE_IN_USE: WIN32_ERROR = 391u32;
+pub const ERROR_CLOUD_FILE_METADATA_CORRUPT: WIN32_ERROR = 363u32;
+pub const ERROR_CLOUD_FILE_METADATA_TOO_LARGE: WIN32_ERROR = 364u32;
+pub const ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE: WIN32_ERROR = 388u32;
+pub const ERROR_CLOUD_FILE_NOT_IN_SYNC: WIN32_ERROR = 377u32;
+pub const ERROR_CLOUD_FILE_NOT_SUPPORTED: WIN32_ERROR = 379u32;
+pub const ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT: WIN32_ERROR = 390u32;
+pub const ERROR_CLOUD_FILE_PINNED: WIN32_ERROR = 392u32;
+pub const ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH: WIN32_ERROR = 366u32;
+pub const ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE: WIN32_ERROR = 365u32;
+pub const ERROR_CLOUD_FILE_PROPERTY_CORRUPT: WIN32_ERROR = 394u32;
+pub const ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT: WIN32_ERROR = 397u32;
+pub const ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED: WIN32_ERROR = 375u32;
+pub const ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING: WIN32_ERROR = 362u32;
+pub const ERROR_CLOUD_FILE_PROVIDER_TERMINATED: WIN32_ERROR = 404u32;
+pub const ERROR_CLOUD_FILE_READ_ONLY_VOLUME: WIN32_ERROR = 381u32;
+pub const ERROR_CLOUD_FILE_REQUEST_ABORTED: WIN32_ERROR = 393u32;
+pub const ERROR_CLOUD_FILE_REQUEST_CANCELED: WIN32_ERROR = 398u32;
+pub const ERROR_CLOUD_FILE_REQUEST_TIMEOUT: WIN32_ERROR = 426u32;
+pub const ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT: WIN32_ERROR = 358u32;
+pub const ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS: WIN32_ERROR = 374u32;
+pub const ERROR_CLOUD_FILE_UNSUCCESSFUL: WIN32_ERROR = 389u32;
+pub const ERROR_CLOUD_FILE_US_MESSAGE_TIMEOUT: WIN32_ERROR = 475u32;
+pub const ERROR_CLOUD_FILE_VALIDATION_FAILED: WIN32_ERROR = 383u32;
+pub const ERROR_COMMITMENT_LIMIT: WIN32_ERROR = 1455u32;
+pub const ERROR_COMMITMENT_MINIMUM: WIN32_ERROR = 635u32;
+pub const ERROR_COMPRESSED_FILE_NOT_SUPPORTED: WIN32_ERROR = 335u32;
+pub const ERROR_COMPRESSION_DISABLED: WIN32_ERROR = 769u32;
+pub const ERROR_COMPRESSION_NOT_BENEFICIAL: WIN32_ERROR = 344u32;
+pub const ERROR_CONNECTED_OTHER_PASSWORD: WIN32_ERROR = 2108u32;
+pub const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT: WIN32_ERROR = 2109u32;
+pub const ERROR_CONNECTION_ABORTED: WIN32_ERROR = 1236u32;
+pub const ERROR_CONNECTION_ACTIVE: WIN32_ERROR = 1230u32;
+pub const ERROR_CONNECTION_COUNT_LIMIT: WIN32_ERROR = 1238u32;
+pub const ERROR_CONNECTION_INVALID: WIN32_ERROR = 1229u32;
+pub const ERROR_CONNECTION_REFUSED: WIN32_ERROR = 1225u32;
+pub const ERROR_CONNECTION_UNAVAIL: WIN32_ERROR = 1201u32;
+pub const ERROR_CONTAINER_ASSIGNED: WIN32_ERROR = 1504u32;
+pub const ERROR_CONTENT_BLOCKED: WIN32_ERROR = 1296u32;
+pub const ERROR_CONTEXT_EXPIRED: WIN32_ERROR = 1931u32;
+pub const ERROR_CONTINUE: WIN32_ERROR = 1246u32;
+pub const ERROR_CONTROL_C_EXIT: WIN32_ERROR = 572u32;
+pub const ERROR_CONTROL_ID_NOT_FOUND: WIN32_ERROR = 1421u32;
+pub const ERROR_CONVERT_TO_LARGE: WIN32_ERROR = 600u32;
+pub const ERROR_CORRUPT_LOG_CLEARED: WIN32_ERROR = 798u32;
+pub const ERROR_CORRUPT_LOG_CORRUPTED: WIN32_ERROR = 795u32;
+pub const ERROR_CORRUPT_LOG_DELETED_FULL: WIN32_ERROR = 797u32;
+pub const ERROR_CORRUPT_LOG_OVERFULL: WIN32_ERROR = 794u32;
+pub const ERROR_CORRUPT_LOG_UNAVAILABLE: WIN32_ERROR = 796u32;
+pub const ERROR_CORRUPT_SYSTEM_FILE: WIN32_ERROR = 634u32;
+pub const ERROR_COULD_NOT_INTERPRET: WIN32_ERROR = 552u32;
+pub const ERROR_COUNTER_TIMEOUT: WIN32_ERROR = 1121u32;
+pub const ERROR_CPU_SET_INVALID: WIN32_ERROR = 813u32;
+pub const ERROR_CRASH_DUMP: WIN32_ERROR = 753u32;
+pub const ERROR_CRC: WIN32_ERROR = 23u32;
+pub const ERROR_CREATE_FAILED: WIN32_ERROR = 1631u32;
+pub const ERROR_CROSS_PARTITION_VIOLATION: WIN32_ERROR = 1661u32;
+pub const ERROR_CSCSHARE_OFFLINE: WIN32_ERROR = 1262u32;
+pub const ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: WIN32_ERROR = 6019u32;
+pub const ERROR_CS_ENCRYPTION_FILE_NOT_CSE: WIN32_ERROR = 6021u32;
+pub const ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: WIN32_ERROR = 6017u32;
+pub const ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: WIN32_ERROR = 6020u32;
+pub const ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER: WIN32_ERROR = 6018u32;
+pub const ERROR_CTX_CLIENT_QUERY_TIMEOUT: WIN32_ERROR = 7040u32;
+pub const ERROR_CTX_MODEM_RESPONSE_TIMEOUT: WIN32_ERROR = 7012u32;
+pub const ERROR_CURRENT_DIRECTORY: WIN32_ERROR = 16u32;
+pub const ERROR_CURRENT_DOMAIN_NOT_ALLOWED: WIN32_ERROR = 1399u32;
+pub const ERROR_DATABASE_DOES_NOT_EXIST: WIN32_ERROR = 1065u32;
+pub const ERROR_DATATYPE_MISMATCH: WIN32_ERROR = 1629u32;
+pub const ERROR_DATA_CHECKSUM_ERROR: WIN32_ERROR = 323u32;
+pub const ERROR_DATA_NOT_ACCEPTED: WIN32_ERROR = 592u32;
+pub const ERROR_DAX_MAPPING_EXISTS: WIN32_ERROR = 361u32;
+pub const ERROR_DBG_COMMAND_EXCEPTION: WIN32_ERROR = 697u32;
+pub const ERROR_DBG_CONTINUE: WIN32_ERROR = 767u32;
+pub const ERROR_DBG_CONTROL_BREAK: WIN32_ERROR = 696u32;
+pub const ERROR_DBG_CONTROL_C: WIN32_ERROR = 693u32;
+pub const ERROR_DBG_EXCEPTION_HANDLED: WIN32_ERROR = 766u32;
+pub const ERROR_DBG_EXCEPTION_NOT_HANDLED: WIN32_ERROR = 688u32;
+pub const ERROR_DBG_PRINTEXCEPTION_C: WIN32_ERROR = 694u32;
+pub const ERROR_DBG_REPLY_LATER: WIN32_ERROR = 689u32;
+pub const ERROR_DBG_RIPEXCEPTION: WIN32_ERROR = 695u32;
+pub const ERROR_DBG_TERMINATE_PROCESS: WIN32_ERROR = 692u32;
+pub const ERROR_DBG_TERMINATE_THREAD: WIN32_ERROR = 691u32;
+pub const ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE: WIN32_ERROR = 690u32;
+pub const ERROR_DC_NOT_FOUND: WIN32_ERROR = 1425u32;
+pub const ERROR_DDE_FAIL: WIN32_ERROR = 1156u32;
+pub const ERROR_DEBUGGER_INACTIVE: WIN32_ERROR = 1284u32;
+pub const ERROR_DEBUG_ATTACH_FAILED: WIN32_ERROR = 590u32;
+pub const ERROR_DECRYPTION_FAILED: WIN32_ERROR = 6001u32;
+pub const ERROR_DELAY_LOAD_FAILED: WIN32_ERROR = 1285u32;
+pub const ERROR_DELETE_PENDING: WIN32_ERROR = 303u32;
+pub const ERROR_DEPENDENT_SERVICES_RUNNING: WIN32_ERROR = 1051u32;
+pub const ERROR_DESTINATION_ELEMENT_FULL: WIN32_ERROR = 1161u32;
+pub const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD: WIN32_ERROR = 1435u32;
+pub const ERROR_DEVICE_ALREADY_ATTACHED: WIN32_ERROR = 548u32;
+pub const ERROR_DEVICE_ALREADY_REMEMBERED: WIN32_ERROR = 1202u32;
+pub const ERROR_DEVICE_DOOR_OPEN: WIN32_ERROR = 1166u32;
+pub const ERROR_DEVICE_ENUMERATION_ERROR: WIN32_ERROR = 648u32;
+pub const ERROR_DEVICE_FEATURE_NOT_SUPPORTED: WIN32_ERROR = 316u32;
+pub const ERROR_DEVICE_HARDWARE_ERROR: WIN32_ERROR = 483u32;
+pub const ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL: WIN32_ERROR = 355u32;
+pub const ERROR_DEVICE_IN_MAINTENANCE: WIN32_ERROR = 359u32;
+pub const ERROR_DEVICE_IN_USE: WIN32_ERROR = 2404u32;
+pub const ERROR_DEVICE_NOT_CONNECTED: WIN32_ERROR = 1167u32;
+pub const ERROR_DEVICE_NOT_PARTITIONED: WIN32_ERROR = 1107u32;
+pub const ERROR_DEVICE_NO_RESOURCES: WIN32_ERROR = 322u32;
+pub const ERROR_DEVICE_REINITIALIZATION_NEEDED: WIN32_ERROR = 1164u32;
+pub const ERROR_DEVICE_REMOVED: WIN32_ERROR = 1617u32;
+pub const ERROR_DEVICE_REQUIRES_CLEANING: WIN32_ERROR = 1165u32;
+pub const ERROR_DEVICE_RESET_REQUIRED: WIN32_ERROR = 507u32;
+pub const ERROR_DEVICE_SUPPORT_IN_PROGRESS: WIN32_ERROR = 171u32;
+pub const ERROR_DEVICE_UNREACHABLE: WIN32_ERROR = 321u32;
+pub const ERROR_DEV_NOT_EXIST: WIN32_ERROR = 55u32;
+pub const ERROR_DHCP_ADDRESS_CONFLICT: WIN32_ERROR = 4100u32;
+pub const ERROR_DIFFERENT_SERVICE_ACCOUNT: WIN32_ERROR = 1079u32;
+pub const ERROR_DIRECTORY: WIN32_ERROR = 267u32;
+pub const ERROR_DIRECTORY_NOT_SUPPORTED: WIN32_ERROR = 336u32;
+pub const ERROR_DIRECT_ACCESS_HANDLE: WIN32_ERROR = 130u32;
+pub const ERROR_DIR_EFS_DISALLOWED: WIN32_ERROR = 6010u32;
+pub const ERROR_DIR_NOT_EMPTY: WIN32_ERROR = 145u32;
+pub const ERROR_DIR_NOT_ROOT: WIN32_ERROR = 144u32;
+pub const ERROR_DISCARDED: WIN32_ERROR = 157u32;
+pub const ERROR_DISK_CHANGE: WIN32_ERROR = 107u32;
+pub const ERROR_DISK_CORRUPT: WIN32_ERROR = 1393u32;
+pub const ERROR_DISK_FULL: WIN32_ERROR = 112u32;
+pub const ERROR_DISK_OPERATION_FAILED: WIN32_ERROR = 1127u32;
+pub const ERROR_DISK_QUOTA_EXCEEDED: WIN32_ERROR = 1295u32;
+pub const ERROR_DISK_RECALIBRATE_FAILED: WIN32_ERROR = 1126u32;
+pub const ERROR_DISK_REPAIR_DISABLED: WIN32_ERROR = 780u32;
+pub const ERROR_DISK_REPAIR_REDIRECTED: WIN32_ERROR = 792u32;
+pub const ERROR_DISK_REPAIR_UNSUCCESSFUL: WIN32_ERROR = 793u32;
+pub const ERROR_DISK_RESET_FAILED: WIN32_ERROR = 1128u32;
+pub const ERROR_DISK_RESOURCES_EXHAUSTED: WIN32_ERROR = 314u32;
+pub const ERROR_DISK_TOO_FRAGMENTED: WIN32_ERROR = 302u32;
+pub const ERROR_DLL_INIT_FAILED: WIN32_ERROR = 1114u32;
+pub const ERROR_DLL_INIT_FAILED_LOGOFF: WIN32_ERROR = 624u32;
+pub const ERROR_DLL_MIGHT_BE_INCOMPATIBLE: WIN32_ERROR = 687u32;
+pub const ERROR_DLL_MIGHT_BE_INSECURE: WIN32_ERROR = 686u32;
+pub const ERROR_DLL_NOT_FOUND: WIN32_ERROR = 1157u32;
+pub const ERROR_DLP_POLICY_DENIES_OPERATION: WIN32_ERROR = 446u32;
+pub const ERROR_DLP_POLICY_SILENTLY_FAIL: WIN32_ERROR = 449u32;
+pub const ERROR_DLP_POLICY_WARNS_AGAINST_OPERATION: WIN32_ERROR = 445u32;
+pub const ERROR_DOMAIN_CONTROLLER_EXISTS: WIN32_ERROR = 1250u32;
+pub const ERROR_DOMAIN_CONTROLLER_NOT_FOUND: WIN32_ERROR = 1908u32;
+pub const ERROR_DOMAIN_CTRLR_CONFIG_ERROR: WIN32_ERROR = 581u32;
+pub const ERROR_DOMAIN_EXISTS: WIN32_ERROR = 1356u32;
+pub const ERROR_DOMAIN_LIMIT_EXCEEDED: WIN32_ERROR = 1357u32;
+pub const ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION: WIN32_ERROR = 8644u32;
+pub const ERROR_DOMAIN_TRUST_INCONSISTENT: WIN32_ERROR = 1810u32;
+pub const ERROR_DOWNGRADE_DETECTED: WIN32_ERROR = 1265u32;
+pub const ERROR_DPL_NOT_SUPPORTED_FOR_USER: WIN32_ERROR = 423u32;
+pub const ERROR_DRIVERS_LEAKING_LOCKED_PAGES: WIN32_ERROR = 729u32;
+pub const ERROR_DRIVER_BLOCKED: WIN32_ERROR = 1275u32;
+pub const ERROR_DRIVER_CANCEL_TIMEOUT: WIN32_ERROR = 594u32;
+pub const ERROR_DRIVER_DATABASE_ERROR: WIN32_ERROR = 652u32;
+pub const ERROR_DRIVER_FAILED_PRIOR_UNLOAD: WIN32_ERROR = 654u32;
+pub const ERROR_DRIVER_FAILED_SLEEP: WIN32_ERROR = 633u32;
+pub const ERROR_DRIVER_PROCESS_TERMINATED: WIN32_ERROR = 1291u32;
+pub const ERROR_DRIVE_LOCKED: WIN32_ERROR = 108u32;
+pub const ERROR_DS_ADD_REPLICA_INHIBITED: WIN32_ERROR = 8302u32;
+pub const ERROR_DS_ADMIN_LIMIT_EXCEEDED: WIN32_ERROR = 8228u32;
+pub const ERROR_DS_AFFECTS_MULTIPLE_DSAS: WIN32_ERROR = 8249u32;
+pub const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: WIN32_ERROR = 8578u32;
+pub const ERROR_DS_ALIASED_OBJ_MISSING: WIN32_ERROR = 8334u32;
+pub const ERROR_DS_ALIAS_DEREF_PROBLEM: WIN32_ERROR = 8244u32;
+pub const ERROR_DS_ALIAS_POINTS_TO_ALIAS: WIN32_ERROR = 8336u32;
+pub const ERROR_DS_ALIAS_PROBLEM: WIN32_ERROR = 8241u32;
+pub const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS: WIN32_ERROR = 8205u32;
+pub const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM: WIN32_ERROR = 8346u32;
+pub const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED: WIN32_ERROR = 8204u32;
+pub const ERROR_DS_ATT_ALREADY_EXISTS: WIN32_ERROR = 8318u32;
+pub const ERROR_DS_ATT_IS_NOT_ON_OBJ: WIN32_ERROR = 8310u32;
+pub const ERROR_DS_ATT_NOT_DEF_FOR_CLASS: WIN32_ERROR = 8317u32;
+pub const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA: WIN32_ERROR = 8303u32;
+pub const ERROR_DS_ATT_SCHEMA_REQ_ID: WIN32_ERROR = 8399u32;
+pub const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX: WIN32_ERROR = 8416u32;
+pub const ERROR_DS_ATT_VAL_ALREADY_EXISTS: WIN32_ERROR = 8323u32;
+pub const ERROR_DS_AUDIT_FAILURE: WIN32_ERROR = 8625u32;
+pub const ERROR_DS_AUTHORIZATION_FAILED: WIN32_ERROR = 8599u32;
+pub const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED: WIN32_ERROR = 8231u32;
+pub const ERROR_DS_AUTH_UNKNOWN: WIN32_ERROR = 8234u32;
+pub const ERROR_DS_AUX_CLS_TEST_FAIL: WIN32_ERROR = 8389u32;
+pub const ERROR_DS_BACKLINK_WITHOUT_LINK: WIN32_ERROR = 8482u32;
+pub const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX: WIN32_ERROR = 8400u32;
+pub const ERROR_DS_BAD_HIERARCHY_FILE: WIN32_ERROR = 8425u32;
+pub const ERROR_DS_BAD_INSTANCE_TYPE: WIN32_ERROR = 8313u32;
+pub const ERROR_DS_BAD_NAME_SYNTAX: WIN32_ERROR = 8335u32;
+pub const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX: WIN32_ERROR = 8392u32;
+pub const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED: WIN32_ERROR = 8426u32;
+pub const ERROR_DS_BUSY: WIN32_ERROR = 8206u32;
+pub const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD: WIN32_ERROR = 8585u32;
+pub const ERROR_DS_CANT_ADD_ATT_VALUES: WIN32_ERROR = 8320u32;
+pub const ERROR_DS_CANT_ADD_SYSTEM_ONLY: WIN32_ERROR = 8358u32;
+pub const ERROR_DS_CANT_ADD_TO_GC: WIN32_ERROR = 8550u32;
+pub const ERROR_DS_CANT_CACHE_ATT: WIN32_ERROR = 8401u32;
+pub const ERROR_DS_CANT_CACHE_CLASS: WIN32_ERROR = 8402u32;
+pub const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC: WIN32_ERROR = 8553u32;
+pub const ERROR_DS_CANT_CREATE_UNDER_SCHEMA: WIN32_ERROR = 8510u32;
+pub const ERROR_DS_CANT_DELETE: WIN32_ERROR = 8398u32;
+pub const ERROR_DS_CANT_DELETE_DSA_OBJ: WIN32_ERROR = 8340u32;
+pub const ERROR_DS_CANT_DEL_MASTER_CROSSREF: WIN32_ERROR = 8375u32;
+pub const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC: WIN32_ERROR = 8604u32;
+pub const ERROR_DS_CANT_DEREF_ALIAS: WIN32_ERROR = 8337u32;
+pub const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN: WIN32_ERROR = 8603u32;
+pub const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF: WIN32_ERROR = 8589u32;
+pub const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN: WIN32_ERROR = 8537u32;
+pub const ERROR_DS_CANT_FIND_DSA_OBJ: WIN32_ERROR = 8419u32;
+pub const ERROR_DS_CANT_FIND_EXPECTED_NC: WIN32_ERROR = 8420u32;
+pub const ERROR_DS_CANT_FIND_NC_IN_CACHE: WIN32_ERROR = 8421u32;
+pub const ERROR_DS_CANT_MIX_MASTER_AND_REPS: WIN32_ERROR = 8331u32;
+pub const ERROR_DS_CANT_MOD_OBJ_CLASS: WIN32_ERROR = 8215u32;
+pub const ERROR_DS_CANT_MOD_PRIMARYGROUPID: WIN32_ERROR = 8506u32;
+pub const ERROR_DS_CANT_MOD_SYSTEM_ONLY: WIN32_ERROR = 8369u32;
+pub const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP: WIN32_ERROR = 8498u32;
+pub const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP: WIN32_ERROR = 8608u32;
+pub const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP: WIN32_ERROR = 8609u32;
+pub const ERROR_DS_CANT_MOVE_DELETED_OBJECT: WIN32_ERROR = 8489u32;
+pub const ERROR_DS_CANT_MOVE_RESOURCE_GROUP: WIN32_ERROR = 8499u32;
+pub const ERROR_DS_CANT_ON_NON_LEAF: WIN32_ERROR = 8213u32;
+pub const ERROR_DS_CANT_ON_RDN: WIN32_ERROR = 8214u32;
+pub const ERROR_DS_CANT_REMOVE_ATT_CACHE: WIN32_ERROR = 8403u32;
+pub const ERROR_DS_CANT_REMOVE_CLASS_CACHE: WIN32_ERROR = 8404u32;
+pub const ERROR_DS_CANT_REM_MISSING_ATT: WIN32_ERROR = 8324u32;
+pub const ERROR_DS_CANT_REM_MISSING_ATT_VAL: WIN32_ERROR = 8325u32;
+pub const ERROR_DS_CANT_REPLACE_HIDDEN_REC: WIN32_ERROR = 8424u32;
+pub const ERROR_DS_CANT_RETRIEVE_ATTS: WIN32_ERROR = 8481u32;
+pub const ERROR_DS_CANT_RETRIEVE_CHILD: WIN32_ERROR = 8422u32;
+pub const ERROR_DS_CANT_RETRIEVE_DN: WIN32_ERROR = 8405u32;
+pub const ERROR_DS_CANT_RETRIEVE_INSTANCE: WIN32_ERROR = 8407u32;
+pub const ERROR_DS_CANT_RETRIEVE_SD: WIN32_ERROR = 8526u32;
+pub const ERROR_DS_CANT_START: WIN32_ERROR = 8531u32;
+pub const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ: WIN32_ERROR = 8560u32;
+pub const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS: WIN32_ERROR = 8493u32;
+pub const ERROR_DS_CHILDREN_EXIST: WIN32_ERROR = 8332u32;
+pub const ERROR_DS_CLASS_MUST_BE_CONCRETE: WIN32_ERROR = 8359u32;
+pub const ERROR_DS_CLASS_NOT_DSA: WIN32_ERROR = 8343u32;
+pub const ERROR_DS_CLIENT_LOOP: WIN32_ERROR = 8259u32;
+pub const ERROR_DS_CODE_INCONSISTENCY: WIN32_ERROR = 8408u32;
+pub const ERROR_DS_COMPARE_FALSE: WIN32_ERROR = 8229u32;
+pub const ERROR_DS_COMPARE_TRUE: WIN32_ERROR = 8230u32;
+pub const ERROR_DS_CONFIDENTIALITY_REQUIRED: WIN32_ERROR = 8237u32;
+pub const ERROR_DS_CONFIG_PARAM_MISSING: WIN32_ERROR = 8427u32;
+pub const ERROR_DS_CONSTRAINT_VIOLATION: WIN32_ERROR = 8239u32;
+pub const ERROR_DS_CONSTRUCTED_ATT_MOD: WIN32_ERROR = 8475u32;
+pub const ERROR_DS_CONTROL_NOT_FOUND: WIN32_ERROR = 8258u32;
+pub const ERROR_DS_COULDNT_CONTACT_FSMO: WIN32_ERROR = 8367u32;
+pub const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE: WIN32_ERROR = 8503u32;
+pub const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE: WIN32_ERROR = 8502u32;
+pub const ERROR_DS_COULDNT_UPDATE_SPNS: WIN32_ERROR = 8525u32;
+pub const ERROR_DS_COUNTING_AB_INDICES_FAILED: WIN32_ERROR = 8428u32;
+pub const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD: WIN32_ERROR = 8491u32;
+pub const ERROR_DS_CROSS_DOM_MOVE_ERROR: WIN32_ERROR = 8216u32;
+pub const ERROR_DS_CROSS_NC_DN_RENAME: WIN32_ERROR = 8368u32;
+pub const ERROR_DS_CROSS_REF_BUSY: WIN32_ERROR = 8602u32;
+pub const ERROR_DS_CROSS_REF_EXISTS: WIN32_ERROR = 8374u32;
+pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE: WIN32_ERROR = 8495u32;
+pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2: WIN32_ERROR = 8586u32;
+pub const ERROR_DS_DATABASE_ERROR: WIN32_ERROR = 8409u32;
+pub const ERROR_DS_DECODING_ERROR: WIN32_ERROR = 8253u32;
+pub const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED: WIN32_ERROR = 8536u32;
+pub const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST: WIN32_ERROR = 8535u32;
+pub const ERROR_DS_DIFFERENT_REPL_EPOCHS: WIN32_ERROR = 8593u32;
+pub const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER: WIN32_ERROR = 8615u32;
+pub const ERROR_DS_DISALLOWED_NC_REDIRECT: WIN32_ERROR = 8640u32;
+pub const ERROR_DS_DNS_LOOKUP_FAILURE: WIN32_ERROR = 8524u32;
+pub const ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST: WIN32_ERROR = 8634u32;
+pub const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS: WIN32_ERROR = 8612u32;
+pub const ERROR_DS_DOMAIN_VERSION_TOO_HIGH: WIN32_ERROR = 8564u32;
+pub const ERROR_DS_DOMAIN_VERSION_TOO_LOW: WIN32_ERROR = 8566u32;
+pub const ERROR_DS_DRA_ABANDON_SYNC: WIN32_ERROR = 8462u32;
+pub const ERROR_DS_DRA_ACCESS_DENIED: WIN32_ERROR = 8453u32;
+pub const ERROR_DS_DRA_BAD_DN: WIN32_ERROR = 8439u32;
+pub const ERROR_DS_DRA_BAD_INSTANCE_TYPE: WIN32_ERROR = 8445u32;
+pub const ERROR_DS_DRA_BAD_NC: WIN32_ERROR = 8440u32;
+pub const ERROR_DS_DRA_BUSY: WIN32_ERROR = 8438u32;
+pub const ERROR_DS_DRA_CONNECTION_FAILED: WIN32_ERROR = 8444u32;
+pub const ERROR_DS_DRA_CORRUPT_UTD_VECTOR: WIN32_ERROR = 8629u32;
+pub const ERROR_DS_DRA_DB_ERROR: WIN32_ERROR = 8451u32;
+pub const ERROR_DS_DRA_DN_EXISTS: WIN32_ERROR = 8441u32;
+pub const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT: WIN32_ERROR = 8544u32;
+pub const ERROR_DS_DRA_EXTN_CONNECTION_FAILED: WIN32_ERROR = 8466u32;
+pub const ERROR_DS_DRA_GENERIC: WIN32_ERROR = 8436u32;
+pub const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET: WIN32_ERROR = 8464u32;
+pub const ERROR_DS_DRA_INCONSISTENT_DIT: WIN32_ERROR = 8443u32;
+pub const ERROR_DS_DRA_INTERNAL_ERROR: WIN32_ERROR = 8442u32;
+pub const ERROR_DS_DRA_INVALID_PARAMETER: WIN32_ERROR = 8437u32;
+pub const ERROR_DS_DRA_MAIL_PROBLEM: WIN32_ERROR = 8447u32;
+pub const ERROR_DS_DRA_MISSING_KRBTGT_SECRET: WIN32_ERROR = 8633u32;
+pub const ERROR_DS_DRA_MISSING_PARENT: WIN32_ERROR = 8460u32;
+pub const ERROR_DS_DRA_NAME_COLLISION: WIN32_ERROR = 8458u32;
+pub const ERROR_DS_DRA_NOT_SUPPORTED: WIN32_ERROR = 8454u32;
+pub const ERROR_DS_DRA_NO_REPLICA: WIN32_ERROR = 8452u32;
+pub const ERROR_DS_DRA_OBJ_IS_REP_SOURCE: WIN32_ERROR = 8450u32;
+pub const ERROR_DS_DRA_OBJ_NC_MISMATCH: WIN32_ERROR = 8545u32;
+pub const ERROR_DS_DRA_OUT_OF_MEM: WIN32_ERROR = 8446u32;
+pub const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW: WIN32_ERROR = 8617u32;
+pub const ERROR_DS_DRA_PREEMPTED: WIN32_ERROR = 8461u32;
+pub const ERROR_DS_DRA_RECYCLED_TARGET: WIN32_ERROR = 8639u32;
+pub const ERROR_DS_DRA_REF_ALREADY_EXISTS: WIN32_ERROR = 8448u32;
+pub const ERROR_DS_DRA_REF_NOT_FOUND: WIN32_ERROR = 8449u32;
+pub const ERROR_DS_DRA_REPL_PENDING: WIN32_ERROR = 8477u32;
+pub const ERROR_DS_DRA_RPC_CANCELLED: WIN32_ERROR = 8455u32;
+pub const ERROR_DS_DRA_SCHEMA_CONFLICT: WIN32_ERROR = 8543u32;
+pub const ERROR_DS_DRA_SCHEMA_INFO_SHIP: WIN32_ERROR = 8542u32;
+pub const ERROR_DS_DRA_SCHEMA_MISMATCH: WIN32_ERROR = 8418u32;
+pub const ERROR_DS_DRA_SECRETS_DENIED: WIN32_ERROR = 8630u32;
+pub const ERROR_DS_DRA_SHUTDOWN: WIN32_ERROR = 8463u32;
+pub const ERROR_DS_DRA_SINK_DISABLED: WIN32_ERROR = 8457u32;
+pub const ERROR_DS_DRA_SOURCE_DISABLED: WIN32_ERROR = 8456u32;
+pub const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA: WIN32_ERROR = 8465u32;
+pub const ERROR_DS_DRA_SOURCE_REINSTALLED: WIN32_ERROR = 8459u32;
+pub const ERROR_DS_DRS_EXTENSIONS_CHANGED: WIN32_ERROR = 8594u32;
+pub const ERROR_DS_DSA_MUST_BE_INT_MASTER: WIN32_ERROR = 8342u32;
+pub const ERROR_DS_DST_DOMAIN_NOT_NATIVE: WIN32_ERROR = 8496u32;
+pub const ERROR_DS_DST_NC_MISMATCH: WIN32_ERROR = 8486u32;
+pub const ERROR_DS_DS_REQUIRED: WIN32_ERROR = 8478u32;
+pub const ERROR_DS_DUPLICATE_ID_FOUND: WIN32_ERROR = 8605u32;
+pub const ERROR_DS_DUP_LDAP_DISPLAY_NAME: WIN32_ERROR = 8382u32;
+pub const ERROR_DS_DUP_LINK_ID: WIN32_ERROR = 8468u32;
+pub const ERROR_DS_DUP_MAPI_ID: WIN32_ERROR = 8380u32;
+pub const ERROR_DS_DUP_MSDS_INTID: WIN32_ERROR = 8597u32;
+pub const ERROR_DS_DUP_OID: WIN32_ERROR = 8379u32;
+pub const ERROR_DS_DUP_RDN: WIN32_ERROR = 8378u32;
+pub const ERROR_DS_DUP_SCHEMA_ID_GUID: WIN32_ERROR = 8381u32;
+pub const ERROR_DS_ENCODING_ERROR: WIN32_ERROR = 8252u32;
+pub const ERROR_DS_EPOCH_MISMATCH: WIN32_ERROR = 8483u32;
+pub const ERROR_DS_EXISTING_AD_CHILD_NC: WIN32_ERROR = 8613u32;
+pub const ERROR_DS_EXISTS_IN_AUX_CLS: WIN32_ERROR = 8393u32;
+pub const ERROR_DS_EXISTS_IN_MAY_HAVE: WIN32_ERROR = 8386u32;
+pub const ERROR_DS_EXISTS_IN_MUST_HAVE: WIN32_ERROR = 8385u32;
+pub const ERROR_DS_EXISTS_IN_POSS_SUP: WIN32_ERROR = 8395u32;
+pub const ERROR_DS_EXISTS_IN_RDNATTID: WIN32_ERROR = 8598u32;
+pub const ERROR_DS_EXISTS_IN_SUB_CLS: WIN32_ERROR = 8394u32;
+pub const ERROR_DS_FILTER_UNKNOWN: WIN32_ERROR = 8254u32;
+pub const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS: WIN32_ERROR = 8555u32;
+pub const ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST: WIN32_ERROR = 8635u32;
+pub const ERROR_DS_FOREST_VERSION_TOO_HIGH: WIN32_ERROR = 8563u32;
+pub const ERROR_DS_FOREST_VERSION_TOO_LOW: WIN32_ERROR = 8565u32;
+pub const ERROR_DS_GCVERIFY_ERROR: WIN32_ERROR = 8417u32;
+pub const ERROR_DS_GC_NOT_AVAILABLE: WIN32_ERROR = 8217u32;
+pub const ERROR_DS_GC_REQUIRED: WIN32_ERROR = 8547u32;
+pub const ERROR_DS_GENERIC_ERROR: WIN32_ERROR = 8341u32;
+pub const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: WIN32_ERROR = 8519u32;
+pub const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: WIN32_ERROR = 8516u32;
+pub const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: WIN32_ERROR = 8517u32;
+pub const ERROR_DS_GOVERNSID_MISSING: WIN32_ERROR = 8410u32;
+pub const ERROR_DS_GROUP_CONVERSION_ERROR: WIN32_ERROR = 8607u32;
+pub const ERROR_DS_HAVE_PRIMARY_MEMBERS: WIN32_ERROR = 8521u32;
+pub const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED: WIN32_ERROR = 8429u32;
+pub const ERROR_DS_HIERARCHY_TABLE_TOO_DEEP: WIN32_ERROR = 8628u32;
+pub const ERROR_DS_HIGH_ADLDS_FFL: WIN32_ERROR = 8641u32;
+pub const ERROR_DS_HIGH_DSA_VERSION: WIN32_ERROR = 8642u32;
+pub const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD: WIN32_ERROR = 8507u32;
+pub const ERROR_DS_ILLEGAL_MOD_OPERATION: WIN32_ERROR = 8311u32;
+pub const ERROR_DS_ILLEGAL_SUPERIOR: WIN32_ERROR = 8345u32;
+pub const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION: WIN32_ERROR = 8492u32;
+pub const ERROR_DS_INAPPROPRIATE_AUTH: WIN32_ERROR = 8233u32;
+pub const ERROR_DS_INAPPROPRIATE_MATCHING: WIN32_ERROR = 8238u32;
+pub const ERROR_DS_INCOMPATIBLE_CONTROLS_USED: WIN32_ERROR = 8574u32;
+pub const ERROR_DS_INCOMPATIBLE_VERSION: WIN32_ERROR = 8567u32;
+pub const ERROR_DS_INCORRECT_ROLE_OWNER: WIN32_ERROR = 8210u32;
+pub const ERROR_DS_INIT_FAILURE: WIN32_ERROR = 8532u32;
+pub const ERROR_DS_INIT_FAILURE_CONSOLE: WIN32_ERROR = 8561u32;
+pub const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE: WIN32_ERROR = 8512u32;
+pub const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION: WIN32_ERROR = 8511u32;
+pub const ERROR_DS_INSTALL_SCHEMA_MISMATCH: WIN32_ERROR = 8467u32;
+pub const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT: WIN32_ERROR = 8606u32;
+pub const ERROR_DS_INSUFF_ACCESS_RIGHTS: WIN32_ERROR = 8344u32;
+pub const ERROR_DS_INTERNAL_FAILURE: WIN32_ERROR = 8430u32;
+pub const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX: WIN32_ERROR = 8203u32;
+pub const ERROR_DS_INVALID_DMD: WIN32_ERROR = 8360u32;
+pub const ERROR_DS_INVALID_DN_SYNTAX: WIN32_ERROR = 8242u32;
+pub const ERROR_DS_INVALID_GROUP_TYPE: WIN32_ERROR = 8513u32;
+pub const ERROR_DS_INVALID_LDAP_DISPLAY_NAME: WIN32_ERROR = 8479u32;
+pub const ERROR_DS_INVALID_NAME_FOR_SPN: WIN32_ERROR = 8554u32;
+pub const ERROR_DS_INVALID_ROLE_OWNER: WIN32_ERROR = 8366u32;
+pub const ERROR_DS_INVALID_SCRIPT: WIN32_ERROR = 8600u32;
+pub const ERROR_DS_INVALID_SEARCH_FLAG: WIN32_ERROR = 8500u32;
+pub const ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE: WIN32_ERROR = 8626u32;
+pub const ERROR_DS_INVALID_SEARCH_FLAG_TUPLE: WIN32_ERROR = 8627u32;
+pub const ERROR_DS_IS_LEAF: WIN32_ERROR = 8243u32;
+pub const ERROR_DS_KEY_NOT_UNIQUE: WIN32_ERROR = 8527u32;
+pub const ERROR_DS_LDAP_SEND_QUEUE_FULL: WIN32_ERROR = 8616u32;
+pub const ERROR_DS_LINK_ID_NOT_AVAILABLE: WIN32_ERROR = 8577u32;
+pub const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: WIN32_ERROR = 8520u32;
+pub const ERROR_DS_LOCAL_ERROR: WIN32_ERROR = 8251u32;
+pub const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: WIN32_ERROR = 8548u32;
+pub const ERROR_DS_LOOP_DETECT: WIN32_ERROR = 8246u32;
+pub const ERROR_DS_LOW_ADLDS_FFL: WIN32_ERROR = 8643u32;
+pub const ERROR_DS_LOW_DSA_VERSION: WIN32_ERROR = 8568u32;
+pub const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4: WIN32_ERROR = 8572u32;
+pub const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: WIN32_ERROR = 8557u32;
+pub const ERROR_DS_MAPI_ID_NOT_AVAILABLE: WIN32_ERROR = 8632u32;
+pub const ERROR_DS_MASTERDSA_REQUIRED: WIN32_ERROR = 8314u32;
+pub const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED: WIN32_ERROR = 8304u32;
+pub const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY: WIN32_ERROR = 8201u32;
+pub const ERROR_DS_MISSING_EXPECTED_ATT: WIN32_ERROR = 8411u32;
+pub const ERROR_DS_MISSING_FOREST_TRUST: WIN32_ERROR = 8649u32;
+pub const ERROR_DS_MISSING_FSMO_SETTINGS: WIN32_ERROR = 8434u32;
+pub const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER: WIN32_ERROR = 8497u32;
+pub const ERROR_DS_MISSING_REQUIRED_ATT: WIN32_ERROR = 8316u32;
+pub const ERROR_DS_MISSING_SUPREF: WIN32_ERROR = 8406u32;
+pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG: WIN32_ERROR = 8581u32;
+pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE: WIN32_ERROR = 8579u32;
+pub const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT: WIN32_ERROR = 8582u32;
+pub const ERROR_DS_MUST_BE_RUN_ON_DST_DC: WIN32_ERROR = 8558u32;
+pub const ERROR_DS_NAME_ERROR_DOMAIN_ONLY: WIN32_ERROR = 8473u32;
+pub const ERROR_DS_NAME_ERROR_NOT_FOUND: WIN32_ERROR = 8470u32;
+pub const ERROR_DS_NAME_ERROR_NOT_UNIQUE: WIN32_ERROR = 8471u32;
+pub const ERROR_DS_NAME_ERROR_NO_MAPPING: WIN32_ERROR = 8472u32;
+pub const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: WIN32_ERROR = 8474u32;
+pub const ERROR_DS_NAME_ERROR_RESOLVING: WIN32_ERROR = 8469u32;
+pub const ERROR_DS_NAME_ERROR_TRUST_REFERRAL: WIN32_ERROR = 8583u32;
+pub const ERROR_DS_NAME_NOT_UNIQUE: WIN32_ERROR = 8571u32;
+pub const ERROR_DS_NAME_REFERENCE_INVALID: WIN32_ERROR = 8373u32;
+pub const ERROR_DS_NAME_TOO_LONG: WIN32_ERROR = 8348u32;
+pub const ERROR_DS_NAME_TOO_MANY_PARTS: WIN32_ERROR = 8347u32;
+pub const ERROR_DS_NAME_TYPE_UNKNOWN: WIN32_ERROR = 8351u32;
+pub const ERROR_DS_NAME_UNPARSEABLE: WIN32_ERROR = 8350u32;
+pub const ERROR_DS_NAME_VALUE_TOO_LONG: WIN32_ERROR = 8349u32;
+pub const ERROR_DS_NAMING_MASTER_GC: WIN32_ERROR = 8523u32;
+pub const ERROR_DS_NAMING_VIOLATION: WIN32_ERROR = 8247u32;
+pub const ERROR_DS_NCNAME_MISSING_CR_REF: WIN32_ERROR = 8412u32;
+pub const ERROR_DS_NCNAME_MUST_BE_NC: WIN32_ERROR = 8357u32;
+pub const ERROR_DS_NC_MUST_HAVE_NC_PARENT: WIN32_ERROR = 8494u32;
+pub const ERROR_DS_NC_STILL_HAS_DSAS: WIN32_ERROR = 8546u32;
+pub const ERROR_DS_NONEXISTENT_MAY_HAVE: WIN32_ERROR = 8387u32;
+pub const ERROR_DS_NONEXISTENT_MUST_HAVE: WIN32_ERROR = 8388u32;
+pub const ERROR_DS_NONEXISTENT_POSS_SUP: WIN32_ERROR = 8390u32;
+pub const ERROR_DS_NONSAFE_SCHEMA_CHANGE: WIN32_ERROR = 8508u32;
+pub const ERROR_DS_NON_ASQ_SEARCH: WIN32_ERROR = 8624u32;
+pub const ERROR_DS_NON_BASE_SEARCH: WIN32_ERROR = 8480u32;
+pub const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX: WIN32_ERROR = 8377u32;
+pub const ERROR_DS_NOT_AN_OBJECT: WIN32_ERROR = 8352u32;
+pub const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC: WIN32_ERROR = 8487u32;
+pub const ERROR_DS_NOT_CLOSEST: WIN32_ERROR = 8588u32;
+pub const ERROR_DS_NOT_INSTALLED: WIN32_ERROR = 8200u32;
+pub const ERROR_DS_NOT_ON_BACKLINK: WIN32_ERROR = 8362u32;
+pub const ERROR_DS_NOT_SUPPORTED: WIN32_ERROR = 8256u32;
+pub const ERROR_DS_NOT_SUPPORTED_SORT_ORDER: WIN32_ERROR = 8570u32;
+pub const ERROR_DS_NO_ATTRIBUTE_OR_VALUE: WIN32_ERROR = 8202u32;
+pub const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN: WIN32_ERROR = 8569u32;
+pub const ERROR_DS_NO_CHAINED_EVAL: WIN32_ERROR = 8328u32;
+pub const ERROR_DS_NO_CHAINING: WIN32_ERROR = 8327u32;
+pub const ERROR_DS_NO_CHECKPOINT_WITH_PDC: WIN32_ERROR = 8551u32;
+pub const ERROR_DS_NO_CROSSREF_FOR_NC: WIN32_ERROR = 8363u32;
+pub const ERROR_DS_NO_DELETED_NAME: WIN32_ERROR = 8355u32;
+pub const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS: WIN32_ERROR = 8549u32;
+pub const ERROR_DS_NO_MORE_RIDS: WIN32_ERROR = 8209u32;
+pub const ERROR_DS_NO_MSDS_INTID: WIN32_ERROR = 8596u32;
+pub const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: WIN32_ERROR = 8514u32;
+pub const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: WIN32_ERROR = 8515u32;
+pub const ERROR_DS_NO_NTDSA_OBJECT: WIN32_ERROR = 8623u32;
+pub const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC: WIN32_ERROR = 8580u32;
+pub const ERROR_DS_NO_PARENT_OBJECT: WIN32_ERROR = 8329u32;
+pub const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION: WIN32_ERROR = 8533u32;
+pub const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA: WIN32_ERROR = 8306u32;
+pub const ERROR_DS_NO_REF_DOMAIN: WIN32_ERROR = 8575u32;
+pub const ERROR_DS_NO_REQUESTED_ATTS_FOUND: WIN32_ERROR = 8308u32;
+pub const ERROR_DS_NO_RESULTS_RETURNED: WIN32_ERROR = 8257u32;
+pub const ERROR_DS_NO_RIDS_ALLOCATED: WIN32_ERROR = 8208u32;
+pub const ERROR_DS_NO_SERVER_OBJECT: WIN32_ERROR = 8622u32;
+pub const ERROR_DS_NO_SUCH_OBJECT: WIN32_ERROR = 8240u32;
+pub const ERROR_DS_NO_TREE_DELETE_ABOVE_NC: WIN32_ERROR = 8501u32;
+pub const ERROR_DS_NTDSCRIPT_PROCESS_ERROR: WIN32_ERROR = 8592u32;
+pub const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR: WIN32_ERROR = 8591u32;
+pub const ERROR_DS_OBJECT_BEING_REMOVED: WIN32_ERROR = 8339u32;
+pub const ERROR_DS_OBJECT_CLASS_REQUIRED: WIN32_ERROR = 8315u32;
+pub const ERROR_DS_OBJECT_RESULTS_TOO_LARGE: WIN32_ERROR = 8248u32;
+pub const ERROR_DS_OBJ_CLASS_NOT_DEFINED: WIN32_ERROR = 8371u32;
+pub const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS: WIN32_ERROR = 8372u32;
+pub const ERROR_DS_OBJ_CLASS_VIOLATION: WIN32_ERROR = 8212u32;
+pub const ERROR_DS_OBJ_GUID_EXISTS: WIN32_ERROR = 8361u32;
+pub const ERROR_DS_OBJ_NOT_FOUND: WIN32_ERROR = 8333u32;
+pub const ERROR_DS_OBJ_STRING_NAME_EXISTS: WIN32_ERROR = 8305u32;
+pub const ERROR_DS_OBJ_TOO_LARGE: WIN32_ERROR = 8312u32;
+pub const ERROR_DS_OFFSET_RANGE_ERROR: WIN32_ERROR = 8262u32;
+pub const ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: WIN32_ERROR = 8637u32;
+pub const ERROR_DS_OID_NOT_FOUND: WIN32_ERROR = 8638u32;
+pub const ERROR_DS_OPERATIONS_ERROR: WIN32_ERROR = 8224u32;
+pub const ERROR_DS_OUT_OF_SCOPE: WIN32_ERROR = 8338u32;
+pub const ERROR_DS_OUT_OF_VERSION_STORE: WIN32_ERROR = 8573u32;
+pub const ERROR_DS_PARAM_ERROR: WIN32_ERROR = 8255u32;
+pub const ERROR_DS_PARENT_IS_AN_ALIAS: WIN32_ERROR = 8330u32;
+pub const ERROR_DS_PDC_OPERATION_IN_PROGRESS: WIN32_ERROR = 8490u32;
+pub const ERROR_DS_PER_ATTRIBUTE_AUTHZ_FAILED_DURING_ADD: WIN32_ERROR = 8652u32;
+pub const ERROR_DS_POLICY_NOT_KNOWN: WIN32_ERROR = 8618u32;
+pub const ERROR_DS_PROTOCOL_ERROR: WIN32_ERROR = 8225u32;
+pub const ERROR_DS_RANGE_CONSTRAINT: WIN32_ERROR = 8322u32;
+pub const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA: WIN32_ERROR = 8307u32;
+pub const ERROR_DS_RECALCSCHEMA_FAILED: WIN32_ERROR = 8396u32;
+pub const ERROR_DS_REFERRAL: WIN32_ERROR = 8235u32;
+pub const ERROR_DS_REFERRAL_LIMIT_EXCEEDED: WIN32_ERROR = 8260u32;
+pub const ERROR_DS_REFUSING_FSMO_ROLES: WIN32_ERROR = 8433u32;
+pub const ERROR_DS_REMOTE_CROSSREF_OP_FAILED: WIN32_ERROR = 8601u32;
+pub const ERROR_DS_REPLICATOR_ONLY: WIN32_ERROR = 8370u32;
+pub const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR: WIN32_ERROR = 8595u32;
+pub const ERROR_DS_REPL_LIFETIME_EXCEEDED: WIN32_ERROR = 8614u32;
+pub const ERROR_DS_RESERVED_LINK_ID: WIN32_ERROR = 8576u32;
+pub const ERROR_DS_RESERVED_MAPI_ID: WIN32_ERROR = 8631u32;
+pub const ERROR_DS_RIDMGR_DISABLED: WIN32_ERROR = 8263u32;
+pub const ERROR_DS_RIDMGR_INIT_ERROR: WIN32_ERROR = 8211u32;
+pub const ERROR_DS_ROLE_NOT_VERIFIED: WIN32_ERROR = 8610u32;
+pub const ERROR_DS_ROOT_CANT_BE_SUBREF: WIN32_ERROR = 8326u32;
+pub const ERROR_DS_ROOT_MUST_BE_NC: WIN32_ERROR = 8301u32;
+pub const ERROR_DS_ROOT_REQUIRES_CLASS_TOP: WIN32_ERROR = 8432u32;
+pub const ERROR_DS_SAM_INIT_FAILURE: WIN32_ERROR = 8504u32;
+pub const ERROR_DS_SAM_INIT_FAILURE_CONSOLE: WIN32_ERROR = 8562u32;
+pub const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY: WIN32_ERROR = 8530u32;
+pub const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD: WIN32_ERROR = 8529u32;
+pub const ERROR_DS_SCHEMA_ALLOC_FAILED: WIN32_ERROR = 8415u32;
+pub const ERROR_DS_SCHEMA_NOT_LOADED: WIN32_ERROR = 8414u32;
+pub const ERROR_DS_SCHEMA_UPDATE_DISALLOWED: WIN32_ERROR = 8509u32;
+pub const ERROR_DS_SECURITY_CHECKING_ERROR: WIN32_ERROR = 8413u32;
+pub const ERROR_DS_SECURITY_ILLEGAL_MODIFY: WIN32_ERROR = 8423u32;
+pub const ERROR_DS_SEC_DESC_INVALID: WIN32_ERROR = 8354u32;
+pub const ERROR_DS_SEC_DESC_TOO_SHORT: WIN32_ERROR = 8353u32;
+pub const ERROR_DS_SEMANTIC_ATT_TEST: WIN32_ERROR = 8383u32;
+pub const ERROR_DS_SENSITIVE_GROUP_VIOLATION: WIN32_ERROR = 8505u32;
+pub const ERROR_DS_SERVER_DOWN: WIN32_ERROR = 8250u32;
+pub const ERROR_DS_SHUTTING_DOWN: WIN32_ERROR = 8364u32;
+pub const ERROR_DS_SINGLE_USER_MODE_FAILED: WIN32_ERROR = 8590u32;
+pub const ERROR_DS_SINGLE_VALUE_CONSTRAINT: WIN32_ERROR = 8321u32;
+pub const ERROR_DS_SIZELIMIT_EXCEEDED: WIN32_ERROR = 8227u32;
+pub const ERROR_DS_SORT_CONTROL_MISSING: WIN32_ERROR = 8261u32;
+pub const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED: WIN32_ERROR = 8552u32;
+pub const ERROR_DS_SOURCE_DOMAIN_IN_FOREST: WIN32_ERROR = 8534u32;
+pub const ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST: WIN32_ERROR = 8647u32;
+pub const ERROR_DS_SRC_AND_DST_NC_IDENTICAL: WIN32_ERROR = 8485u32;
+pub const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH: WIN32_ERROR = 8540u32;
+pub const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER: WIN32_ERROR = 8559u32;
+pub const ERROR_DS_SRC_GUID_MISMATCH: WIN32_ERROR = 8488u32;
+pub const ERROR_DS_SRC_NAME_MISMATCH: WIN32_ERROR = 8484u32;
+pub const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER: WIN32_ERROR = 8538u32;
+pub const ERROR_DS_SRC_SID_EXISTS_IN_FOREST: WIN32_ERROR = 8539u32;
+pub const ERROR_DS_STRING_SD_CONVERSION_FAILED: WIN32_ERROR = 8522u32;
+pub const ERROR_DS_STRONG_AUTH_REQUIRED: WIN32_ERROR = 8232u32;
+pub const ERROR_DS_SUBREF_MUST_HAVE_PARENT: WIN32_ERROR = 8356u32;
+pub const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD: WIN32_ERROR = 8376u32;
+pub const ERROR_DS_SUB_CLS_TEST_FAIL: WIN32_ERROR = 8391u32;
+pub const ERROR_DS_SYNTAX_MISMATCH: WIN32_ERROR = 8384u32;
+pub const ERROR_DS_THREAD_LIMIT_EXCEEDED: WIN32_ERROR = 8587u32;
+pub const ERROR_DS_TIMELIMIT_EXCEEDED: WIN32_ERROR = 8226u32;
+pub const ERROR_DS_TREE_DELETE_NOT_FINISHED: WIN32_ERROR = 8397u32;
+pub const ERROR_DS_UNABLE_TO_SURRENDER_ROLES: WIN32_ERROR = 8435u32;
+pub const ERROR_DS_UNAVAILABLE: WIN32_ERROR = 8207u32;
+pub const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION: WIN32_ERROR = 8236u32;
+pub const ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED: WIN32_ERROR = 8645u32;
+pub const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES: WIN32_ERROR = 8556u32;
+pub const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: WIN32_ERROR = 8518u32;
+pub const ERROR_DS_UNKNOWN_ERROR: WIN32_ERROR = 8431u32;
+pub const ERROR_DS_UNKNOWN_OPERATION: WIN32_ERROR = 8365u32;
+pub const ERROR_DS_UNWILLING_TO_PERFORM: WIN32_ERROR = 8245u32;
+pub const ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST: WIN32_ERROR = 8648u32;
+pub const ERROR_DS_USER_BUFFER_TO_SMALL: WIN32_ERROR = 8309u32;
+pub const ERROR_DS_VALUE_KEY_NOT_UNIQUE: WIN32_ERROR = 8650u32;
+pub const ERROR_DS_VERSION_CHECK_FAILURE: WIN32_ERROR = 643u32;
+pub const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL: WIN32_ERROR = 8611u32;
+pub const ERROR_DS_WRONG_LINKED_ATT_SYNTAX: WIN32_ERROR = 8528u32;
+pub const ERROR_DS_WRONG_OM_OBJ_CLASS: WIN32_ERROR = 8476u32;
+pub const ERROR_DUPLICATE_PRIVILEGES: WIN32_ERROR = 311u32;
+pub const ERROR_DUPLICATE_SERVICE_NAME: WIN32_ERROR = 1078u32;
+pub const ERROR_DUP_DOMAINNAME: WIN32_ERROR = 1221u32;
+pub const ERROR_DUP_NAME: WIN32_ERROR = 52u32;
+pub const ERROR_DYNAMIC_CODE_BLOCKED: WIN32_ERROR = 1655u32;
+pub const ERROR_DYNLINK_FROM_INVALID_RING: WIN32_ERROR = 196u32;
+pub const ERROR_EAS_DIDNT_FIT: WIN32_ERROR = 275u32;
+pub const ERROR_EAS_NOT_SUPPORTED: WIN32_ERROR = 282u32;
+pub const ERROR_EA_ACCESS_DENIED: WIN32_ERROR = 994u32;
+pub const ERROR_EA_FILE_CORRUPT: WIN32_ERROR = 276u32;
+pub const ERROR_EA_LIST_INCONSISTENT: WIN32_ERROR = 255u32;
+pub const ERROR_EA_TABLE_FULL: WIN32_ERROR = 277u32;
+pub const ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED: WIN32_ERROR = 357u32;
+pub const ERROR_EDP_POLICY_DENIES_OPERATION: WIN32_ERROR = 356u32;
+pub const ERROR_EFS_ALG_BLOB_TOO_BIG: WIN32_ERROR = 6013u32;
+pub const ERROR_EFS_DISABLED: WIN32_ERROR = 6015u32;
+pub const ERROR_EFS_SERVER_NOT_TRUSTED: WIN32_ERROR = 6011u32;
+pub const ERROR_EFS_VERSION_NOT_SUPPORT: WIN32_ERROR = 6016u32;
+pub const ERROR_ELEVATION_REQUIRED: WIN32_ERROR = 740u32;
+pub const ERROR_ENCLAVE_FAILURE: WIN32_ERROR = 349u32;
+pub const ERROR_ENCLAVE_NOT_TERMINATED: WIN32_ERROR = 814u32;
+pub const ERROR_ENCLAVE_VIOLATION: WIN32_ERROR = 815u32;
+pub const ERROR_ENCRYPTED_FILE_NOT_SUPPORTED: WIN32_ERROR = 489u32;
+pub const ERROR_ENCRYPTED_IO_NOT_POSSIBLE: WIN32_ERROR = 808u32;
+pub const ERROR_ENCRYPTING_METADATA_DISALLOWED: WIN32_ERROR = 431u32;
+pub const ERROR_ENCRYPTION_DISABLED: WIN32_ERROR = 430u32;
+pub const ERROR_ENCRYPTION_FAILED: WIN32_ERROR = 6000u32;
+pub const ERROR_ENCRYPTION_POLICY_DENIES_OPERATION: WIN32_ERROR = 6022u32;
+pub const ERROR_END_OF_MEDIA: WIN32_ERROR = 1100u32;
+pub const ERROR_ENVVAR_NOT_FOUND: WIN32_ERROR = 203u32;
+pub const ERROR_EOM_OVERFLOW: WIN32_ERROR = 1129u32;
+pub const ERROR_ERRORS_ENCOUNTERED: WIN32_ERROR = 774u32;
+pub const ERROR_EVALUATION_EXPIRATION: WIN32_ERROR = 622u32;
+pub const ERROR_EVENTLOG_CANT_START: WIN32_ERROR = 1501u32;
+pub const ERROR_EVENTLOG_FILE_CHANGED: WIN32_ERROR = 1503u32;
+pub const ERROR_EVENTLOG_FILE_CORRUPT: WIN32_ERROR = 1500u32;
+pub const ERROR_EVENT_DONE: WIN32_ERROR = 710u32;
+pub const ERROR_EVENT_PENDING: WIN32_ERROR = 711u32;
+pub const ERROR_EXCEPTION_IN_SERVICE: WIN32_ERROR = 1064u32;
+pub const ERROR_EXCL_SEM_ALREADY_OWNED: WIN32_ERROR = 101u32;
+pub const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY: WIN32_ERROR = 217u32;
+pub const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY: WIN32_ERROR = 218u32;
+pub const ERROR_EXE_MACHINE_TYPE_MISMATCH: WIN32_ERROR = 216u32;
+pub const ERROR_EXE_MARKED_INVALID: WIN32_ERROR = 192u32;
+pub const ERROR_EXTENDED_ERROR: WIN32_ERROR = 1208u32;
+pub const ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN: WIN32_ERROR = 343u32;
+pub const ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED: WIN32_ERROR = 399u32;
+pub const ERROR_EXTRANEOUS_INFORMATION: WIN32_ERROR = 677u32;
+pub const ERROR_FAILED_DRIVER_ENTRY: WIN32_ERROR = 647u32;
+pub const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: WIN32_ERROR = 1063u32;
+pub const ERROR_FAIL_FAST_EXCEPTION: WIN32_ERROR = 1653u32;
+pub const ERROR_FAIL_I24: WIN32_ERROR = 83u32;
+pub const ERROR_FAIL_NOACTION_REBOOT: WIN32_ERROR = 350u32;
+pub const ERROR_FAIL_RESTART: WIN32_ERROR = 352u32;
+pub const ERROR_FAIL_SHUTDOWN: WIN32_ERROR = 351u32;
+pub const ERROR_FATAL_APP_EXIT: WIN32_ERROR = 713u32;
+pub const ERROR_FILEMARK_DETECTED: WIN32_ERROR = 1101u32;
+pub const ERROR_FILENAME_EXCED_RANGE: WIN32_ERROR = 206u32;
+pub const ERROR_FILE_CHECKED_OUT: WIN32_ERROR = 220u32;
+pub const ERROR_FILE_CORRUPT: WIN32_ERROR = 1392u32;
+pub const ERROR_FILE_ENCRYPTED: WIN32_ERROR = 6002u32;
+pub const ERROR_FILE_EXISTS: WIN32_ERROR = 80u32;
+pub const ERROR_FILE_HANDLE_REVOKED: WIN32_ERROR = 806u32;
+pub const ERROR_FILE_INVALID: WIN32_ERROR = 1006u32;
+pub const ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED: WIN32_ERROR = 326u32;
+pub const ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS: WIN32_ERROR = 809u32;
+pub const ERROR_FILE_NOT_ENCRYPTED: WIN32_ERROR = 6007u32;
+pub const ERROR_FILE_NOT_FOUND: WIN32_ERROR = 2u32;
+pub const ERROR_FILE_NOT_SUPPORTED: WIN32_ERROR = 425u32;
+pub const ERROR_FILE_OFFLINE: WIN32_ERROR = 4350u32;
+pub const ERROR_FILE_PROTECTED_UNDER_DPL: WIN32_ERROR = 406u32;
+pub const ERROR_FILE_READ_ONLY: WIN32_ERROR = 6009u32;
+pub const ERROR_FILE_SNAP_INVALID_PARAMETER: WIN32_ERROR = 440u32;
+pub const ERROR_FILE_SNAP_IN_PROGRESS: WIN32_ERROR = 435u32;
+pub const ERROR_FILE_SNAP_IO_NOT_COORDINATED: WIN32_ERROR = 438u32;
+pub const ERROR_FILE_SNAP_MODIFY_NOT_SUPPORTED: WIN32_ERROR = 437u32;
+pub const ERROR_FILE_SNAP_UNEXPECTED_ERROR: WIN32_ERROR = 439u32;
+pub const ERROR_FILE_SNAP_USER_SECTION_NOT_SUPPORTED: WIN32_ERROR = 436u32;
+pub const ERROR_FILE_SYSTEM_LIMITATION: WIN32_ERROR = 665u32;
+pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY: WIN32_ERROR = 371u32;
+pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION: WIN32_ERROR = 385u32;
+pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT: WIN32_ERROR = 370u32;
+pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN: WIN32_ERROR = 372u32;
+pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE: WIN32_ERROR = 369u32;
+pub const ERROR_FILE_TOO_LARGE: WIN32_ERROR = 223u32;
+pub const ERROR_FIRMWARE_UPDATED: WIN32_ERROR = 728u32;
+pub const ERROR_FLOAT_MULTIPLE_FAULTS: WIN32_ERROR = 630u32;
+pub const ERROR_FLOAT_MULTIPLE_TRAPS: WIN32_ERROR = 631u32;
+pub const ERROR_FLOPPY_BAD_REGISTERS: WIN32_ERROR = 1125u32;
+pub const ERROR_FLOPPY_ID_MARK_NOT_FOUND: WIN32_ERROR = 1122u32;
+pub const ERROR_FLOPPY_UNKNOWN_ERROR: WIN32_ERROR = 1124u32;
+pub const ERROR_FLOPPY_VOLUME: WIN32_ERROR = 584u32;
+pub const ERROR_FLOPPY_WRONG_CYLINDER: WIN32_ERROR = 1123u32;
+pub const ERROR_FORMS_AUTH_REQUIRED: WIN32_ERROR = 224u32;
+pub const ERROR_FOUND_OUT_OF_SCOPE: WIN32_ERROR = 601u32;
+pub const ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY: WIN32_ERROR = 762u32;
+pub const ERROR_FS_DRIVER_REQUIRED: WIN32_ERROR = 588u32;
+pub const ERROR_FS_METADATA_INCONSISTENT: WIN32_ERROR = 510u32;
+pub const ERROR_FT_DI_SCAN_REQUIRED: WIN32_ERROR = 339u32;
+pub const ERROR_FT_READ_FAILURE: WIN32_ERROR = 415u32;
+pub const ERROR_FT_READ_FROM_COPY_FAILURE: WIN32_ERROR = 818u32;
+pub const ERROR_FT_READ_RECOVERY_FROM_BACKUP: WIN32_ERROR = 704u32;
+pub const ERROR_FT_WRITE_FAILURE: WIN32_ERROR = 338u32;
+pub const ERROR_FT_WRITE_RECOVERY: WIN32_ERROR = 705u32;
+pub const ERROR_FULLSCREEN_MODE: WIN32_ERROR = 1007u32;
+pub const ERROR_FUNCTION_FAILED: WIN32_ERROR = 1627u32;
+pub const ERROR_FUNCTION_NOT_CALLED: WIN32_ERROR = 1626u32;
+pub const ERROR_GDI_HANDLE_LEAK: WIN32_ERROR = 373u32;
+pub const ERROR_GENERIC_NOT_MAPPED: WIN32_ERROR = 1360u32;
+pub const ERROR_GEN_FAILURE: WIN32_ERROR = 31u32;
+pub const ERROR_GLOBAL_ONLY_HOOK: WIN32_ERROR = 1429u32;
+pub const ERROR_GRACEFUL_DISCONNECT: WIN32_ERROR = 1226u32;
+pub const ERROR_GROUP_EXISTS: WIN32_ERROR = 1318u32;
+pub const ERROR_GUID_SUBSTITUTION_MADE: WIN32_ERROR = 680u32;
+pub const ERROR_HANDLES_CLOSED: WIN32_ERROR = 676u32;
+pub const ERROR_HANDLE_DISK_FULL: WIN32_ERROR = 39u32;
+pub const ERROR_HANDLE_EOF: WIN32_ERROR = 38u32;
+pub const ERROR_HANDLE_REVOKED: WIN32_ERROR = 811u32;
+pub const ERROR_HAS_SYSTEM_CRITICAL_FILES: WIN32_ERROR = 488u32;
+pub const ERROR_HIBERNATED: WIN32_ERROR = 726u32;
+pub const ERROR_HIBERNATION_FAILURE: WIN32_ERROR = 656u32;
+pub const ERROR_HOOK_NEEDS_HMOD: WIN32_ERROR = 1428u32;
+pub const ERROR_HOOK_NOT_INSTALLED: WIN32_ERROR = 1431u32;
+pub const ERROR_HOOK_TYPE_NOT_ALLOWED: WIN32_ERROR = 1458u32;
+pub const ERROR_HOST_DOWN: WIN32_ERROR = 1256u32;
+pub const ERROR_HOST_UNREACHABLE: WIN32_ERROR = 1232u32;
+pub const ERROR_HOTKEY_ALREADY_REGISTERED: WIN32_ERROR = 1409u32;
+pub const ERROR_HOTKEY_NOT_REGISTERED: WIN32_ERROR = 1419u32;
+pub const ERROR_HWNDS_HAVE_DIFF_PARENT: WIN32_ERROR = 1441u32;
+pub const ERROR_ILLEGAL_CHARACTER: WIN32_ERROR = 582u32;
+pub const ERROR_ILLEGAL_DLL_RELOCATION: WIN32_ERROR = 623u32;
+pub const ERROR_ILLEGAL_ELEMENT_ADDRESS: WIN32_ERROR = 1162u32;
+pub const ERROR_ILLEGAL_FLOAT_CONTEXT: WIN32_ERROR = 579u32;
+pub const ERROR_ILL_FORMED_PASSWORD: WIN32_ERROR = 1324u32;
+pub const ERROR_IMAGE_AT_DIFFERENT_BASE: WIN32_ERROR = 807u32;
+pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH: WIN32_ERROR = 706u32;
+pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE: WIN32_ERROR = 720u32;
+pub const ERROR_IMAGE_NOT_AT_BASE: WIN32_ERROR = 700u32;
+pub const ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT: WIN32_ERROR = 308u32;
+pub const ERROR_IMPLEMENTATION_LIMIT: WIN32_ERROR = 1292u32;
+pub const ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE: WIN32_ERROR = 1297u32;
+pub const ERROR_INCOMPATIBLE_SERVICE_SID_TYPE: WIN32_ERROR = 1290u32;
+pub const ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: WIN32_ERROR = 304u32;
+pub const ERROR_INCORRECT_ACCOUNT_TYPE: WIN32_ERROR = 8646u32;
+pub const ERROR_INCORRECT_ADDRESS: WIN32_ERROR = 1241u32;
+pub const ERROR_INCORRECT_SIZE: WIN32_ERROR = 1462u32;
+pub const ERROR_INDEX_ABSENT: WIN32_ERROR = 1611u32;
+pub const ERROR_INDEX_OUT_OF_BOUNDS: WIN32_ERROR = 474u32;
+pub const ERROR_INFLOOP_IN_RELOC_CHAIN: WIN32_ERROR = 202u32;
+pub const ERROR_INSTALL_ALREADY_RUNNING: WIN32_ERROR = 1618u32;
+pub const ERROR_INSTALL_FAILURE: WIN32_ERROR = 1603u32;
+pub const ERROR_INSTALL_LANGUAGE_UNSUPPORTED: WIN32_ERROR = 1623u32;
+pub const ERROR_INSTALL_LOG_FAILURE: WIN32_ERROR = 1622u32;
+pub const ERROR_INSTALL_NOTUSED: WIN32_ERROR = 1634u32;
+pub const ERROR_INSTALL_PACKAGE_INVALID: WIN32_ERROR = 1620u32;
+pub const ERROR_INSTALL_PACKAGE_OPEN_FAILED: WIN32_ERROR = 1619u32;
+pub const ERROR_INSTALL_PACKAGE_REJECTED: WIN32_ERROR = 1625u32;
+pub const ERROR_INSTALL_PACKAGE_VERSION: WIN32_ERROR = 1613u32;
+pub const ERROR_INSTALL_PLATFORM_UNSUPPORTED: WIN32_ERROR = 1633u32;
+pub const ERROR_INSTALL_REJECTED: WIN32_ERROR = 1654u32;
+pub const ERROR_INSTALL_REMOTE_DISALLOWED: WIN32_ERROR = 1640u32;
+pub const ERROR_INSTALL_REMOTE_PROHIBITED: WIN32_ERROR = 1645u32;
+pub const ERROR_INSTALL_SERVICE_FAILURE: WIN32_ERROR = 1601u32;
+pub const ERROR_INSTALL_SERVICE_SAFEBOOT: WIN32_ERROR = 1652u32;
+pub const ERROR_INSTALL_SOURCE_ABSENT: WIN32_ERROR = 1612u32;
+pub const ERROR_INSTALL_SUSPEND: WIN32_ERROR = 1604u32;
+pub const ERROR_INSTALL_TEMP_UNWRITABLE: WIN32_ERROR = 1632u32;
+pub const ERROR_INSTALL_TRANSFORM_FAILURE: WIN32_ERROR = 1624u32;
+pub const ERROR_INSTALL_TRANSFORM_REJECTED: WIN32_ERROR = 1644u32;
+pub const ERROR_INSTALL_UI_FAILURE: WIN32_ERROR = 1621u32;
+pub const ERROR_INSTALL_USEREXIT: WIN32_ERROR = 1602u32;
+pub const ERROR_INSTRUCTION_MISALIGNMENT: WIN32_ERROR = 549u32;
+pub const ERROR_INSUFFICIENT_BUFFER: WIN32_ERROR = 122u32;
+pub const ERROR_INSUFFICIENT_LOGON_INFO: WIN32_ERROR = 608u32;
+pub const ERROR_INSUFFICIENT_POWER: WIN32_ERROR = 639u32;
+pub const ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: WIN32_ERROR = 781u32;
+pub const ERROR_INSUFFICIENT_VIRTUAL_ADDR_RESOURCES: WIN32_ERROR = 473u32;
+pub const ERROR_INTERMIXED_KERNEL_EA_OPERATION: WIN32_ERROR = 324u32;
+pub const ERROR_INTERNAL_DB_CORRUPTION: WIN32_ERROR = 1358u32;
+pub const ERROR_INTERNAL_DB_ERROR: WIN32_ERROR = 1383u32;
+pub const ERROR_INTERNAL_ERROR: WIN32_ERROR = 1359u32;
+pub const ERROR_INTERRUPT_STILL_CONNECTED: WIN32_ERROR = 764u32;
+pub const ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED: WIN32_ERROR = 763u32;
+pub const ERROR_INVALID_ACCEL_HANDLE: WIN32_ERROR = 1403u32;
+pub const ERROR_INVALID_ACCESS: WIN32_ERROR = 12u32;
+pub const ERROR_INVALID_ACCOUNT_NAME: WIN32_ERROR = 1315u32;
+pub const ERROR_INVALID_ACE_CONDITION: WIN32_ERROR = 805u32;
+pub const ERROR_INVALID_ACL: WIN32_ERROR = 1336u32;
+pub const ERROR_INVALID_ADDRESS: WIN32_ERROR = 487u32;
+pub const ERROR_INVALID_AT_INTERRUPT_TIME: WIN32_ERROR = 104u32;
+pub const ERROR_INVALID_BLOCK: WIN32_ERROR = 9u32;
+pub const ERROR_INVALID_BLOCK_LENGTH: WIN32_ERROR = 1106u32;
+pub const ERROR_INVALID_CAP: WIN32_ERROR = 320u32;
+pub const ERROR_INVALID_CATEGORY: WIN32_ERROR = 117u32;
+pub const ERROR_INVALID_COMBOBOX_MESSAGE: WIN32_ERROR = 1422u32;
+pub const ERROR_INVALID_COMMAND_LINE: WIN32_ERROR = 1639u32;
+pub const ERROR_INVALID_COMPUTERNAME: WIN32_ERROR = 1210u32;
+pub const ERROR_INVALID_CRUNTIME_PARAMETER: WIN32_ERROR = 1288u32;
+pub const ERROR_INVALID_CURSOR_HANDLE: WIN32_ERROR = 1402u32;
+pub const ERROR_INVALID_DATA: WIN32_ERROR = 13u32;
+pub const ERROR_INVALID_DATATYPE: WIN32_ERROR = 1804u32;
+pub const ERROR_INVALID_DEVICE_OBJECT_PARAMETER: WIN32_ERROR = 650u32;
+pub const ERROR_INVALID_DLL: WIN32_ERROR = 1154u32;
+pub const ERROR_INVALID_DOMAINNAME: WIN32_ERROR = 1212u32;
+pub const ERROR_INVALID_DOMAIN_ROLE: WIN32_ERROR = 1354u32;
+pub const ERROR_INVALID_DOMAIN_STATE: WIN32_ERROR = 1353u32;
+pub const ERROR_INVALID_DRIVE: WIN32_ERROR = 15u32;
+pub const ERROR_INVALID_DWP_HANDLE: WIN32_ERROR = 1405u32;
+pub const ERROR_INVALID_EA_HANDLE: WIN32_ERROR = 278u32;
+pub const ERROR_INVALID_EA_NAME: WIN32_ERROR = 254u32;
+pub const ERROR_INVALID_EDIT_HEIGHT: WIN32_ERROR = 1424u32;
+pub const ERROR_INVALID_ENVIRONMENT: WIN32_ERROR = 1805u32;
+pub const ERROR_INVALID_EVENTNAME: WIN32_ERROR = 1211u32;
+pub const ERROR_INVALID_EVENT_COUNT: WIN32_ERROR = 151u32;
+pub const ERROR_INVALID_EXCEPTION_HANDLER: WIN32_ERROR = 310u32;
+pub const ERROR_INVALID_EXE_SIGNATURE: WIN32_ERROR = 191u32;
+pub const ERROR_INVALID_FIELD: WIN32_ERROR = 1616u32;
+pub const ERROR_INVALID_FIELD_IN_PARAMETER_LIST: WIN32_ERROR = 328u32;
+pub const ERROR_INVALID_FILTER_PROC: WIN32_ERROR = 1427u32;
+pub const ERROR_INVALID_FLAGS: WIN32_ERROR = 1004u32;
+pub const ERROR_INVALID_FLAG_NUMBER: WIN32_ERROR = 186u32;
+pub const ERROR_INVALID_FORM_NAME: WIN32_ERROR = 1902u32;
+pub const ERROR_INVALID_FORM_SIZE: WIN32_ERROR = 1903u32;
+pub const ERROR_INVALID_FUNCTION: WIN32_ERROR = 1u32;
+pub const ERROR_INVALID_GROUPNAME: WIN32_ERROR = 1209u32;
+pub const ERROR_INVALID_GROUP_ATTRIBUTES: WIN32_ERROR = 1345u32;
+pub const ERROR_INVALID_GW_COMMAND: WIN32_ERROR = 1443u32;
+pub const ERROR_INVALID_HANDLE: WIN32_ERROR = 6u32;
+pub const ERROR_INVALID_HANDLE_STATE: WIN32_ERROR = 1609u32;
+pub const ERROR_INVALID_HOOK_FILTER: WIN32_ERROR = 1426u32;
+pub const ERROR_INVALID_HOOK_HANDLE: WIN32_ERROR = 1404u32;
+pub const ERROR_INVALID_HW_PROFILE: WIN32_ERROR = 619u32;
+pub const ERROR_INVALID_ICON_HANDLE: WIN32_ERROR = 1414u32;
+pub const ERROR_INVALID_ID_AUTHORITY: WIN32_ERROR = 1343u32;
+pub const ERROR_INVALID_IMAGE_HASH: WIN32_ERROR = 577u32;
+pub const ERROR_INVALID_IMPORT_OF_NON_DLL: WIN32_ERROR = 1276u32;
+pub const ERROR_INVALID_INDEX: WIN32_ERROR = 1413u32;
+pub const ERROR_INVALID_KERNEL_INFO_VERSION: WIN32_ERROR = 340u32;
+pub const ERROR_INVALID_KEYBOARD_HANDLE: WIN32_ERROR = 1457u32;
+pub const ERROR_INVALID_LABEL: WIN32_ERROR = 1299u32;
+pub const ERROR_INVALID_LB_MESSAGE: WIN32_ERROR = 1432u32;
+pub const ERROR_INVALID_LDT_DESCRIPTOR: WIN32_ERROR = 564u32;
+pub const ERROR_INVALID_LDT_OFFSET: WIN32_ERROR = 563u32;
+pub const ERROR_INVALID_LDT_SIZE: WIN32_ERROR = 561u32;
+pub const ERROR_INVALID_LEVEL: WIN32_ERROR = 124u32;
+pub const ERROR_INVALID_LIST_FORMAT: WIN32_ERROR = 153u32;
+pub const ERROR_INVALID_LOCK_RANGE: WIN32_ERROR = 307u32;
+pub const ERROR_INVALID_LOGON_HOURS: WIN32_ERROR = 1328u32;
+pub const ERROR_INVALID_LOGON_TYPE: WIN32_ERROR = 1367u32;
+pub const ERROR_INVALID_MEMBER: WIN32_ERROR = 1388u32;
+pub const ERROR_INVALID_MENU_HANDLE: WIN32_ERROR = 1401u32;
+pub const ERROR_INVALID_MESSAGE: WIN32_ERROR = 1002u32;
+pub const ERROR_INVALID_MESSAGEDEST: WIN32_ERROR = 1218u32;
+pub const ERROR_INVALID_MESSAGENAME: WIN32_ERROR = 1217u32;
+pub const ERROR_INVALID_MINALLOCSIZE: WIN32_ERROR = 195u32;
+pub const ERROR_INVALID_MODULETYPE: WIN32_ERROR = 190u32;
+pub const ERROR_INVALID_MONITOR_HANDLE: WIN32_ERROR = 1461u32;
+pub const ERROR_INVALID_MSGBOX_STYLE: WIN32_ERROR = 1438u32;
+pub const ERROR_INVALID_NAME: WIN32_ERROR = 123u32;
+pub const ERROR_INVALID_NETNAME: WIN32_ERROR = 1214u32;
+pub const ERROR_INVALID_OPLOCK_PROTOCOL: WIN32_ERROR = 301u32;
+pub const ERROR_INVALID_ORDINAL: WIN32_ERROR = 182u32;
+pub const ERROR_INVALID_OWNER: WIN32_ERROR = 1307u32;
+pub const ERROR_INVALID_PACKAGE_SID_LENGTH: WIN32_ERROR = 4253u32;
+pub const ERROR_INVALID_PARAMETER: WIN32_ERROR = 87u32;
+pub const ERROR_INVALID_PASSWORD: WIN32_ERROR = 86u32;
+pub const ERROR_INVALID_PASSWORDNAME: WIN32_ERROR = 1216u32;
+pub const ERROR_INVALID_PATCH_XML: WIN32_ERROR = 1650u32;
+pub const ERROR_INVALID_PEP_INFO_VERSION: WIN32_ERROR = 341u32;
+pub const ERROR_INVALID_PLUGPLAY_DEVICE_PATH: WIN32_ERROR = 620u32;
+pub const ERROR_INVALID_PORT_ATTRIBUTES: WIN32_ERROR = 545u32;
+pub const ERROR_INVALID_PRIMARY_GROUP: WIN32_ERROR = 1308u32;
+pub const ERROR_INVALID_PRINTER_COMMAND: WIN32_ERROR = 1803u32;
+pub const ERROR_INVALID_PRINTER_NAME: WIN32_ERROR = 1801u32;
+pub const ERROR_INVALID_PRINTER_STATE: WIN32_ERROR = 1906u32;
+pub const ERROR_INVALID_PRIORITY: WIN32_ERROR = 1800u32;
+pub const ERROR_INVALID_QUOTA_LOWER: WIN32_ERROR = 547u32;
+pub const ERROR_INVALID_REPARSE_DATA: WIN32_ERROR = 4392u32;
+pub const ERROR_INVALID_SCROLLBAR_RANGE: WIN32_ERROR = 1448u32;
+pub const ERROR_INVALID_SECURITY_DESCR: WIN32_ERROR = 1338u32;
+pub const ERROR_INVALID_SEGDPL: WIN32_ERROR = 198u32;
+pub const ERROR_INVALID_SEGMENT_NUMBER: WIN32_ERROR = 180u32;
+pub const ERROR_INVALID_SEPARATOR_FILE: WIN32_ERROR = 1799u32;
+pub const ERROR_INVALID_SERVER_STATE: WIN32_ERROR = 1352u32;
+pub const ERROR_INVALID_SERVICENAME: WIN32_ERROR = 1213u32;
+pub const ERROR_INVALID_SERVICE_ACCOUNT: WIN32_ERROR = 1057u32;
+pub const ERROR_INVALID_SERVICE_CONTROL: WIN32_ERROR = 1052u32;
+pub const ERROR_INVALID_SERVICE_LOCK: WIN32_ERROR = 1071u32;
+pub const ERROR_INVALID_SHARENAME: WIN32_ERROR = 1215u32;
+pub const ERROR_INVALID_SHOWWIN_COMMAND: WIN32_ERROR = 1449u32;
+pub const ERROR_INVALID_SID: WIN32_ERROR = 1337u32;
+pub const ERROR_INVALID_SIGNAL_NUMBER: WIN32_ERROR = 209u32;
+pub const ERROR_INVALID_SPI_VALUE: WIN32_ERROR = 1439u32;
+pub const ERROR_INVALID_STACKSEG: WIN32_ERROR = 189u32;
+pub const ERROR_INVALID_STARTING_CODESEG: WIN32_ERROR = 188u32;
+pub const ERROR_INVALID_SUB_AUTHORITY: WIN32_ERROR = 1335u32;
+pub const ERROR_INVALID_TABLE: WIN32_ERROR = 1628u32;
+pub const ERROR_INVALID_TARGET_HANDLE: WIN32_ERROR = 114u32;
+pub const ERROR_INVALID_TASK_INDEX: WIN32_ERROR = 1551u32;
+pub const ERROR_INVALID_TASK_NAME: WIN32_ERROR = 1550u32;
+pub const ERROR_INVALID_THREAD_ID: WIN32_ERROR = 1444u32;
+pub const ERROR_INVALID_TIME: WIN32_ERROR = 1901u32;
+pub const ERROR_INVALID_TOKEN: WIN32_ERROR = 315u32;
+pub const ERROR_INVALID_UNWIND_TARGET: WIN32_ERROR = 544u32;
+pub const ERROR_INVALID_USER_BUFFER: WIN32_ERROR = 1784u32;
+pub const ERROR_INVALID_USER_PRINCIPAL_NAME: WIN32_ERROR = 8636u32;
+pub const ERROR_INVALID_VARIANT: WIN32_ERROR = 604u32;
+pub const ERROR_INVALID_VERIFY_SWITCH: WIN32_ERROR = 118u32;
+pub const ERROR_INVALID_WINDOW_HANDLE: WIN32_ERROR = 1400u32;
+pub const ERROR_INVALID_WORKSTATION: WIN32_ERROR = 1329u32;
+pub const ERROR_IOPL_NOT_ENABLED: WIN32_ERROR = 197u32;
+pub const ERROR_IO_DEVICE: WIN32_ERROR = 1117u32;
+pub const ERROR_IO_INCOMPLETE: WIN32_ERROR = 996u32;
+pub const ERROR_IO_PENDING: WIN32_ERROR = 997u32;
+pub const ERROR_IO_PRIVILEGE_FAILED: WIN32_ERROR = 571u32;
+pub const ERROR_IO_REISSUE_AS_CACHED: WIN32_ERROR = 3950u32;
+pub const ERROR_IPSEC_IKE_TIMED_OUT: WIN32_ERROR = 13805u32;
+pub const ERROR_IP_ADDRESS_CONFLICT1: WIN32_ERROR = 611u32;
+pub const ERROR_IP_ADDRESS_CONFLICT2: WIN32_ERROR = 612u32;
+pub const ERROR_IRQ_BUSY: WIN32_ERROR = 1119u32;
+pub const ERROR_IS_JOINED: WIN32_ERROR = 134u32;
+pub const ERROR_IS_JOIN_PATH: WIN32_ERROR = 147u32;
+pub const ERROR_IS_JOIN_TARGET: WIN32_ERROR = 133u32;
+pub const ERROR_IS_SUBSTED: WIN32_ERROR = 135u32;
+pub const ERROR_IS_SUBST_PATH: WIN32_ERROR = 146u32;
+pub const ERROR_IS_SUBST_TARGET: WIN32_ERROR = 149u32;
+pub const ERROR_ITERATED_DATA_EXCEEDS_64k: WIN32_ERROR = 194u32;
+pub const ERROR_JOB_NO_CONTAINER: WIN32_ERROR = 1505u32;
+pub const ERROR_JOIN_TO_JOIN: WIN32_ERROR = 138u32;
+pub const ERROR_JOIN_TO_SUBST: WIN32_ERROR = 140u32;
+pub const ERROR_JOURNAL_DELETE_IN_PROGRESS: WIN32_ERROR = 1178u32;
+pub const ERROR_JOURNAL_ENTRY_DELETED: WIN32_ERROR = 1181u32;
+pub const ERROR_JOURNAL_HOOK_SET: WIN32_ERROR = 1430u32;
+pub const ERROR_JOURNAL_NOT_ACTIVE: WIN32_ERROR = 1179u32;
+pub const ERROR_KERNEL_APC: WIN32_ERROR = 738u32;
+pub const ERROR_KEY_DELETED: WIN32_ERROR = 1018u32;
+pub const ERROR_KEY_HAS_CHILDREN: WIN32_ERROR = 1020u32;
+pub const ERROR_KM_DRIVER_BLOCKED: WIN32_ERROR = 1930u32;
+pub const ERROR_LABEL_TOO_LONG: WIN32_ERROR = 154u32;
+pub const ERROR_LAST_ADMIN: WIN32_ERROR = 1322u32;
+pub const ERROR_LB_WITHOUT_TABSTOPS: WIN32_ERROR = 1434u32;
+pub const ERROR_LICENSE_QUOTA_EXCEEDED: WIN32_ERROR = 1395u32;
+pub const ERROR_LINUX_SUBSYSTEM_NOT_PRESENT: WIN32_ERROR = 414u32;
+pub const ERROR_LINUX_SUBSYSTEM_UPDATE_REQUIRED: WIN32_ERROR = 444u32;
+pub const ERROR_LISTBOX_ID_NOT_FOUND: WIN32_ERROR = 1416u32;
+pub const ERROR_LM_CROSS_ENCRYPTION_REQUIRED: WIN32_ERROR = 1390u32;
+pub const ERROR_LOCAL_POLICY_MODIFICATION_NOT_SUPPORTED: WIN32_ERROR = 8653u32;
+pub const ERROR_LOCAL_USER_SESSION_KEY: WIN32_ERROR = 1303u32;
+pub const ERROR_LOCKED: WIN32_ERROR = 212u32;
+pub const ERROR_LOCK_FAILED: WIN32_ERROR = 167u32;
+pub const ERROR_LOCK_VIOLATION: WIN32_ERROR = 33u32;
+pub const ERROR_LOGIN_TIME_RESTRICTION: WIN32_ERROR = 1239u32;
+pub const ERROR_LOGIN_WKSTA_RESTRICTION: WIN32_ERROR = 1240u32;
+pub const ERROR_LOGON_FAILURE: WIN32_ERROR = 1326u32;
+pub const ERROR_LOGON_NOT_GRANTED: WIN32_ERROR = 1380u32;
+pub const ERROR_LOGON_SERVER_CONFLICT: WIN32_ERROR = 568u32;
+pub const ERROR_LOGON_SESSION_COLLISION: WIN32_ERROR = 1366u32;
+pub const ERROR_LOGON_SESSION_EXISTS: WIN32_ERROR = 1363u32;
+pub const ERROR_LOGON_TYPE_NOT_GRANTED: WIN32_ERROR = 1385u32;
+pub const ERROR_LOG_FILE_FULL: WIN32_ERROR = 1502u32;
+pub const ERROR_LOG_HARD_ERROR: WIN32_ERROR = 718u32;
+pub const ERROR_LONGJUMP: WIN32_ERROR = 682u32;
+pub const ERROR_LOST_MODE_LOGON_RESTRICTION: WIN32_ERROR = 1939u32;
+pub const ERROR_LOST_WRITEBEHIND_DATA: WIN32_ERROR = 596u32;
+pub const ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: WIN32_ERROR = 790u32;
+pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: WIN32_ERROR = 788u32;
+pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: WIN32_ERROR = 789u32;
+pub const ERROR_LUIDS_EXHAUSTED: WIN32_ERROR = 1334u32;
+pub const ERROR_MACHINE_LOCKED: WIN32_ERROR = 1271u32;
+pub const ERROR_MAGAZINE_NOT_PRESENT: WIN32_ERROR = 1163u32;
+pub const ERROR_MAPPED_ALIGNMENT: WIN32_ERROR = 1132u32;
+pub const ERROR_MARKED_TO_DISALLOW_WRITES: WIN32_ERROR = 348u32;
+pub const ERROR_MARSHALL_OVERFLOW: WIN32_ERROR = 603u32;
+pub const ERROR_MAX_SESSIONS_REACHED: WIN32_ERROR = 353u32;
+pub const ERROR_MAX_THRDS_REACHED: WIN32_ERROR = 164u32;
+pub const ERROR_MCA_EXCEPTION: WIN32_ERROR = 784u32;
+pub const ERROR_MCA_OCCURED: WIN32_ERROR = 651u32;
+pub const ERROR_MEDIA_CHANGED: WIN32_ERROR = 1110u32;
+pub const ERROR_MEDIA_CHECK: WIN32_ERROR = 679u32;
+pub const ERROR_MEMBERS_PRIMARY_GROUP: WIN32_ERROR = 1374u32;
+pub const ERROR_MEMBER_IN_ALIAS: WIN32_ERROR = 1378u32;
+pub const ERROR_MEMBER_IN_GROUP: WIN32_ERROR = 1320u32;
+pub const ERROR_MEMBER_NOT_IN_ALIAS: WIN32_ERROR = 1377u32;
+pub const ERROR_MEMBER_NOT_IN_GROUP: WIN32_ERROR = 1321u32;
+pub const ERROR_MEMORY_HARDWARE: WIN32_ERROR = 779u32;
+pub const ERROR_MENU_ITEM_NOT_FOUND: WIN32_ERROR = 1456u32;
+pub const ERROR_MESSAGE_SYNC_ONLY: WIN32_ERROR = 1159u32;
+pub const ERROR_META_EXPANSION_TOO_LONG: WIN32_ERROR = 208u32;
+pub const ERROR_MISSING_SYSTEMFILE: WIN32_ERROR = 573u32;
+pub const ERROR_MOD_NOT_FOUND: WIN32_ERROR = 126u32;
+pub const ERROR_MORE_DATA: WIN32_ERROR = 234u32;
+pub const ERROR_MORE_WRITES: WIN32_ERROR = 1120u32;
+pub const ERROR_MOUNT_POINT_NOT_RESOLVED: WIN32_ERROR = 649u32;
+pub const ERROR_MP_PROCESSOR_MISMATCH: WIN32_ERROR = 725u32;
+pub const ERROR_MR_MID_NOT_FOUND: WIN32_ERROR = 317u32;
+pub const ERROR_MULTIPLE_FAULT_VIOLATION: WIN32_ERROR = 640u32;
+pub const ERROR_MUTANT_LIMIT_EXCEEDED: WIN32_ERROR = 587u32;
+pub const ERROR_MUTUAL_AUTH_FAILED: WIN32_ERROR = 1397u32;
+pub const ERROR_NEGATIVE_SEEK: WIN32_ERROR = 131u32;
+pub const ERROR_NESTING_NOT_ALLOWED: WIN32_ERROR = 215u32;
+pub const ERROR_NETLOGON_NOT_STARTED: WIN32_ERROR = 1792u32;
+pub const ERROR_NETNAME_DELETED: WIN32_ERROR = 64u32;
+pub const ERROR_NETWORK_ACCESS_DENIED: WIN32_ERROR = 65u32;
+pub const ERROR_NETWORK_ACCESS_DENIED_EDP: WIN32_ERROR = 354u32;
+pub const ERROR_NETWORK_BUSY: WIN32_ERROR = 54u32;
+pub const ERROR_NETWORK_UNREACHABLE: WIN32_ERROR = 1231u32;
+pub const ERROR_NET_OPEN_FAILED: WIN32_ERROR = 570u32;
+pub const ERROR_NET_WRITE_FAULT: WIN32_ERROR = 88u32;
+pub const ERROR_NOACCESS: WIN32_ERROR = 998u32;
+pub const ERROR_NOINTERFACE: WIN32_ERROR = 632u32;
+pub const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: WIN32_ERROR = 1807u32;
+pub const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT: WIN32_ERROR = 1809u32;
+pub const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT: WIN32_ERROR = 1808u32;
+pub const ERROR_NONE_MAPPED: WIN32_ERROR = 1332u32;
+pub const ERROR_NONPAGED_SYSTEM_RESOURCES: WIN32_ERROR = 1451u32;
+pub const ERROR_NON_ACCOUNT_SID: WIN32_ERROR = 1257u32;
+pub const ERROR_NON_DOMAIN_SID: WIN32_ERROR = 1258u32;
+pub const ERROR_NON_MDICHILD_WINDOW: WIN32_ERROR = 1445u32;
+pub const ERROR_NOTHING_TO_TERMINATE: WIN32_ERROR = 758u32;
+pub const ERROR_NOTIFICATION_GUID_ALREADY_DEFINED: WIN32_ERROR = 309u32;
+pub const ERROR_NOTIFY_CLEANUP: WIN32_ERROR = 745u32;
+pub const ERROR_NOTIFY_ENUM_DIR: WIN32_ERROR = 1022u32;
+pub const ERROR_NOT_ALLOWED_ON_SYSTEM_FILE: WIN32_ERROR = 313u32;
+pub const ERROR_NOT_ALL_ASSIGNED: WIN32_ERROR = 1300u32;
+pub const ERROR_NOT_APPCONTAINER: WIN32_ERROR = 4250u32;
+pub const ERROR_NOT_AUTHENTICATED: WIN32_ERROR = 1244u32;
+pub const ERROR_NOT_A_CLOUD_FILE: WIN32_ERROR = 376u32;
+pub const ERROR_NOT_A_CLOUD_SYNC_ROOT: WIN32_ERROR = 405u32;
+pub const ERROR_NOT_A_DAX_VOLUME: WIN32_ERROR = 420u32;
+pub const ERROR_NOT_A_REPARSE_POINT: WIN32_ERROR = 4390u32;
+pub const ERROR_NOT_CAPABLE: WIN32_ERROR = 775u32;
+pub const ERROR_NOT_CHILD_WINDOW: WIN32_ERROR = 1442u32;
+pub const ERROR_NOT_CONNECTED: WIN32_ERROR = 2250u32;
+pub const ERROR_NOT_CONTAINER: WIN32_ERROR = 1207u32;
+pub const ERROR_NOT_DAX_MAPPABLE: WIN32_ERROR = 421u32;
+pub const ERROR_NOT_DOS_DISK: WIN32_ERROR = 26u32;
+pub const ERROR_NOT_ENOUGH_MEMORY: WIN32_ERROR = 8u32;
+pub const ERROR_NOT_ENOUGH_QUOTA: WIN32_ERROR = 1816u32;
+pub const ERROR_NOT_ENOUGH_SERVER_MEMORY: WIN32_ERROR = 1130u32;
+pub const ERROR_NOT_EXPORT_FORMAT: WIN32_ERROR = 6008u32;
+pub const ERROR_NOT_FOUND: WIN32_ERROR = 1168u32;
+pub const ERROR_NOT_GUI_PROCESS: WIN32_ERROR = 1471u32;
+pub const ERROR_NOT_JOINED: WIN32_ERROR = 136u32;
+pub const ERROR_NOT_LOCKED: WIN32_ERROR = 158u32;
+pub const ERROR_NOT_LOGGED_ON: WIN32_ERROR = 1245u32;
+pub const ERROR_NOT_LOGON_PROCESS: WIN32_ERROR = 1362u32;
+pub const ERROR_NOT_OWNER: WIN32_ERROR = 288u32;
+pub const ERROR_NOT_READY: WIN32_ERROR = 21u32;
+pub const ERROR_NOT_READ_FROM_COPY: WIN32_ERROR = 337u32;
+pub const ERROR_NOT_REDUNDANT_STORAGE: WIN32_ERROR = 333u32;
+pub const ERROR_NOT_REGISTRY_FILE: WIN32_ERROR = 1017u32;
+pub const ERROR_NOT_SAFEBOOT_SERVICE: WIN32_ERROR = 1084u32;
+pub const ERROR_NOT_SAFE_MODE_DRIVER: WIN32_ERROR = 646u32;
+pub const ERROR_NOT_SAME_DEVICE: WIN32_ERROR = 17u32;
+pub const ERROR_NOT_SAME_OBJECT: WIN32_ERROR = 1656u32;
+pub const ERROR_NOT_SUBSTED: WIN32_ERROR = 137u32;
+pub const ERROR_NOT_SUPPORTED: WIN32_ERROR = 50u32;
+pub const ERROR_NOT_SUPPORTED_IN_APPCONTAINER: WIN32_ERROR = 4252u32;
+pub const ERROR_NOT_SUPPORTED_ON_DAX: WIN32_ERROR = 360u32;
+pub const ERROR_NOT_SUPPORTED_ON_SBS: WIN32_ERROR = 1254u32;
+pub const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER: WIN32_ERROR = 8584u32;
+pub const ERROR_NOT_SUPPORTED_WITH_AUDITING: WIN32_ERROR = 499u32;
+pub const ERROR_NOT_SUPPORTED_WITH_BTT: WIN32_ERROR = 429u32;
+pub const ERROR_NOT_SUPPORTED_WITH_BYPASSIO: WIN32_ERROR = 493u32;
+pub const ERROR_NOT_SUPPORTED_WITH_CACHED_HANDLE: WIN32_ERROR = 509u32;
+pub const ERROR_NOT_SUPPORTED_WITH_COMPRESSION: WIN32_ERROR = 496u32;
+pub const ERROR_NOT_SUPPORTED_WITH_DEDUPLICATION: WIN32_ERROR = 498u32;
+pub const ERROR_NOT_SUPPORTED_WITH_ENCRYPTION: WIN32_ERROR = 495u32;
+pub const ERROR_NOT_SUPPORTED_WITH_MONITORING: WIN32_ERROR = 503u32;
+pub const ERROR_NOT_SUPPORTED_WITH_REPLICATION: WIN32_ERROR = 497u32;
+pub const ERROR_NOT_SUPPORTED_WITH_SNAPSHOT: WIN32_ERROR = 504u32;
+pub const ERROR_NOT_SUPPORTED_WITH_VIRTUALIZATION: WIN32_ERROR = 505u32;
+pub const ERROR_NOT_TINY_STREAM: WIN32_ERROR = 598u32;
+pub const ERROR_NO_ACE_CONDITION: WIN32_ERROR = 804u32;
+pub const ERROR_NO_ASSOCIATION: WIN32_ERROR = 1155u32;
+pub const ERROR_NO_BYPASSIO_DRIVER_SUPPORT: WIN32_ERROR = 494u32;
+pub const ERROR_NO_CALLBACK_ACTIVE: WIN32_ERROR = 614u32;
+pub const ERROR_NO_DATA: WIN32_ERROR = 232u32;
+pub const ERROR_NO_DATA_DETECTED: WIN32_ERROR = 1104u32;
+pub const ERROR_NO_EFS: WIN32_ERROR = 6004u32;
+pub const ERROR_NO_EVENT_PAIR: WIN32_ERROR = 580u32;
+pub const ERROR_NO_GUID_TRANSLATION: WIN32_ERROR = 560u32;
+pub const ERROR_NO_IMPERSONATION_TOKEN: WIN32_ERROR = 1309u32;
+pub const ERROR_NO_INHERITANCE: WIN32_ERROR = 1391u32;
+pub const ERROR_NO_LOGON_SERVERS: WIN32_ERROR = 1311u32;
+pub const ERROR_NO_LOG_SPACE: WIN32_ERROR = 1019u32;
+pub const ERROR_NO_MATCH: WIN32_ERROR = 1169u32;
+pub const ERROR_NO_MEDIA_IN_DRIVE: WIN32_ERROR = 1112u32;
+pub const ERROR_NO_MORE_DEVICES: WIN32_ERROR = 1248u32;
+pub const ERROR_NO_MORE_FILES: WIN32_ERROR = 18u32;
+pub const ERROR_NO_MORE_ITEMS: WIN32_ERROR = 259u32;
+pub const ERROR_NO_MORE_MATCHES: WIN32_ERROR = 626u32;
+pub const ERROR_NO_MORE_SEARCH_HANDLES: WIN32_ERROR = 113u32;
+pub const ERROR_NO_MORE_USER_HANDLES: WIN32_ERROR = 1158u32;
+pub const ERROR_NO_NETWORK: WIN32_ERROR = 1222u32;
+pub const ERROR_NO_NET_OR_BAD_PATH: WIN32_ERROR = 1203u32;
+pub const ERROR_NO_NVRAM_RESOURCES: WIN32_ERROR = 1470u32;
+pub const ERROR_NO_PAGEFILE: WIN32_ERROR = 578u32;
+pub const ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND: WIN32_ERROR = 408u32;
+pub const ERROR_NO_PROC_SLOTS: WIN32_ERROR = 89u32;
+pub const ERROR_NO_PROMOTION_ACTIVE: WIN32_ERROR = 8222u32;
+pub const ERROR_NO_QUOTAS_FOR_ACCOUNT: WIN32_ERROR = 1302u32;
+pub const ERROR_NO_RANGES_PROCESSED: WIN32_ERROR = 312u32;
+pub const ERROR_NO_RECOVERY_POLICY: WIN32_ERROR = 6003u32;
+pub const ERROR_NO_RECOVERY_PROGRAM: WIN32_ERROR = 1082u32;
+pub const ERROR_NO_SCROLLBARS: WIN32_ERROR = 1447u32;
+pub const ERROR_NO_SECRETS: WIN32_ERROR = 8620u32;
+pub const ERROR_NO_SECURITY_ON_OBJECT: WIN32_ERROR = 1350u32;
+pub const ERROR_NO_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1116u32;
+pub const ERROR_NO_SIGNAL_SENT: WIN32_ERROR = 205u32;
+pub const ERROR_NO_SITENAME: WIN32_ERROR = 1919u32;
+pub const ERROR_NO_SITE_SETTINGS_OBJECT: WIN32_ERROR = 8619u32;
+pub const ERROR_NO_SPOOL_SPACE: WIN32_ERROR = 62u32;
+pub const ERROR_NO_SUCH_ALIAS: WIN32_ERROR = 1376u32;
+pub const ERROR_NO_SUCH_DEVICE: WIN32_ERROR = 433u32;
+pub const ERROR_NO_SUCH_DOMAIN: WIN32_ERROR = 1355u32;
+pub const ERROR_NO_SUCH_GROUP: WIN32_ERROR = 1319u32;
+pub const ERROR_NO_SUCH_LOGON_SESSION: WIN32_ERROR = 1312u32;
+pub const ERROR_NO_SUCH_MEMBER: WIN32_ERROR = 1387u32;
+pub const ERROR_NO_SUCH_PACKAGE: WIN32_ERROR = 1364u32;
+pub const ERROR_NO_SUCH_PRIVILEGE: WIN32_ERROR = 1313u32;
+pub const ERROR_NO_SUCH_SITE: WIN32_ERROR = 1249u32;
+pub const ERROR_NO_SUCH_USER: WIN32_ERROR = 1317u32;
+pub const ERROR_NO_SYSTEM_MENU: WIN32_ERROR = 1437u32;
+pub const ERROR_NO_SYSTEM_RESOURCES: WIN32_ERROR = 1450u32;
+pub const ERROR_NO_TASK_QUEUE: WIN32_ERROR = 427u32;
+pub const ERROR_NO_TOKEN: WIN32_ERROR = 1008u32;
+pub const ERROR_NO_TRACKING_SERVICE: WIN32_ERROR = 1172u32;
+pub const ERROR_NO_TRUST_LSA_SECRET: WIN32_ERROR = 1786u32;
+pub const ERROR_NO_TRUST_SAM_ACCOUNT: WIN32_ERROR = 1787u32;
+pub const ERROR_NO_UNICODE_TRANSLATION: WIN32_ERROR = 1113u32;
+pub const ERROR_NO_USER_KEYS: WIN32_ERROR = 6006u32;
+pub const ERROR_NO_USER_SESSION_KEY: WIN32_ERROR = 1394u32;
+pub const ERROR_NO_VOLUME_ID: WIN32_ERROR = 1173u32;
+pub const ERROR_NO_VOLUME_LABEL: WIN32_ERROR = 125u32;
+pub const ERROR_NO_WILDCARD_CHARACTERS: WIN32_ERROR = 1417u32;
+pub const ERROR_NO_WORK_DONE: WIN32_ERROR = 235u32;
+pub const ERROR_NO_WRITABLE_DC_FOUND: WIN32_ERROR = 8621u32;
+pub const ERROR_NO_YIELD_PERFORMED: WIN32_ERROR = 721u32;
+pub const ERROR_NTLM_BLOCKED: WIN32_ERROR = 1937u32;
+pub const ERROR_NT_CROSS_ENCRYPTION_REQUIRED: WIN32_ERROR = 1386u32;
+pub const ERROR_NULL_LM_PASSWORD: WIN32_ERROR = 1304u32;
+pub const ERROR_OBJECT_IS_IMMUTABLE: WIN32_ERROR = 4449u32;
+pub const ERROR_OBJECT_NAME_EXISTS: WIN32_ERROR = 698u32;
+pub const ERROR_OBJECT_NOT_EXTERNALLY_BACKED: WIN32_ERROR = 342u32;
+pub const ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED: WIN32_ERROR = 4442u32;
+pub const ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED: WIN32_ERROR = 4440u32;
+pub const ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: WIN32_ERROR = 4443u32;
+pub const ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: WIN32_ERROR = 4441u32;
+pub const ERROR_OFFSET_ALIGNMENT_VIOLATION: WIN32_ERROR = 327u32;
+pub const ERROR_OLD_WIN_VERSION: WIN32_ERROR = 1150u32;
+pub const ERROR_ONLY_IF_CONNECTED: WIN32_ERROR = 1251u32;
+pub const ERROR_OPEN_FAILED: WIN32_ERROR = 110u32;
+pub const ERROR_OPEN_FILES: WIN32_ERROR = 2401u32;
+pub const ERROR_OPERATION_ABORTED: WIN32_ERROR = 995u32;
+pub const ERROR_OPERATION_IN_PROGRESS: WIN32_ERROR = 329u32;
+pub const ERROR_OPLOCK_BREAK_IN_PROGRESS: WIN32_ERROR = 742u32;
+pub const ERROR_OPLOCK_HANDLE_CLOSED: WIN32_ERROR = 803u32;
+pub const ERROR_OPLOCK_NOT_GRANTED: WIN32_ERROR = 300u32;
+pub const ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE: WIN32_ERROR = 800u32;
+pub const ERROR_ORPHAN_NAME_EXHAUSTED: WIN32_ERROR = 799u32;
+pub const ERROR_OUTOFMEMORY: WIN32_ERROR = 14u32;
+pub const ERROR_OUT_OF_PAPER: WIN32_ERROR = 28u32;
+pub const ERROR_OUT_OF_STRUCTURES: WIN32_ERROR = 84u32;
+pub const ERROR_OVERRIDE_NOCHANGES: WIN32_ERROR = 1252u32;
+pub const ERROR_PAGED_SYSTEM_RESOURCES: WIN32_ERROR = 1452u32;
+pub const ERROR_PAGEFILE_CREATE_FAILED: WIN32_ERROR = 576u32;
+pub const ERROR_PAGEFILE_NOT_SUPPORTED: WIN32_ERROR = 491u32;
+pub const ERROR_PAGEFILE_QUOTA: WIN32_ERROR = 1454u32;
+pub const ERROR_PAGEFILE_QUOTA_EXCEEDED: WIN32_ERROR = 567u32;
+pub const ERROR_PAGE_FAULT_COPY_ON_WRITE: WIN32_ERROR = 749u32;
+pub const ERROR_PAGE_FAULT_DEMAND_ZERO: WIN32_ERROR = 748u32;
+pub const ERROR_PAGE_FAULT_GUARD_PAGE: WIN32_ERROR = 750u32;
+pub const ERROR_PAGE_FAULT_PAGING_FILE: WIN32_ERROR = 751u32;
+pub const ERROR_PAGE_FAULT_TRANSITION: WIN32_ERROR = 747u32;
+pub const ERROR_PARAMETER_QUOTA_EXCEEDED: WIN32_ERROR = 1283u32;
+pub const ERROR_PARTIAL_COPY: WIN32_ERROR = 299u32;
+pub const ERROR_PARTITION_FAILURE: WIN32_ERROR = 1105u32;
+pub const ERROR_PARTITION_TERMINATING: WIN32_ERROR = 1184u32;
+pub const ERROR_PASSWORD_CHANGE_REQUIRED: WIN32_ERROR = 1938u32;
+pub const ERROR_PASSWORD_EXPIRED: WIN32_ERROR = 1330u32;
+pub const ERROR_PASSWORD_MUST_CHANGE: WIN32_ERROR = 1907u32;
+pub const ERROR_PASSWORD_RESTRICTION: WIN32_ERROR = 1325u32;
+pub const ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT: WIN32_ERROR = 1651u32;
+pub const ERROR_PATCH_NO_SEQUENCE: WIN32_ERROR = 1648u32;
+pub const ERROR_PATCH_PACKAGE_INVALID: WIN32_ERROR = 1636u32;
+pub const ERROR_PATCH_PACKAGE_OPEN_FAILED: WIN32_ERROR = 1635u32;
+pub const ERROR_PATCH_PACKAGE_REJECTED: WIN32_ERROR = 1643u32;
+pub const ERROR_PATCH_PACKAGE_UNSUPPORTED: WIN32_ERROR = 1637u32;
+pub const ERROR_PATCH_REMOVAL_DISALLOWED: WIN32_ERROR = 1649u32;
+pub const ERROR_PATCH_REMOVAL_UNSUPPORTED: WIN32_ERROR = 1646u32;
+pub const ERROR_PATCH_TARGET_NOT_FOUND: WIN32_ERROR = 1642u32;
+pub const ERROR_PATH_BUSY: WIN32_ERROR = 148u32;
+pub const ERROR_PATH_NOT_FOUND: WIN32_ERROR = 3u32;
+pub const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1932u32;
+pub const ERROR_PIPE_BUSY: WIN32_ERROR = 231u32;
+pub const ERROR_PIPE_CONNECTED: WIN32_ERROR = 535u32;
+pub const ERROR_PIPE_LISTENING: WIN32_ERROR = 536u32;
+pub const ERROR_PIPE_LOCAL: WIN32_ERROR = 229u32;
+pub const ERROR_PIPE_NOT_CONNECTED: WIN32_ERROR = 233u32;
+pub const ERROR_PKINIT_FAILURE: WIN32_ERROR = 1263u32;
+pub const ERROR_PLUGPLAY_QUERY_VETOED: WIN32_ERROR = 683u32;
+pub const ERROR_PNP_BAD_MPS_TABLE: WIN32_ERROR = 671u32;
+pub const ERROR_PNP_INVALID_ID: WIN32_ERROR = 674u32;
+pub const ERROR_PNP_IRQ_TRANSLATION_FAILED: WIN32_ERROR = 673u32;
+pub const ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT: WIN32_ERROR = 480u32;
+pub const ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT: WIN32_ERROR = 481u32;
+pub const ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT: WIN32_ERROR = 482u32;
+pub const ERROR_PNP_REBOOT_REQUIRED: WIN32_ERROR = 638u32;
+pub const ERROR_PNP_RESTART_ENUMERATION: WIN32_ERROR = 636u32;
+pub const ERROR_PNP_TRANSLATION_FAILED: WIN32_ERROR = 672u32;
+pub const ERROR_POINT_NOT_FOUND: WIN32_ERROR = 1171u32;
+pub const ERROR_POLICY_OBJECT_NOT_FOUND: WIN32_ERROR = 8219u32;
+pub const ERROR_POLICY_ONLY_IN_DS: WIN32_ERROR = 8220u32;
+pub const ERROR_POPUP_ALREADY_ACTIVE: WIN32_ERROR = 1446u32;
+pub const ERROR_PORT_MESSAGE_TOO_LONG: WIN32_ERROR = 546u32;
+pub const ERROR_PORT_NOT_SET: WIN32_ERROR = 642u32;
+pub const ERROR_PORT_UNREACHABLE: WIN32_ERROR = 1234u32;
+pub const ERROR_POSSIBLE_DEADLOCK: WIN32_ERROR = 1131u32;
+pub const ERROR_POTENTIAL_FILE_FOUND: WIN32_ERROR = 1180u32;
+pub const ERROR_PREDEFINED_HANDLE: WIN32_ERROR = 714u32;
+pub const ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED: WIN32_ERROR = 746u32;
+pub const ERROR_PRINTER_ALREADY_EXISTS: WIN32_ERROR = 1802u32;
+pub const ERROR_PRINTER_DELETED: WIN32_ERROR = 1905u32;
+pub const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED: WIN32_ERROR = 1795u32;
+pub const ERROR_PRINTQ_FULL: WIN32_ERROR = 61u32;
+pub const ERROR_PRINT_CANCELLED: WIN32_ERROR = 63u32;
+pub const ERROR_PRIVATE_DIALOG_INDEX: WIN32_ERROR = 1415u32;
+pub const ERROR_PRIVILEGE_NOT_HELD: WIN32_ERROR = 1314u32;
+pub const ERROR_PROCESS_ABORTED: WIN32_ERROR = 1067u32;
+pub const ERROR_PROCESS_IN_JOB: WIN32_ERROR = 760u32;
+pub const ERROR_PROCESS_IS_PROTECTED: WIN32_ERROR = 1293u32;
+pub const ERROR_PROCESS_MODE_ALREADY_BACKGROUND: WIN32_ERROR = 402u32;
+pub const ERROR_PROCESS_MODE_NOT_BACKGROUND: WIN32_ERROR = 403u32;
+pub const ERROR_PROCESS_NOT_IN_JOB: WIN32_ERROR = 759u32;
+pub const ERROR_PROC_NOT_FOUND: WIN32_ERROR = 127u32;
+pub const ERROR_PRODUCT_UNINSTALLED: WIN32_ERROR = 1614u32;
+pub const ERROR_PRODUCT_VERSION: WIN32_ERROR = 1638u32;
+pub const ERROR_PROFILING_AT_LIMIT: WIN32_ERROR = 553u32;
+pub const ERROR_PROFILING_NOT_STARTED: WIN32_ERROR = 550u32;
+pub const ERROR_PROFILING_NOT_STOPPED: WIN32_ERROR = 551u32;
+pub const ERROR_PROMOTION_ACTIVE: WIN32_ERROR = 8221u32;
+pub const ERROR_PROTOCOL_UNREACHABLE: WIN32_ERROR = 1233u32;
+pub const ERROR_PWD_HISTORY_CONFLICT: WIN32_ERROR = 617u32;
+pub const ERROR_PWD_TOO_LONG: WIN32_ERROR = 657u32;
+pub const ERROR_PWD_TOO_RECENT: WIN32_ERROR = 616u32;
+pub const ERROR_PWD_TOO_SHORT: WIN32_ERROR = 615u32;
+pub const ERROR_QUOTA_ACTIVITY: WIN32_ERROR = 810u32;
+pub const ERROR_QUOTA_LIST_INCONSISTENT: WIN32_ERROR = 621u32;
+pub const ERROR_RANGE_LIST_CONFLICT: WIN32_ERROR = 627u32;
+pub const ERROR_RANGE_NOT_FOUND: WIN32_ERROR = 644u32;
+pub const ERROR_READ_FAULT: WIN32_ERROR = 30u32;
+pub const ERROR_RECEIVE_EXPEDITED: WIN32_ERROR = 708u32;
+pub const ERROR_RECEIVE_PARTIAL: WIN32_ERROR = 707u32;
+pub const ERROR_RECEIVE_PARTIAL_EXPEDITED: WIN32_ERROR = 709u32;
+pub const ERROR_RECOVERY_FAILURE: WIN32_ERROR = 1279u32;
+pub const ERROR_REDIRECTOR_HAS_OPEN_HANDLES: WIN32_ERROR = 1794u32;
+pub const ERROR_REDIR_PAUSED: WIN32_ERROR = 72u32;
+pub const ERROR_REGISTRY_CORRUPT: WIN32_ERROR = 1015u32;
+pub const ERROR_REGISTRY_HIVE_RECOVERED: WIN32_ERROR = 685u32;
+pub const ERROR_REGISTRY_IO_FAILED: WIN32_ERROR = 1016u32;
+pub const ERROR_REGISTRY_QUOTA_LIMIT: WIN32_ERROR = 613u32;
+pub const ERROR_REGISTRY_RECOVERED: WIN32_ERROR = 1014u32;
+pub const ERROR_REG_NAT_CONSUMPTION: WIN32_ERROR = 1261u32;
+pub const ERROR_RELOC_CHAIN_XEEDS_SEGLIM: WIN32_ERROR = 201u32;
+pub const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED: WIN32_ERROR = 1936u32;
+pub const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED: WIN32_ERROR = 1220u32;
+pub const ERROR_REMOTE_STORAGE_MEDIA_ERROR: WIN32_ERROR = 4352u32;
+pub const ERROR_REMOTE_STORAGE_NOT_ACTIVE: WIN32_ERROR = 4351u32;
+pub const ERROR_REM_NOT_LIST: WIN32_ERROR = 51u32;
+pub const ERROR_REPARSE: WIN32_ERROR = 741u32;
+pub const ERROR_REPARSE_ATTRIBUTE_CONFLICT: WIN32_ERROR = 4391u32;
+pub const ERROR_REPARSE_OBJECT: WIN32_ERROR = 755u32;
+pub const ERROR_REPARSE_POINT_ENCOUNTERED: WIN32_ERROR = 4395u32;
+pub const ERROR_REPARSE_TAG_INVALID: WIN32_ERROR = 4393u32;
+pub const ERROR_REPARSE_TAG_MISMATCH: WIN32_ERROR = 4394u32;
+pub const ERROR_REPLY_MESSAGE_MISMATCH: WIN32_ERROR = 595u32;
+pub const ERROR_REQUEST_ABORTED: WIN32_ERROR = 1235u32;
+pub const ERROR_REQUEST_OUT_OF_SEQUENCE: WIN32_ERROR = 776u32;
+pub const ERROR_REQUEST_PAUSED: WIN32_ERROR = 3050u32;
+pub const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION: WIN32_ERROR = 1459u32;
+pub const ERROR_REQ_NOT_ACCEP: WIN32_ERROR = 71u32;
+pub const ERROR_RESIDENT_FILE_NOT_SUPPORTED: WIN32_ERROR = 334u32;
+pub const ERROR_RESOURCE_CALL_TIMED_OUT: WIN32_ERROR = 5910u32;
+pub const ERROR_RESOURCE_DATA_NOT_FOUND: WIN32_ERROR = 1812u32;
+pub const ERROR_RESOURCE_LANG_NOT_FOUND: WIN32_ERROR = 1815u32;
+pub const ERROR_RESOURCE_NAME_NOT_FOUND: WIN32_ERROR = 1814u32;
+pub const ERROR_RESOURCE_REQUIREMENTS_CHANGED: WIN32_ERROR = 756u32;
+pub const ERROR_RESOURCE_TYPE_NOT_FOUND: WIN32_ERROR = 1813u32;
+pub const ERROR_RESTART_APPLICATION: WIN32_ERROR = 1467u32;
+pub const ERROR_RESUME_HIBERNATION: WIN32_ERROR = 727u32;
+pub const ERROR_RETRY: WIN32_ERROR = 1237u32;
+pub const ERROR_RETURN_ADDRESS_HIJACK_ATTEMPT: WIN32_ERROR = 1662u32;
+pub const ERROR_REVISION_MISMATCH: WIN32_ERROR = 1306u32;
+pub const ERROR_RING2SEG_MUST_BE_MOVABLE: WIN32_ERROR = 200u32;
+pub const ERROR_RING2_STACK_IN_USE: WIN32_ERROR = 207u32;
+pub const ERROR_RMODE_APP: WIN32_ERROR = 1153u32;
+pub const ERROR_ROWSNOTRELEASED: WIN32_ERROR = 772u32;
+pub const ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT: WIN32_ERROR = 15403u32;
+pub const ERROR_RUNLEVEL_SWITCH_TIMEOUT: WIN32_ERROR = 15402u32;
+pub const ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED: WIN32_ERROR = 410u32;
+pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET: WIN32_ERROR = 411u32;
+pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE: WIN32_ERROR = 412u32;
+pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER: WIN32_ERROR = 413u32;
+pub const ERROR_RXACT_COMMITTED: WIN32_ERROR = 744u32;
+pub const ERROR_RXACT_COMMIT_FAILURE: WIN32_ERROR = 1370u32;
+pub const ERROR_RXACT_COMMIT_NECESSARY: WIN32_ERROR = 678u32;
+pub const ERROR_RXACT_INVALID_STATE: WIN32_ERROR = 1369u32;
+pub const ERROR_RXACT_STATE_CREATED: WIN32_ERROR = 701u32;
+pub const ERROR_SAME_DRIVE: WIN32_ERROR = 143u32;
+pub const ERROR_SAM_INIT_FAILURE: WIN32_ERROR = 8541u32;
+pub const ERROR_SCOPE_NOT_FOUND: WIN32_ERROR = 318u32;
+pub const ERROR_SCREEN_ALREADY_LOCKED: WIN32_ERROR = 1440u32;
+pub const ERROR_SCRUB_DATA_DISABLED: WIN32_ERROR = 332u32;
+pub const ERROR_SECRET_TOO_LONG: WIN32_ERROR = 1382u32;
+pub const ERROR_SECTION_DIRECT_MAP_ONLY: WIN32_ERROR = 819u32;
+pub const ERROR_SECTOR_NOT_FOUND: WIN32_ERROR = 27u32;
+pub const ERROR_SECURITY_DENIES_OPERATION: WIN32_ERROR = 447u32;
+pub const ERROR_SECURITY_STREAM_IS_INCONSISTENT: WIN32_ERROR = 306u32;
+pub const ERROR_SEEK: WIN32_ERROR = 25u32;
+pub const ERROR_SEEK_ON_DEVICE: WIN32_ERROR = 132u32;
+pub const ERROR_SEGMENT_NOTIFICATION: WIN32_ERROR = 702u32;
+pub const ERROR_SEM_IS_SET: WIN32_ERROR = 102u32;
+pub const ERROR_SEM_NOT_FOUND: WIN32_ERROR = 187u32;
+pub const ERROR_SEM_OWNER_DIED: WIN32_ERROR = 105u32;
+pub const ERROR_SEM_TIMEOUT: WIN32_ERROR = 121u32;
+pub const ERROR_SEM_USER_LIMIT: WIN32_ERROR = 106u32;
+pub const ERROR_SERIAL_NO_DEVICE: WIN32_ERROR = 1118u32;
+pub const ERROR_SERVER_DISABLED: WIN32_ERROR = 1341u32;
+pub const ERROR_SERVER_HAS_OPEN_HANDLES: WIN32_ERROR = 1811u32;
+pub const ERROR_SERVER_NOT_DISABLED: WIN32_ERROR = 1342u32;
+pub const ERROR_SERVER_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1255u32;
+pub const ERROR_SERVER_SID_MISMATCH: WIN32_ERROR = 628u32;
+pub const ERROR_SERVER_TRANSPORT_CONFLICT: WIN32_ERROR = 816u32;
+pub const ERROR_SERVICE_ALREADY_RUNNING: WIN32_ERROR = 1056u32;
+pub const ERROR_SERVICE_CANNOT_ACCEPT_CTRL: WIN32_ERROR = 1061u32;
+pub const ERROR_SERVICE_DATABASE_LOCKED: WIN32_ERROR = 1055u32;
+pub const ERROR_SERVICE_DEPENDENCY_DELETED: WIN32_ERROR = 1075u32;
+pub const ERROR_SERVICE_DEPENDENCY_FAIL: WIN32_ERROR = 1068u32;
+pub const ERROR_SERVICE_DISABLED: WIN32_ERROR = 1058u32;
+pub const ERROR_SERVICE_DOES_NOT_EXIST: WIN32_ERROR = 1060u32;
+pub const ERROR_SERVICE_EXISTS: WIN32_ERROR = 1073u32;
+pub const ERROR_SERVICE_LOGON_FAILED: WIN32_ERROR = 1069u32;
+pub const ERROR_SERVICE_MARKED_FOR_DELETE: WIN32_ERROR = 1072u32;
+pub const ERROR_SERVICE_NEVER_STARTED: WIN32_ERROR = 1077u32;
+pub const ERROR_SERVICE_NOTIFICATION: WIN32_ERROR = 716u32;
+pub const ERROR_SERVICE_NOTIFY_CLIENT_LAGGING: WIN32_ERROR = 1294u32;
+pub const ERROR_SERVICE_NOT_ACTIVE: WIN32_ERROR = 1062u32;
+pub const ERROR_SERVICE_NOT_FOUND: WIN32_ERROR = 1243u32;
+pub const ERROR_SERVICE_NOT_IN_EXE: WIN32_ERROR = 1083u32;
+pub const ERROR_SERVICE_NO_THREAD: WIN32_ERROR = 1054u32;
+pub const ERROR_SERVICE_REQUEST_TIMEOUT: WIN32_ERROR = 1053u32;
+pub const ERROR_SERVICE_SPECIFIC_ERROR: WIN32_ERROR = 1066u32;
+pub const ERROR_SERVICE_START_HANG: WIN32_ERROR = 1070u32;
+pub const ERROR_SESSION_CREDENTIAL_CONFLICT: WIN32_ERROR = 1219u32;
+pub const ERROR_SESSION_KEY_TOO_SHORT: WIN32_ERROR = 501u32;
+pub const ERROR_SETCOUNT_ON_BAD_LB: WIN32_ERROR = 1433u32;
+pub const ERROR_SETMARK_DETECTED: WIN32_ERROR = 1103u32;
+pub const ERROR_SET_CONTEXT_DENIED: WIN32_ERROR = 1660u32;
+pub const ERROR_SET_NOT_FOUND: WIN32_ERROR = 1170u32;
+pub const ERROR_SET_POWER_STATE_FAILED: WIN32_ERROR = 1141u32;
+pub const ERROR_SET_POWER_STATE_VETOED: WIN32_ERROR = 1140u32;
+pub const ERROR_SHARED_POLICY: WIN32_ERROR = 8218u32;
+pub const ERROR_SHARING_BUFFER_EXCEEDED: WIN32_ERROR = 36u32;
+pub const ERROR_SHARING_PAUSED: WIN32_ERROR = 70u32;
+pub const ERROR_SHARING_VIOLATION: WIN32_ERROR = 32u32;
+pub const ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: WIN32_ERROR = 305u32;
+pub const ERROR_SHUTDOWN_DISKS_NOT_IN_MAINTENANCE_MODE: WIN32_ERROR = 1192u32;
+pub const ERROR_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1115u32;
+pub const ERROR_SHUTDOWN_IS_SCHEDULED: WIN32_ERROR = 1190u32;
+pub const ERROR_SHUTDOWN_USERS_LOGGED_ON: WIN32_ERROR = 1191u32;
+pub const ERROR_SIGNAL_PENDING: WIN32_ERROR = 162u32;
+pub const ERROR_SIGNAL_REFUSED: WIN32_ERROR = 156u32;
+pub const ERROR_SINGLE_INSTANCE_APP: WIN32_ERROR = 1152u32;
+pub const ERROR_SMARTCARD_SUBSYSTEM_FAILURE: WIN32_ERROR = 1264u32;
+pub const ERROR_SMB1_NOT_AVAILABLE: WIN32_ERROR = 384u32;
+pub const ERROR_SMB_GUEST_LOGON_BLOCKED: WIN32_ERROR = 1272u32;
+pub const ERROR_SMR_GARBAGE_COLLECTION_REQUIRED: WIN32_ERROR = 4445u32;
+pub const ERROR_SOME_NOT_MAPPED: WIN32_ERROR = 1301u32;
+pub const ERROR_SOURCE_ELEMENT_EMPTY: WIN32_ERROR = 1160u32;
+pub const ERROR_SPARSE_FILE_NOT_SUPPORTED: WIN32_ERROR = 490u32;
+pub const ERROR_SPECIAL_ACCOUNT: WIN32_ERROR = 1371u32;
+pub const ERROR_SPECIAL_GROUP: WIN32_ERROR = 1372u32;
+pub const ERROR_SPECIAL_USER: WIN32_ERROR = 1373u32;
+pub const ERROR_SRC_SRV_DLL_LOAD_FAILED: WIN32_ERROR = 428u32;
+pub const ERROR_STACK_BUFFER_OVERRUN: WIN32_ERROR = 1282u32;
+pub const ERROR_STACK_OVERFLOW: WIN32_ERROR = 1001u32;
+pub const ERROR_STACK_OVERFLOW_READ: WIN32_ERROR = 599u32;
+pub const ERROR_STOPPED_ON_SYMLINK: WIN32_ERROR = 681u32;
+pub const ERROR_STORAGE_LOST_DATA_PERSISTENCE: WIN32_ERROR = 368u32;
+pub const ERROR_STORAGE_RESERVE_ALREADY_EXISTS: WIN32_ERROR = 418u32;
+pub const ERROR_STORAGE_RESERVE_DOES_NOT_EXIST: WIN32_ERROR = 417u32;
+pub const ERROR_STORAGE_RESERVE_ID_INVALID: WIN32_ERROR = 416u32;
+pub const ERROR_STORAGE_RESERVE_NOT_EMPTY: WIN32_ERROR = 419u32;
+pub const ERROR_STORAGE_STACK_ACCESS_DENIED: WIN32_ERROR = 472u32;
+pub const ERROR_STORAGE_TOPOLOGY_ID_MISMATCH: WIN32_ERROR = 345u32;
+pub const ERROR_STRICT_CFG_VIOLATION: WIN32_ERROR = 1657u32;
+pub const ERROR_SUBST_TO_JOIN: WIN32_ERROR = 141u32;
+pub const ERROR_SUBST_TO_SUBST: WIN32_ERROR = 139u32;
+pub const ERROR_SUCCESS: WIN32_ERROR = 0u32;
+pub const ERROR_SUCCESS_REBOOT_INITIATED: WIN32_ERROR = 1641u32;
+pub const ERROR_SWAPERROR: WIN32_ERROR = 999u32;
+pub const ERROR_SYMLINK_CLASS_DISABLED: WIN32_ERROR = 1463u32;
+pub const ERROR_SYMLINK_NOT_SUPPORTED: WIN32_ERROR = 1464u32;
+pub const ERROR_SYNCHRONIZATION_REQUIRED: WIN32_ERROR = 569u32;
+pub const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED: WIN32_ERROR = 1274u32;
+pub const ERROR_SYSTEM_HIVE_TOO_LARGE: WIN32_ERROR = 653u32;
+pub const ERROR_SYSTEM_IMAGE_BAD_SIGNATURE: WIN32_ERROR = 637u32;
+pub const ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: WIN32_ERROR = 783u32;
+pub const ERROR_SYSTEM_POWERSTATE_TRANSITION: WIN32_ERROR = 782u32;
+pub const ERROR_SYSTEM_PROCESS_TERMINATED: WIN32_ERROR = 591u32;
+pub const ERROR_SYSTEM_SHUTDOWN: WIN32_ERROR = 641u32;
+pub const ERROR_SYSTEM_TRACE: WIN32_ERROR = 150u32;
+pub const ERROR_THREAD_1_INACTIVE: WIN32_ERROR = 210u32;
+pub const ERROR_THREAD_ALREADY_IN_TASK: WIN32_ERROR = 1552u32;
+pub const ERROR_THREAD_MODE_ALREADY_BACKGROUND: WIN32_ERROR = 400u32;
+pub const ERROR_THREAD_MODE_NOT_BACKGROUND: WIN32_ERROR = 401u32;
+pub const ERROR_THREAD_NOT_IN_PROCESS: WIN32_ERROR = 566u32;
+pub const ERROR_THREAD_WAS_SUSPENDED: WIN32_ERROR = 699u32;
+pub const ERROR_TIMEOUT: WIN32_ERROR = 1460u32;
+pub const ERROR_TIMER_NOT_CANCELED: WIN32_ERROR = 541u32;
+pub const ERROR_TIMER_RESOLUTION_NOT_SET: WIN32_ERROR = 607u32;
+pub const ERROR_TIMER_RESUME_IGNORED: WIN32_ERROR = 722u32;
+pub const ERROR_TIME_SENSITIVE_THREAD: WIN32_ERROR = 422u32;
+pub const ERROR_TIME_SKEW: WIN32_ERROR = 1398u32;
+pub const ERROR_TLW_WITH_WSCHILD: WIN32_ERROR = 1406u32;
+pub const ERROR_TOKEN_ALREADY_IN_USE: WIN32_ERROR = 1375u32;
+pub const ERROR_TOO_MANY_CMDS: WIN32_ERROR = 56u32;
+pub const ERROR_TOO_MANY_CONTEXT_IDS: WIN32_ERROR = 1384u32;
+pub const ERROR_TOO_MANY_DESCRIPTORS: WIN32_ERROR = 331u32;
+pub const ERROR_TOO_MANY_LINKS: WIN32_ERROR = 1142u32;
+pub const ERROR_TOO_MANY_LUIDS_REQUESTED: WIN32_ERROR = 1333u32;
+pub const ERROR_TOO_MANY_MODULES: WIN32_ERROR = 214u32;
+pub const ERROR_TOO_MANY_MUXWAITERS: WIN32_ERROR = 152u32;
+pub const ERROR_TOO_MANY_NAMES: WIN32_ERROR = 68u32;
+pub const ERROR_TOO_MANY_OPEN_FILES: WIN32_ERROR = 4u32;
+pub const ERROR_TOO_MANY_POSTS: WIN32_ERROR = 298u32;
+pub const ERROR_TOO_MANY_SECRETS: WIN32_ERROR = 1381u32;
+pub const ERROR_TOO_MANY_SEMAPHORES: WIN32_ERROR = 100u32;
+pub const ERROR_TOO_MANY_SEM_REQUESTS: WIN32_ERROR = 103u32;
+pub const ERROR_TOO_MANY_SESS: WIN32_ERROR = 69u32;
+pub const ERROR_TOO_MANY_SIDS: WIN32_ERROR = 1389u32;
+pub const ERROR_TOO_MANY_TCBS: WIN32_ERROR = 155u32;
+pub const ERROR_TOO_MANY_THREADS: WIN32_ERROR = 565u32;
+pub const ERROR_TRANSLATION_COMPLETE: WIN32_ERROR = 757u32;
+pub const ERROR_TRUSTED_DOMAIN_FAILURE: WIN32_ERROR = 1788u32;
+pub const ERROR_TRUSTED_RELATIONSHIP_FAILURE: WIN32_ERROR = 1789u32;
+pub const ERROR_TRUST_FAILURE: WIN32_ERROR = 1790u32;
+pub const ERROR_UNABLE_TO_LOCK_MEDIA: WIN32_ERROR = 1108u32;
+pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT: WIN32_ERROR = 1176u32;
+pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2: WIN32_ERROR = 1177u32;
+pub const ERROR_UNABLE_TO_REMOVE_REPLACED: WIN32_ERROR = 1175u32;
+pub const ERROR_UNABLE_TO_UNLOAD_MEDIA: WIN32_ERROR = 1109u32;
+pub const ERROR_UNDEFINED_CHARACTER: WIN32_ERROR = 583u32;
+pub const ERROR_UNDEFINED_SCOPE: WIN32_ERROR = 319u32;
+pub const ERROR_UNEXPECTED_MM_CREATE_ERR: WIN32_ERROR = 556u32;
+pub const ERROR_UNEXPECTED_MM_EXTEND_ERR: WIN32_ERROR = 558u32;
+pub const ERROR_UNEXPECTED_MM_MAP_ERROR: WIN32_ERROR = 557u32;
+pub const ERROR_UNEXPECTED_NTCACHEMANAGER_ERROR: WIN32_ERROR = 443u32;
+pub const ERROR_UNEXP_NET_ERR: WIN32_ERROR = 59u32;
+pub const ERROR_UNHANDLED_EXCEPTION: WIN32_ERROR = 574u32;
+pub const ERROR_UNIDENTIFIED_ERROR: WIN32_ERROR = 1287u32;
+pub const ERROR_UNKNOWN_COMPONENT: WIN32_ERROR = 1607u32;
+pub const ERROR_UNKNOWN_FEATURE: WIN32_ERROR = 1606u32;
+pub const ERROR_UNKNOWN_PATCH: WIN32_ERROR = 1647u32;
+pub const ERROR_UNKNOWN_PORT: WIN32_ERROR = 1796u32;
+pub const ERROR_UNKNOWN_PRINTER_DRIVER: WIN32_ERROR = 1797u32;
+pub const ERROR_UNKNOWN_PRINTPROCESSOR: WIN32_ERROR = 1798u32;
+pub const ERROR_UNKNOWN_PRODUCT: WIN32_ERROR = 1605u32;
+pub const ERROR_UNKNOWN_PROPERTY: WIN32_ERROR = 1608u32;
+pub const ERROR_UNKNOWN_REVISION: WIN32_ERROR = 1305u32;
+pub const ERROR_UNRECOGNIZED_MEDIA: WIN32_ERROR = 1785u32;
+pub const ERROR_UNRECOGNIZED_VOLUME: WIN32_ERROR = 1005u32;
+pub const ERROR_UNSATISFIED_DEPENDENCIES: WIN32_ERROR = 441u32;
+pub const ERROR_UNSUPPORTED_COMPRESSION: WIN32_ERROR = 618u32;
+pub const ERROR_UNSUPPORTED_TYPE: WIN32_ERROR = 1630u32;
+pub const ERROR_UNTRUSTED_MOUNT_POINT: WIN32_ERROR = 448u32;
+pub const ERROR_UNWIND: WIN32_ERROR = 542u32;
+pub const ERROR_UNWIND_CONSOLIDATE: WIN32_ERROR = 684u32;
+pub const ERROR_USER_APC: WIN32_ERROR = 737u32;
+pub const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1934u32;
+pub const ERROR_USER_EXISTS: WIN32_ERROR = 1316u32;
+pub const ERROR_USER_MAPPED_FILE: WIN32_ERROR = 1224u32;
+pub const ERROR_USER_PROFILE_LOAD: WIN32_ERROR = 500u32;
+pub const ERROR_VALIDATE_CONTINUE: WIN32_ERROR = 625u32;
+pub const ERROR_VC_DISCONNECTED: WIN32_ERROR = 240u32;
+pub const ERROR_VDM_DISALLOWED: WIN32_ERROR = 1286u32;
+pub const ERROR_VDM_HARD_ERROR: WIN32_ERROR = 593u32;
+pub const ERROR_VERIFIER_STOP: WIN32_ERROR = 537u32;
+pub const ERROR_VERSION_PARSE_ERROR: WIN32_ERROR = 777u32;
+pub const ERROR_VIRUS_DELETED: WIN32_ERROR = 226u32;
+pub const ERROR_VIRUS_INFECTED: WIN32_ERROR = 225u32;
+pub const ERROR_VOLSNAP_HIBERNATE_READY: WIN32_ERROR = 761u32;
+pub const ERROR_VOLSNAP_PREPARE_HIBERNATE: WIN32_ERROR = 655u32;
+pub const ERROR_VOLUME_MOUNTED: WIN32_ERROR = 743u32;
+pub const ERROR_VOLUME_NOT_CLUSTER_ALIGNED: WIN32_ERROR = 407u32;
+pub const ERROR_VOLUME_NOT_SIS_ENABLED: WIN32_ERROR = 4500u32;
+pub const ERROR_VOLUME_NOT_SUPPORTED: WIN32_ERROR = 492u32;
+pub const ERROR_VOLUME_NOT_SUPPORT_EFS: WIN32_ERROR = 6014u32;
+pub const ERROR_VOLUME_WRITE_ACCESS_DENIED: WIN32_ERROR = 508u32;
+pub const ERROR_WAIT_1: WIN32_ERROR = 731u32;
+pub const ERROR_WAIT_2: WIN32_ERROR = 732u32;
+pub const ERROR_WAIT_3: WIN32_ERROR = 733u32;
+pub const ERROR_WAIT_63: WIN32_ERROR = 734u32;
+pub const ERROR_WAIT_FOR_OPLOCK: WIN32_ERROR = 765u32;
+pub const ERROR_WAIT_NO_CHILDREN: WIN32_ERROR = 128u32;
+pub const ERROR_WAKE_SYSTEM: WIN32_ERROR = 730u32;
+pub const ERROR_WAKE_SYSTEM_DEBUGGER: WIN32_ERROR = 675u32;
+pub const ERROR_WAS_LOCKED: WIN32_ERROR = 717u32;
+pub const ERROR_WAS_UNLOCKED: WIN32_ERROR = 715u32;
+pub const ERROR_WEAK_WHFBKEY_BLOCKED: WIN32_ERROR = 8651u32;
+pub const ERROR_WINDOW_NOT_COMBOBOX: WIN32_ERROR = 1423u32;
+pub const ERROR_WINDOW_NOT_DIALOG: WIN32_ERROR = 1420u32;
+pub const ERROR_WINDOW_OF_OTHER_THREAD: WIN32_ERROR = 1408u32;
+pub const ERROR_WIP_ENCRYPTION_FAILED: WIN32_ERROR = 6023u32;
+pub const ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT: WIN32_ERROR = 4448u32;
+pub const ERROR_WOF_WIM_HEADER_CORRUPT: WIN32_ERROR = 4446u32;
+pub const ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT: WIN32_ERROR = 4447u32;
+pub const ERROR_WORKING_SET_QUOTA: WIN32_ERROR = 1453u32;
+pub const ERROR_WOW_ASSERTION: WIN32_ERROR = 670u32;
+pub const ERROR_WRITE_FAULT: WIN32_ERROR = 29u32;
+pub const ERROR_WRITE_PROTECT: WIN32_ERROR = 19u32;
+pub const ERROR_WRONG_COMPARTMENT: WIN32_ERROR = 1468u32;
+pub const ERROR_WRONG_DISK: WIN32_ERROR = 34u32;
+pub const ERROR_WRONG_EFS: WIN32_ERROR = 6005u32;
+pub const ERROR_WRONG_PASSWORD: WIN32_ERROR = 1323u32;
+pub const ERROR_WRONG_TARGET_NAME: WIN32_ERROR = 1396u32;
+pub const ERROR_WX86_ERROR: WIN32_ERROR = 540u32;
+pub const ERROR_WX86_WARNING: WIN32_ERROR = 539u32;
+pub const ERROR_XMLDSIG_ERROR: WIN32_ERROR = 1466u32;
+pub const ERROR_XML_PARSE_ERROR: WIN32_ERROR = 1465u32;
+pub type EXCEPTION_DISPOSITION = i32;
+pub const EXCEPTION_MAXIMUM_PARAMETERS: u32 = 15u32;
+#[repr(C)]
+pub struct EXCEPTION_POINTERS {
+ pub ExceptionRecord: *mut EXCEPTION_RECORD,
+ pub ContextRecord: *mut CONTEXT,
+}
+impl ::core::marker::Copy for EXCEPTION_POINTERS {}
+impl ::core::clone::Clone for EXCEPTION_POINTERS {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct EXCEPTION_RECORD {
+ pub ExceptionCode: NTSTATUS,
+ pub ExceptionFlags: u32,
+ pub ExceptionRecord: *mut EXCEPTION_RECORD,
+ pub ExceptionAddress: *mut ::core::ffi::c_void,
+ pub NumberParameters: u32,
+ pub ExceptionInformation: [usize; 15],
+}
+impl ::core::marker::Copy for EXCEPTION_RECORD {}
+impl ::core::clone::Clone for EXCEPTION_RECORD {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const EXCEPTION_STACK_OVERFLOW: NTSTATUS = -1073741571i32;
+pub const EXTENDED_STARTUPINFO_PRESENT: PROCESS_CREATION_FLAGS = 524288u32;
+pub const E_NOTIMPL: HRESULT = -2147467263i32;
+pub const ExceptionCollidedUnwind: EXCEPTION_DISPOSITION = 3i32;
+pub const ExceptionContinueExecution: EXCEPTION_DISPOSITION = 0i32;
+pub const ExceptionContinueSearch: EXCEPTION_DISPOSITION = 1i32;
+pub const ExceptionNestedException: EXCEPTION_DISPOSITION = 2i32;
+pub type FACILITY_CODE = u32;
+pub const FACILITY_NT_BIT: FACILITY_CODE = 268435456u32;
+pub const FALSE: BOOL = 0i32;
+pub type FARPROC = ::core::option::Option<unsafe extern "system" fn() -> isize>;
+#[repr(C)]
+pub struct FD_SET {
+ pub fd_count: u32,
+ pub fd_array: [SOCKET; 64],
+}
+impl ::core::marker::Copy for FD_SET {}
+impl ::core::clone::Clone for FD_SET {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct FILETIME {
+ pub dwLowDateTime: u32,
+ pub dwHighDateTime: u32,
+}
+impl ::core::marker::Copy for FILETIME {}
+impl ::core::clone::Clone for FILETIME {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type FILE_ACCESS_RIGHTS = u32;
+pub const FILE_ADD_FILE: FILE_ACCESS_RIGHTS = 2u32;
+pub const FILE_ADD_SUBDIRECTORY: FILE_ACCESS_RIGHTS = 4u32;
+pub const FILE_ALL_ACCESS: FILE_ACCESS_RIGHTS = 2032127u32;
+pub const FILE_APPEND_DATA: FILE_ACCESS_RIGHTS = 4u32;
+pub const FILE_ATTRIBUTE_ARCHIVE: FILE_FLAGS_AND_ATTRIBUTES = 32u32;
+pub const FILE_ATTRIBUTE_COMPRESSED: FILE_FLAGS_AND_ATTRIBUTES = 2048u32;
+pub const FILE_ATTRIBUTE_DEVICE: FILE_FLAGS_AND_ATTRIBUTES = 64u32;
+pub const FILE_ATTRIBUTE_DIRECTORY: FILE_FLAGS_AND_ATTRIBUTES = 16u32;
+pub const FILE_ATTRIBUTE_EA: FILE_FLAGS_AND_ATTRIBUTES = 262144u32;
+pub const FILE_ATTRIBUTE_ENCRYPTED: FILE_FLAGS_AND_ATTRIBUTES = 16384u32;
+pub const FILE_ATTRIBUTE_HIDDEN: FILE_FLAGS_AND_ATTRIBUTES = 2u32;
+pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: FILE_FLAGS_AND_ATTRIBUTES = 32768u32;
+pub const FILE_ATTRIBUTE_NORMAL: FILE_FLAGS_AND_ATTRIBUTES = 128u32;
+pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: FILE_FLAGS_AND_ATTRIBUTES = 8192u32;
+pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: FILE_FLAGS_AND_ATTRIBUTES = 131072u32;
+pub const FILE_ATTRIBUTE_OFFLINE: FILE_FLAGS_AND_ATTRIBUTES = 4096u32;
+pub const FILE_ATTRIBUTE_PINNED: FILE_FLAGS_AND_ATTRIBUTES = 524288u32;
+pub const FILE_ATTRIBUTE_READONLY: FILE_FLAGS_AND_ATTRIBUTES = 1u32;
+pub const FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS: FILE_FLAGS_AND_ATTRIBUTES = 4194304u32;
+pub const FILE_ATTRIBUTE_RECALL_ON_OPEN: FILE_FLAGS_AND_ATTRIBUTES = 262144u32;
+pub const FILE_ATTRIBUTE_REPARSE_POINT: FILE_FLAGS_AND_ATTRIBUTES = 1024u32;
+pub const FILE_ATTRIBUTE_SPARSE_FILE: FILE_FLAGS_AND_ATTRIBUTES = 512u32;
+pub const FILE_ATTRIBUTE_SYSTEM: FILE_FLAGS_AND_ATTRIBUTES = 4u32;
+#[repr(C)]
+pub struct FILE_ATTRIBUTE_TAG_INFO {
+ pub FileAttributes: u32,
+ pub ReparseTag: u32,
+}
+impl ::core::marker::Copy for FILE_ATTRIBUTE_TAG_INFO {}
+impl ::core::clone::Clone for FILE_ATTRIBUTE_TAG_INFO {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const FILE_ATTRIBUTE_TEMPORARY: FILE_FLAGS_AND_ATTRIBUTES = 256u32;
+pub const FILE_ATTRIBUTE_UNPINNED: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32;
+pub const FILE_ATTRIBUTE_VIRTUAL: FILE_FLAGS_AND_ATTRIBUTES = 65536u32;
+#[repr(C)]
+pub struct FILE_BASIC_INFO {
+ pub CreationTime: i64,
+ pub LastAccessTime: i64,
+ pub LastWriteTime: i64,
+ pub ChangeTime: i64,
+ pub FileAttributes: u32,
+}
+impl ::core::marker::Copy for FILE_BASIC_INFO {}
+impl ::core::clone::Clone for FILE_BASIC_INFO {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const FILE_BEGIN: SET_FILE_POINTER_MOVE_METHOD = 0u32;
+pub const FILE_COMPLETE_IF_OPLOCKED: NTCREATEFILE_CREATE_OPTIONS = 256u32;
+pub const FILE_CONTAINS_EXTENDED_CREATE_INFORMATION: NTCREATEFILE_CREATE_OPTIONS = 268435456u32;
+pub const FILE_CREATE: NTCREATEFILE_CREATE_DISPOSITION = 2u32;
+pub const FILE_CREATE_PIPE_INSTANCE: FILE_ACCESS_RIGHTS = 4u32;
+pub const FILE_CREATE_TREE_CONNECTION: NTCREATEFILE_CREATE_OPTIONS = 128u32;
+pub type FILE_CREATION_DISPOSITION = u32;
+pub const FILE_CURRENT: SET_FILE_POINTER_MOVE_METHOD = 1u32;
+pub const FILE_DELETE_CHILD: FILE_ACCESS_RIGHTS = 64u32;
+pub const FILE_DELETE_ON_CLOSE: NTCREATEFILE_CREATE_OPTIONS = 4096u32;
+pub const FILE_DIRECTORY_FILE: NTCREATEFILE_CREATE_OPTIONS = 1u32;
+pub const FILE_DISALLOW_EXCLUSIVE: NTCREATEFILE_CREATE_OPTIONS = 131072u32;
+pub const FILE_DISPOSITION_FLAG_DELETE: FILE_DISPOSITION_INFO_EX_FLAGS = 1u32;
+pub const FILE_DISPOSITION_FLAG_DO_NOT_DELETE: FILE_DISPOSITION_INFO_EX_FLAGS = 0u32;
+pub const FILE_DISPOSITION_FLAG_FORCE_IMAGE_SECTION_CHECK: FILE_DISPOSITION_INFO_EX_FLAGS = 4u32;
+pub const FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE: FILE_DISPOSITION_INFO_EX_FLAGS = 16u32;
+pub const FILE_DISPOSITION_FLAG_ON_CLOSE: FILE_DISPOSITION_INFO_EX_FLAGS = 8u32;
+pub const FILE_DISPOSITION_FLAG_POSIX_SEMANTICS: FILE_DISPOSITION_INFO_EX_FLAGS = 2u32;
+#[repr(C)]
+pub struct FILE_DISPOSITION_INFO {
+ pub DeleteFile: BOOLEAN,
+}
+impl ::core::marker::Copy for FILE_DISPOSITION_INFO {}
+impl ::core::clone::Clone for FILE_DISPOSITION_INFO {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct FILE_DISPOSITION_INFO_EX {
+ pub Flags: FILE_DISPOSITION_INFO_EX_FLAGS,
+}
+impl ::core::marker::Copy for FILE_DISPOSITION_INFO_EX {}
+impl ::core::clone::Clone for FILE_DISPOSITION_INFO_EX {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type FILE_DISPOSITION_INFO_EX_FLAGS = u32;
+pub const FILE_END: SET_FILE_POINTER_MOVE_METHOD = 2u32;
+#[repr(C)]
+pub struct FILE_END_OF_FILE_INFO {
+ pub EndOfFile: i64,
+}
+impl ::core::marker::Copy for FILE_END_OF_FILE_INFO {}
+impl ::core::clone::Clone for FILE_END_OF_FILE_INFO {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const FILE_EXECUTE: FILE_ACCESS_RIGHTS = 32u32;
+pub type FILE_FLAGS_AND_ATTRIBUTES = u32;
+pub const FILE_FLAG_BACKUP_SEMANTICS: FILE_FLAGS_AND_ATTRIBUTES = 33554432u32;
+pub const FILE_FLAG_DELETE_ON_CLOSE: FILE_FLAGS_AND_ATTRIBUTES = 67108864u32;
+pub const FILE_FLAG_FIRST_PIPE_INSTANCE: FILE_FLAGS_AND_ATTRIBUTES = 524288u32;
+pub const FILE_FLAG_NO_BUFFERING: FILE_FLAGS_AND_ATTRIBUTES = 536870912u32;
+pub const FILE_FLAG_OPEN_NO_RECALL: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32;
+pub const FILE_FLAG_OPEN_REPARSE_POINT: FILE_FLAGS_AND_ATTRIBUTES = 2097152u32;
+pub const FILE_FLAG_OVERLAPPED: FILE_FLAGS_AND_ATTRIBUTES = 1073741824u32;
+pub const FILE_FLAG_POSIX_SEMANTICS: FILE_FLAGS_AND_ATTRIBUTES = 16777216u32;
+pub const FILE_FLAG_RANDOM_ACCESS: FILE_FLAGS_AND_ATTRIBUTES = 268435456u32;
+pub const FILE_FLAG_SEQUENTIAL_SCAN: FILE_FLAGS_AND_ATTRIBUTES = 134217728u32;
+pub const FILE_FLAG_SESSION_AWARE: FILE_FLAGS_AND_ATTRIBUTES = 8388608u32;
+pub const FILE_FLAG_WRITE_THROUGH: FILE_FLAGS_AND_ATTRIBUTES = 2147483648u32;
+pub const FILE_GENERIC_EXECUTE: FILE_ACCESS_RIGHTS = 1179808u32;
+pub const FILE_GENERIC_READ: FILE_ACCESS_RIGHTS = 1179785u32;
+pub const FILE_GENERIC_WRITE: FILE_ACCESS_RIGHTS = 1179926u32;
+#[repr(C)]
+pub struct FILE_ID_BOTH_DIR_INFO {
+ pub NextEntryOffset: u32,
+ pub FileIndex: u32,
+ pub CreationTime: i64,
+ pub LastAccessTime: i64,
+ pub LastWriteTime: i64,
+ pub ChangeTime: i64,
+ pub EndOfFile: i64,
+ pub AllocationSize: i64,
+ pub FileAttributes: u32,
+ pub FileNameLength: u32,
+ pub EaSize: u32,
+ pub ShortNameLength: i8,
+ pub ShortName: [u16; 12],
+ pub FileId: i64,
+ pub FileName: [u16; 1],
+}
+impl ::core::marker::Copy for FILE_ID_BOTH_DIR_INFO {}
+impl ::core::clone::Clone for FILE_ID_BOTH_DIR_INFO {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type FILE_INFO_BY_HANDLE_CLASS = i32;
+pub const FILE_LIST_DIRECTORY: FILE_ACCESS_RIGHTS = 1u32;
+pub const FILE_NAME_NORMALIZED: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32;
+pub const FILE_NAME_OPENED: GETFINALPATHNAMEBYHANDLE_FLAGS = 8u32;
+pub const FILE_NON_DIRECTORY_FILE: NTCREATEFILE_CREATE_OPTIONS = 64u32;
+pub const FILE_NO_COMPRESSION: NTCREATEFILE_CREATE_OPTIONS = 32768u32;
+pub const FILE_NO_EA_KNOWLEDGE: NTCREATEFILE_CREATE_OPTIONS = 512u32;
+pub const FILE_NO_INTERMEDIATE_BUFFERING: NTCREATEFILE_CREATE_OPTIONS = 8u32;
+pub const FILE_OPEN: NTCREATEFILE_CREATE_DISPOSITION = 1u32;
+pub const FILE_OPEN_BY_FILE_ID: NTCREATEFILE_CREATE_OPTIONS = 8192u32;
+pub const FILE_OPEN_FOR_BACKUP_INTENT: NTCREATEFILE_CREATE_OPTIONS = 16384u32;
+pub const FILE_OPEN_FOR_FREE_SPACE_QUERY: NTCREATEFILE_CREATE_OPTIONS = 8388608u32;
+pub const FILE_OPEN_IF: NTCREATEFILE_CREATE_DISPOSITION = 3u32;
+pub const FILE_OPEN_NO_RECALL: NTCREATEFILE_CREATE_OPTIONS = 4194304u32;
+pub const FILE_OPEN_REPARSE_POINT: NTCREATEFILE_CREATE_OPTIONS = 2097152u32;
+pub const FILE_OPEN_REQUIRING_OPLOCK: NTCREATEFILE_CREATE_OPTIONS = 65536u32;
+pub const FILE_OVERWRITE: NTCREATEFILE_CREATE_DISPOSITION = 4u32;
+pub const FILE_OVERWRITE_IF: NTCREATEFILE_CREATE_DISPOSITION = 5u32;
+pub const FILE_RANDOM_ACCESS: NTCREATEFILE_CREATE_OPTIONS = 2048u32;
+pub const FILE_READ_ATTRIBUTES: FILE_ACCESS_RIGHTS = 128u32;
+pub const FILE_READ_DATA: FILE_ACCESS_RIGHTS = 1u32;
+pub const FILE_READ_EA: FILE_ACCESS_RIGHTS = 8u32;
+pub const FILE_RESERVE_OPFILTER: NTCREATEFILE_CREATE_OPTIONS = 1048576u32;
+pub const FILE_SEQUENTIAL_ONLY: NTCREATEFILE_CREATE_OPTIONS = 4u32;
+pub const FILE_SESSION_AWARE: NTCREATEFILE_CREATE_OPTIONS = 262144u32;
+pub const FILE_SHARE_DELETE: FILE_SHARE_MODE = 4u32;
+pub type FILE_SHARE_MODE = u32;
+pub const FILE_SHARE_NONE: FILE_SHARE_MODE = 0u32;
+pub const FILE_SHARE_READ: FILE_SHARE_MODE = 1u32;
+pub const FILE_SHARE_WRITE: FILE_SHARE_MODE = 2u32;
+#[repr(C)]
+pub struct FILE_STANDARD_INFO {
+ pub AllocationSize: i64,
+ pub EndOfFile: i64,
+ pub NumberOfLinks: u32,
+ pub DeletePending: BOOLEAN,
+ pub Directory: BOOLEAN,
+}
+impl ::core::marker::Copy for FILE_STANDARD_INFO {}
+impl ::core::clone::Clone for FILE_STANDARD_INFO {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const FILE_SUPERSEDE: NTCREATEFILE_CREATE_DISPOSITION = 0u32;
+pub const FILE_SYNCHRONOUS_IO_ALERT: NTCREATEFILE_CREATE_OPTIONS = 16u32;
+pub const FILE_SYNCHRONOUS_IO_NONALERT: NTCREATEFILE_CREATE_OPTIONS = 32u32;
+pub const FILE_TRAVERSE: FILE_ACCESS_RIGHTS = 32u32;
+pub type FILE_TYPE = u32;
+pub const FILE_TYPE_CHAR: FILE_TYPE = 2u32;
+pub const FILE_TYPE_DISK: FILE_TYPE = 1u32;
+pub const FILE_TYPE_PIPE: FILE_TYPE = 3u32;
+pub const FILE_TYPE_REMOTE: FILE_TYPE = 32768u32;
+pub const FILE_TYPE_UNKNOWN: FILE_TYPE = 0u32;
+pub const FILE_WRITE_ATTRIBUTES: FILE_ACCESS_RIGHTS = 256u32;
+pub const FILE_WRITE_DATA: FILE_ACCESS_RIGHTS = 2u32;
+pub const FILE_WRITE_EA: FILE_ACCESS_RIGHTS = 16u32;
+pub const FILE_WRITE_THROUGH: NTCREATEFILE_CREATE_OPTIONS = 2u32;
+pub const FIONBIO: i32 = -2147195266i32;
+#[repr(C)]
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+pub struct FLOATING_SAVE_AREA {
+ pub ControlWord: u32,
+ pub StatusWord: u32,
+ pub TagWord: u32,
+ pub ErrorOffset: u32,
+ pub ErrorSelector: u32,
+ pub DataOffset: u32,
+ pub DataSelector: u32,
+ pub RegisterArea: [u8; 80],
+ pub Cr0NpxState: u32,
+}
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+impl ::core::marker::Copy for FLOATING_SAVE_AREA {}
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+impl ::core::clone::Clone for FLOATING_SAVE_AREA {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "x86")]
+pub struct FLOATING_SAVE_AREA {
+ pub ControlWord: u32,
+ pub StatusWord: u32,
+ pub TagWord: u32,
+ pub ErrorOffset: u32,
+ pub ErrorSelector: u32,
+ pub DataOffset: u32,
+ pub DataSelector: u32,
+ pub RegisterArea: [u8; 80],
+ pub Spare0: u32,
+}
+#[cfg(target_arch = "x86")]
+impl ::core::marker::Copy for FLOATING_SAVE_AREA {}
+#[cfg(target_arch = "x86")]
+impl ::core::clone::Clone for FLOATING_SAVE_AREA {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: FORMAT_MESSAGE_OPTIONS = 256u32;
+pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: FORMAT_MESSAGE_OPTIONS = 8192u32;
+pub const FORMAT_MESSAGE_FROM_HMODULE: FORMAT_MESSAGE_OPTIONS = 2048u32;
+pub const FORMAT_MESSAGE_FROM_STRING: FORMAT_MESSAGE_OPTIONS = 1024u32;
+pub const FORMAT_MESSAGE_FROM_SYSTEM: FORMAT_MESSAGE_OPTIONS = 4096u32;
+pub const FORMAT_MESSAGE_IGNORE_INSERTS: FORMAT_MESSAGE_OPTIONS = 512u32;
+pub type FORMAT_MESSAGE_OPTIONS = u32;
+pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: i32 = 8014i32;
+pub const FSCTL_GET_REPARSE_POINT: u32 = 589992u32;
+pub const FSCTL_SET_REPARSE_POINT: u32 = 589988u32;
+pub const FileAlignmentInfo: FILE_INFO_BY_HANDLE_CLASS = 17i32;
+pub const FileAllocationInfo: FILE_INFO_BY_HANDLE_CLASS = 5i32;
+pub const FileAttributeTagInfo: FILE_INFO_BY_HANDLE_CLASS = 9i32;
+pub const FileBasicInfo: FILE_INFO_BY_HANDLE_CLASS = 0i32;
+pub const FileCaseSensitiveInfo: FILE_INFO_BY_HANDLE_CLASS = 23i32;
+pub const FileCompressionInfo: FILE_INFO_BY_HANDLE_CLASS = 8i32;
+pub const FileDispositionInfo: FILE_INFO_BY_HANDLE_CLASS = 4i32;
+pub const FileDispositionInfoEx: FILE_INFO_BY_HANDLE_CLASS = 21i32;
+pub const FileEndOfFileInfo: FILE_INFO_BY_HANDLE_CLASS = 6i32;
+pub const FileFullDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 14i32;
+pub const FileFullDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 15i32;
+pub const FileIdBothDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 10i32;
+pub const FileIdBothDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 11i32;
+pub const FileIdExtdDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 19i32;
+pub const FileIdExtdDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 20i32;
+pub const FileIdInfo: FILE_INFO_BY_HANDLE_CLASS = 18i32;
+pub const FileIoPriorityHintInfo: FILE_INFO_BY_HANDLE_CLASS = 12i32;
+pub const FileNameInfo: FILE_INFO_BY_HANDLE_CLASS = 2i32;
+pub const FileNormalizedNameInfo: FILE_INFO_BY_HANDLE_CLASS = 24i32;
+pub const FileRemoteProtocolInfo: FILE_INFO_BY_HANDLE_CLASS = 13i32;
+pub const FileRenameInfo: FILE_INFO_BY_HANDLE_CLASS = 3i32;
+pub const FileRenameInfoEx: FILE_INFO_BY_HANDLE_CLASS = 22i32;
+pub const FileStandardInfo: FILE_INFO_BY_HANDLE_CLASS = 1i32;
+pub const FileStorageInfo: FILE_INFO_BY_HANDLE_CLASS = 16i32;
+pub const FileStreamInfo: FILE_INFO_BY_HANDLE_CLASS = 7i32;
+pub type FindFileHandle = *mut ::core::ffi::c_void;
+pub type GENERIC_ACCESS_RIGHTS = u32;
+pub const GENERIC_ALL: GENERIC_ACCESS_RIGHTS = 268435456u32;
+pub const GENERIC_EXECUTE: GENERIC_ACCESS_RIGHTS = 536870912u32;
+pub const GENERIC_READ: GENERIC_ACCESS_RIGHTS = 2147483648u32;
+pub const GENERIC_WRITE: GENERIC_ACCESS_RIGHTS = 1073741824u32;
+pub type GETFINALPATHNAMEBYHANDLE_FLAGS = u32;
+#[repr(C)]
+pub struct GUID {
+ pub data1: u32,
+ pub data2: u16,
+ pub data3: u16,
+ pub data4: [u8; 8],
+}
+impl GUID {
+ pub const fn from_u128(uuid: u128) -> Self {
+ Self {
+ data1: (uuid >> 96) as u32,
+ data2: (uuid >> 80 & 0xffff) as u16,
+ data3: (uuid >> 64 & 0xffff) as u16,
+ data4: (uuid as u64).to_be_bytes(),
+ }
+ }
+}
+impl ::core::marker::Copy for GUID {}
+impl ::core::clone::Clone for GUID {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type HANDLE = *mut ::core::ffi::c_void;
+pub type HANDLE_FLAGS = u32;
+pub const HANDLE_FLAG_INHERIT: HANDLE_FLAGS = 1u32;
+pub const HANDLE_FLAG_PROTECT_FROM_CLOSE: HANDLE_FLAGS = 2u32;
+pub const HIGH_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 128u32;
+pub type HMODULE = *mut ::core::ffi::c_void;
+pub type HRESULT = i32;
+pub const IDLE_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 64u32;
+#[repr(C)]
+pub struct IN6_ADDR {
+ pub u: IN6_ADDR_0,
+}
+impl ::core::marker::Copy for IN6_ADDR {}
+impl ::core::clone::Clone for IN6_ADDR {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub union IN6_ADDR_0 {
+ pub Byte: [u8; 16],
+ pub Word: [u16; 8],
+}
+impl ::core::marker::Copy for IN6_ADDR_0 {}
+impl ::core::clone::Clone for IN6_ADDR_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const INFINITE: u32 = 4294967295u32;
+pub const INHERIT_CALLER_PRIORITY: PROCESS_CREATION_FLAGS = 131072u32;
+pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32;
+pub const INIT_ONCE_INIT_FAILED: u32 = 4u32;
+pub const INVALID_FILE_ATTRIBUTES: u32 = 4294967295u32;
+pub const INVALID_HANDLE_VALUE: HANDLE = ::core::ptr::invalid_mut(-1i32 as _);
+pub const INVALID_SOCKET: SOCKET = -1i32 as _;
+#[repr(C)]
+pub struct IN_ADDR {
+ pub S_un: IN_ADDR_0,
+}
+impl ::core::marker::Copy for IN_ADDR {}
+impl ::core::clone::Clone for IN_ADDR {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub union IN_ADDR_0 {
+ pub S_un_b: IN_ADDR_0_0,
+ pub S_un_w: IN_ADDR_0_1,
+ pub S_addr: u32,
+}
+impl ::core::marker::Copy for IN_ADDR_0 {}
+impl ::core::clone::Clone for IN_ADDR_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct IN_ADDR_0_0 {
+ pub s_b1: u8,
+ pub s_b2: u8,
+ pub s_b3: u8,
+ pub s_b4: u8,
+}
+impl ::core::marker::Copy for IN_ADDR_0_0 {}
+impl ::core::clone::Clone for IN_ADDR_0_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct IN_ADDR_0_1 {
+ pub s_w1: u16,
+ pub s_w2: u16,
+}
+impl ::core::marker::Copy for IN_ADDR_0_1 {}
+impl ::core::clone::Clone for IN_ADDR_0_1 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const IO_REPARSE_TAG_MOUNT_POINT: u32 = 2684354563u32;
+pub const IO_REPARSE_TAG_SYMLINK: u32 = 2684354572u32;
+#[repr(C)]
+pub struct IO_STATUS_BLOCK {
+ pub Anonymous: IO_STATUS_BLOCK_0,
+ pub Information: usize,
+}
+impl ::core::marker::Copy for IO_STATUS_BLOCK {}
+impl ::core::clone::Clone for IO_STATUS_BLOCK {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub union IO_STATUS_BLOCK_0 {
+ pub Status: NTSTATUS,
+ pub Pointer: *mut ::core::ffi::c_void,
+}
+impl ::core::marker::Copy for IO_STATUS_BLOCK_0 {}
+impl ::core::clone::Clone for IO_STATUS_BLOCK_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type IPPROTO = i32;
+pub const IPPROTO_AH: IPPROTO = 51i32;
+pub const IPPROTO_CBT: IPPROTO = 7i32;
+pub const IPPROTO_DSTOPTS: IPPROTO = 60i32;
+pub const IPPROTO_EGP: IPPROTO = 8i32;
+pub const IPPROTO_ESP: IPPROTO = 50i32;
+pub const IPPROTO_FRAGMENT: IPPROTO = 44i32;
+pub const IPPROTO_GGP: IPPROTO = 3i32;
+pub const IPPROTO_HOPOPTS: IPPROTO = 0i32;
+pub const IPPROTO_ICLFXBM: IPPROTO = 78i32;
+pub const IPPROTO_ICMP: IPPROTO = 1i32;
+pub const IPPROTO_ICMPV6: IPPROTO = 58i32;
+pub const IPPROTO_IDP: IPPROTO = 22i32;
+pub const IPPROTO_IGMP: IPPROTO = 2i32;
+pub const IPPROTO_IGP: IPPROTO = 9i32;
+pub const IPPROTO_IP: IPPROTO = 0i32;
+pub const IPPROTO_IPV4: IPPROTO = 4i32;
+pub const IPPROTO_IPV6: IPPROTO = 41i32;
+pub const IPPROTO_L2TP: IPPROTO = 115i32;
+pub const IPPROTO_MAX: IPPROTO = 256i32;
+pub const IPPROTO_ND: IPPROTO = 77i32;
+pub const IPPROTO_NONE: IPPROTO = 59i32;
+pub const IPPROTO_PGM: IPPROTO = 113i32;
+pub const IPPROTO_PIM: IPPROTO = 103i32;
+pub const IPPROTO_PUP: IPPROTO = 12i32;
+pub const IPPROTO_RAW: IPPROTO = 255i32;
+pub const IPPROTO_RDP: IPPROTO = 27i32;
+pub const IPPROTO_RESERVED_IPSEC: IPPROTO = 258i32;
+pub const IPPROTO_RESERVED_IPSECOFFLOAD: IPPROTO = 259i32;
+pub const IPPROTO_RESERVED_MAX: IPPROTO = 261i32;
+pub const IPPROTO_RESERVED_RAW: IPPROTO = 257i32;
+pub const IPPROTO_RESERVED_WNV: IPPROTO = 260i32;
+pub const IPPROTO_RM: IPPROTO = 113i32;
+pub const IPPROTO_ROUTING: IPPROTO = 43i32;
+pub const IPPROTO_SCTP: IPPROTO = 132i32;
+pub const IPPROTO_ST: IPPROTO = 5i32;
+pub const IPPROTO_TCP: IPPROTO = 6i32;
+pub const IPPROTO_UDP: IPPROTO = 17i32;
+pub const IPV6_ADD_MEMBERSHIP: i32 = 12i32;
+pub const IPV6_DROP_MEMBERSHIP: i32 = 13i32;
+#[repr(C)]
+pub struct IPV6_MREQ {
+ pub ipv6mr_multiaddr: IN6_ADDR,
+ pub ipv6mr_interface: u32,
+}
+impl ::core::marker::Copy for IPV6_MREQ {}
+impl ::core::clone::Clone for IPV6_MREQ {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const IPV6_MULTICAST_LOOP: i32 = 11i32;
+pub const IPV6_V6ONLY: i32 = 27i32;
+pub const IP_ADD_MEMBERSHIP: i32 = 12i32;
+pub const IP_DROP_MEMBERSHIP: i32 = 13i32;
+#[repr(C)]
+pub struct IP_MREQ {
+ pub imr_multiaddr: IN_ADDR,
+ pub imr_interface: IN_ADDR,
+}
+impl ::core::marker::Copy for IP_MREQ {}
+impl ::core::clone::Clone for IP_MREQ {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const IP_MULTICAST_LOOP: i32 = 11i32;
+pub const IP_MULTICAST_TTL: i32 = 10i32;
+pub const IP_TTL: i32 = 4i32;
+#[repr(C)]
+pub struct LINGER {
+ pub l_onoff: u16,
+ pub l_linger: u16,
+}
+impl ::core::marker::Copy for LINGER {}
+impl ::core::clone::Clone for LINGER {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type LPOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option<
+ unsafe extern "system" fn(
+ dwerrorcode: u32,
+ dwnumberofbytestransfered: u32,
+ lpoverlapped: *mut OVERLAPPED,
+ ) -> (),
+>;
+pub type LPPROGRESS_ROUTINE = ::core::option::Option<
+ unsafe extern "system" fn(
+ totalfilesize: i64,
+ totalbytestransferred: i64,
+ streamsize: i64,
+ streambytestransferred: i64,
+ dwstreamnumber: u32,
+ dwcallbackreason: LPPROGRESS_ROUTINE_CALLBACK_REASON,
+ hsourcefile: HANDLE,
+ hdestinationfile: HANDLE,
+ lpdata: *const ::core::ffi::c_void,
+ ) -> u32,
+>;
+pub type LPPROGRESS_ROUTINE_CALLBACK_REASON = u32;
+pub type LPTHREAD_START_ROUTINE = ::core::option::Option<
+ unsafe extern "system" fn(lpthreadparameter: *mut ::core::ffi::c_void) -> u32,
+>;
+pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option<
+ unsafe extern "system" fn(
+ dwerror: u32,
+ cbtransferred: u32,
+ lpoverlapped: *mut OVERLAPPED,
+ dwflags: u32,
+ ) -> (),
+>;
+#[repr(C)]
+pub struct M128A {
+ pub Low: u64,
+ pub High: i64,
+}
+impl ::core::marker::Copy for M128A {}
+impl ::core::clone::Clone for M128A {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: u32 = 16384u32;
+pub const MAX_PATH: u32 = 260u32;
+pub const MB_COMPOSITE: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 2u32;
+pub const MB_ERR_INVALID_CHARS: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 8u32;
+pub const MB_PRECOMPOSED: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 1u32;
+pub const MB_USEGLYPHCHARS: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 4u32;
+pub const MOVEFILE_COPY_ALLOWED: MOVE_FILE_FLAGS = 2u32;
+pub const MOVEFILE_CREATE_HARDLINK: MOVE_FILE_FLAGS = 16u32;
+pub const MOVEFILE_DELAY_UNTIL_REBOOT: MOVE_FILE_FLAGS = 4u32;
+pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: MOVE_FILE_FLAGS = 32u32;
+pub const MOVEFILE_REPLACE_EXISTING: MOVE_FILE_FLAGS = 1u32;
+pub const MOVEFILE_WRITE_THROUGH: MOVE_FILE_FLAGS = 8u32;
+pub type MOVE_FILE_FLAGS = u32;
+pub const MSG_DONTROUTE: SEND_RECV_FLAGS = 4i32;
+pub const MSG_OOB: SEND_RECV_FLAGS = 1i32;
+pub const MSG_PEEK: SEND_RECV_FLAGS = 2i32;
+pub const MSG_PUSH_IMMEDIATE: SEND_RECV_FLAGS = 32i32;
+pub const MSG_WAITALL: SEND_RECV_FLAGS = 8i32;
+pub type MULTI_BYTE_TO_WIDE_CHAR_FLAGS = u32;
+pub const MaximumFileInfoByHandleClass: FILE_INFO_BY_HANDLE_CLASS = 25i32;
+pub type NAMED_PIPE_MODE = u32;
+pub const NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32u32;
+pub const NO_ERROR: WIN32_ERROR = 0u32;
+pub type NTCREATEFILE_CREATE_DISPOSITION = u32;
+pub type NTCREATEFILE_CREATE_OPTIONS = u32;
+pub type NTSTATUS = i32;
+#[repr(C)]
+pub struct OBJECT_ATTRIBUTES {
+ pub Length: u32,
+ pub RootDirectory: HANDLE,
+ pub ObjectName: *mut UNICODE_STRING,
+ pub Attributes: u32,
+ pub SecurityDescriptor: *mut ::core::ffi::c_void,
+ pub SecurityQualityOfService: *mut ::core::ffi::c_void,
+}
+impl ::core::marker::Copy for OBJECT_ATTRIBUTES {}
+impl ::core::clone::Clone for OBJECT_ATTRIBUTES {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const OBJ_DONT_REPARSE: i32 = 4096i32;
+pub const OPEN_ALWAYS: FILE_CREATION_DISPOSITION = 4u32;
+pub const OPEN_EXISTING: FILE_CREATION_DISPOSITION = 3u32;
+#[repr(C)]
+pub struct OVERLAPPED {
+ pub Internal: usize,
+ pub InternalHigh: usize,
+ pub Anonymous: OVERLAPPED_0,
+ pub hEvent: HANDLE,
+}
+impl ::core::marker::Copy for OVERLAPPED {}
+impl ::core::clone::Clone for OVERLAPPED {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub union OVERLAPPED_0 {
+ pub Anonymous: OVERLAPPED_0_0,
+ pub Pointer: *mut ::core::ffi::c_void,
+}
+impl ::core::marker::Copy for OVERLAPPED_0 {}
+impl ::core::clone::Clone for OVERLAPPED_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct OVERLAPPED_0_0 {
+ pub Offset: u32,
+ pub OffsetHigh: u32,
+}
+impl ::core::marker::Copy for OVERLAPPED_0_0 {}
+impl ::core::clone::Clone for OVERLAPPED_0_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type PCSTR = *const u8;
+pub type PCWSTR = *const u16;
+pub type PIO_APC_ROUTINE = ::core::option::Option<
+ unsafe extern "system" fn(
+ apccontext: *const ::core::ffi::c_void,
+ iostatusblock: *const IO_STATUS_BLOCK,
+ reserved: u32,
+ ) -> (),
+>;
+pub const PIPE_ACCEPT_REMOTE_CLIENTS: NAMED_PIPE_MODE = 0u32;
+pub const PIPE_ACCESS_DUPLEX: FILE_FLAGS_AND_ATTRIBUTES = 3u32;
+pub const PIPE_ACCESS_INBOUND: FILE_FLAGS_AND_ATTRIBUTES = 1u32;
+pub const PIPE_ACCESS_OUTBOUND: FILE_FLAGS_AND_ATTRIBUTES = 2u32;
+pub const PIPE_CLIENT_END: NAMED_PIPE_MODE = 0u32;
+pub const PIPE_NOWAIT: NAMED_PIPE_MODE = 1u32;
+pub const PIPE_READMODE_BYTE: NAMED_PIPE_MODE = 0u32;
+pub const PIPE_READMODE_MESSAGE: NAMED_PIPE_MODE = 2u32;
+pub const PIPE_REJECT_REMOTE_CLIENTS: NAMED_PIPE_MODE = 8u32;
+pub const PIPE_SERVER_END: NAMED_PIPE_MODE = 1u32;
+pub const PIPE_TYPE_BYTE: NAMED_PIPE_MODE = 0u32;
+pub const PIPE_TYPE_MESSAGE: NAMED_PIPE_MODE = 4u32;
+pub const PIPE_WAIT: NAMED_PIPE_MODE = 0u32;
+pub type PROCESSOR_ARCHITECTURE = u16;
+pub type PROCESS_CREATION_FLAGS = u32;
+#[repr(C)]
+pub struct PROCESS_INFORMATION {
+ pub hProcess: HANDLE,
+ pub hThread: HANDLE,
+ pub dwProcessId: u32,
+ pub dwThreadId: u32,
+}
+impl ::core::marker::Copy for PROCESS_INFORMATION {}
+impl ::core::clone::Clone for PROCESS_INFORMATION {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const PROCESS_MODE_BACKGROUND_BEGIN: PROCESS_CREATION_FLAGS = 1048576u32;
+pub const PROCESS_MODE_BACKGROUND_END: PROCESS_CREATION_FLAGS = 2097152u32;
+pub const PROFILE_KERNEL: PROCESS_CREATION_FLAGS = 536870912u32;
+pub const PROFILE_SERVER: PROCESS_CREATION_FLAGS = 1073741824u32;
+pub const PROFILE_USER: PROCESS_CREATION_FLAGS = 268435456u32;
+pub const PROGRESS_CONTINUE: u32 = 0u32;
+pub type PSTR = *mut u8;
+pub type PVECTORED_EXCEPTION_HANDLER = ::core::option::Option<
+ unsafe extern "system" fn(exceptioninfo: *mut EXCEPTION_POINTERS) -> i32,
+>;
+pub type PWSTR = *mut u16;
+pub const READ_CONTROL: FILE_ACCESS_RIGHTS = 131072u32;
+pub const REALTIME_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 256u32;
+#[repr(C)]
+pub struct RTL_CONDITION_VARIABLE {
+ pub Ptr: *mut ::core::ffi::c_void,
+}
+impl ::core::marker::Copy for RTL_CONDITION_VARIABLE {}
+impl ::core::clone::Clone for RTL_CONDITION_VARIABLE {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub union RTL_RUN_ONCE {
+ pub Ptr: *mut ::core::ffi::c_void,
+}
+impl ::core::marker::Copy for RTL_RUN_ONCE {}
+impl ::core::clone::Clone for RTL_RUN_ONCE {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct RTL_SRWLOCK {
+ pub Ptr: *mut ::core::ffi::c_void,
+}
+impl ::core::marker::Copy for RTL_SRWLOCK {}
+impl ::core::clone::Clone for RTL_SRWLOCK {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const SD_BOTH: WINSOCK_SHUTDOWN_HOW = 2i32;
+pub const SD_RECEIVE: WINSOCK_SHUTDOWN_HOW = 0i32;
+pub const SD_SEND: WINSOCK_SHUTDOWN_HOW = 1i32;
+pub const SECURITY_ANONYMOUS: FILE_FLAGS_AND_ATTRIBUTES = 0u32;
+#[repr(C)]
+pub struct SECURITY_ATTRIBUTES {
+ pub nLength: u32,
+ pub lpSecurityDescriptor: *mut ::core::ffi::c_void,
+ pub bInheritHandle: BOOL,
+}
+impl ::core::marker::Copy for SECURITY_ATTRIBUTES {}
+impl ::core::clone::Clone for SECURITY_ATTRIBUTES {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const SECURITY_CONTEXT_TRACKING: FILE_FLAGS_AND_ATTRIBUTES = 262144u32;
+pub const SECURITY_DELEGATION: FILE_FLAGS_AND_ATTRIBUTES = 196608u32;
+pub const SECURITY_EFFECTIVE_ONLY: FILE_FLAGS_AND_ATTRIBUTES = 524288u32;
+pub const SECURITY_IDENTIFICATION: FILE_FLAGS_AND_ATTRIBUTES = 65536u32;
+pub const SECURITY_IMPERSONATION: FILE_FLAGS_AND_ATTRIBUTES = 131072u32;
+pub const SECURITY_SQOS_PRESENT: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32;
+pub const SECURITY_VALID_SQOS_FLAGS: FILE_FLAGS_AND_ATTRIBUTES = 2031616u32;
+pub type SEND_RECV_FLAGS = i32;
+pub type SET_FILE_POINTER_MOVE_METHOD = u32;
+#[repr(C)]
+pub struct SOCKADDR {
+ pub sa_family: ADDRESS_FAMILY,
+ pub sa_data: [u8; 14],
+}
+impl ::core::marker::Copy for SOCKADDR {}
+impl ::core::clone::Clone for SOCKADDR {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[cfg(target_pointer_width = "32")]
+pub type SOCKET = u32;
+#[cfg(target_pointer_width = "64")]
+pub type SOCKET = u64;
+pub const SOCKET_ERROR: i32 = -1i32;
+pub const SOCK_DGRAM: WINSOCK_SOCKET_TYPE = 2i32;
+pub const SOCK_RAW: WINSOCK_SOCKET_TYPE = 3i32;
+pub const SOCK_RDM: WINSOCK_SOCKET_TYPE = 4i32;
+pub const SOCK_SEQPACKET: WINSOCK_SOCKET_TYPE = 5i32;
+pub const SOCK_STREAM: WINSOCK_SOCKET_TYPE = 1i32;
+pub const SOL_SOCKET: i32 = 65535i32;
+pub const SO_BROADCAST: i32 = 32i32;
+pub const SO_ERROR: i32 = 4103i32;
+pub const SO_LINGER: i32 = 128i32;
+pub const SO_RCVTIMEO: i32 = 4102i32;
+pub const SO_SNDTIMEO: i32 = 4101i32;
+pub const SPECIFIC_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 65535u32;
+pub const STACK_SIZE_PARAM_IS_A_RESERVATION: THREAD_CREATION_FLAGS = 65536u32;
+pub const STANDARD_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 2031616u32;
+pub const STANDARD_RIGHTS_EXECUTE: FILE_ACCESS_RIGHTS = 131072u32;
+pub const STANDARD_RIGHTS_READ: FILE_ACCESS_RIGHTS = 131072u32;
+pub const STANDARD_RIGHTS_REQUIRED: FILE_ACCESS_RIGHTS = 983040u32;
+pub const STANDARD_RIGHTS_WRITE: FILE_ACCESS_RIGHTS = 131072u32;
+pub const STARTF_FORCEOFFFEEDBACK: STARTUPINFOW_FLAGS = 128u32;
+pub const STARTF_FORCEONFEEDBACK: STARTUPINFOW_FLAGS = 64u32;
+pub const STARTF_PREVENTPINNING: STARTUPINFOW_FLAGS = 8192u32;
+pub const STARTF_RUNFULLSCREEN: STARTUPINFOW_FLAGS = 32u32;
+pub const STARTF_TITLEISAPPID: STARTUPINFOW_FLAGS = 4096u32;
+pub const STARTF_TITLEISLINKNAME: STARTUPINFOW_FLAGS = 2048u32;
+pub const STARTF_UNTRUSTEDSOURCE: STARTUPINFOW_FLAGS = 32768u32;
+pub const STARTF_USECOUNTCHARS: STARTUPINFOW_FLAGS = 8u32;
+pub const STARTF_USEFILLATTRIBUTE: STARTUPINFOW_FLAGS = 16u32;
+pub const STARTF_USEHOTKEY: STARTUPINFOW_FLAGS = 512u32;
+pub const STARTF_USEPOSITION: STARTUPINFOW_FLAGS = 4u32;
+pub const STARTF_USESHOWWINDOW: STARTUPINFOW_FLAGS = 1u32;
+pub const STARTF_USESIZE: STARTUPINFOW_FLAGS = 2u32;
+pub const STARTF_USESTDHANDLES: STARTUPINFOW_FLAGS = 256u32;
+#[repr(C)]
+pub struct STARTUPINFOW {
+ pub cb: u32,
+ pub lpReserved: PWSTR,
+ pub lpDesktop: PWSTR,
+ pub lpTitle: PWSTR,
+ pub dwX: u32,
+ pub dwY: u32,
+ pub dwXSize: u32,
+ pub dwYSize: u32,
+ pub dwXCountChars: u32,
+ pub dwYCountChars: u32,
+ pub dwFillAttribute: u32,
+ pub dwFlags: STARTUPINFOW_FLAGS,
+ pub wShowWindow: u16,
+ pub cbReserved2: u16,
+ pub lpReserved2: *mut u8,
+ pub hStdInput: HANDLE,
+ pub hStdOutput: HANDLE,
+ pub hStdError: HANDLE,
+}
+impl ::core::marker::Copy for STARTUPINFOW {}
+impl ::core::clone::Clone for STARTUPINFOW {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type STARTUPINFOW_FLAGS = u32;
+pub const STATUS_DELETE_PENDING: NTSTATUS = -1073741738i32;
+pub const STATUS_END_OF_FILE: NTSTATUS = -1073741807i32;
+pub const STATUS_INVALID_PARAMETER: NTSTATUS = -1073741811i32;
+pub const STATUS_PENDING: NTSTATUS = 259i32;
+pub const STATUS_SUCCESS: NTSTATUS = 0i32;
+pub const STD_ERROR_HANDLE: STD_HANDLE = 4294967284u32;
+pub type STD_HANDLE = u32;
+pub const STD_INPUT_HANDLE: STD_HANDLE = 4294967286u32;
+pub const STD_OUTPUT_HANDLE: STD_HANDLE = 4294967285u32;
+pub type SYMBOLIC_LINK_FLAGS = u32;
+pub const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: SYMBOLIC_LINK_FLAGS = 2u32;
+pub const SYMBOLIC_LINK_FLAG_DIRECTORY: SYMBOLIC_LINK_FLAGS = 1u32;
+pub const SYMLINK_FLAG_RELATIVE: u32 = 1u32;
+pub const SYNCHRONIZE: FILE_ACCESS_RIGHTS = 1048576u32;
+#[repr(C)]
+pub struct SYSTEM_INFO {
+ pub Anonymous: SYSTEM_INFO_0,
+ pub dwPageSize: u32,
+ pub lpMinimumApplicationAddress: *mut ::core::ffi::c_void,
+ pub lpMaximumApplicationAddress: *mut ::core::ffi::c_void,
+ pub dwActiveProcessorMask: usize,
+ pub dwNumberOfProcessors: u32,
+ pub dwProcessorType: u32,
+ pub dwAllocationGranularity: u32,
+ pub wProcessorLevel: u16,
+ pub wProcessorRevision: u16,
+}
+impl ::core::marker::Copy for SYSTEM_INFO {}
+impl ::core::clone::Clone for SYSTEM_INFO {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub union SYSTEM_INFO_0 {
+ pub dwOemId: u32,
+ pub Anonymous: SYSTEM_INFO_0_0,
+}
+impl ::core::marker::Copy for SYSTEM_INFO_0 {}
+impl ::core::clone::Clone for SYSTEM_INFO_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct SYSTEM_INFO_0_0 {
+ pub wProcessorArchitecture: PROCESSOR_ARCHITECTURE,
+ pub wReserved: u16,
+}
+impl ::core::marker::Copy for SYSTEM_INFO_0_0 {}
+impl ::core::clone::Clone for SYSTEM_INFO_0_0 {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const TCP_NODELAY: i32 = 1i32;
+pub const THREAD_CREATE_RUN_IMMEDIATELY: THREAD_CREATION_FLAGS = 0u32;
+pub const THREAD_CREATE_SUSPENDED: THREAD_CREATION_FLAGS = 4u32;
+pub type THREAD_CREATION_FLAGS = u32;
+#[repr(C)]
+pub struct TIMEVAL {
+ pub tv_sec: i32,
+ pub tv_usec: i32,
+}
+impl ::core::marker::Copy for TIMEVAL {}
+impl ::core::clone::Clone for TIMEVAL {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const TLS_OUT_OF_INDEXES: u32 = 4294967295u32;
+pub type TOKEN_ACCESS_MASK = u32;
+pub const TOKEN_ACCESS_PSEUDO_HANDLE: TOKEN_ACCESS_MASK = 24u32;
+pub const TOKEN_ACCESS_PSEUDO_HANDLE_WIN8: TOKEN_ACCESS_MASK = 24u32;
+pub const TOKEN_ACCESS_SYSTEM_SECURITY: TOKEN_ACCESS_MASK = 16777216u32;
+pub const TOKEN_ADJUST_DEFAULT: TOKEN_ACCESS_MASK = 128u32;
+pub const TOKEN_ADJUST_GROUPS: TOKEN_ACCESS_MASK = 64u32;
+pub const TOKEN_ADJUST_PRIVILEGES: TOKEN_ACCESS_MASK = 32u32;
+pub const TOKEN_ADJUST_SESSIONID: TOKEN_ACCESS_MASK = 256u32;
+pub const TOKEN_ALL_ACCESS: TOKEN_ACCESS_MASK = 983551u32;
+pub const TOKEN_ASSIGN_PRIMARY: TOKEN_ACCESS_MASK = 1u32;
+pub const TOKEN_DELETE: TOKEN_ACCESS_MASK = 65536u32;
+pub const TOKEN_DUPLICATE: TOKEN_ACCESS_MASK = 2u32;
+pub const TOKEN_EXECUTE: TOKEN_ACCESS_MASK = 131072u32;
+pub const TOKEN_IMPERSONATE: TOKEN_ACCESS_MASK = 4u32;
+pub const TOKEN_QUERY: TOKEN_ACCESS_MASK = 8u32;
+pub const TOKEN_QUERY_SOURCE: TOKEN_ACCESS_MASK = 16u32;
+pub const TOKEN_READ: TOKEN_ACCESS_MASK = 131080u32;
+pub const TOKEN_READ_CONTROL: TOKEN_ACCESS_MASK = 131072u32;
+pub const TOKEN_TRUST_CONSTRAINT_MASK: TOKEN_ACCESS_MASK = 131096u32;
+pub const TOKEN_WRITE: TOKEN_ACCESS_MASK = 131296u32;
+pub const TOKEN_WRITE_DAC: TOKEN_ACCESS_MASK = 262144u32;
+pub const TOKEN_WRITE_OWNER: TOKEN_ACCESS_MASK = 524288u32;
+pub const TRUE: BOOL = 1i32;
+pub const TRUNCATE_EXISTING: FILE_CREATION_DISPOSITION = 5u32;
+#[repr(C)]
+pub struct UNICODE_STRING {
+ pub Length: u16,
+ pub MaximumLength: u16,
+ pub Buffer: PWSTR,
+}
+impl ::core::marker::Copy for UNICODE_STRING {}
+impl ::core::clone::Clone for UNICODE_STRING {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const VOLUME_NAME_DOS: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32;
+pub const VOLUME_NAME_GUID: GETFINALPATHNAMEBYHANDLE_FLAGS = 1u32;
+pub const VOLUME_NAME_NONE: GETFINALPATHNAMEBYHANDLE_FLAGS = 4u32;
+pub const WAIT_ABANDONED: WIN32_ERROR = 128u32;
+pub const WAIT_ABANDONED_0: WIN32_ERROR = 128u32;
+pub const WAIT_FAILED: WIN32_ERROR = 4294967295u32;
+pub const WAIT_IO_COMPLETION: WIN32_ERROR = 192u32;
+pub const WAIT_OBJECT_0: WIN32_ERROR = 0u32;
+pub const WAIT_TIMEOUT: WIN32_ERROR = 258u32;
+pub const WC_ERR_INVALID_CHARS: u32 = 128u32;
+pub type WIN32_ERROR = u32;
+#[repr(C)]
+pub struct WIN32_FIND_DATAW {
+ pub dwFileAttributes: u32,
+ pub ftCreationTime: FILETIME,
+ pub ftLastAccessTime: FILETIME,
+ pub ftLastWriteTime: FILETIME,
+ pub nFileSizeHigh: u32,
+ pub nFileSizeLow: u32,
+ pub dwReserved0: u32,
+ pub dwReserved1: u32,
+ pub cFileName: [u16; 260],
+ pub cAlternateFileName: [u16; 14],
+}
+impl ::core::marker::Copy for WIN32_FIND_DATAW {}
+impl ::core::clone::Clone for WIN32_FIND_DATAW {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub type WINSOCK_SHUTDOWN_HOW = i32;
+pub type WINSOCK_SOCKET_TYPE = i32;
+pub const WRITE_DAC: FILE_ACCESS_RIGHTS = 262144u32;
+pub const WRITE_OWNER: FILE_ACCESS_RIGHTS = 524288u32;
+pub const WSABASEERR: WSA_ERROR = 10000i32;
+#[repr(C)]
+pub struct WSABUF {
+ pub len: u32,
+ pub buf: PSTR,
+}
+impl ::core::marker::Copy for WSABUF {}
+impl ::core::clone::Clone for WSABUF {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+pub struct WSADATA {
+ pub wVersion: u16,
+ pub wHighVersion: u16,
+ pub iMaxSockets: u16,
+ pub iMaxUdpDg: u16,
+ pub lpVendorInfo: PSTR,
+ pub szDescription: [u8; 257],
+ pub szSystemStatus: [u8; 129],
+}
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+impl ::core::marker::Copy for WSADATA {}
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+impl ::core::clone::Clone for WSADATA {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "x86")]
+pub struct WSADATA {
+ pub wVersion: u16,
+ pub wHighVersion: u16,
+ pub szDescription: [u8; 257],
+ pub szSystemStatus: [u8; 129],
+ pub iMaxSockets: u16,
+ pub iMaxUdpDg: u16,
+ pub lpVendorInfo: PSTR,
+}
+#[cfg(target_arch = "x86")]
+impl ::core::marker::Copy for WSADATA {}
+#[cfg(target_arch = "x86")]
+impl ::core::clone::Clone for WSADATA {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const WSAEACCES: WSA_ERROR = 10013i32;
+pub const WSAEADDRINUSE: WSA_ERROR = 10048i32;
+pub const WSAEADDRNOTAVAIL: WSA_ERROR = 10049i32;
+pub const WSAEAFNOSUPPORT: WSA_ERROR = 10047i32;
+pub const WSAEALREADY: WSA_ERROR = 10037i32;
+pub const WSAEBADF: WSA_ERROR = 10009i32;
+pub const WSAECANCELLED: WSA_ERROR = 10103i32;
+pub const WSAECONNABORTED: WSA_ERROR = 10053i32;
+pub const WSAECONNREFUSED: WSA_ERROR = 10061i32;
+pub const WSAECONNRESET: WSA_ERROR = 10054i32;
+pub const WSAEDESTADDRREQ: WSA_ERROR = 10039i32;
+pub const WSAEDISCON: WSA_ERROR = 10101i32;
+pub const WSAEDQUOT: WSA_ERROR = 10069i32;
+pub const WSAEFAULT: WSA_ERROR = 10014i32;
+pub const WSAEHOSTDOWN: WSA_ERROR = 10064i32;
+pub const WSAEHOSTUNREACH: WSA_ERROR = 10065i32;
+pub const WSAEINPROGRESS: WSA_ERROR = 10036i32;
+pub const WSAEINTR: WSA_ERROR = 10004i32;
+pub const WSAEINVAL: WSA_ERROR = 10022i32;
+pub const WSAEINVALIDPROCTABLE: WSA_ERROR = 10104i32;
+pub const WSAEINVALIDPROVIDER: WSA_ERROR = 10105i32;
+pub const WSAEISCONN: WSA_ERROR = 10056i32;
+pub const WSAELOOP: WSA_ERROR = 10062i32;
+pub const WSAEMFILE: WSA_ERROR = 10024i32;
+pub const WSAEMSGSIZE: WSA_ERROR = 10040i32;
+pub const WSAENAMETOOLONG: WSA_ERROR = 10063i32;
+pub const WSAENETDOWN: WSA_ERROR = 10050i32;
+pub const WSAENETRESET: WSA_ERROR = 10052i32;
+pub const WSAENETUNREACH: WSA_ERROR = 10051i32;
+pub const WSAENOBUFS: WSA_ERROR = 10055i32;
+pub const WSAENOMORE: WSA_ERROR = 10102i32;
+pub const WSAENOPROTOOPT: WSA_ERROR = 10042i32;
+pub const WSAENOTCONN: WSA_ERROR = 10057i32;
+pub const WSAENOTEMPTY: WSA_ERROR = 10066i32;
+pub const WSAENOTSOCK: WSA_ERROR = 10038i32;
+pub const WSAEOPNOTSUPP: WSA_ERROR = 10045i32;
+pub const WSAEPFNOSUPPORT: WSA_ERROR = 10046i32;
+pub const WSAEPROCLIM: WSA_ERROR = 10067i32;
+pub const WSAEPROTONOSUPPORT: WSA_ERROR = 10043i32;
+pub const WSAEPROTOTYPE: WSA_ERROR = 10041i32;
+pub const WSAEPROVIDERFAILEDINIT: WSA_ERROR = 10106i32;
+pub const WSAEREFUSED: WSA_ERROR = 10112i32;
+pub const WSAEREMOTE: WSA_ERROR = 10071i32;
+pub const WSAESHUTDOWN: WSA_ERROR = 10058i32;
+pub const WSAESOCKTNOSUPPORT: WSA_ERROR = 10044i32;
+pub const WSAESTALE: WSA_ERROR = 10070i32;
+pub const WSAETIMEDOUT: WSA_ERROR = 10060i32;
+pub const WSAETOOMANYREFS: WSA_ERROR = 10059i32;
+pub const WSAEUSERS: WSA_ERROR = 10068i32;
+pub const WSAEWOULDBLOCK: WSA_ERROR = 10035i32;
+pub const WSAHOST_NOT_FOUND: WSA_ERROR = 11001i32;
+pub const WSANOTINITIALISED: WSA_ERROR = 10093i32;
+pub const WSANO_DATA: WSA_ERROR = 11004i32;
+pub const WSANO_RECOVERY: WSA_ERROR = 11003i32;
+#[repr(C)]
+pub struct WSAPROTOCOLCHAIN {
+ pub ChainLen: i32,
+ pub ChainEntries: [u32; 7],
+}
+impl ::core::marker::Copy for WSAPROTOCOLCHAIN {}
+impl ::core::clone::Clone for WSAPROTOCOLCHAIN {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+pub struct WSAPROTOCOL_INFOW {
+ pub dwServiceFlags1: u32,
+ pub dwServiceFlags2: u32,
+ pub dwServiceFlags3: u32,
+ pub dwServiceFlags4: u32,
+ pub dwProviderFlags: u32,
+ pub ProviderId: GUID,
+ pub dwCatalogEntryId: u32,
+ pub ProtocolChain: WSAPROTOCOLCHAIN,
+ pub iVersion: i32,
+ pub iAddressFamily: i32,
+ pub iMaxSockAddr: i32,
+ pub iMinSockAddr: i32,
+ pub iSocketType: i32,
+ pub iProtocol: i32,
+ pub iProtocolMaxOffset: i32,
+ pub iNetworkByteOrder: i32,
+ pub iSecurityScheme: i32,
+ pub dwMessageSize: u32,
+ pub dwProviderReserved: u32,
+ pub szProtocol: [u16; 256],
+}
+impl ::core::marker::Copy for WSAPROTOCOL_INFOW {}
+impl ::core::clone::Clone for WSAPROTOCOL_INFOW {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+pub const WSASERVICE_NOT_FOUND: WSA_ERROR = 10108i32;
+pub const WSASYSCALLFAILURE: WSA_ERROR = 10107i32;
+pub const WSASYSNOTREADY: WSA_ERROR = 10091i32;
+pub const WSATRY_AGAIN: WSA_ERROR = 11002i32;
+pub const WSATYPE_NOT_FOUND: WSA_ERROR = 10109i32;
+pub const WSAVERNOTSUPPORTED: WSA_ERROR = 10092i32;
+pub type WSA_ERROR = i32;
+pub const WSA_E_CANCELLED: WSA_ERROR = 10111i32;
+pub const WSA_E_NO_MORE: WSA_ERROR = 10110i32;
+pub const WSA_FLAG_NO_HANDLE_INHERIT: u32 = 128u32;
+pub const WSA_FLAG_OVERLAPPED: u32 = 1u32;
+pub const WSA_INVALID_HANDLE: WSA_ERROR = 6i32;
+pub const WSA_INVALID_PARAMETER: WSA_ERROR = 87i32;
+pub const WSA_IO_INCOMPLETE: WSA_ERROR = 996i32;
+pub const WSA_IO_PENDING: WSA_ERROR = 997i32;
+pub const WSA_IPSEC_NAME_POLICY_ERROR: WSA_ERROR = 11033i32;
+pub const WSA_NOT_ENOUGH_MEMORY: WSA_ERROR = 8i32;
+pub const WSA_OPERATION_ABORTED: WSA_ERROR = 995i32;
+pub const WSA_QOS_ADMISSION_FAILURE: WSA_ERROR = 11010i32;
+pub const WSA_QOS_BAD_OBJECT: WSA_ERROR = 11013i32;
+pub const WSA_QOS_BAD_STYLE: WSA_ERROR = 11012i32;
+pub const WSA_QOS_EFILTERCOUNT: WSA_ERROR = 11021i32;
+pub const WSA_QOS_EFILTERSTYLE: WSA_ERROR = 11019i32;
+pub const WSA_QOS_EFILTERTYPE: WSA_ERROR = 11020i32;
+pub const WSA_QOS_EFLOWCOUNT: WSA_ERROR = 11023i32;
+pub const WSA_QOS_EFLOWDESC: WSA_ERROR = 11026i32;
+pub const WSA_QOS_EFLOWSPEC: WSA_ERROR = 11017i32;
+pub const WSA_QOS_EOBJLENGTH: WSA_ERROR = 11022i32;
+pub const WSA_QOS_EPOLICYOBJ: WSA_ERROR = 11025i32;
+pub const WSA_QOS_EPROVSPECBUF: WSA_ERROR = 11018i32;
+pub const WSA_QOS_EPSFILTERSPEC: WSA_ERROR = 11028i32;
+pub const WSA_QOS_EPSFLOWSPEC: WSA_ERROR = 11027i32;
+pub const WSA_QOS_ESDMODEOBJ: WSA_ERROR = 11029i32;
+pub const WSA_QOS_ESERVICETYPE: WSA_ERROR = 11016i32;
+pub const WSA_QOS_ESHAPERATEOBJ: WSA_ERROR = 11030i32;
+pub const WSA_QOS_EUNKOWNPSOBJ: WSA_ERROR = 11024i32;
+pub const WSA_QOS_GENERIC_ERROR: WSA_ERROR = 11015i32;
+pub const WSA_QOS_NO_RECEIVERS: WSA_ERROR = 11008i32;
+pub const WSA_QOS_NO_SENDERS: WSA_ERROR = 11007i32;
+pub const WSA_QOS_POLICY_FAILURE: WSA_ERROR = 11011i32;
+pub const WSA_QOS_RECEIVERS: WSA_ERROR = 11005i32;
+pub const WSA_QOS_REQUEST_CONFIRMED: WSA_ERROR = 11009i32;
+pub const WSA_QOS_RESERVED_PETYPE: WSA_ERROR = 11031i32;
+pub const WSA_QOS_SENDERS: WSA_ERROR = 11006i32;
+pub const WSA_QOS_TRAFFIC_CTRL_ERROR: WSA_ERROR = 11014i32;
+pub const WSA_SECURE_HOST_NOT_FOUND: WSA_ERROR = 11032i32;
+pub const WSA_WAIT_EVENT_0: WSA_ERROR = 0i32;
+pub const WSA_WAIT_IO_COMPLETION: WSA_ERROR = 192i32;
+#[repr(C)]
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+pub struct XSAVE_FORMAT {
+ pub ControlWord: u16,
+ pub StatusWord: u16,
+ pub TagWord: u8,
+ pub Reserved1: u8,
+ pub ErrorOpcode: u16,
+ pub ErrorOffset: u32,
+ pub ErrorSelector: u16,
+ pub Reserved2: u16,
+ pub DataOffset: u32,
+ pub DataSelector: u16,
+ pub Reserved3: u16,
+ pub MxCsr: u32,
+ pub MxCsr_Mask: u32,
+ pub FloatRegisters: [M128A; 8],
+ pub XmmRegisters: [M128A; 16],
+ pub Reserved4: [u8; 96],
+}
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+impl ::core::marker::Copy for XSAVE_FORMAT {}
+#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
+impl ::core::clone::Clone for XSAVE_FORMAT {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+#[repr(C)]
+#[cfg(target_arch = "x86")]
+pub struct XSAVE_FORMAT {
+ pub ControlWord: u16,
+ pub StatusWord: u16,
+ pub TagWord: u8,
+ pub Reserved1: u8,
+ pub ErrorOpcode: u16,
+ pub ErrorOffset: u32,
+ pub ErrorSelector: u16,
+ pub Reserved2: u16,
+ pub DataOffset: u32,
+ pub DataSelector: u16,
+ pub Reserved3: u16,
+ pub MxCsr: u32,
+ pub MxCsr_Mask: u32,
+ pub FloatRegisters: [M128A; 8],
+ pub XmmRegisters: [M128A; 8],
+ pub Reserved4: [u8; 224],
+}
+#[cfg(target_arch = "x86")]
+impl ::core::marker::Copy for XSAVE_FORMAT {}
+#[cfg(target_arch = "x86")]
+impl ::core::clone::Clone for XSAVE_FORMAT {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
diff --git a/library/std/src/sys/windows/compat.rs b/library/std/src/sys/windows/compat.rs
index 7dff81ecb..4fe95d411 100644
--- a/library/std/src/sys/windows/compat.rs
+++ b/library/std/src/sys/windows/compat.rs
@@ -114,17 +114,20 @@ impl Module {
/// (e.g. kernel32 and ntdll).
pub unsafe fn new(name: &CStr) -> Option<Self> {
// SAFETY: A CStr is always null terminated.
- let module = c::GetModuleHandleA(name.as_ptr());
+ let module = c::GetModuleHandleA(name.as_ptr().cast::<u8>());
NonNull::new(module).map(Self)
}
// Try to get the address of a function.
pub fn proc_address(self, name: &CStr) -> Option<NonNull<c_void>> {
- // SAFETY:
- // `self.0` will always be a valid module.
- // A CStr is always null terminated.
- let proc = unsafe { c::GetProcAddress(self.0.as_ptr(), name.as_ptr()) };
- NonNull::new(proc)
+ unsafe {
+ // SAFETY:
+ // `self.0` will always be a valid module.
+ // A CStr is always null terminated.
+ let proc = c::GetProcAddress(self.0.as_ptr(), name.as_ptr().cast::<u8>());
+ // SAFETY: `GetProcAddress` returns None on null.
+ proc.map(|p| NonNull::new_unchecked(p as *mut c_void))
+ }
}
}
@@ -199,6 +202,7 @@ macro_rules! compat_fn_optional {
)+) => (
$(
pub mod $symbol {
+ #[allow(unused_imports)]
use super::*;
use crate::ffi::c_void;
use crate::mem;
diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs
index 956db577d..21a65bc25 100644
--- a/library/std/src/sys/windows/fs.rs
+++ b/library/std/src/sys/windows/fs.rs
@@ -88,6 +88,14 @@ pub struct FilePermissions {
pub struct FileTimes {
accessed: Option<c::FILETIME>,
modified: Option<c::FILETIME>,
+ created: Option<c::FILETIME>,
+}
+
+impl fmt::Debug for c::FILETIME {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let time = ((self.dwHighDateTime as u64) << 32) | self.dwLowDateTime as u64;
+ f.debug_tuple("FILETIME").field(&time).finish()
+ }
}
#[derive(Debug)]
@@ -290,6 +298,7 @@ impl File {
ptr::null_mut(),
)
};
+ let handle = unsafe { HandleOrInvalid::from_raw_handle(handle) };
if let Ok(handle) = handle.try_into() {
Ok(File { handle: Handle::from_inner(handle) })
} else {
@@ -477,7 +486,7 @@ impl File {
fn reparse_point(
&self,
space: &mut Align8<[MaybeUninit<u8>]>,
- ) -> io::Result<(c::DWORD, *const c::REPARSE_DATA_BUFFER)> {
+ ) -> io::Result<(c::DWORD, *mut c::REPARSE_DATA_BUFFER)> {
unsafe {
let mut bytes = 0;
cvt({
@@ -496,32 +505,33 @@ impl File {
)
})?;
const _: () = assert!(core::mem::align_of::<c::REPARSE_DATA_BUFFER>() <= 8);
- Ok((bytes, space.0.as_ptr().cast::<c::REPARSE_DATA_BUFFER>()))
+ Ok((bytes, space.0.as_mut_ptr().cast::<c::REPARSE_DATA_BUFFER>()))
}
}
fn readlink(&self) -> io::Result<PathBuf> {
- let mut space = Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]);
+ let mut space =
+ Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize]);
let (_bytes, buf) = self.reparse_point(&mut space)?;
unsafe {
let (path_buffer, subst_off, subst_len, relative) = match (*buf).ReparseTag {
c::IO_REPARSE_TAG_SYMLINK => {
- let info: *const c::SYMBOLIC_LINK_REPARSE_BUFFER =
- ptr::addr_of!((*buf).rest).cast();
+ let info: *mut c::SYMBOLIC_LINK_REPARSE_BUFFER =
+ ptr::addr_of_mut!((*buf).rest).cast();
assert!(info.is_aligned());
(
- ptr::addr_of!((*info).PathBuffer).cast::<u16>(),
+ ptr::addr_of_mut!((*info).PathBuffer).cast::<u16>(),
(*info).SubstituteNameOffset / 2,
(*info).SubstituteNameLength / 2,
(*info).Flags & c::SYMLINK_FLAG_RELATIVE != 0,
)
}
c::IO_REPARSE_TAG_MOUNT_POINT => {
- let info: *const c::MOUNT_POINT_REPARSE_BUFFER =
- ptr::addr_of!((*buf).rest).cast();
+ let info: *mut c::MOUNT_POINT_REPARSE_BUFFER =
+ ptr::addr_of_mut!((*buf).rest).cast();
assert!(info.is_aligned());
(
- ptr::addr_of!((*info).PathBuffer).cast::<u16>(),
+ ptr::addr_of_mut!((*info).PathBuffer).cast::<u16>(),
(*info).SubstituteNameOffset / 2,
(*info).SubstituteNameLength / 2,
false,
@@ -535,13 +545,20 @@ impl File {
}
};
let subst_ptr = path_buffer.add(subst_off.into());
- let mut subst = slice::from_raw_parts(subst_ptr, subst_len as usize);
+ let subst = slice::from_raw_parts_mut(subst_ptr, subst_len as usize);
// Absolute paths start with an NT internal namespace prefix `\??\`
// We should not let it leak through.
if !relative && subst.starts_with(&[92u16, 63u16, 63u16, 92u16]) {
- subst = &subst[4..];
+ // Turn `\??\` into `\\?\` (a verbatim path).
+ subst[1] = b'\\' as u16;
+ // Attempt to convert to a more user-friendly path.
+ let user = super::args::from_wide_to_user_path(
+ subst.iter().copied().chain([0]).collect(),
+ )?;
+ Ok(PathBuf::from(OsString::from_wide(&user.strip_suffix(&[0]).unwrap_or(&user))))
+ } else {
+ Ok(PathBuf::from(OsString::from_wide(subst)))
}
- Ok(PathBuf::from(OsString::from_wide(subst)))
}
}
@@ -567,7 +584,10 @@ impl File {
pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
let is_zero = |t: c::FILETIME| t.dwLowDateTime == 0 && t.dwHighDateTime == 0;
- if times.accessed.map_or(false, is_zero) || times.modified.map_or(false, is_zero) {
+ if times.accessed.map_or(false, is_zero)
+ || times.modified.map_or(false, is_zero)
+ || times.created.map_or(false, is_zero)
+ {
return Err(io::const_io_error!(
io::ErrorKind::InvalidInput,
"Cannot set file timestamp to 0",
@@ -575,14 +595,23 @@ impl File {
}
let is_max =
|t: c::FILETIME| t.dwLowDateTime == c::DWORD::MAX && t.dwHighDateTime == c::DWORD::MAX;
- if times.accessed.map_or(false, is_max) || times.modified.map_or(false, is_max) {
+ if times.accessed.map_or(false, is_max)
+ || times.modified.map_or(false, is_max)
+ || times.created.map_or(false, is_max)
+ {
return Err(io::const_io_error!(
io::ErrorKind::InvalidInput,
"Cannot set file timestamp to 0xFFFF_FFFF_FFFF_FFFF",
));
}
cvt(unsafe {
- c::SetFileTime(self.as_handle(), None, times.accessed.as_ref(), times.modified.as_ref())
+ let created =
+ times.created.as_ref().map(|a| a as *const c::FILETIME).unwrap_or(ptr::null());
+ let accessed =
+ times.accessed.as_ref().map(|a| a as *const c::FILETIME).unwrap_or(ptr::null());
+ let modified =
+ times.modified.as_ref().map(|a| a as *const c::FILETIME).unwrap_or(ptr::null());
+ c::SetFileTime(self.as_raw_handle(), created, accessed, modified)
})?;
Ok(())
}
@@ -611,9 +640,9 @@ impl File {
/// then errors will be `ERROR_NOT_SUPPORTED` or `ERROR_INVALID_PARAMETER`.
fn posix_delete(&self) -> io::Result<()> {
let mut info = c::FILE_DISPOSITION_INFO_EX {
- Flags: c::FILE_DISPOSITION_DELETE
- | c::FILE_DISPOSITION_POSIX_SEMANTICS
- | c::FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE,
+ Flags: c::FILE_DISPOSITION_FLAG_DELETE
+ | c::FILE_DISPOSITION_FLAG_POSIX_SEMANTICS
+ | c::FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE,
};
let size = mem::size_of_val(&info);
cvt(unsafe {
@@ -784,15 +813,15 @@ fn open_link_no_reparse(parent: &File, name: &[u16], access: u32) -> io::Result<
// See https://docs.microsoft.com/en-us/windows/win32/api/winternl/nf-winternl-ntcreatefile
unsafe {
let mut handle = ptr::null_mut();
- let mut io_status = c::IO_STATUS_BLOCK::default();
- let name_str = c::UNICODE_STRING::from_ref(name);
+ let mut io_status = c::IO_STATUS_BLOCK::PENDING;
+ let mut name_str = c::UNICODE_STRING::from_ref(name);
use crate::sync::atomic::{AtomicU32, Ordering};
// The `OBJ_DONT_REPARSE` attribute ensures that we haven't been
// tricked into following a symlink. However, it may not be available in
// earlier versions of Windows.
static ATTRIBUTES: AtomicU32 = AtomicU32::new(c::OBJ_DONT_REPARSE);
- let object = c::OBJECT_ATTRIBUTES {
- ObjectName: &name_str,
+ let mut object = c::OBJECT_ATTRIBUTES {
+ ObjectName: &mut name_str,
RootDirectory: parent.as_raw_handle(),
Attributes: ATTRIBUTES.load(Ordering::Relaxed),
..c::OBJECT_ATTRIBUTES::default()
@@ -800,7 +829,7 @@ fn open_link_no_reparse(parent: &File, name: &[u16], access: u32) -> io::Result<
let status = c::NtCreateFile(
&mut handle,
access,
- &object,
+ &mut object,
&mut io_status,
crate::ptr::null_mut(),
0,
@@ -832,6 +861,7 @@ fn open_link_no_reparse(parent: &File, name: &[u16], access: u32) -> io::Result<
}
impl AsInner<Handle> for File {
+ #[inline]
fn as_inner(&self) -> &Handle {
&self.handle
}
@@ -985,6 +1015,10 @@ impl FileTimes {
pub fn set_modified(&mut self, t: SystemTime) {
self.modified = Some(t.into_inner());
}
+
+ pub fn set_created(&mut self, t: SystemTime) {
+ self.created = Some(t.into_inner());
+ }
}
impl FileType {
@@ -1132,26 +1166,29 @@ fn remove_dir_all_iterative(f: &File, delete: fn(&File) -> io::Result<()>) -> io
&dir,
&name,
c::SYNCHRONIZE | c::DELETE | c::FILE_LIST_DIRECTORY,
- )?;
- dirlist.push(child_dir);
- } else {
- for i in 1..=MAX_RETRIES {
- let result = open_link_no_reparse(&dir, &name, c::SYNCHRONIZE | c::DELETE);
- match result {
- Ok(f) => delete(&f)?,
- // Already deleted, so skip.
- Err(e) if e.kind() == io::ErrorKind::NotFound => break,
- // Retry a few times if the file is locked or a delete is already in progress.
- Err(e)
- if i < MAX_RETRIES
- && (e.raw_os_error() == Some(c::ERROR_DELETE_PENDING as _)
- || e.raw_os_error()
- == Some(c::ERROR_SHARING_VIOLATION as _)) => {}
- // Otherwise return the error.
- Err(e) => return Err(e),
- }
- thread::yield_now();
+ );
+ // On success, add the handle to the queue.
+ // If opening the directory fails we treat it the same as a file
+ if let Ok(child_dir) = child_dir {
+ dirlist.push(child_dir);
+ continue;
+ }
+ }
+ for i in 1..=MAX_RETRIES {
+ let result = open_link_no_reparse(&dir, &name, c::SYNCHRONIZE | c::DELETE);
+ match result {
+ Ok(f) => delete(&f)?,
+ // Already deleted, so skip.
+ Err(e) if e.kind() == io::ErrorKind::NotFound => break,
+ // Retry a few times if the file is locked or a delete is already in progress.
+ Err(e)
+ if i < MAX_RETRIES
+ && (e.raw_os_error() == Some(c::ERROR_DELETE_PENDING as _)
+ || e.raw_os_error() == Some(c::ERROR_SHARING_VIOLATION as _)) => {}
+ // Otherwise return the error.
+ Err(e) => return Err(e),
}
+ thread::yield_now();
}
}
// If there were no more files then delete the directory.
@@ -1357,7 +1394,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
_dwCallbackReason: c::DWORD,
_hSourceFile: c::HANDLE,
_hDestinationFile: c::HANDLE,
- lpData: c::LPVOID,
+ lpData: c::LPCVOID,
) -> c::DWORD {
if dwStreamNumber == 1 {
*(lpData as *mut i64) = StreamBytesTransferred;
@@ -1404,9 +1441,10 @@ fn symlink_junction_inner(original: &Path, junction: &Path) -> io::Result<()> {
let f = File::open(junction, &opts)?;
let h = f.as_inner().as_raw_handle();
unsafe {
- let mut data = Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]);
+ let mut data =
+ Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize]);
let data_ptr = data.0.as_mut_ptr();
- let data_end = data_ptr.add(c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
+ let data_end = data_ptr.add(c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize);
let db = data_ptr.cast::<c::REPARSE_MOUNTPOINT_DATA_BUFFER>();
// Zero the header to ensure it's fully initialized, including reserved parameters.
*db = mem::zeroed();
diff --git a/library/std/src/sys/windows/handle.rs b/library/std/src/sys/windows/handle.rs
index b290f4070..84c1fbde3 100644
--- a/library/std/src/sys/windows/handle.rs
+++ b/library/std/src/sys/windows/handle.rs
@@ -34,6 +34,7 @@ impl Handle {
}
impl AsInner<OwnedHandle> for Handle {
+ #[inline]
fn as_inner(&self) -> &OwnedHandle {
&self.0
}
@@ -143,7 +144,7 @@ impl Handle {
let len = cmp::min(buf.len(), <c::DWORD>::MAX as usize) as c::DWORD;
let mut amt = 0;
let res = cvt(c::ReadFile(
- self.as_handle(),
+ self.as_raw_handle(),
buf.as_ptr() as c::LPVOID,
len,
&mut amt,
@@ -234,7 +235,7 @@ impl Handle {
len: usize,
offset: Option<u64>,
) -> io::Result<usize> {
- let mut io_status = c::IO_STATUS_BLOCK::default();
+ let mut io_status = c::IO_STATUS_BLOCK::PENDING;
// The length is clamped at u32::MAX.
let len = cmp::min(len, c::DWORD::MAX as usize) as c::DWORD;
@@ -282,7 +283,7 @@ impl Handle {
///
/// If `offset` is `None` then the current file position is used.
fn synchronous_write(&self, buf: &[u8], offset: Option<u64>) -> io::Result<usize> {
- let mut io_status = c::IO_STATUS_BLOCK::default();
+ let mut io_status = c::IO_STATUS_BLOCK::PENDING;
// The length is clamped at u32::MAX.
let len = cmp::min(buf.len(), c::DWORD::MAX as usize) as c::DWORD;
diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/windows/io.rs
index 7fdd1f702..fc9856cae 100644
--- a/library/std/src/sys/windows/io.rs
+++ b/library/std/src/sys/windows/io.rs
@@ -17,10 +17,7 @@ impl<'a> IoSlice<'a> {
pub fn new(buf: &'a [u8]) -> IoSlice<'a> {
assert!(buf.len() <= c::ULONG::MAX as usize);
IoSlice {
- vec: c::WSABUF {
- len: buf.len() as c::ULONG,
- buf: buf.as_ptr() as *mut u8 as *mut c::CHAR,
- },
+ vec: c::WSABUF { len: buf.len() as c::ULONG, buf: buf.as_ptr() as *mut u8 },
_p: PhantomData,
}
}
@@ -54,7 +51,7 @@ impl<'a> IoSliceMut<'a> {
pub fn new(buf: &'a mut [u8]) -> IoSliceMut<'a> {
assert!(buf.len() <= c::ULONG::MAX as usize);
IoSliceMut {
- vec: c::WSABUF { len: buf.len() as c::ULONG, buf: buf.as_mut_ptr() as *mut c::CHAR },
+ vec: c::WSABUF { len: buf.len() as c::ULONG, buf: buf.as_mut_ptr() },
_p: PhantomData,
}
}
diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs
index 77359abe4..bcc172b0f 100644
--- a/library/std/src/sys/windows/mod.rs
+++ b/library/std/src/sys/windows/mod.rs
@@ -68,10 +68,13 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
c::ERROR_ALREADY_EXISTS => return AlreadyExists,
c::ERROR_FILE_EXISTS => return AlreadyExists,
c::ERROR_BROKEN_PIPE => return BrokenPipe,
- c::ERROR_FILE_NOT_FOUND => return NotFound,
- c::ERROR_PATH_NOT_FOUND => return NotFound,
+ c::ERROR_FILE_NOT_FOUND
+ | c::ERROR_PATH_NOT_FOUND
+ | c::ERROR_INVALID_DRIVE
+ | c::ERROR_BAD_NETPATH
+ | c::ERROR_BAD_NET_NAME => return NotFound,
c::ERROR_NO_DATA => return BrokenPipe,
- c::ERROR_INVALID_NAME => return InvalidFilename,
+ c::ERROR_INVALID_NAME | c::ERROR_BAD_PATHNAME => return InvalidFilename,
c::ERROR_INVALID_PARAMETER => return InvalidInput,
c::ERROR_NOT_ENOUGH_MEMORY | c::ERROR_OUTOFMEMORY => return OutOfMemory,
c::ERROR_SEM_TIMEOUT
diff --git a/library/std/src/sys/windows/net.rs b/library/std/src/sys/windows/net.rs
index ee1f5482b..2404bbe2b 100644
--- a/library/std/src/sys/windows/net.rs
+++ b/library/std/src/sys/windows/net.rs
@@ -263,7 +263,7 @@ impl Socket {
&mut nread,
&mut flags,
ptr::null_mut(),
- ptr::null_mut(),
+ None,
)
};
@@ -347,7 +347,7 @@ impl Socket {
&mut nwritten,
0,
ptr::null_mut(),
- ptr::null_mut(),
+ None,
)
};
cvt(result).map(|_| nwritten as usize)
@@ -446,6 +446,7 @@ impl<'a> Read for &'a Socket {
}
impl AsInner<OwnedSocket> for Socket {
+ #[inline]
fn as_inner(&self) -> &OwnedSocket {
&self.0
}
diff --git a/library/std/src/sys/windows/os_str.rs b/library/std/src/sys/windows/os_str.rs
index 4bdd8c505..2f2b0e56e 100644
--- a/library/std/src/sys/windows/os_str.rs
+++ b/library/std/src/sys/windows/os_str.rs
@@ -27,6 +27,7 @@ impl FromInner<Wtf8Buf> for Buf {
}
impl AsInner<Wtf8> for Buf {
+ #[inline]
fn as_inner(&self) -> &Wtf8 {
&self.inner
}
diff --git a/library/std/src/sys/windows/pipe.rs b/library/std/src/sys/windows/pipe.rs
index 0780b2958..d07147ecc 100644
--- a/library/std/src/sys/windows/pipe.rs
+++ b/library/std/src/sys/windows/pipe.rs
@@ -373,7 +373,7 @@ impl AnonPipe {
// Asynchronous read of the pipe.
// If successful, `callback` will be called once it completes.
- let result = io(self.inner.as_handle(), buf, len, &mut overlapped, callback);
+ let result = io(self.inner.as_handle(), buf, len, &mut overlapped, Some(callback));
if result == c::FALSE {
// We can return here because the call failed.
// After this we must not return until the I/O completes.
diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs
index 1c73b64e2..df3667c0f 100644
--- a/library/std/src/sys/windows/process.rs
+++ b/library/std/src/sys/windows/process.rs
@@ -308,7 +308,7 @@ impl Command {
let stderr = stderr.to_handle(c::STD_ERROR_HANDLE, &mut pipes.stderr)?;
let mut si = zeroed_startupinfo();
- si.cb = mem::size_of::<c::STARTUPINFO>() as c::DWORD;
+ si.cb = mem::size_of::<c::STARTUPINFOW>() as c::DWORD;
// If at least one of stdin, stdout or stderr are set (i.e. are non null)
// then set the `hStd` fields in `STARTUPINFO`.
@@ -332,7 +332,7 @@ impl Command {
flags,
envp,
dirp,
- &mut si,
+ &si,
&mut pi,
))
}?;
@@ -720,8 +720,8 @@ impl From<u32> for ExitCode {
}
}
-fn zeroed_startupinfo() -> c::STARTUPINFO {
- c::STARTUPINFO {
+fn zeroed_startupinfo() -> c::STARTUPINFOW {
+ c::STARTUPINFOW {
cb: 0,
lpReserved: ptr::null_mut(),
lpDesktop: ptr::null_mut(),
@@ -731,7 +731,7 @@ fn zeroed_startupinfo() -> c::STARTUPINFO {
dwXSize: 0,
dwYSize: 0,
dwXCountChars: 0,
- dwYCountCharts: 0,
+ dwYCountChars: 0,
dwFillAttribute: 0,
dwFlags: 0,
wShowWindow: 0,
diff --git a/library/std/src/sys/windows/rand.rs b/library/std/src/sys/windows/rand.rs
index cdf37cfe9..bca4e38d9 100644
--- a/library/std/src/sys/windows/rand.rs
+++ b/library/std/src/sys/windows/rand.rs
@@ -1,3 +1,4 @@
+use crate::ffi::c_void;
use crate::io;
use crate::mem;
use crate::ptr;
@@ -25,8 +26,9 @@ pub fn hashmap_random_keys() -> (u64, u64) {
#[inline(never)]
fn fallback_rng() -> (u64, u64) {
let mut v = (0, 0);
- let ret =
- unsafe { c::RtlGenRandom(&mut v as *mut _ as *mut u8, mem::size_of_val(&v) as c::ULONG) };
+ let ret = unsafe {
+ c::RtlGenRandom(&mut v as *mut _ as *mut c_void, mem::size_of_val(&v) as c::ULONG)
+ };
if ret != 0 { v } else { panic!("fallback RNG broken: {}", io::Error::last_os_error()) }
}
diff --git a/library/std/src/sys/windows/stack_overflow.rs b/library/std/src/sys/windows/stack_overflow.rs
index 18a2a36ad..0caf0a317 100644
--- a/library/std/src/sys/windows/stack_overflow.rs
+++ b/library/std/src/sys/windows/stack_overflow.rs
@@ -18,7 +18,7 @@ impl Handler {
}
}
-extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -> c::LONG {
+unsafe extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -> c::LONG {
unsafe {
let rec = &(*(*ExceptionInfo).ExceptionRecord);
let code = rec.ExceptionCode;
@@ -34,7 +34,7 @@ extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -
}
pub unsafe fn init() {
- if c::AddVectoredExceptionHandler(0, vectored_handler).is_null() {
+ if c::AddVectoredExceptionHandler(0, Some(vectored_handler)).is_null() {
panic!("failed to install exception handler");
}
// Set the thread stack guarantee for the main thread.
diff --git a/library/std/src/sys/windows/stdio.rs b/library/std/src/sys/windows/stdio.rs
index 32c6ccffb..2e3e0859d 100644
--- a/library/std/src/sys/windows/stdio.rs
+++ b/library/std/src/sys/windows/stdio.rs
@@ -180,7 +180,7 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
let result = c::MultiByteToWideChar(
c::CP_UTF8, // CodePage
c::MB_ERR_INVALID_CHARS, // dwFlags
- utf8.as_ptr() as c::LPCCH, // lpMultiByteStr
+ utf8.as_ptr(), // lpMultiByteStr
utf8.len() as c::c_int, // cbMultiByte
utf16.as_mut_ptr() as c::LPWSTR, // lpWideCharStr
utf16.len() as c::c_int, // cchWideChar
@@ -344,7 +344,7 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [MaybeUninit<u16>]) -> io::Result<usiz
// See #38274 and https://stackoverflow.com/questions/43836040/win-api-readconsole.
const CTRL_Z: u16 = 0x1A;
const CTRL_Z_MASK: c::ULONG = 1 << CTRL_Z;
- let mut input_control = c::CONSOLE_READCONSOLE_CONTROL {
+ let input_control = c::CONSOLE_READCONSOLE_CONTROL {
nLength: crate::mem::size_of::<c::CONSOLE_READCONSOLE_CONTROL>() as c::ULONG,
nInitialChars: 0,
dwCtrlWakeupMask: CTRL_Z_MASK,
@@ -360,7 +360,7 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [MaybeUninit<u16>]) -> io::Result<usiz
buf.as_mut_ptr() as c::LPVOID,
buf.len() as u32,
&mut amount,
- &mut input_control as c::PCONSOLE_READCONSOLE_CONTROL,
+ &input_control,
)
})?;
@@ -385,14 +385,14 @@ fn utf16_to_utf8(utf16: &[u16], utf8: &mut [u8]) -> io::Result<usize> {
let result = unsafe {
c::WideCharToMultiByte(
- c::CP_UTF8, // CodePage
- c::WC_ERR_INVALID_CHARS, // dwFlags
- utf16.as_ptr(), // lpWideCharStr
- utf16.len() as c::c_int, // cchWideChar
- utf8.as_mut_ptr() as c::LPSTR, // lpMultiByteStr
- utf8.len() as c::c_int, // cbMultiByte
- ptr::null(), // lpDefaultChar
- ptr::null_mut(), // lpUsedDefaultChar
+ c::CP_UTF8, // CodePage
+ c::WC_ERR_INVALID_CHARS, // dwFlags
+ utf16.as_ptr(), // lpWideCharStr
+ utf16.len() as c::c_int, // cchWideChar
+ utf8.as_mut_ptr(), // lpMultiByteStr
+ utf8.len() as c::c_int, // cbMultiByte
+ ptr::null(), // lpDefaultChar
+ ptr::null_mut(), // lpUsedDefaultChar
)
};
if result == 0 {
diff --git a/library/std/src/sys/windows/thread.rs b/library/std/src/sys/windows/thread.rs
index ed58c47e0..18cecb656 100644
--- a/library/std/src/sys/windows/thread.rs
+++ b/library/std/src/sys/windows/thread.rs
@@ -2,6 +2,7 @@ use crate::ffi::CStr;
use crate::io;
use crate::num::NonZeroUsize;
use crate::os::windows::io::AsRawHandle;
+use crate::os::windows::io::HandleOrNull;
use crate::ptr;
use crate::sys::c;
use crate::sys::handle::Handle;
@@ -32,12 +33,12 @@ impl Thread {
let ret = c::CreateThread(
ptr::null_mut(),
stack,
- thread_start,
+ Some(thread_start),
p as *mut _,
c::STACK_SIZE_PARAM_IS_A_RESERVATION,
ptr::null_mut(),
);
-
+ let ret = HandleOrNull::from_raw_handle(ret);
return if let Ok(handle) = ret.try_into() {
Ok(Thread { handle: Handle::from_inner(handle) })
} else {
diff --git a/library/std/src/sys_common/backtrace.rs b/library/std/src/sys_common/backtrace.rs
index 8752f46ff..6f020940d 100644
--- a/library/std/src/sys_common/backtrace.rs
+++ b/library/std/src/sys_common/backtrace.rs
@@ -68,13 +68,17 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt::
}
let mut hit = false;
- let mut stop = false;
backtrace_rs::resolve_frame_unsynchronized(frame, |symbol| {
hit = true;
+
+ // Any frames between `__rust_begin_short_backtrace` and `__rust_end_short_backtrace`
+ // are omitted from the backtrace in short mode, `__rust_end_short_backtrace` will be
+ // called before the panic hook, so we won't ignore any frames if there is no
+ // invoke of `__rust_begin_short_backtrace`.
if print_fmt == PrintFmt::Short {
if let Some(sym) = symbol.name().and_then(|s| s.as_str()) {
if start && sym.contains("__rust_begin_short_backtrace") {
- stop = true;
+ start = false;
return;
}
if sym.contains("__rust_end_short_backtrace") {
@@ -88,9 +92,6 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt::
res = bt_fmt.frame().symbol(frame, symbol);
}
});
- if stop {
- return false;
- }
#[cfg(target_os = "nto")]
if libc::__my_thread_exit as *mut libc::c_void == frame.ip() {
if !hit && start {
diff --git a/library/std/src/sys_common/net.rs b/library/std/src/sys_common/net.rs
index cb24caa1e..652c695fc 100644
--- a/library/std/src/sys_common/net.rs
+++ b/library/std/src/sys_common/net.rs
@@ -239,6 +239,7 @@ impl TcpStream {
Ok(TcpStream { inner: sock })
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
@@ -352,6 +353,7 @@ impl TcpStream {
}
impl AsInner<Socket> for TcpStream {
+ #[inline]
fn as_inner(&self) -> &Socket {
&self.inner
}
@@ -427,6 +429,7 @@ impl TcpListener {
Ok(TcpListener { inner: sock })
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
@@ -517,6 +520,7 @@ impl UdpSocket {
Ok(UdpSocket { inner: sock })
}
+ #[inline]
pub fn socket(&self) -> &Socket {
&self.inner
}
diff --git a/library/std/src/sys_common/thread_local_key.rs b/library/std/src/sys_common/thread_local_key.rs
index 89360e456..204834984 100644
--- a/library/std/src/sys_common/thread_local_key.rs
+++ b/library/std/src/sys_common/thread_local_key.rs
@@ -87,31 +87,6 @@ pub struct StaticKey {
dtor: Option<unsafe extern "C" fn(*mut u8)>,
}
-/// A type for a safely managed OS-based TLS slot.
-///
-/// This type allocates an OS TLS key when it is initialized and will deallocate
-/// the key when it falls out of scope. When compared with `StaticKey`, this
-/// type is entirely safe to use.
-///
-/// Implementations will likely, however, contain unsafe code as this type only
-/// operates on `*mut u8`, a raw pointer.
-///
-/// # Examples
-///
-/// ```ignore (cannot-doctest-private-modules)
-/// use tls::os::Key;
-///
-/// let key = Key::new(None);
-/// assert!(key.get().is_null());
-/// key.set(1 as *mut u8);
-/// assert!(!key.get().is_null());
-///
-/// drop(key); // deallocate this TLS slot.
-/// ```
-pub struct Key {
- key: imp::Key,
-}
-
/// Constant initialization value for static TLS keys.
///
/// This value specifies no destructor by default.
@@ -194,39 +169,3 @@ impl StaticKey {
}
}
}
-
-impl Key {
- /// Creates a new managed OS TLS key.
- ///
- /// This key will be deallocated when the key falls out of scope.
- ///
- /// The argument provided is an optionally-specified destructor for the
- /// value of this TLS key. When a thread exits and the value for this key
- /// is non-null the destructor will be invoked. The TLS value will be reset
- /// to null before the destructor is invoked.
- ///
- /// Note that the destructor will not be run when the `Key` goes out of
- /// scope.
- #[inline]
- pub fn new(dtor: Option<unsafe extern "C" fn(*mut u8)>) -> Key {
- Key { key: unsafe { imp::create(dtor) } }
- }
-
- /// See StaticKey::get
- #[inline]
- pub fn get(&self) -> *mut u8 {
- unsafe { imp::get(self.key) }
- }
-
- /// See StaticKey::set
- #[inline]
- pub fn set(&self, val: *mut u8) {
- unsafe { imp::set(self.key, val) }
- }
-}
-
-impl Drop for Key {
- fn drop(&mut self) {
- unsafe { imp::destroy(self.key) }
- }
-}
diff --git a/library/std/src/sys_common/thread_local_key/tests.rs b/library/std/src/sys_common/thread_local_key/tests.rs
index 6f32b858f..6a44c65d9 100644
--- a/library/std/src/sys_common/thread_local_key/tests.rs
+++ b/library/std/src/sys_common/thread_local_key/tests.rs
@@ -1,24 +1,6 @@
-use super::{Key, StaticKey};
+use super::StaticKey;
use core::ptr;
-fn assert_sync<T: Sync>() {}
-fn assert_send<T: Send>() {}
-
-#[test]
-fn smoke() {
- assert_sync::<Key>();
- assert_send::<Key>();
-
- let k1 = Key::new(None);
- let k2 = Key::new(None);
- assert!(k1.get().is_null());
- assert!(k2.get().is_null());
- k1.set(ptr::invalid_mut(1));
- k2.set(ptr::invalid_mut(2));
- assert_eq!(k1.get() as usize, 1);
- assert_eq!(k2.get() as usize, 2);
-}
-
#[test]
fn statik() {
static K1: StaticKey = StaticKey::new(None);
diff --git a/library/std/src/sys_common/thread_parking/generic.rs b/library/std/src/sys_common/thread_parking/generic.rs
deleted file mode 100644
index 3209bffe3..000000000
--- a/library/std/src/sys_common/thread_parking/generic.rs
+++ /dev/null
@@ -1,125 +0,0 @@
-//! Parker implementation based on a Mutex and Condvar.
-
-use crate::pin::Pin;
-use crate::sync::atomic::AtomicUsize;
-use crate::sync::atomic::Ordering::SeqCst;
-use crate::sync::{Condvar, Mutex};
-use crate::time::Duration;
-
-const EMPTY: usize = 0;
-const PARKED: usize = 1;
-const NOTIFIED: usize = 2;
-
-pub struct Parker {
- state: AtomicUsize,
- lock: Mutex<()>,
- cvar: Condvar,
-}
-
-impl Parker {
- /// Construct the generic parker. The UNIX parker implementation
- /// requires this to happen in-place.
- pub unsafe fn new_in_place(parker: *mut Parker) {
- parker.write(Parker {
- state: AtomicUsize::new(EMPTY),
- lock: Mutex::new(()),
- cvar: Condvar::new(),
- });
- }
-
- // This implementation doesn't require `unsafe` and `Pin`, but other implementations do.
- pub unsafe fn park(self: Pin<&Self>) {
- // If we were previously notified then we consume this notification and
- // return quickly.
- if self.state.compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst).is_ok() {
- return;
- }
-
- // Otherwise we need to coordinate going to sleep
- let mut m = self.lock.lock().unwrap();
- match self.state.compare_exchange(EMPTY, PARKED, SeqCst, SeqCst) {
- Ok(_) => {}
- Err(NOTIFIED) => {
- // We must read here, even though we know it will be `NOTIFIED`.
- // This is because `unpark` may have been called again since we read
- // `NOTIFIED` in the `compare_exchange` above. We must perform an
- // acquire operation that synchronizes with that `unpark` to observe
- // any writes it made before the call to unpark. To do that we must
- // read from the write it made to `state`.
- let old = self.state.swap(EMPTY, SeqCst);
- assert_eq!(old, NOTIFIED, "park state changed unexpectedly");
- return;
- } // should consume this notification, so prohibit spurious wakeups in next park.
- Err(_) => panic!("inconsistent park state"),
- }
- loop {
- m = self.cvar.wait(m).unwrap();
- match self.state.compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst) {
- Ok(_) => return, // got a notification
- Err(_) => {} // spurious wakeup, go back to sleep
- }
- }
- }
-
- // This implementation doesn't require `unsafe` and `Pin`, but other implementations do.
- pub unsafe fn park_timeout(self: Pin<&Self>, dur: Duration) {
- // Like `park` above we have a fast path for an already-notified thread, and
- // afterwards we start coordinating for a sleep.
- // return quickly.
- if self.state.compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst).is_ok() {
- return;
- }
- let m = self.lock.lock().unwrap();
- match self.state.compare_exchange(EMPTY, PARKED, SeqCst, SeqCst) {
- Ok(_) => {}
- Err(NOTIFIED) => {
- // We must read again here, see `park`.
- let old = self.state.swap(EMPTY, SeqCst);
- assert_eq!(old, NOTIFIED, "park state changed unexpectedly");
- return;
- } // should consume this notification, so prohibit spurious wakeups in next park.
- Err(_) => panic!("inconsistent park_timeout state"),
- }
-
- // Wait with a timeout, and if we spuriously wake up or otherwise wake up
- // from a notification we just want to unconditionally set the state back to
- // empty, either consuming a notification or un-flagging ourselves as
- // parked.
- let (_m, _result) = self.cvar.wait_timeout(m, dur).unwrap();
- match self.state.swap(EMPTY, SeqCst) {
- NOTIFIED => {} // got a notification, hurray!
- PARKED => {} // no notification, alas
- n => panic!("inconsistent park_timeout state: {n}"),
- }
- }
-
- // This implementation doesn't require `Pin`, but other implementations do.
- pub fn unpark(self: Pin<&Self>) {
- // To ensure the unparked thread will observe any writes we made
- // before this call, we must perform a release operation that `park`
- // can synchronize with. To do that we must write `NOTIFIED` even if
- // `state` is already `NOTIFIED`. That is why this must be a swap
- // rather than a compare-and-swap that returns if it reads `NOTIFIED`
- // on failure.
- match self.state.swap(NOTIFIED, SeqCst) {
- EMPTY => return, // no one was waiting
- NOTIFIED => return, // already unparked
- PARKED => {} // gotta go wake someone up
- _ => panic!("inconsistent state in unpark"),
- }
-
- // There is a period between when the parked thread sets `state` to
- // `PARKED` (or last checked `state` in the case of a spurious wake
- // up) and when it actually waits on `cvar`. If we were to notify
- // during this period it would be ignored and then when the parked
- // thread went to sleep it would never wake up. Fortunately, it has
- // `lock` locked at this stage so we can acquire `lock` to wait until
- // it is ready to receive the notification.
- //
- // Releasing `lock` before the call to `notify_one` means that when the
- // parked thread wakes it doesn't get woken only to have to wait for us
- // to release `lock`.
- drop(self.lock.lock().unwrap());
- self.cvar.notify_one()
- }
-}
diff --git a/library/std/src/sys_common/thread_parking/mod.rs b/library/std/src/sys_common/thread_parking/mod.rs
index e8e028bb3..c4d3f9ea2 100644
--- a/library/std/src/sys_common/thread_parking/mod.rs
+++ b/library/std/src/sys_common/thread_parking/mod.rs
@@ -18,10 +18,7 @@ cfg_if::cfg_if! {
))] {
mod id;
pub use id::Parker;
- } else if #[cfg(any(windows, target_family = "unix"))] {
- pub use crate::sys::thread_parking::Parker;
} else {
- mod generic;
- pub use generic::Parker;
+ pub use crate::sys::thread_parking::Parker;
}
}
diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs
index bc588bdbb..ff96c35fb 100644
--- a/library/std/src/sys_common/wtf8.rs
+++ b/library/std/src/sys_common/wtf8.rs
@@ -501,6 +501,7 @@ pub struct Wtf8 {
}
impl AsInner<[u8]> for Wtf8 {
+ #[inline]
fn as_inner(&self) -> &[u8] {
&self.bytes
}
diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs
index 7fdf03acc..1b86d898c 100644
--- a/library/std/src/thread/local.rs
+++ b/library/std/src/thread/local.rs
@@ -18,8 +18,8 @@ use crate::fmt;
/// target platform. It is instantiated with the [`thread_local!`] macro and the
/// primary method is the [`with`] method.
///
-/// The [`with`] method yields a reference to the contained value which cannot be
-/// sent across threads or escape the given closure.
+/// The [`with`] method yields a reference to the contained value which cannot
+/// outlive the current thread or escape the given closure.
///
/// [`thread_local!`]: crate::thread_local
///
@@ -134,10 +134,28 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
/// thread_local! {
/// pub static FOO: RefCell<u32> = RefCell::new(1);
///
-/// #[allow(unused)]
/// static BAR: RefCell<f32> = RefCell::new(1.0);
/// }
-/// # fn main() {}
+///
+/// FOO.with(|foo| assert_eq!(*foo.borrow(), 1));
+/// BAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));
+/// ```
+///
+/// This macro supports a special `const {}` syntax that can be used
+/// when the initialization expression can be evaluated as a constant.
+/// This can enable a more efficient thread local implementation that
+/// can avoid lazy initialization. For types that do not
+/// [need to be dropped][crate::mem::needs_drop], this can enable an
+/// even more efficient implementation that does not need to
+/// track any additional state.
+///
+/// ```
+/// use std::cell::Cell;
+/// thread_local! {
+/// pub static FOO: Cell<u32> = const { Cell::new(1) };
+/// }
+///
+/// FOO.with(|foo| assert_eq!(foo.get(), 1));
/// ```
///
/// See [`LocalKey` documentation][`std::thread::LocalKey`] for more
@@ -153,23 +171,23 @@ macro_rules! thread_local {
() => {};
($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = const { $init:expr }; $($rest:tt)*) => (
- $crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, const $init);
+ $crate::thread::local_impl::thread_local_inner!($(#[$attr])* $vis $name, $t, const $init);
$crate::thread_local!($($rest)*);
);
($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = const { $init:expr }) => (
- $crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, const $init);
+ $crate::thread::local_impl::thread_local_inner!($(#[$attr])* $vis $name, $t, const $init);
);
// process multiple declarations
($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr; $($rest:tt)*) => (
- $crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
+ $crate::thread::local_impl::thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
$crate::thread_local!($($rest)*);
);
// handle a single declaration
($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr) => (
- $crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
+ $crate::thread::local_impl::thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
);
}
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
index 13b845b25..f712c8727 100644
--- a/library/std/src/thread/mod.rs
+++ b/library/std/src/thread/mod.rs
@@ -193,20 +193,23 @@ pub use scoped::{scope, Scope, ScopedJoinHandle};
#[macro_use]
mod local;
-#[stable(feature = "rust1", since = "1.0.0")]
-pub use self::local::{AccessError, LocalKey};
-
-// Provide the type used by the thread_local! macro to access TLS keys. This
-// needs to be kept in sync with the macro itself (in `local.rs`).
-// There are three types: "static", "fast", "OS". The "OS" thread local key
-// type is accessed via platform-specific API calls and is slow, while the "fast"
-// key type is accessed via code generated via LLVM, where TLS keys are set up
-// by the elf linker. "static" is for single-threaded platforms where a global
-// static is sufficient.
-
-#[doc(hidden)]
-#[unstable(feature = "libstd_thread_internals", issue = "none")]
-pub use crate::sys::common::thread_local::Key as __LocalKeyInner;
+cfg_if::cfg_if! {
+ if #[cfg(test)] {
+ // Avoid duplicating the global state assoicated with thread-locals between this crate and
+ // realstd. Miri relies on this.
+ pub use realstd::thread::{local_impl, AccessError, LocalKey};
+ } else {
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub use self::local::{AccessError, LocalKey};
+
+ // Implementation details used by the thread_local!{} macro.
+ #[doc(hidden)]
+ #[unstable(feature = "thread_local_internals", issue = "none")]
+ pub mod local_impl {
+ pub use crate::sys::common::thread_local::{thread_local_inner, Key};
+ }
+ }
+}
////////////////////////////////////////////////////////////////////////////////
// Builder
@@ -494,7 +497,7 @@ impl Builder {
MaybeDangling(mem::MaybeUninit::new(x))
}
fn into_inner(self) -> T {
- // SAFETY: we are always initiailized.
+ // SAFETY: we are always initialized.
let ret = unsafe { self.0.assume_init_read() };
// Make sure we don't drop.
mem::forget(self);
@@ -503,7 +506,7 @@ impl Builder {
}
impl<T> Drop for MaybeDangling<T> {
fn drop(&mut self) {
- // SAFETY: we are always initiailized.
+ // SAFETY: we are always initialized.
unsafe { self.0.assume_init_drop() };
}
}
diff --git a/library/std/src/thread/tests.rs b/library/std/src/thread/tests.rs
index 6c9ce6fa0..b65e2572c 100644
--- a/library/std/src/thread/tests.rs
+++ b/library/std/src/thread/tests.rs
@@ -375,7 +375,9 @@ fn test_scoped_threads_nll() {
// this is mostly a *compilation test* for this exact function:
fn foo(x: &u8) {
thread::scope(|s| {
- s.spawn(|| drop(x));
+ s.spawn(|| match x {
+ _ => (),
+ });
});
}
// let's also run it for good measure
diff --git a/library/std/src/time.rs b/library/std/src/time.rs
index 5c2e9da70..00e2857a1 100644
--- a/library/std/src/time.rs
+++ b/library/std/src/time.rs
@@ -119,7 +119,7 @@ pub use core::time::TryFromFloatSecsError;
/// [QueryPerformanceCounter]: https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter
/// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time
/// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode
-/// [__wasi_clock_time_get (Monotonic Clock)]: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md#clock_time_get
+/// [__wasi_clock_time_get (Monotonic Clock)]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#clock_time_get
/// [clock_gettime (Monotonic Clock)]: https://linux.die.net/man/3/clock_gettime
/// [mach_absolute_time]: https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/services/services.html
///
@@ -224,7 +224,7 @@ pub struct Instant(time::Instant);
/// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode
/// [gettimeofday]: https://man7.org/linux/man-pages/man2/gettimeofday.2.html
/// [clock_gettime (Realtime Clock)]: https://linux.die.net/man/3/clock_gettime
-/// [__wasi_clock_time_get (Realtime Clock)]: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md#clock_time_get
+/// [__wasi_clock_time_get (Realtime Clock)]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#clock_time_get
/// [GetSystemTimePreciseAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
/// [GetSystemTimeAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime
///
diff --git a/library/std/src/time/tests.rs b/library/std/src/time/tests.rs
index 2e64ae59a..6ed84806e 100644
--- a/library/std/src/time/tests.rs
+++ b/library/std/src/time/tests.rs
@@ -1,4 +1,5 @@
use super::{Duration, Instant, SystemTime, UNIX_EPOCH};
+use core::fmt::Debug;
#[cfg(not(target_arch = "wasm32"))]
use test::{black_box, Bencher};
@@ -201,6 +202,32 @@ fn since_epoch() {
assert!(a < hundred_twenty_years);
}
+#[test]
+fn big_math() {
+ // Check that the same result occurs when adding/subtracting each duration one at a time as when
+ // adding/subtracting them all at once.
+ #[track_caller]
+ fn check<T: Eq + Copy + Debug>(start: Option<T>, op: impl Fn(&T, Duration) -> Option<T>) {
+ const DURATIONS: [Duration; 2] =
+ [Duration::from_secs(i64::MAX as _), Duration::from_secs(50)];
+ if let Some(start) = start {
+ assert_eq!(
+ op(&start, DURATIONS.into_iter().sum()),
+ DURATIONS.into_iter().try_fold(start, |t, d| op(&t, d))
+ )
+ }
+ }
+
+ check(SystemTime::UNIX_EPOCH.checked_sub(Duration::from_secs(100)), SystemTime::checked_add);
+ check(SystemTime::UNIX_EPOCH.checked_add(Duration::from_secs(100)), SystemTime::checked_sub);
+
+ let instant = Instant::now();
+ check(instant.checked_sub(Duration::from_secs(100)), Instant::checked_add);
+ check(instant.checked_sub(Duration::from_secs(i64::MAX as _)), Instant::checked_add);
+ check(instant.checked_add(Duration::from_secs(100)), Instant::checked_sub);
+ check(instant.checked_add(Duration::from_secs(i64::MAX as _)), Instant::checked_sub);
+}
+
macro_rules! bench_instant_threaded {
($bench_name:ident, $thread_count:expr) => {
#[bench]
diff --git a/library/std/tests/run-time-detect.rs b/library/std/tests/run-time-detect.rs
index bf3c81fcc..9ce29a33d 100644
--- a/library/std/tests/run-time-detect.rs
+++ b/library/std/tests/run-time-detect.rs
@@ -16,7 +16,6 @@ fn arm_linux() {
// tidy-alphabetical-start
println!("aes: {}", is_arm_feature_detected!("aes"));
println!("crc: {}", is_arm_feature_detected!("crc"));
- println!("crypto: {}", is_arm_feature_detected!("crypto"));
println!("neon: {}", is_arm_feature_detected!("neon"));
println!("pmull: {}", is_arm_feature_detected!("pmull"));
println!("sha2: {}", is_arm_feature_detected!("sha2"));
diff --git a/library/stdarch/.cirrus.yml b/library/stdarch/.cirrus.yml
index 7b75ba39d..2456de30d 100644
--- a/library/stdarch/.cirrus.yml
+++ b/library/stdarch/.cirrus.yml
@@ -1,13 +1,8 @@
-env:
- # Temporary fix for https://github.com/rust-lang/rustup/issues/2774.
- RUSTUP_IO_THREADS: "1"
-
task:
name: x86_64-unknown-freebsd
freebsd_instance:
- image: freebsd-12-2-release-amd64
+ image_family: freebsd-12-4
setup_script:
- - pkg install -y curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh --default-toolchain nightly -y
- . $HOME/.cargo/env
diff --git a/library/stdarch/.github/workflows/main.yml b/library/stdarch/.github/workflows/main.yml
index 7d4085334..2de81e5a2 100644
--- a/library/stdarch/.github/workflows/main.yml
+++ b/library/stdarch/.github/workflows/main.yml
@@ -211,3 +211,13 @@ jobs:
if: "matrix.os == 'ubuntu-latest' && !startsWith(matrix.target, 'thumb')"
env:
TARGET: ${{ matrix.target }}
+
+ build-std-detect:
+ needs: [style]
+ name: Build std_detect
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@master
+ - name: Install Rust
+ run: rustup update nightly && rustup default nightly
+ - run: ./ci/build-std-detect.sh
diff --git a/library/stdarch/ci/build-std-detect.sh b/library/stdarch/ci/build-std-detect.sh
new file mode 100755
index 000000000..e4560b337
--- /dev/null
+++ b/library/stdarch/ci/build-std-detect.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+# Build std_detect on non-Linux & non-x86 targets.
+#
+# In std_detect, non-x86 targets have OS-specific implementations,
+# but we can test only Linux in CI. This script builds targets supported
+# by std_detect but cannot be tested in CI.
+
+set -ex
+cd "$(dirname "$0")"/..
+
+targets=(
+ # Android
+ aarch64-linux-android
+ arm-linux-androideabi
+
+ # FreeBSD
+ aarch64-unknown-freebsd
+ armv6-unknown-freebsd
+ powerpc-unknown-freebsd
+ powerpc64-unknown-freebsd
+
+ # OpenBSD
+ aarch64-unknown-openbsd
+
+ # Windows
+ aarch64-pc-windows-msvc
+)
+
+rustup component add rust-src # for -Z build-std
+
+cd crates/std_detect
+for target in "${targets[@]}"; do
+ if rustup target add "${target}" &>/dev/null; then
+ cargo build --target "${target}"
+ else
+ # tier 3 targets requires -Z build-std.
+ cargo build -Z build-std="core,alloc" --target "${target}"
+ fi
+done
diff --git a/library/stdarch/ci/docker/wasm32-wasi/Dockerfile b/library/stdarch/ci/docker/wasm32-wasi/Dockerfile
index fff41a0eb..5be645507 100644
--- a/library/stdarch/ci/docker/wasm32-wasi/Dockerfile
+++ b/library/stdarch/ci/docker/wasm32-wasi/Dockerfile
@@ -7,8 +7,8 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
xz-utils \
clang
-RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | tar xJf -
-ENV PATH=$PATH:/wasmtime-dev-x86_64-linux
+RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v8.0.0/wasmtime-v8.0.0-x86_64-linux.tar.xz | tar xJf -
+ENV PATH=$PATH:/wasmtime-v8.0.0-x86_64-linux
ENV CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime \
--wasm-features=threads,relaxed-simd \
diff --git a/library/stdarch/ci/run.sh b/library/stdarch/ci/run.sh
index 54145a0e7..4bb68069c 100755
--- a/library/stdarch/ci/run.sh
+++ b/library/stdarch/ci/run.sh
@@ -73,6 +73,9 @@ cargo_test() {
wasm32*)
cmd="$cmd --nocapture"
;;
+ # qemu has an erratic behavior on those tests
+ powerpc64*)
+ cmd="$cmd --skip test_vec_lde_u16 --skip test_vec_lde_u32 --skip test_vec_expte"
esac
if [ "$SKIP_TESTS" != "" ]; then
diff --git a/library/stdarch/crates/core_arch/avx512f.md b/library/stdarch/crates/core_arch/avx512f.md
index 6cb6e6564..2435583bf 100644
--- a/library/stdarch/crates/core_arch/avx512f.md
+++ b/library/stdarch/crates/core_arch/avx512f.md
@@ -1519,7 +1519,7 @@
* [x] [`_mm512_mask_i32scatter_epi64`]
* [_] [`_mm_i32scatter_epi64`]//need i1
* [_] [`_mm_mask_i32scatter_epi64`] //need i1
- * [_] [`_mm256_i32scatter_epi64`] //need i1
+ * [x] [`_mm256_i32scatter_epi64`]
* [_] [`_mm256_mask_i32scatter_epi64`] //need i1
* [x] [`_mm512_i32scatter_ps`]
* [x] [`_mm512_mask_i32scatter_ps`]
diff --git a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs
index cb5413fa3..da7fdf8b1 100644
--- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs
+++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs
@@ -1349,7 +1349,7 @@ pub unsafe fn vcgeq_f64(a: float64x2_t, b: float64x2_t) -> uint64x2_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgez_s8)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(cmge))]
+#[cfg_attr(test, assert_instr(cmgt))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgez_s8(a: int8x8_t) -> uint8x8_t {
let b: i8x8 = i8x8::new(0, 0, 0, 0, 0, 0, 0, 0);
@@ -1361,7 +1361,7 @@ pub unsafe fn vcgez_s8(a: int8x8_t) -> uint8x8_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgezq_s8)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(cmge))]
+#[cfg_attr(test, assert_instr(cmgt))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgezq_s8(a: int8x16_t) -> uint8x16_t {
let b: i8x16 = i8x16::new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
@@ -1373,7 +1373,7 @@ pub unsafe fn vcgezq_s8(a: int8x16_t) -> uint8x16_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgez_s16)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(cmge))]
+#[cfg_attr(test, assert_instr(cmgt))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgez_s16(a: int16x4_t) -> uint16x4_t {
let b: i16x4 = i16x4::new(0, 0, 0, 0);
@@ -1385,7 +1385,7 @@ pub unsafe fn vcgez_s16(a: int16x4_t) -> uint16x4_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgezq_s16)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(cmge))]
+#[cfg_attr(test, assert_instr(cmgt))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgezq_s16(a: int16x8_t) -> uint16x8_t {
let b: i16x8 = i16x8::new(0, 0, 0, 0, 0, 0, 0, 0);
@@ -1397,7 +1397,7 @@ pub unsafe fn vcgezq_s16(a: int16x8_t) -> uint16x8_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgez_s32)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(cmge))]
+#[cfg_attr(test, assert_instr(cmgt))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgez_s32(a: int32x2_t) -> uint32x2_t {
let b: i32x2 = i32x2::new(0, 0);
@@ -1409,7 +1409,7 @@ pub unsafe fn vcgez_s32(a: int32x2_t) -> uint32x2_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgezq_s32)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(cmge))]
+#[cfg_attr(test, assert_instr(cmgt))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgezq_s32(a: int32x4_t) -> uint32x4_t {
let b: i32x4 = i32x4::new(0, 0, 0, 0);
@@ -1421,7 +1421,7 @@ pub unsafe fn vcgezq_s32(a: int32x4_t) -> uint32x4_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgez_s64)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(cmge))]
+#[cfg_attr(test, assert_instr(cmgt))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgez_s64(a: int64x1_t) -> uint64x1_t {
let b: i64x1 = i64x1::new(0);
@@ -1433,7 +1433,7 @@ pub unsafe fn vcgez_s64(a: int64x1_t) -> uint64x1_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgezq_s64)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(cmge))]
+#[cfg_attr(test, assert_instr(cmgt))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgezq_s64(a: int64x2_t) -> uint64x2_t {
let b: i64x2 = i64x2::new(0, 0);
@@ -1493,7 +1493,7 @@ pub unsafe fn vcgezq_f64(a: float64x2_t) -> uint64x2_t {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcgezd_s64)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(eor))]
+#[cfg_attr(test, assert_instr(nop))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vcgezd_s64(a: i64) -> u64 {
transmute(vcgez_s64(transmute(a)))
@@ -11595,7 +11595,7 @@ pub unsafe fn vqdmlal_high_laneq_s32<const N: i32>(a: int64x2_t, b: int32x4_t, c
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqdmlalh_s16)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(sqdmull))]
+#[cfg_attr(test, assert_instr(sqdmlal))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vqdmlalh_s16(a: i32, b: i16, c: i16) -> i32 {
let x: int32x4_t = vqdmull_s16(vdup_n_s16(b), vdup_n_s16(c));
@@ -11607,11 +11607,11 @@ pub unsafe fn vqdmlalh_s16(a: i32, b: i16, c: i16) -> i32 {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqdmlals_s32)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(sqdmull))]
+#[cfg_attr(test, assert_instr(sqdmlal))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vqdmlals_s32(a: i64, b: i32, c: i32) -> i64 {
- let x: int64x2_t = vqdmull_s32(vdup_n_s32(b), vdup_n_s32(c));
- vqaddd_s64(a, simd_extract(x, 0))
+ let x: i64 = vqaddd_s64(a, vqdmulls_s32(b, c));
+ x as i64
}
/// Signed saturating doubling multiply-add long
@@ -11645,7 +11645,7 @@ pub unsafe fn vqdmlalh_laneq_s16<const LANE: i32>(a: i32, b: i16, c: int16x8_t)
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqdmlals_lane_s32)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(sqdmull, LANE = 0))]
+#[cfg_attr(test, assert_instr(sqdmlal, LANE = 0))]
#[rustc_legacy_const_generics(3)]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vqdmlals_lane_s32<const LANE: i32>(a: i64, b: i32, c: int32x2_t) -> i64 {
@@ -11658,7 +11658,7 @@ pub unsafe fn vqdmlals_lane_s32<const LANE: i32>(a: i64, b: i32, c: int32x2_t) -
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqdmlals_laneq_s32)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(sqdmull, LANE = 0))]
+#[cfg_attr(test, assert_instr(sqdmlal, LANE = 0))]
#[rustc_legacy_const_generics(3)]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vqdmlals_laneq_s32<const LANE: i32>(a: i64, b: i32, c: int32x4_t) -> i64 {
@@ -11793,7 +11793,7 @@ pub unsafe fn vqdmlsl_high_laneq_s32<const N: i32>(a: int64x2_t, b: int32x4_t, c
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqdmlslh_s16)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(sqdmull))]
+#[cfg_attr(test, assert_instr(sqdmlsl))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vqdmlslh_s16(a: i32, b: i16, c: i16) -> i32 {
let x: int32x4_t = vqdmull_s16(vdup_n_s16(b), vdup_n_s16(c));
@@ -11805,11 +11805,11 @@ pub unsafe fn vqdmlslh_s16(a: i32, b: i16, c: i16) -> i32 {
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqdmlsls_s32)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(sqdmull))]
+#[cfg_attr(test, assert_instr(sqdmlsl))]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vqdmlsls_s32(a: i64, b: i32, c: i32) -> i64 {
- let x: int64x2_t = vqdmull_s32(vdup_n_s32(b), vdup_n_s32(c));
- vqsubd_s64(a, simd_extract(x, 0))
+ let x: i64 = vqsubd_s64(a, vqdmulls_s32(b, c));
+ x as i64
}
/// Signed saturating doubling multiply-subtract long
@@ -11843,7 +11843,7 @@ pub unsafe fn vqdmlslh_laneq_s16<const LANE: i32>(a: i32, b: i16, c: int16x8_t)
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqdmlsls_lane_s32)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(sqdmull, LANE = 0))]
+#[cfg_attr(test, assert_instr(sqdmlsl, LANE = 0))]
#[rustc_legacy_const_generics(3)]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vqdmlsls_lane_s32<const LANE: i32>(a: i64, b: i32, c: int32x2_t) -> i64 {
@@ -11856,7 +11856,7 @@ pub unsafe fn vqdmlsls_lane_s32<const LANE: i32>(a: i64, b: i32, c: int32x2_t) -
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqdmlsls_laneq_s32)
#[inline]
#[target_feature(enable = "neon")]
-#[cfg_attr(test, assert_instr(sqdmull, LANE = 0))]
+#[cfg_attr(test, assert_instr(sqdmlsl, LANE = 0))]
#[rustc_legacy_const_generics(3)]
#[stable(feature = "neon_intrinsics", since = "1.59.0")]
pub unsafe fn vqdmlsls_laneq_s32<const LANE: i32>(a: i64, b: i32, c: int32x4_t) -> i64 {
diff --git a/library/stdarch/crates/core_arch/src/arm_shared/crypto.rs b/library/stdarch/crates/core_arch/src/arm_shared/crypto.rs
index 060091136..193f109bf 100644
--- a/library/stdarch/crates/core_arch/src/arm_shared/crypto.rs
+++ b/library/stdarch/crates/core_arch/src/arm_shared/crypto.rs
@@ -55,8 +55,8 @@ use stdarch_test::assert_instr;
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaeseq_u8)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "aes"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "aes")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(aese))]
pub unsafe fn vaeseq_u8(data: uint8x16_t, key: uint8x16_t) -> uint8x16_t {
vaeseq_u8_(data, key)
@@ -66,8 +66,8 @@ pub unsafe fn vaeseq_u8(data: uint8x16_t, key: uint8x16_t) -> uint8x16_t {
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaesdq_u8)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "aes"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "aes")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(aesd))]
pub unsafe fn vaesdq_u8(data: uint8x16_t, key: uint8x16_t) -> uint8x16_t {
vaesdq_u8_(data, key)
@@ -77,8 +77,8 @@ pub unsafe fn vaesdq_u8(data: uint8x16_t, key: uint8x16_t) -> uint8x16_t {
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaesmcq_u8)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "aes"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "aes")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(aesmc))]
pub unsafe fn vaesmcq_u8(data: uint8x16_t) -> uint8x16_t {
vaesmcq_u8_(data)
@@ -88,8 +88,8 @@ pub unsafe fn vaesmcq_u8(data: uint8x16_t) -> uint8x16_t {
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaesimcq_u8)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "aes"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "aes")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(aesimc))]
pub unsafe fn vaesimcq_u8(data: uint8x16_t) -> uint8x16_t {
vaesimcq_u8_(data)
@@ -99,8 +99,8 @@ pub unsafe fn vaesimcq_u8(data: uint8x16_t) -> uint8x16_t {
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1h_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha1h))]
pub unsafe fn vsha1h_u32(hash_e: u32) -> u32 {
vsha1h_u32_(hash_e)
@@ -110,8 +110,8 @@ pub unsafe fn vsha1h_u32(hash_e: u32) -> u32 {
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1cq_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha1c))]
pub unsafe fn vsha1cq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) -> uint32x4_t {
vsha1cq_u32_(hash_abcd, hash_e, wk)
@@ -121,8 +121,8 @@ pub unsafe fn vsha1cq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) ->
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1mq_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha1m))]
pub unsafe fn vsha1mq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) -> uint32x4_t {
vsha1mq_u32_(hash_abcd, hash_e, wk)
@@ -132,8 +132,8 @@ pub unsafe fn vsha1mq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) ->
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1pq_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha1p))]
pub unsafe fn vsha1pq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) -> uint32x4_t {
vsha1pq_u32_(hash_abcd, hash_e, wk)
@@ -143,8 +143,8 @@ pub unsafe fn vsha1pq_u32(hash_abcd: uint32x4_t, hash_e: u32, wk: uint32x4_t) ->
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1su0q_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha1su0))]
pub unsafe fn vsha1su0q_u32(w0_3: uint32x4_t, w4_7: uint32x4_t, w8_11: uint32x4_t) -> uint32x4_t {
vsha1su0q_u32_(w0_3, w4_7, w8_11)
@@ -154,8 +154,8 @@ pub unsafe fn vsha1su0q_u32(w0_3: uint32x4_t, w4_7: uint32x4_t, w8_11: uint32x4_
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha1su1q_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha1su1))]
pub unsafe fn vsha1su1q_u32(tw0_3: uint32x4_t, w12_15: uint32x4_t) -> uint32x4_t {
vsha1su1q_u32_(tw0_3, w12_15)
@@ -165,8 +165,8 @@ pub unsafe fn vsha1su1q_u32(tw0_3: uint32x4_t, w12_15: uint32x4_t) -> uint32x4_t
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha256hq_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha256h))]
pub unsafe fn vsha256hq_u32(
hash_abcd: uint32x4_t,
@@ -180,8 +180,8 @@ pub unsafe fn vsha256hq_u32(
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha256h2q_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha256h2))]
pub unsafe fn vsha256h2q_u32(
hash_efgh: uint32x4_t,
@@ -195,8 +195,8 @@ pub unsafe fn vsha256h2q_u32(
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha256su0q_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha256su0))]
pub unsafe fn vsha256su0q_u32(w0_3: uint32x4_t, w4_7: uint32x4_t) -> uint32x4_t {
vsha256su0q_u32_(w0_3, w4_7)
@@ -206,8 +206,8 @@ pub unsafe fn vsha256su0q_u32(w0_3: uint32x4_t, w4_7: uint32x4_t) -> uint32x4_t
///
/// [Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsha256su1q_u32)
#[inline]
-#[cfg_attr(not(target_arch = "arm"), target_feature(enable = "sha2"))]
-#[cfg_attr(target_arch = "arm", target_feature(enable = "crypto,v8"))]
+#[target_feature(enable = "sha2")]
+#[cfg_attr(target_arch = "arm", target_feature(enable = "v8"))]
#[cfg_attr(test, assert_instr(sha256su1))]
pub unsafe fn vsha256su1q_u32(
tw0_3: uint32x4_t,
@@ -224,8 +224,7 @@ mod tests {
use std::mem;
use stdarch_test::simd_test;
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "aes"))]
+ #[simd_test(enable = "aes")]
unsafe fn test_vaeseq_u8() {
let data = mem::transmute(u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8));
let key = mem::transmute(u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7));
@@ -238,8 +237,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "aes"))]
+ #[simd_test(enable = "aes")]
unsafe fn test_vaesdq_u8() {
let data = mem::transmute(u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8));
let key = mem::transmute(u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7));
@@ -250,8 +248,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "aes"))]
+ #[simd_test(enable = "aes")]
unsafe fn test_vaesmcq_u8() {
let data = mem::transmute(u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8));
let r: u8x16 = mem::transmute(vaesmcq_u8(data));
@@ -261,8 +258,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "aes"))]
+ #[simd_test(enable = "aes")]
unsafe fn test_vaesimcq_u8() {
let data = mem::transmute(u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8));
let r: u8x16 = mem::transmute(vaesimcq_u8(data));
@@ -272,15 +268,13 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha1h_u32() {
assert_eq!(vsha1h_u32(0x1234), 0x048d);
assert_eq!(vsha1h_u32(0x5678), 0x159e);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha1su0q_u32() {
let r: u32x4 = mem::transmute(vsha1su0q_u32(
mem::transmute(u32x4::new(0x1234_u32, 0x5678_u32, 0x9abc_u32, 0xdef0_u32)),
@@ -290,8 +284,7 @@ mod tests {
assert_eq!(r, u32x4::new(0x9abc, 0xdef0, 0x1234, 0x5678));
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha1su1q_u32() {
let r: u32x4 = mem::transmute(vsha1su1q_u32(
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -303,8 +296,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha1cq_u32() {
let r: u32x4 = mem::transmute(vsha1cq_u32(
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -317,8 +309,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha1pq_u32() {
let r: u32x4 = mem::transmute(vsha1pq_u32(
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -331,8 +322,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha1mq_u32() {
let r: u32x4 = mem::transmute(vsha1mq_u32(
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -345,8 +335,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha256hq_u32() {
let r: u32x4 = mem::transmute(vsha256hq_u32(
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -359,8 +348,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha256h2q_u32() {
let r: u32x4 = mem::transmute(vsha256h2q_u32(
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -373,8 +361,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha256su0q_u32() {
let r: u32x4 = mem::transmute(vsha256su0q_u32(
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
@@ -386,8 +373,7 @@ mod tests {
);
}
- #[cfg_attr(target_arch = "arm", simd_test(enable = "crypto"))]
- #[cfg_attr(not(target_arch = "arm"), simd_test(enable = "sha2"))]
+ #[simd_test(enable = "sha2")]
unsafe fn test_vsha256su1q_u32() {
let r: u32x4 = mem::transmute(vsha256su1q_u32(
mem::transmute(u32x4::new(0x1234, 0x5678, 0x9abc, 0xdef0)),
diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs
index 923265966..8a8f4febf 100644
--- a/library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs
+++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/mod.rs
@@ -109,7 +109,7 @@ types! {
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int8x8x2_t(pub int8x8_t, pub int8x8_t);
@@ -117,7 +117,7 @@ pub struct int8x8x2_t(pub int8x8_t, pub int8x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int8x8x3_t(pub int8x8_t, pub int8x8_t, pub int8x8_t);
@@ -125,7 +125,7 @@ pub struct int8x8x3_t(pub int8x8_t, pub int8x8_t, pub int8x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int8x8x4_t(pub int8x8_t, pub int8x8_t, pub int8x8_t, pub int8x8_t);
@@ -134,7 +134,7 @@ pub struct int8x8x4_t(pub int8x8_t, pub int8x8_t, pub int8x8_t, pub int8x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int8x16x2_t(pub int8x16_t, pub int8x16_t);
@@ -142,7 +142,7 @@ pub struct int8x16x2_t(pub int8x16_t, pub int8x16_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int8x16x3_t(pub int8x16_t, pub int8x16_t, pub int8x16_t);
@@ -150,7 +150,7 @@ pub struct int8x16x3_t(pub int8x16_t, pub int8x16_t, pub int8x16_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int8x16x4_t(pub int8x16_t, pub int8x16_t, pub int8x16_t, pub int8x16_t);
@@ -159,7 +159,7 @@ pub struct int8x16x4_t(pub int8x16_t, pub int8x16_t, pub int8x16_t, pub int8x16_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint8x8x2_t(pub uint8x8_t, pub uint8x8_t);
@@ -167,7 +167,7 @@ pub struct uint8x8x2_t(pub uint8x8_t, pub uint8x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint8x8x3_t(pub uint8x8_t, pub uint8x8_t, pub uint8x8_t);
@@ -175,7 +175,7 @@ pub struct uint8x8x3_t(pub uint8x8_t, pub uint8x8_t, pub uint8x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint8x8x4_t(pub uint8x8_t, pub uint8x8_t, pub uint8x8_t, pub uint8x8_t);
@@ -184,7 +184,7 @@ pub struct uint8x8x4_t(pub uint8x8_t, pub uint8x8_t, pub uint8x8_t, pub uint8x8_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint8x16x2_t(pub uint8x16_t, pub uint8x16_t);
@@ -192,7 +192,7 @@ pub struct uint8x16x2_t(pub uint8x16_t, pub uint8x16_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint8x16x3_t(pub uint8x16_t, pub uint8x16_t, pub uint8x16_t);
@@ -200,7 +200,7 @@ pub struct uint8x16x3_t(pub uint8x16_t, pub uint8x16_t, pub uint8x16_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint8x16x4_t(
@@ -214,7 +214,7 @@ pub struct uint8x16x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly8x8x2_t(pub poly8x8_t, pub poly8x8_t);
@@ -222,7 +222,7 @@ pub struct poly8x8x2_t(pub poly8x8_t, pub poly8x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly8x8x3_t(pub poly8x8_t, pub poly8x8_t, pub poly8x8_t);
@@ -230,7 +230,7 @@ pub struct poly8x8x3_t(pub poly8x8_t, pub poly8x8_t, pub poly8x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly8x8x4_t(pub poly8x8_t, pub poly8x8_t, pub poly8x8_t, pub poly8x8_t);
@@ -239,7 +239,7 @@ pub struct poly8x8x4_t(pub poly8x8_t, pub poly8x8_t, pub poly8x8_t, pub poly8x8_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly8x16x2_t(pub poly8x16_t, pub poly8x16_t);
@@ -247,7 +247,7 @@ pub struct poly8x16x2_t(pub poly8x16_t, pub poly8x16_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly8x16x3_t(pub poly8x16_t, pub poly8x16_t, pub poly8x16_t);
@@ -255,7 +255,7 @@ pub struct poly8x16x3_t(pub poly8x16_t, pub poly8x16_t, pub poly8x16_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly8x16x4_t(
@@ -269,7 +269,7 @@ pub struct poly8x16x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int16x4x2_t(pub int16x4_t, pub int16x4_t);
@@ -277,7 +277,7 @@ pub struct int16x4x2_t(pub int16x4_t, pub int16x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int16x4x3_t(pub int16x4_t, pub int16x4_t, pub int16x4_t);
@@ -285,7 +285,7 @@ pub struct int16x4x3_t(pub int16x4_t, pub int16x4_t, pub int16x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int16x4x4_t(pub int16x4_t, pub int16x4_t, pub int16x4_t, pub int16x4_t);
@@ -294,7 +294,7 @@ pub struct int16x4x4_t(pub int16x4_t, pub int16x4_t, pub int16x4_t, pub int16x4_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int16x8x2_t(pub int16x8_t, pub int16x8_t);
@@ -302,7 +302,7 @@ pub struct int16x8x2_t(pub int16x8_t, pub int16x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int16x8x3_t(pub int16x8_t, pub int16x8_t, pub int16x8_t);
@@ -310,7 +310,7 @@ pub struct int16x8x3_t(pub int16x8_t, pub int16x8_t, pub int16x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int16x8x4_t(pub int16x8_t, pub int16x8_t, pub int16x8_t, pub int16x8_t);
@@ -319,7 +319,7 @@ pub struct int16x8x4_t(pub int16x8_t, pub int16x8_t, pub int16x8_t, pub int16x8_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint16x4x2_t(pub uint16x4_t, pub uint16x4_t);
@@ -327,7 +327,7 @@ pub struct uint16x4x2_t(pub uint16x4_t, pub uint16x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint16x4x3_t(pub uint16x4_t, pub uint16x4_t, pub uint16x4_t);
@@ -335,7 +335,7 @@ pub struct uint16x4x3_t(pub uint16x4_t, pub uint16x4_t, pub uint16x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint16x4x4_t(
@@ -349,7 +349,7 @@ pub struct uint16x4x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint16x8x2_t(pub uint16x8_t, pub uint16x8_t);
@@ -357,7 +357,7 @@ pub struct uint16x8x2_t(pub uint16x8_t, pub uint16x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint16x8x3_t(pub uint16x8_t, pub uint16x8_t, pub uint16x8_t);
@@ -365,7 +365,7 @@ pub struct uint16x8x3_t(pub uint16x8_t, pub uint16x8_t, pub uint16x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint16x8x4_t(
@@ -379,7 +379,7 @@ pub struct uint16x8x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly16x4x2_t(pub poly16x4_t, pub poly16x4_t);
@@ -387,7 +387,7 @@ pub struct poly16x4x2_t(pub poly16x4_t, pub poly16x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly16x4x3_t(pub poly16x4_t, pub poly16x4_t, pub poly16x4_t);
@@ -395,7 +395,7 @@ pub struct poly16x4x3_t(pub poly16x4_t, pub poly16x4_t, pub poly16x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly16x4x4_t(
@@ -409,7 +409,7 @@ pub struct poly16x4x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly16x8x2_t(pub poly16x8_t, pub poly16x8_t);
@@ -417,7 +417,7 @@ pub struct poly16x8x2_t(pub poly16x8_t, pub poly16x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly16x8x3_t(pub poly16x8_t, pub poly16x8_t, pub poly16x8_t);
@@ -425,7 +425,7 @@ pub struct poly16x8x3_t(pub poly16x8_t, pub poly16x8_t, pub poly16x8_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly16x8x4_t(
@@ -439,7 +439,7 @@ pub struct poly16x8x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int32x2x2_t(pub int32x2_t, pub int32x2_t);
@@ -447,7 +447,7 @@ pub struct int32x2x2_t(pub int32x2_t, pub int32x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int32x2x3_t(pub int32x2_t, pub int32x2_t, pub int32x2_t);
@@ -455,7 +455,7 @@ pub struct int32x2x3_t(pub int32x2_t, pub int32x2_t, pub int32x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int32x2x4_t(pub int32x2_t, pub int32x2_t, pub int32x2_t, pub int32x2_t);
@@ -464,7 +464,7 @@ pub struct int32x2x4_t(pub int32x2_t, pub int32x2_t, pub int32x2_t, pub int32x2_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int32x4x2_t(pub int32x4_t, pub int32x4_t);
@@ -472,7 +472,7 @@ pub struct int32x4x2_t(pub int32x4_t, pub int32x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int32x4x3_t(pub int32x4_t, pub int32x4_t, pub int32x4_t);
@@ -480,7 +480,7 @@ pub struct int32x4x3_t(pub int32x4_t, pub int32x4_t, pub int32x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int32x4x4_t(pub int32x4_t, pub int32x4_t, pub int32x4_t, pub int32x4_t);
@@ -489,7 +489,7 @@ pub struct int32x4x4_t(pub int32x4_t, pub int32x4_t, pub int32x4_t, pub int32x4_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint32x2x2_t(pub uint32x2_t, pub uint32x2_t);
@@ -497,7 +497,7 @@ pub struct uint32x2x2_t(pub uint32x2_t, pub uint32x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint32x2x3_t(pub uint32x2_t, pub uint32x2_t, pub uint32x2_t);
@@ -505,7 +505,7 @@ pub struct uint32x2x3_t(pub uint32x2_t, pub uint32x2_t, pub uint32x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint32x2x4_t(
@@ -519,7 +519,7 @@ pub struct uint32x2x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint32x4x2_t(pub uint32x4_t, pub uint32x4_t);
@@ -527,7 +527,7 @@ pub struct uint32x4x2_t(pub uint32x4_t, pub uint32x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint32x4x3_t(pub uint32x4_t, pub uint32x4_t, pub uint32x4_t);
@@ -535,7 +535,7 @@ pub struct uint32x4x3_t(pub uint32x4_t, pub uint32x4_t, pub uint32x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint32x4x4_t(
@@ -549,7 +549,7 @@ pub struct uint32x4x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct float32x2x2_t(pub float32x2_t, pub float32x2_t);
@@ -557,7 +557,7 @@ pub struct float32x2x2_t(pub float32x2_t, pub float32x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct float32x2x3_t(pub float32x2_t, pub float32x2_t, pub float32x2_t);
@@ -565,7 +565,7 @@ pub struct float32x2x3_t(pub float32x2_t, pub float32x2_t, pub float32x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct float32x2x4_t(
@@ -579,7 +579,7 @@ pub struct float32x2x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct float32x4x2_t(pub float32x4_t, pub float32x4_t);
@@ -587,7 +587,7 @@ pub struct float32x4x2_t(pub float32x4_t, pub float32x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct float32x4x3_t(pub float32x4_t, pub float32x4_t, pub float32x4_t);
@@ -595,7 +595,7 @@ pub struct float32x4x3_t(pub float32x4_t, pub float32x4_t, pub float32x4_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct float32x4x4_t(
@@ -609,7 +609,7 @@ pub struct float32x4x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int64x1x2_t(pub int64x1_t, pub int64x1_t);
@@ -617,7 +617,7 @@ pub struct int64x1x2_t(pub int64x1_t, pub int64x1_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int64x1x3_t(pub int64x1_t, pub int64x1_t, pub int64x1_t);
@@ -625,7 +625,7 @@ pub struct int64x1x3_t(pub int64x1_t, pub int64x1_t, pub int64x1_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int64x1x4_t(pub int64x1_t, pub int64x1_t, pub int64x1_t, pub int64x1_t);
@@ -634,7 +634,7 @@ pub struct int64x1x4_t(pub int64x1_t, pub int64x1_t, pub int64x1_t, pub int64x1_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int64x2x2_t(pub int64x2_t, pub int64x2_t);
@@ -642,7 +642,7 @@ pub struct int64x2x2_t(pub int64x2_t, pub int64x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int64x2x3_t(pub int64x2_t, pub int64x2_t, pub int64x2_t);
@@ -650,7 +650,7 @@ pub struct int64x2x3_t(pub int64x2_t, pub int64x2_t, pub int64x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct int64x2x4_t(pub int64x2_t, pub int64x2_t, pub int64x2_t, pub int64x2_t);
@@ -659,7 +659,7 @@ pub struct int64x2x4_t(pub int64x2_t, pub int64x2_t, pub int64x2_t, pub int64x2_
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint64x1x2_t(pub uint64x1_t, pub uint64x1_t);
@@ -667,7 +667,7 @@ pub struct uint64x1x2_t(pub uint64x1_t, pub uint64x1_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint64x1x3_t(pub uint64x1_t, pub uint64x1_t, pub uint64x1_t);
@@ -675,7 +675,7 @@ pub struct uint64x1x3_t(pub uint64x1_t, pub uint64x1_t, pub uint64x1_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint64x1x4_t(
@@ -689,7 +689,7 @@ pub struct uint64x1x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint64x2x2_t(pub uint64x2_t, pub uint64x2_t);
@@ -697,7 +697,7 @@ pub struct uint64x2x2_t(pub uint64x2_t, pub uint64x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint64x2x3_t(pub uint64x2_t, pub uint64x2_t, pub uint64x2_t);
@@ -705,7 +705,7 @@ pub struct uint64x2x3_t(pub uint64x2_t, pub uint64x2_t, pub uint64x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct uint64x2x4_t(
@@ -719,7 +719,7 @@ pub struct uint64x2x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x1x2_t(pub poly64x1_t, pub poly64x1_t);
@@ -727,7 +727,7 @@ pub struct poly64x1x2_t(pub poly64x1_t, pub poly64x1_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x1x3_t(pub poly64x1_t, pub poly64x1_t, pub poly64x1_t);
@@ -735,7 +735,7 @@ pub struct poly64x1x3_t(pub poly64x1_t, pub poly64x1_t, pub poly64x1_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x1x4_t(
@@ -749,7 +749,7 @@ pub struct poly64x1x4_t(
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x2x2_t(pub poly64x2_t, pub poly64x2_t);
@@ -757,7 +757,7 @@ pub struct poly64x2x2_t(pub poly64x2_t, pub poly64x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x2x3_t(pub poly64x2_t, pub poly64x2_t, pub poly64x2_t);
@@ -765,7 +765,7 @@ pub struct poly64x2x3_t(pub poly64x2_t, pub poly64x2_t, pub poly64x2_t);
#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub struct poly64x2x4_t(
@@ -971,7 +971,7 @@ extern "unadjusted" {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8", LANE = 7))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 7))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_s8<const LANE: i32>(ptr: *const i8, src: int8x8_t) -> int8x8_t {
@@ -987,7 +987,7 @@ pub unsafe fn vld1_lane_s8<const LANE: i32>(ptr: *const i8, src: int8x8_t) -> in
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8", LANE = 15))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 15))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_s8<const LANE: i32>(ptr: *const i8, src: int8x16_t) -> int8x16_t {
@@ -1003,7 +1003,7 @@ pub unsafe fn vld1q_lane_s8<const LANE: i32>(ptr: *const i8, src: int8x16_t) ->
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16", LANE = 3))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 3))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_s16<const LANE: i32>(ptr: *const i16, src: int16x4_t) -> int16x4_t {
@@ -1019,7 +1019,7 @@ pub unsafe fn vld1_lane_s16<const LANE: i32>(ptr: *const i16, src: int16x4_t) ->
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16", LANE = 7))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 7))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_s16<const LANE: i32>(ptr: *const i16, src: int16x8_t) -> int16x8_t {
@@ -1035,7 +1035,7 @@ pub unsafe fn vld1q_lane_s16<const LANE: i32>(ptr: *const i16, src: int16x8_t) -
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32", LANE = 1))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_s32<const LANE: i32>(ptr: *const i32, src: int32x2_t) -> int32x2_t {
@@ -1051,7 +1051,7 @@ pub unsafe fn vld1_lane_s32<const LANE: i32>(ptr: *const i32, src: int32x2_t) ->
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32", LANE = 3))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 3))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_s32<const LANE: i32>(ptr: *const i32, src: int32x4_t) -> int32x4_t {
@@ -1067,7 +1067,7 @@ pub unsafe fn vld1q_lane_s32<const LANE: i32>(ptr: *const i32, src: int32x4_t) -
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr", LANE = 0))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ldr, LANE = 0))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_s64<const LANE: i32>(ptr: *const i64, src: int64x1_t) -> int64x1_t {
@@ -1083,7 +1083,7 @@ pub unsafe fn vld1_lane_s64<const LANE: i32>(ptr: *const i64, src: int64x1_t) ->
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr", LANE = 1))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_s64<const LANE: i32>(ptr: *const i64, src: int64x2_t) -> int64x2_t {
@@ -1099,7 +1099,7 @@ pub unsafe fn vld1q_lane_s64<const LANE: i32>(ptr: *const i64, src: int64x2_t) -
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8", LANE = 7))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 7))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_u8<const LANE: i32>(ptr: *const u8, src: uint8x8_t) -> uint8x8_t {
@@ -1115,7 +1115,7 @@ pub unsafe fn vld1_lane_u8<const LANE: i32>(ptr: *const u8, src: uint8x8_t) -> u
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8", LANE = 15))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 15))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_u8<const LANE: i32>(ptr: *const u8, src: uint8x16_t) -> uint8x16_t {
@@ -1131,7 +1131,7 @@ pub unsafe fn vld1q_lane_u8<const LANE: i32>(ptr: *const u8, src: uint8x16_t) ->
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16", LANE = 3))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 3))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_u16<const LANE: i32>(ptr: *const u16, src: uint16x4_t) -> uint16x4_t {
@@ -1147,7 +1147,7 @@ pub unsafe fn vld1_lane_u16<const LANE: i32>(ptr: *const u16, src: uint16x4_t) -
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16", LANE = 7))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 7))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_u16<const LANE: i32>(ptr: *const u16, src: uint16x8_t) -> uint16x8_t {
@@ -1163,7 +1163,7 @@ pub unsafe fn vld1q_lane_u16<const LANE: i32>(ptr: *const u16, src: uint16x8_t)
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32", LANE = 1))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_u32<const LANE: i32>(ptr: *const u32, src: uint32x2_t) -> uint32x2_t {
@@ -1179,7 +1179,7 @@ pub unsafe fn vld1_lane_u32<const LANE: i32>(ptr: *const u32, src: uint32x2_t) -
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32", LANE = 3))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 3))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_u32<const LANE: i32>(ptr: *const u32, src: uint32x4_t) -> uint32x4_t {
@@ -1195,7 +1195,7 @@ pub unsafe fn vld1q_lane_u32<const LANE: i32>(ptr: *const u32, src: uint32x4_t)
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr", LANE = 0))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ldr, LANE = 0))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_u64<const LANE: i32>(ptr: *const u64, src: uint64x1_t) -> uint64x1_t {
@@ -1211,7 +1211,7 @@ pub unsafe fn vld1_lane_u64<const LANE: i32>(ptr: *const u64, src: uint64x1_t) -
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr", LANE = 1))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_u64<const LANE: i32>(ptr: *const u64, src: uint64x2_t) -> uint64x2_t {
@@ -1227,7 +1227,7 @@ pub unsafe fn vld1q_lane_u64<const LANE: i32>(ptr: *const u64, src: uint64x2_t)
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8", LANE = 7))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 7))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_p8<const LANE: i32>(ptr: *const p8, src: poly8x8_t) -> poly8x8_t {
@@ -1243,7 +1243,7 @@ pub unsafe fn vld1_lane_p8<const LANE: i32>(ptr: *const p8, src: poly8x8_t) -> p
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8", LANE = 15))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 15))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_p8<const LANE: i32>(ptr: *const p8, src: poly8x16_t) -> poly8x16_t {
@@ -1259,7 +1259,7 @@ pub unsafe fn vld1q_lane_p8<const LANE: i32>(ptr: *const p8, src: poly8x16_t) ->
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16", LANE = 3))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 3))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_p16<const LANE: i32>(ptr: *const p16, src: poly16x4_t) -> poly16x4_t {
@@ -1275,7 +1275,7 @@ pub unsafe fn vld1_lane_p16<const LANE: i32>(ptr: *const p16, src: poly16x4_t) -
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16", LANE = 7))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 7))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_p16<const LANE: i32>(ptr: *const p16, src: poly16x8_t) -> poly16x8_t {
@@ -1293,7 +1293,7 @@ pub unsafe fn vld1q_lane_p16<const LANE: i32>(ptr: *const p16, src: poly16x8_t)
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr", LANE = 0))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ldr, LANE = 0))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_p64<const LANE: i32>(ptr: *const p64, src: poly64x1_t) -> poly64x1_t {
@@ -1311,7 +1311,7 @@ pub unsafe fn vld1_lane_p64<const LANE: i32>(ptr: *const p64, src: poly64x1_t) -
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr", LANE = 1))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_p64<const LANE: i32>(ptr: *const p64, src: poly64x2_t) -> poly64x2_t {
@@ -1327,7 +1327,7 @@ pub unsafe fn vld1q_lane_p64<const LANE: i32>(ptr: *const p64, src: poly64x2_t)
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32", LANE = 1))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_lane_f32<const LANE: i32>(ptr: *const f32, src: float32x2_t) -> float32x2_t {
@@ -1343,7 +1343,7 @@ pub unsafe fn vld1_lane_f32<const LANE: i32>(ptr: *const f32, src: float32x2_t)
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32", LANE = 3))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1, LANE = 3))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_lane_f32<const LANE: i32>(ptr: *const f32, src: float32x4_t) -> float32x4_t {
@@ -1358,7 +1358,7 @@ pub unsafe fn vld1q_lane_f32<const LANE: i32>(ptr: *const f32, src: float32x4_t)
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_s8(ptr: *const i8) -> int8x8_t {
@@ -1373,7 +1373,7 @@ pub unsafe fn vld1_dup_s8(ptr: *const i8) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_s8(ptr: *const i8) -> int8x16_t {
@@ -1388,7 +1388,7 @@ pub unsafe fn vld1q_dup_s8(ptr: *const i8) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_s16(ptr: *const i16) -> int16x4_t {
@@ -1403,7 +1403,7 @@ pub unsafe fn vld1_dup_s16(ptr: *const i16) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_s16(ptr: *const i16) -> int16x8_t {
@@ -1418,7 +1418,7 @@ pub unsafe fn vld1q_dup_s16(ptr: *const i16) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_s32(ptr: *const i32) -> int32x2_t {
@@ -1433,7 +1433,7 @@ pub unsafe fn vld1_dup_s32(ptr: *const i32) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_s32(ptr: *const i32) -> int32x4_t {
@@ -1448,7 +1448,7 @@ pub unsafe fn vld1q_dup_s32(ptr: *const i32) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ldr))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_s64(ptr: *const i64) -> int64x1_t {
@@ -1469,7 +1469,7 @@ pub unsafe fn vld1_dup_s64(ptr: *const i64) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_s64(ptr: *const i64) -> int64x2_t {
@@ -1484,7 +1484,7 @@ pub unsafe fn vld1q_dup_s64(ptr: *const i64) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_u8(ptr: *const u8) -> uint8x8_t {
@@ -1499,7 +1499,7 @@ pub unsafe fn vld1_dup_u8(ptr: *const u8) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_u8(ptr: *const u8) -> uint8x16_t {
@@ -1514,7 +1514,7 @@ pub unsafe fn vld1q_dup_u8(ptr: *const u8) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_u16(ptr: *const u16) -> uint16x4_t {
@@ -1529,7 +1529,7 @@ pub unsafe fn vld1_dup_u16(ptr: *const u16) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_u16(ptr: *const u16) -> uint16x8_t {
@@ -1544,7 +1544,7 @@ pub unsafe fn vld1q_dup_u16(ptr: *const u16) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_u32(ptr: *const u32) -> uint32x2_t {
@@ -1559,7 +1559,7 @@ pub unsafe fn vld1_dup_u32(ptr: *const u32) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_u32(ptr: *const u32) -> uint32x4_t {
@@ -1574,7 +1574,7 @@ pub unsafe fn vld1q_dup_u32(ptr: *const u32) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ldr))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_u64(ptr: *const u64) -> uint64x1_t {
@@ -1595,7 +1595,7 @@ pub unsafe fn vld1_dup_u64(ptr: *const u64) -> uint64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_u64(ptr: *const u64) -> uint64x2_t {
@@ -1610,7 +1610,7 @@ pub unsafe fn vld1q_dup_u64(ptr: *const u64) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_p8(ptr: *const p8) -> poly8x8_t {
@@ -1625,7 +1625,7 @@ pub unsafe fn vld1_dup_p8(ptr: *const p8) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_p8(ptr: *const p8) -> poly8x16_t {
@@ -1640,7 +1640,7 @@ pub unsafe fn vld1q_dup_p8(ptr: *const p8) -> poly8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_p16(ptr: *const p16) -> poly16x4_t {
@@ -1655,7 +1655,7 @@ pub unsafe fn vld1_dup_p16(ptr: *const p16) -> poly16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_p16(ptr: *const p16) -> poly16x8_t {
@@ -1670,7 +1670,7 @@ pub unsafe fn vld1q_dup_p16(ptr: *const p16) -> poly16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_f32(ptr: *const f32) -> float32x2_t {
@@ -1687,7 +1687,7 @@ pub unsafe fn vld1_dup_f32(ptr: *const f32) -> float32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ldr))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1_dup_p64(ptr: *const p64) -> poly64x1_t {
@@ -1710,7 +1710,7 @@ pub unsafe fn vld1_dup_p64(ptr: *const p64) -> poly64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_p64(ptr: *const p64) -> poly64x2_t {
@@ -1725,7 +1725,7 @@ pub unsafe fn vld1q_dup_p64(ptr: *const p64) -> poly64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vld1.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ld1r))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vld1q_dup_f32(ptr: *const f32) -> float32x4_t {
@@ -1740,7 +1740,7 @@ pub unsafe fn vld1q_dup_f32(ptr: *const f32) -> float32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.s8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("saba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaba_s8(a: int8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t {
@@ -1752,7 +1752,7 @@ pub unsafe fn vaba_s8(a: int8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.s16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("saba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaba_s16(a: int16x4_t, b: int16x4_t, c: int16x4_t) -> int16x4_t {
@@ -1764,7 +1764,7 @@ pub unsafe fn vaba_s16(a: int16x4_t, b: int16x4_t, c: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.s32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("saba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaba_s32(a: int32x2_t, b: int32x2_t, c: int32x2_t) -> int32x2_t {
@@ -1776,7 +1776,7 @@ pub unsafe fn vaba_s32(a: int32x2_t, b: int32x2_t, c: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.u8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("uaba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaba_u8(a: uint8x8_t, b: uint8x8_t, c: uint8x8_t) -> uint8x8_t {
@@ -1788,7 +1788,7 @@ pub unsafe fn vaba_u8(a: uint8x8_t, b: uint8x8_t, c: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.u16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("uaba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaba_u16(a: uint16x4_t, b: uint16x4_t, c: uint16x4_t) -> uint16x4_t {
@@ -1800,7 +1800,7 @@ pub unsafe fn vaba_u16(a: uint16x4_t, b: uint16x4_t, c: uint16x4_t) -> uint16x4_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.u32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("uaba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaba_u32(a: uint32x2_t, b: uint32x2_t, c: uint32x2_t) -> uint32x2_t {
@@ -1813,7 +1813,7 @@ pub unsafe fn vaba_u32(a: uint32x2_t, b: uint32x2_t, c: uint32x2_t) -> uint32x2_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.s8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("saba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabaq_s8(a: int8x16_t, b: int8x16_t, c: int8x16_t) -> int8x16_t {
@@ -1825,7 +1825,7 @@ pub unsafe fn vabaq_s8(a: int8x16_t, b: int8x16_t, c: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.s16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("saba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabaq_s16(a: int16x8_t, b: int16x8_t, c: int16x8_t) -> int16x8_t {
@@ -1837,7 +1837,7 @@ pub unsafe fn vabaq_s16(a: int16x8_t, b: int16x8_t, c: int16x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.s32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("saba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabaq_s32(a: int32x4_t, b: int32x4_t, c: int32x4_t) -> int32x4_t {
@@ -1849,7 +1849,7 @@ pub unsafe fn vabaq_s32(a: int32x4_t, b: int32x4_t, c: int32x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.u8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("uaba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabaq_u8(a: uint8x16_t, b: uint8x16_t, c: uint8x16_t) -> uint8x16_t {
@@ -1861,7 +1861,7 @@ pub unsafe fn vabaq_u8(a: uint8x16_t, b: uint8x16_t, c: uint8x16_t) -> uint8x16_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.u16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("uaba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabaq_u16(a: uint16x8_t, b: uint16x8_t, c: uint16x8_t) -> uint16x8_t {
@@ -1873,7 +1873,7 @@ pub unsafe fn vabaq_u16(a: uint16x8_t, b: uint16x8_t, c: uint16x8_t) -> uint16x8
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vaba.u32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("uaba"))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabaq_u32(a: uint32x4_t, b: uint32x4_t, c: uint32x4_t) -> uint32x4_t {
@@ -1887,7 +1887,7 @@ pub unsafe fn vabaq_u32(a: uint32x4_t, b: uint32x4_t, c: uint32x4_t) -> uint32x4
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vabs))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(abs))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabs_s8(a: int8x8_t) -> int8x8_t {
@@ -1900,7 +1900,7 @@ pub unsafe fn vabs_s8(a: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vabs))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(abs))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabs_s16(a: int16x4_t) -> int16x4_t {
@@ -1913,7 +1913,7 @@ pub unsafe fn vabs_s16(a: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vabs))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(abs))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabs_s32(a: int32x2_t) -> int32x2_t {
@@ -1926,7 +1926,7 @@ pub unsafe fn vabs_s32(a: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vabs))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(abs))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabsq_s8(a: int8x16_t) -> int8x16_t {
@@ -1939,7 +1939,7 @@ pub unsafe fn vabsq_s8(a: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vabs))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(abs))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabsq_s16(a: int16x8_t) -> int16x8_t {
@@ -1952,7 +1952,7 @@ pub unsafe fn vabsq_s16(a: int16x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vabs))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(abs))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vabsq_s32(a: int32x4_t) -> int32x4_t {
@@ -1966,7 +1966,7 @@ pub unsafe fn vabsq_s32(a: int32x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadd_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
@@ -1979,7 +1979,7 @@ pub unsafe fn vpadd_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadd_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
@@ -1992,7 +1992,7 @@ pub unsafe fn vpadd_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadd_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
@@ -2005,7 +2005,7 @@ pub unsafe fn vpadd_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadd_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
@@ -2018,7 +2018,7 @@ pub unsafe fn vpadd_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadd_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
@@ -2031,7 +2031,7 @@ pub unsafe fn vpadd_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadd_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
@@ -2045,7 +2045,7 @@ pub unsafe fn vpadd_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vadd_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
@@ -2059,7 +2059,7 @@ pub unsafe fn vadd_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t {
@@ -2073,7 +2073,7 @@ pub unsafe fn vaddq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vadd_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
@@ -2087,7 +2087,7 @@ pub unsafe fn vadd_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t {
@@ -2101,7 +2101,7 @@ pub unsafe fn vaddq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vadd_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
@@ -2115,7 +2115,7 @@ pub unsafe fn vadd_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t {
@@ -2129,7 +2129,7 @@ pub unsafe fn vaddq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t {
@@ -2143,7 +2143,7 @@ pub unsafe fn vaddq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vadd_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
@@ -2157,7 +2157,7 @@ pub unsafe fn vadd_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
@@ -2171,7 +2171,7 @@ pub unsafe fn vaddq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vadd_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
@@ -2185,7 +2185,7 @@ pub unsafe fn vadd_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
@@ -2199,7 +2199,7 @@ pub unsafe fn vaddq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vadd_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
@@ -2213,7 +2213,7 @@ pub unsafe fn vadd_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
@@ -2227,7 +2227,7 @@ pub unsafe fn vaddq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(add))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
@@ -2241,7 +2241,7 @@ pub unsafe fn vaddq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(fadd))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vadd_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t {
@@ -2255,7 +2255,7 @@ pub unsafe fn vadd_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vadd))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(fadd))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t {
@@ -2269,7 +2269,7 @@ pub unsafe fn vaddq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_s8(a: int8x8_t, b: int8x8_t) -> int16x8_t {
@@ -2285,7 +2285,7 @@ pub unsafe fn vaddl_s8(a: int8x8_t, b: int8x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_s16(a: int16x4_t, b: int16x4_t) -> int32x4_t {
@@ -2301,7 +2301,7 @@ pub unsafe fn vaddl_s16(a: int16x4_t, b: int16x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_s32(a: int32x2_t, b: int32x2_t) -> int64x2_t {
@@ -2317,7 +2317,7 @@ pub unsafe fn vaddl_s32(a: int32x2_t, b: int32x2_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_u8(a: uint8x8_t, b: uint8x8_t) -> uint16x8_t {
@@ -2333,7 +2333,7 @@ pub unsafe fn vaddl_u8(a: uint8x8_t, b: uint8x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_u16(a: uint16x4_t, b: uint16x4_t) -> uint32x4_t {
@@ -2349,7 +2349,7 @@ pub unsafe fn vaddl_u16(a: uint16x4_t, b: uint16x4_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_u32(a: uint32x2_t, b: uint32x2_t) -> uint64x2_t {
@@ -2365,7 +2365,7 @@ pub unsafe fn vaddl_u32(a: uint32x2_t, b: uint32x2_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddl2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_high_s8(a: int8x16_t, b: int8x16_t) -> int16x8_t {
@@ -2383,7 +2383,7 @@ pub unsafe fn vaddl_high_s8(a: int8x16_t, b: int8x16_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddl2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_high_s16(a: int16x8_t, b: int16x8_t) -> int32x4_t {
@@ -2401,7 +2401,7 @@ pub unsafe fn vaddl_high_s16(a: int16x8_t, b: int16x8_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddl2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_high_s32(a: int32x4_t, b: int32x4_t) -> int64x2_t {
@@ -2419,7 +2419,7 @@ pub unsafe fn vaddl_high_s32(a: int32x4_t, b: int32x4_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddl2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_high_u8(a: uint8x16_t, b: uint8x16_t) -> uint16x8_t {
@@ -2437,7 +2437,7 @@ pub unsafe fn vaddl_high_u8(a: uint8x16_t, b: uint8x16_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddl2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_high_u16(a: uint16x8_t, b: uint16x8_t) -> uint32x4_t {
@@ -2455,7 +2455,7 @@ pub unsafe fn vaddl_high_u16(a: uint16x8_t, b: uint16x8_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddl2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddl_high_u32(a: uint32x4_t, b: uint32x4_t) -> uint64x2_t {
@@ -2473,7 +2473,7 @@ pub unsafe fn vaddl_high_u32(a: uint32x4_t, b: uint32x4_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddw))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_s8(a: int16x8_t, b: int8x8_t) -> int16x8_t {
@@ -2488,7 +2488,7 @@ pub unsafe fn vaddw_s8(a: int16x8_t, b: int8x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddw))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_s16(a: int32x4_t, b: int16x4_t) -> int32x4_t {
@@ -2503,7 +2503,7 @@ pub unsafe fn vaddw_s16(a: int32x4_t, b: int16x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddw))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_s32(a: int64x2_t, b: int32x2_t) -> int64x2_t {
@@ -2518,7 +2518,7 @@ pub unsafe fn vaddw_s32(a: int64x2_t, b: int32x2_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddw))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_u8(a: uint16x8_t, b: uint8x8_t) -> uint16x8_t {
@@ -2533,7 +2533,7 @@ pub unsafe fn vaddw_u8(a: uint16x8_t, b: uint8x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddw))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_u16(a: uint32x4_t, b: uint16x4_t) -> uint32x4_t {
@@ -2548,7 +2548,7 @@ pub unsafe fn vaddw_u16(a: uint32x4_t, b: uint16x4_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddw))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_u32(a: uint64x2_t, b: uint32x2_t) -> uint64x2_t {
@@ -2563,7 +2563,7 @@ pub unsafe fn vaddw_u32(a: uint64x2_t, b: uint32x2_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddw2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_high_s8(a: int16x8_t, b: int8x16_t) -> int16x8_t {
@@ -2579,7 +2579,7 @@ pub unsafe fn vaddw_high_s8(a: int16x8_t, b: int8x16_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddw2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_high_s16(a: int32x4_t, b: int16x8_t) -> int32x4_t {
@@ -2595,7 +2595,7 @@ pub unsafe fn vaddw_high_s16(a: int32x4_t, b: int16x8_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddw2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_high_s32(a: int64x2_t, b: int32x4_t) -> int64x2_t {
@@ -2611,7 +2611,7 @@ pub unsafe fn vaddw_high_s32(a: int64x2_t, b: int32x4_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddw2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_high_u8(a: uint16x8_t, b: uint8x16_t) -> uint16x8_t {
@@ -2627,7 +2627,7 @@ pub unsafe fn vaddw_high_u8(a: uint16x8_t, b: uint8x16_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddw2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_high_u16(a: uint32x4_t, b: uint16x8_t) -> uint32x4_t {
@@ -2643,7 +2643,7 @@ pub unsafe fn vaddw_high_u16(a: uint32x4_t, b: uint16x8_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddw))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddw2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddw_high_u32(a: uint64x2_t, b: uint32x4_t) -> uint64x2_t {
@@ -2659,7 +2659,7 @@ pub unsafe fn vaddw_high_u32(a: uint64x2_t, b: uint32x4_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_s16(a: int16x8_t, b: int16x8_t) -> int8x8_t {
@@ -2673,7 +2673,7 @@ pub unsafe fn vaddhn_s16(a: int16x8_t, b: int16x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_s32(a: int32x4_t, b: int32x4_t) -> int16x4_t {
@@ -2687,7 +2687,7 @@ pub unsafe fn vaddhn_s32(a: int32x4_t, b: int32x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_s64(a: int64x2_t, b: int64x2_t) -> int32x2_t {
@@ -2701,7 +2701,7 @@ pub unsafe fn vaddhn_s64(a: int64x2_t, b: int64x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_u16(a: uint16x8_t, b: uint16x8_t) -> uint8x8_t {
@@ -2715,7 +2715,7 @@ pub unsafe fn vaddhn_u16(a: uint16x8_t, b: uint16x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_u32(a: uint32x4_t, b: uint32x4_t) -> uint16x4_t {
@@ -2729,7 +2729,7 @@ pub unsafe fn vaddhn_u32(a: uint32x4_t, b: uint32x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_u64(a: uint64x2_t, b: uint64x2_t) -> uint32x2_t {
@@ -2743,7 +2743,7 @@ pub unsafe fn vaddhn_u64(a: uint64x2_t, b: uint64x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_high_s16(r: int8x8_t, a: int16x8_t, b: int16x8_t) -> int8x16_t {
@@ -2758,7 +2758,7 @@ pub unsafe fn vaddhn_high_s16(r: int8x8_t, a: int16x8_t, b: int16x8_t) -> int8x1
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_high_s32(r: int16x4_t, a: int32x4_t, b: int32x4_t) -> int16x8_t {
@@ -2773,7 +2773,7 @@ pub unsafe fn vaddhn_high_s32(r: int16x4_t, a: int32x4_t, b: int32x4_t) -> int16
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_high_s64(r: int32x2_t, a: int64x2_t, b: int64x2_t) -> int32x4_t {
@@ -2788,7 +2788,7 @@ pub unsafe fn vaddhn_high_s64(r: int32x2_t, a: int64x2_t, b: int64x2_t) -> int32
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_high_u16(r: uint8x8_t, a: uint16x8_t, b: uint16x8_t) -> uint8x16_t {
@@ -2803,7 +2803,7 @@ pub unsafe fn vaddhn_high_u16(r: uint8x8_t, a: uint16x8_t, b: uint16x8_t) -> uin
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_high_u32(r: uint16x4_t, a: uint32x4_t, b: uint32x4_t) -> uint16x8_t {
@@ -2818,7 +2818,7 @@ pub unsafe fn vaddhn_high_u32(r: uint16x4_t, a: uint32x4_t, b: uint32x4_t) -> ui
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vaddhn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(addhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vaddhn_high_u64(r: uint32x2_t, a: uint64x2_t, b: uint64x2_t) -> uint32x4_t {
@@ -2833,7 +2833,7 @@ pub unsafe fn vaddhn_high_u64(r: uint32x2_t, a: uint64x2_t, b: uint64x2_t) -> ui
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_s16(a: int16x8_t, b: int16x8_t) -> int8x8_t {
@@ -2847,7 +2847,7 @@ pub unsafe fn vraddhn_s16(a: int16x8_t, b: int16x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_s32(a: int32x4_t, b: int32x4_t) -> int16x4_t {
@@ -2861,7 +2861,7 @@ pub unsafe fn vraddhn_s32(a: int32x4_t, b: int32x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i64))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_s64(a: int64x2_t, b: int64x2_t) -> int32x2_t {
@@ -2875,7 +2875,7 @@ pub unsafe fn vraddhn_s64(a: int64x2_t, b: int64x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_u16(a: uint16x8_t, b: uint16x8_t) -> uint8x8_t {
@@ -2889,7 +2889,7 @@ pub unsafe fn vraddhn_u16(a: uint16x8_t, b: uint16x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_u32(a: uint32x4_t, b: uint32x4_t) -> uint16x4_t {
@@ -2903,7 +2903,7 @@ pub unsafe fn vraddhn_u32(a: uint32x4_t, b: uint32x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i64))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_u64(a: uint64x2_t, b: uint64x2_t) -> uint32x2_t {
@@ -2917,7 +2917,7 @@ pub unsafe fn vraddhn_u64(a: uint64x2_t, b: uint64x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_high_s16(r: int8x8_t, a: int16x8_t, b: int16x8_t) -> int8x16_t {
@@ -2932,7 +2932,7 @@ pub unsafe fn vraddhn_high_s16(r: int8x8_t, a: int16x8_t, b: int16x8_t) -> int8x
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_high_s32(r: int16x4_t, a: int32x4_t, b: int32x4_t) -> int16x8_t {
@@ -2947,7 +2947,7 @@ pub unsafe fn vraddhn_high_s32(r: int16x4_t, a: int32x4_t, b: int32x4_t) -> int1
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i64))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_high_s64(r: int32x2_t, a: int64x2_t, b: int64x2_t) -> int32x4_t {
@@ -2962,7 +2962,7 @@ pub unsafe fn vraddhn_high_s64(r: int32x2_t, a: int64x2_t, b: int64x2_t) -> int3
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_high_u16(r: uint8x8_t, a: uint16x8_t, b: uint16x8_t) -> uint8x16_t {
@@ -2977,7 +2977,7 @@ pub unsafe fn vraddhn_high_u16(r: uint8x8_t, a: uint16x8_t, b: uint16x8_t) -> ui
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_high_u32(r: uint16x4_t, a: uint32x4_t, b: uint32x4_t) -> uint16x8_t {
@@ -2992,7 +2992,7 @@ pub unsafe fn vraddhn_high_u32(r: uint16x4_t, a: uint32x4_t, b: uint32x4_t) -> u
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vraddhn.i64))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(raddhn2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vraddhn_high_u64(r: uint32x2_t, a: uint64x2_t, b: uint64x2_t) -> uint32x4_t {
@@ -3007,7 +3007,7 @@ pub unsafe fn vraddhn_high_u64(r: uint32x2_t, a: uint64x2_t, b: uint64x2_t) -> u
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.s8))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddl_s8(a: int8x8_t) -> int16x4_t {
@@ -3021,7 +3021,7 @@ pub unsafe fn vpaddl_s8(a: int8x8_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.s16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddl_s16(a: int16x4_t) -> int32x2_t {
@@ -3035,7 +3035,7 @@ pub unsafe fn vpaddl_s16(a: int16x4_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.s32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddl_s32(a: int32x2_t) -> int64x1_t {
@@ -3049,7 +3049,7 @@ pub unsafe fn vpaddl_s32(a: int32x2_t) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.s8))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddlq_s8(a: int8x16_t) -> int16x8_t {
@@ -3063,7 +3063,7 @@ pub unsafe fn vpaddlq_s8(a: int8x16_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.s16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddlq_s16(a: int16x8_t) -> int32x4_t {
@@ -3077,7 +3077,7 @@ pub unsafe fn vpaddlq_s16(a: int16x8_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.s32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(saddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddlq_s32(a: int32x4_t) -> int64x2_t {
@@ -3091,7 +3091,7 @@ pub unsafe fn vpaddlq_s32(a: int32x4_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.u8))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddl_u8(a: uint8x8_t) -> uint16x4_t {
@@ -3105,7 +3105,7 @@ pub unsafe fn vpaddl_u8(a: uint8x8_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.u16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddl_u16(a: uint16x4_t) -> uint32x2_t {
@@ -3119,7 +3119,7 @@ pub unsafe fn vpaddl_u16(a: uint16x4_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.u32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddl_u32(a: uint32x2_t) -> uint64x1_t {
@@ -3133,7 +3133,7 @@ pub unsafe fn vpaddl_u32(a: uint32x2_t) -> uint64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.u8))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddlq_u8(a: uint8x16_t) -> uint16x8_t {
@@ -3147,7 +3147,7 @@ pub unsafe fn vpaddlq_u8(a: uint8x16_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.u16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddlq_u16(a: uint16x8_t) -> uint32x4_t {
@@ -3161,7 +3161,7 @@ pub unsafe fn vpaddlq_u16(a: uint16x8_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpaddl.u32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uaddlp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpaddlq_u32(a: uint32x4_t) -> uint64x2_t {
@@ -3175,7 +3175,7 @@ pub unsafe fn vpaddlq_u32(a: uint32x4_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(xtn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovn_s16(a: int16x8_t) -> int8x8_t {
@@ -3189,7 +3189,7 @@ pub unsafe fn vmovn_s16(a: int16x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(xtn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovn_s32(a: int32x4_t) -> int16x4_t {
@@ -3203,7 +3203,7 @@ pub unsafe fn vmovn_s32(a: int32x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(xtn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovn_s64(a: int64x2_t) -> int32x2_t {
@@ -3217,7 +3217,7 @@ pub unsafe fn vmovn_s64(a: int64x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(xtn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovn_u16(a: uint16x8_t) -> uint8x8_t {
@@ -3231,7 +3231,7 @@ pub unsafe fn vmovn_u16(a: uint16x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(xtn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovn_u32(a: uint32x4_t) -> uint16x4_t {
@@ -3245,7 +3245,7 @@ pub unsafe fn vmovn_u32(a: uint32x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(xtn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovn_u64(a: uint64x2_t) -> uint32x2_t {
@@ -3259,7 +3259,7 @@ pub unsafe fn vmovn_u64(a: uint64x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sxtl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovl_s8(a: int8x8_t) -> int16x8_t {
@@ -3273,7 +3273,7 @@ pub unsafe fn vmovl_s8(a: int8x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sxtl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovl_s16(a: int16x4_t) -> int32x4_t {
@@ -3287,7 +3287,7 @@ pub unsafe fn vmovl_s16(a: int16x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sxtl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovl_s32(a: int32x2_t) -> int64x2_t {
@@ -3301,7 +3301,7 @@ pub unsafe fn vmovl_s32(a: int32x2_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uxtl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovl_u8(a: uint8x8_t) -> uint16x8_t {
@@ -3315,7 +3315,7 @@ pub unsafe fn vmovl_u8(a: uint8x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uxtl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovl_u16(a: uint16x4_t) -> uint32x4_t {
@@ -3329,7 +3329,7 @@ pub unsafe fn vmovl_u16(a: uint16x4_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmovl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uxtl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovl_u32(a: uint32x2_t) -> uint64x2_t {
@@ -3343,7 +3343,7 @@ pub unsafe fn vmovl_u32(a: uint32x2_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvn_s8(a: int8x8_t) -> int8x8_t {
@@ -3358,7 +3358,7 @@ pub unsafe fn vmvn_s8(a: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvnq_s8(a: int8x16_t) -> int8x16_t {
@@ -3375,7 +3375,7 @@ pub unsafe fn vmvnq_s8(a: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvn_s16(a: int16x4_t) -> int16x4_t {
@@ -3390,7 +3390,7 @@ pub unsafe fn vmvn_s16(a: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvnq_s16(a: int16x8_t) -> int16x8_t {
@@ -3405,7 +3405,7 @@ pub unsafe fn vmvnq_s16(a: int16x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvn_s32(a: int32x2_t) -> int32x2_t {
@@ -3420,7 +3420,7 @@ pub unsafe fn vmvn_s32(a: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvnq_s32(a: int32x4_t) -> int32x4_t {
@@ -3435,7 +3435,7 @@ pub unsafe fn vmvnq_s32(a: int32x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvn_u8(a: uint8x8_t) -> uint8x8_t {
@@ -3450,7 +3450,7 @@ pub unsafe fn vmvn_u8(a: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvnq_u8(a: uint8x16_t) -> uint8x16_t {
@@ -3467,7 +3467,7 @@ pub unsafe fn vmvnq_u8(a: uint8x16_t) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvn_u16(a: uint16x4_t) -> uint16x4_t {
@@ -3482,7 +3482,7 @@ pub unsafe fn vmvn_u16(a: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvnq_u16(a: uint16x8_t) -> uint16x8_t {
@@ -3499,7 +3499,7 @@ pub unsafe fn vmvnq_u16(a: uint16x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvn_u32(a: uint32x2_t) -> uint32x2_t {
@@ -3514,7 +3514,7 @@ pub unsafe fn vmvn_u32(a: uint32x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvnq_u32(a: uint32x4_t) -> uint32x4_t {
@@ -3529,7 +3529,7 @@ pub unsafe fn vmvnq_u32(a: uint32x4_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvn_p8(a: poly8x8_t) -> poly8x8_t {
@@ -3544,7 +3544,7 @@ pub unsafe fn vmvn_p8(a: poly8x8_t) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vmvn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(mvn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmvnq_p8(a: poly8x16_t) -> poly8x16_t {
@@ -3561,7 +3561,7 @@ pub unsafe fn vmvnq_p8(a: poly8x16_t) -> poly8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbic_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
@@ -3576,7 +3576,7 @@ pub unsafe fn vbic_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbicq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t {
@@ -3593,7 +3593,7 @@ pub unsafe fn vbicq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbic_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
@@ -3608,7 +3608,7 @@ pub unsafe fn vbic_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbicq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t {
@@ -3623,7 +3623,7 @@ pub unsafe fn vbicq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbic_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
@@ -3638,7 +3638,7 @@ pub unsafe fn vbic_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbicq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t {
@@ -3653,7 +3653,7 @@ pub unsafe fn vbicq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbic_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t {
@@ -3668,7 +3668,7 @@ pub unsafe fn vbic_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbicq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t {
@@ -3683,7 +3683,7 @@ pub unsafe fn vbicq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbic_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
@@ -3698,7 +3698,7 @@ pub unsafe fn vbic_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbicq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
@@ -3715,7 +3715,7 @@ pub unsafe fn vbicq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbic_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
@@ -3730,7 +3730,7 @@ pub unsafe fn vbic_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbicq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
@@ -3745,7 +3745,7 @@ pub unsafe fn vbicq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbic_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
@@ -3760,7 +3760,7 @@ pub unsafe fn vbic_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbicq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
@@ -3775,7 +3775,7 @@ pub unsafe fn vbicq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbic_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t {
@@ -3790,7 +3790,7 @@ pub unsafe fn vbic_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbic))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bic))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbicq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
@@ -3809,7 +3809,7 @@ pub unsafe fn vbicq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_s8(a: uint8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t {
@@ -3827,7 +3827,7 @@ pub unsafe fn vbsl_s8(a: uint8x8_t, b: int8x8_t, c: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_s16(a: uint16x4_t, b: int16x4_t, c: int16x4_t) -> int16x4_t {
@@ -3845,7 +3845,7 @@ pub unsafe fn vbsl_s16(a: uint16x4_t, b: int16x4_t, c: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_s32(a: uint32x2_t, b: int32x2_t, c: int32x2_t) -> int32x2_t {
@@ -3863,7 +3863,7 @@ pub unsafe fn vbsl_s32(a: uint32x2_t, b: int32x2_t, c: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_s64(a: uint64x1_t, b: int64x1_t, c: int64x1_t) -> int64x1_t {
@@ -3881,7 +3881,7 @@ pub unsafe fn vbsl_s64(a: uint64x1_t, b: int64x1_t, c: int64x1_t) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_u8(a: uint8x8_t, b: uint8x8_t, c: uint8x8_t) -> uint8x8_t {
@@ -3899,7 +3899,7 @@ pub unsafe fn vbsl_u8(a: uint8x8_t, b: uint8x8_t, c: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_u16(a: uint16x4_t, b: uint16x4_t, c: uint16x4_t) -> uint16x4_t {
@@ -3917,7 +3917,7 @@ pub unsafe fn vbsl_u16(a: uint16x4_t, b: uint16x4_t, c: uint16x4_t) -> uint16x4_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_u32(a: uint32x2_t, b: uint32x2_t, c: uint32x2_t) -> uint32x2_t {
@@ -3935,7 +3935,7 @@ pub unsafe fn vbsl_u32(a: uint32x2_t, b: uint32x2_t, c: uint32x2_t) -> uint32x2_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_u64(a: uint64x1_t, b: uint64x1_t, c: uint64x1_t) -> uint64x1_t {
@@ -3953,7 +3953,7 @@ pub unsafe fn vbsl_u64(a: uint64x1_t, b: uint64x1_t, c: uint64x1_t) -> uint64x1_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_f32(a: uint32x2_t, b: float32x2_t, c: float32x2_t) -> float32x2_t {
@@ -3971,7 +3971,7 @@ pub unsafe fn vbsl_f32(a: uint32x2_t, b: float32x2_t, c: float32x2_t) -> float32
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_p8(a: uint8x8_t, b: poly8x8_t, c: poly8x8_t) -> poly8x8_t {
@@ -3989,7 +3989,7 @@ pub unsafe fn vbsl_p8(a: uint8x8_t, b: poly8x8_t, c: poly8x8_t) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbsl_p16(a: uint16x4_t, b: poly16x4_t, c: poly16x4_t) -> poly16x4_t {
@@ -4007,7 +4007,7 @@ pub unsafe fn vbsl_p16(a: uint16x4_t, b: poly16x4_t, c: poly16x4_t) -> poly16x4_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_s8(a: uint8x16_t, b: int8x16_t, c: int8x16_t) -> int8x16_t {
@@ -4027,7 +4027,7 @@ pub unsafe fn vbslq_s8(a: uint8x16_t, b: int8x16_t, c: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_s16(a: uint16x8_t, b: int16x8_t, c: int16x8_t) -> int16x8_t {
@@ -4045,7 +4045,7 @@ pub unsafe fn vbslq_s16(a: uint16x8_t, b: int16x8_t, c: int16x8_t) -> int16x8_t
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_s32(a: uint32x4_t, b: int32x4_t, c: int32x4_t) -> int32x4_t {
@@ -4063,7 +4063,7 @@ pub unsafe fn vbslq_s32(a: uint32x4_t, b: int32x4_t, c: int32x4_t) -> int32x4_t
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_s64(a: uint64x2_t, b: int64x2_t, c: int64x2_t) -> int64x2_t {
@@ -4081,7 +4081,7 @@ pub unsafe fn vbslq_s64(a: uint64x2_t, b: int64x2_t, c: int64x2_t) -> int64x2_t
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_u8(a: uint8x16_t, b: uint8x16_t, c: uint8x16_t) -> uint8x16_t {
@@ -4101,7 +4101,7 @@ pub unsafe fn vbslq_u8(a: uint8x16_t, b: uint8x16_t, c: uint8x16_t) -> uint8x16_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_u16(a: uint16x8_t, b: uint16x8_t, c: uint16x8_t) -> uint16x8_t {
@@ -4119,7 +4119,7 @@ pub unsafe fn vbslq_u16(a: uint16x8_t, b: uint16x8_t, c: uint16x8_t) -> uint16x8
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_u32(a: uint32x4_t, b: uint32x4_t, c: uint32x4_t) -> uint32x4_t {
@@ -4137,7 +4137,7 @@ pub unsafe fn vbslq_u32(a: uint32x4_t, b: uint32x4_t, c: uint32x4_t) -> uint32x4
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_u64(a: uint64x2_t, b: uint64x2_t, c: uint64x2_t) -> uint64x2_t {
@@ -4155,7 +4155,7 @@ pub unsafe fn vbslq_u64(a: uint64x2_t, b: uint64x2_t, c: uint64x2_t) -> uint64x2
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_p8(a: uint8x16_t, b: poly8x16_t, c: poly8x16_t) -> poly8x16_t {
@@ -4175,7 +4175,7 @@ pub unsafe fn vbslq_p8(a: uint8x16_t, b: poly8x16_t, c: poly8x16_t) -> poly8x16_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_p16(a: uint16x8_t, b: poly16x8_t, c: poly16x8_t) -> poly16x8_t {
@@ -4193,7 +4193,7 @@ pub unsafe fn vbslq_p16(a: uint16x8_t, b: poly16x8_t, c: poly16x8_t) -> poly16x8
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vbsl))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(bsl))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vbslq_f32(a: uint32x4_t, b: float32x4_t, c: float32x4_t) -> float32x4_t {
@@ -4211,7 +4211,7 @@ pub unsafe fn vbslq_f32(a: uint32x4_t, b: float32x4_t, c: float32x4_t) -> float3
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vorn_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
@@ -4226,7 +4226,7 @@ pub unsafe fn vorn_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vornq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t {
@@ -4243,7 +4243,7 @@ pub unsafe fn vornq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vorn_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
@@ -4258,7 +4258,7 @@ pub unsafe fn vorn_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vornq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t {
@@ -4273,7 +4273,7 @@ pub unsafe fn vornq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vorn_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
@@ -4288,7 +4288,7 @@ pub unsafe fn vorn_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vornq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t {
@@ -4303,7 +4303,7 @@ pub unsafe fn vornq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vorn_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t {
@@ -4318,7 +4318,7 @@ pub unsafe fn vorn_s64(a: int64x1_t, b: int64x1_t) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vornq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t {
@@ -4333,7 +4333,7 @@ pub unsafe fn vornq_s64(a: int64x2_t, b: int64x2_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vorn_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
@@ -4348,7 +4348,7 @@ pub unsafe fn vorn_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vornq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
@@ -4365,7 +4365,7 @@ pub unsafe fn vornq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vorn_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
@@ -4380,7 +4380,7 @@ pub unsafe fn vorn_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vornq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
@@ -4395,7 +4395,7 @@ pub unsafe fn vornq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vorn_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
@@ -4410,7 +4410,7 @@ pub unsafe fn vorn_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vornq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
@@ -4425,7 +4425,7 @@ pub unsafe fn vornq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vorn_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t {
@@ -4440,7 +4440,7 @@ pub unsafe fn vorn_u64(a: uint64x1_t, b: uint64x1_t) -> uint64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorn))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(orn))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vornq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
@@ -4455,7 +4455,7 @@ pub unsafe fn vornq_u64(a: uint64x2_t, b: uint64x2_t) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmin))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sminp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmin_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
@@ -4469,7 +4469,7 @@ pub unsafe fn vpmin_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmin))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sminp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmin_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
@@ -4483,7 +4483,7 @@ pub unsafe fn vpmin_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmin))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sminp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmin_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
@@ -4497,7 +4497,7 @@ pub unsafe fn vpmin_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmin))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uminp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmin_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
@@ -4511,7 +4511,7 @@ pub unsafe fn vpmin_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmin))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uminp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmin_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
@@ -4525,7 +4525,7 @@ pub unsafe fn vpmin_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmin))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uminp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmin_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
@@ -4539,7 +4539,7 @@ pub unsafe fn vpmin_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmin))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(fminp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmin_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t {
@@ -4553,7 +4553,7 @@ pub unsafe fn vpmin_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmax))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(smaxp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmax_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
@@ -4567,7 +4567,7 @@ pub unsafe fn vpmax_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmax))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(smaxp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmax_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
@@ -4581,7 +4581,7 @@ pub unsafe fn vpmax_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmax))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(smaxp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmax_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
@@ -4595,7 +4595,7 @@ pub unsafe fn vpmax_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmax))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(umaxp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmax_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
@@ -4609,7 +4609,7 @@ pub unsafe fn vpmax_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmax))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(umaxp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmax_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
@@ -4623,7 +4623,7 @@ pub unsafe fn vpmax_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmax))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(umaxp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmax_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
@@ -4637,7 +4637,7 @@ pub unsafe fn vpmax_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpmax))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(fmaxp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpmax_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t {
@@ -4651,7 +4651,7 @@ pub unsafe fn vpmax_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_u64<const IMM5: i32>(v: uint64x2_t) -> u64 {
@@ -4666,7 +4666,7 @@ pub unsafe fn vgetq_lane_u64<const IMM5: i32>(v: uint64x2_t) -> u64 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 0))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_u64<const IMM5: i32>(v: uint64x1_t) -> u64 {
@@ -4681,7 +4681,7 @@ pub unsafe fn vget_lane_u64<const IMM5: i32>(v: uint64x1_t) -> u64 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_u16<const IMM5: i32>(v: uint16x4_t) -> u16 {
@@ -4696,7 +4696,7 @@ pub unsafe fn vget_lane_u16<const IMM5: i32>(v: uint16x4_t) -> u16 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_s16<const IMM5: i32>(v: int16x4_t) -> i16 {
@@ -4711,7 +4711,7 @@ pub unsafe fn vget_lane_s16<const IMM5: i32>(v: int16x4_t) -> i16 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_p16<const IMM5: i32>(v: poly16x4_t) -> p16 {
@@ -4726,7 +4726,7 @@ pub unsafe fn vget_lane_p16<const IMM5: i32>(v: poly16x4_t) -> p16 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_u32<const IMM5: i32>(v: uint32x2_t) -> u32 {
@@ -4741,7 +4741,7 @@ pub unsafe fn vget_lane_u32<const IMM5: i32>(v: uint32x2_t) -> u32 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_s32<const IMM5: i32>(v: int32x2_t) -> i32 {
@@ -4756,7 +4756,7 @@ pub unsafe fn vget_lane_s32<const IMM5: i32>(v: int32x2_t) -> i32 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_f32<const IMM5: i32>(v: float32x2_t) -> f32 {
@@ -4771,7 +4771,7 @@ pub unsafe fn vget_lane_f32<const IMM5: i32>(v: float32x2_t) -> f32 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 1))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_f32<const IMM5: i32>(v: float32x4_t) -> f32 {
@@ -4786,7 +4786,7 @@ pub unsafe fn vgetq_lane_f32<const IMM5: i32>(v: float32x4_t) -> f32 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 0))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_p64<const IMM5: i32>(v: poly64x1_t) -> p64 {
@@ -4801,7 +4801,7 @@ pub unsafe fn vget_lane_p64<const IMM5: i32>(v: poly64x1_t) -> p64 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 0))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_p64<const IMM5: i32>(v: poly64x2_t) -> p64 {
@@ -4816,7 +4816,7 @@ pub unsafe fn vgetq_lane_p64<const IMM5: i32>(v: poly64x2_t) -> p64 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 0))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_s64<const IMM5: i32>(v: int64x1_t) -> i64 {
@@ -4831,7 +4831,7 @@ pub unsafe fn vget_lane_s64<const IMM5: i32>(v: int64x1_t) -> i64 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 0))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_s64<const IMM5: i32>(v: int64x2_t) -> i64 {
@@ -4846,7 +4846,7 @@ pub unsafe fn vgetq_lane_s64<const IMM5: i32>(v: int64x2_t) -> i64 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_u16<const IMM5: i32>(v: uint16x8_t) -> u16 {
@@ -4861,7 +4861,7 @@ pub unsafe fn vgetq_lane_u16<const IMM5: i32>(v: uint16x8_t) -> u16 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_u32<const IMM5: i32>(v: uint32x4_t) -> u32 {
@@ -4876,7 +4876,7 @@ pub unsafe fn vgetq_lane_u32<const IMM5: i32>(v: uint32x4_t) -> u32 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_s16<const IMM5: i32>(v: int16x8_t) -> i16 {
@@ -4891,7 +4891,7 @@ pub unsafe fn vgetq_lane_s16<const IMM5: i32>(v: int16x8_t) -> i16 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_p16<const IMM5: i32>(v: poly16x8_t) -> p16 {
@@ -4906,7 +4906,7 @@ pub unsafe fn vgetq_lane_p16<const IMM5: i32>(v: poly16x8_t) -> p16 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_s32<const IMM5: i32>(v: int32x4_t) -> i32 {
@@ -4921,7 +4921,7 @@ pub unsafe fn vgetq_lane_s32<const IMM5: i32>(v: int32x4_t) -> i32 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_u8<const IMM5: i32>(v: uint8x8_t) -> u8 {
@@ -4936,7 +4936,7 @@ pub unsafe fn vget_lane_u8<const IMM5: i32>(v: uint8x8_t) -> u8 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_s8<const IMM5: i32>(v: int8x8_t) -> i8 {
@@ -4951,7 +4951,7 @@ pub unsafe fn vget_lane_s8<const IMM5: i32>(v: int8x8_t) -> i8 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_lane_p8<const IMM5: i32>(v: poly8x8_t) -> p8 {
@@ -4966,7 +4966,7 @@ pub unsafe fn vget_lane_p8<const IMM5: i32>(v: poly8x8_t) -> p8 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_u8<const IMM5: i32>(v: uint8x16_t) -> u8 {
@@ -4981,7 +4981,7 @@ pub unsafe fn vgetq_lane_u8<const IMM5: i32>(v: uint8x16_t) -> u8 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_s8<const IMM5: i32>(v: int8x16_t) -> i8 {
@@ -4996,7 +4996,7 @@ pub unsafe fn vgetq_lane_s8<const IMM5: i32>(v: int8x16_t) -> i8 {
#[rustc_legacy_const_generics(1)]
#[cfg_attr(test, assert_instr(nop, IMM5 = 2))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vgetq_lane_p8<const IMM5: i32>(v: poly8x16_t) -> p8 {
@@ -5011,7 +5011,7 @@ pub unsafe fn vgetq_lane_p8<const IMM5: i32>(v: poly8x16_t) -> p8 {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_s8(a: int8x16_t) -> int8x8_t {
@@ -5025,7 +5025,7 @@ pub unsafe fn vget_high_s8(a: int8x16_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_s16(a: int16x8_t) -> int16x4_t {
@@ -5039,7 +5039,7 @@ pub unsafe fn vget_high_s16(a: int16x8_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_s32(a: int32x4_t) -> int32x2_t {
@@ -5053,7 +5053,7 @@ pub unsafe fn vget_high_s32(a: int32x4_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_s64(a: int64x2_t) -> int64x1_t {
@@ -5067,7 +5067,7 @@ pub unsafe fn vget_high_s64(a: int64x2_t) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_u8(a: uint8x16_t) -> uint8x8_t {
@@ -5081,7 +5081,7 @@ pub unsafe fn vget_high_u8(a: uint8x16_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_u16(a: uint16x8_t) -> uint16x4_t {
@@ -5095,7 +5095,7 @@ pub unsafe fn vget_high_u16(a: uint16x8_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_u32(a: uint32x4_t) -> uint32x2_t {
@@ -5109,7 +5109,7 @@ pub unsafe fn vget_high_u32(a: uint32x4_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_u64(a: uint64x2_t) -> uint64x1_t {
@@ -5123,7 +5123,7 @@ pub unsafe fn vget_high_u64(a: uint64x2_t) -> uint64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_p8(a: poly8x16_t) -> poly8x8_t {
@@ -5137,7 +5137,7 @@ pub unsafe fn vget_high_p8(a: poly8x16_t) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_p16(a: poly16x8_t) -> poly16x4_t {
@@ -5151,7 +5151,7 @@ pub unsafe fn vget_high_p16(a: poly16x8_t) -> poly16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(ext))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_high_f32(a: float32x4_t) -> float32x2_t {
@@ -5164,7 +5164,7 @@ pub unsafe fn vget_high_f32(a: float32x4_t) -> float32x2_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "vget_low_s8", since = "1.60.0")
)]
pub unsafe fn vget_low_s8(a: int8x16_t) -> int8x8_t {
@@ -5177,7 +5177,7 @@ pub unsafe fn vget_low_s8(a: int8x16_t) -> int8x8_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_s16(a: int16x8_t) -> int16x4_t {
@@ -5190,7 +5190,7 @@ pub unsafe fn vget_low_s16(a: int16x8_t) -> int16x4_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_s32(a: int32x4_t) -> int32x2_t {
@@ -5203,7 +5203,7 @@ pub unsafe fn vget_low_s32(a: int32x4_t) -> int32x2_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_s64(a: int64x2_t) -> int64x1_t {
@@ -5216,7 +5216,7 @@ pub unsafe fn vget_low_s64(a: int64x2_t) -> int64x1_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_u8(a: uint8x16_t) -> uint8x8_t {
@@ -5229,7 +5229,7 @@ pub unsafe fn vget_low_u8(a: uint8x16_t) -> uint8x8_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_u16(a: uint16x8_t) -> uint16x4_t {
@@ -5242,7 +5242,7 @@ pub unsafe fn vget_low_u16(a: uint16x8_t) -> uint16x4_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_u32(a: uint32x4_t) -> uint32x2_t {
@@ -5255,7 +5255,7 @@ pub unsafe fn vget_low_u32(a: uint32x4_t) -> uint32x2_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_u64(a: uint64x2_t) -> uint64x1_t {
@@ -5268,7 +5268,7 @@ pub unsafe fn vget_low_u64(a: uint64x2_t) -> uint64x1_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_p8(a: poly8x16_t) -> poly8x8_t {
@@ -5281,7 +5281,7 @@ pub unsafe fn vget_low_p8(a: poly8x16_t) -> poly8x8_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_p16(a: poly16x8_t) -> poly16x4_t {
@@ -5294,7 +5294,7 @@ pub unsafe fn vget_low_p16(a: poly16x8_t) -> poly16x4_t {
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
#[cfg_attr(test, assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vget_low_f32(a: float32x4_t) -> float32x2_t {
@@ -5308,7 +5308,7 @@ pub unsafe fn vget_low_f32(a: float32x4_t) -> float32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_s8(value: i8) -> int8x16_t {
@@ -5325,7 +5325,7 @@ pub unsafe fn vdupq_n_s8(value: i8) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_s16(value: i16) -> int16x8_t {
@@ -5339,7 +5339,7 @@ pub unsafe fn vdupq_n_s16(value: i16) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_s32(value: i32) -> int32x4_t {
@@ -5353,7 +5353,7 @@ pub unsafe fn vdupq_n_s32(value: i32) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_s64(value: i64) -> int64x2_t {
@@ -5367,7 +5367,7 @@ pub unsafe fn vdupq_n_s64(value: i64) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_u8(value: u8) -> uint8x16_t {
@@ -5384,7 +5384,7 @@ pub unsafe fn vdupq_n_u8(value: u8) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_u16(value: u16) -> uint16x8_t {
@@ -5398,7 +5398,7 @@ pub unsafe fn vdupq_n_u16(value: u16) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_u32(value: u32) -> uint32x4_t {
@@ -5412,7 +5412,7 @@ pub unsafe fn vdupq_n_u32(value: u32) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_u64(value: u64) -> uint64x2_t {
@@ -5426,7 +5426,7 @@ pub unsafe fn vdupq_n_u64(value: u64) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_p8(value: p8) -> poly8x16_t {
@@ -5443,7 +5443,7 @@ pub unsafe fn vdupq_n_p8(value: p8) -> poly8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_p16(value: p16) -> poly16x8_t {
@@ -5457,7 +5457,7 @@ pub unsafe fn vdupq_n_p16(value: p16) -> poly16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdupq_n_f32(value: f32) -> float32x4_t {
@@ -5474,7 +5474,7 @@ pub unsafe fn vdupq_n_f32(value: f32) -> float32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
unsafe fn vdupq_n_f32_vfp4(value: f32) -> float32x4_t {
@@ -5488,7 +5488,7 @@ unsafe fn vdupq_n_f32_vfp4(value: f32) -> float32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_s8(value: i8) -> int8x8_t {
@@ -5502,7 +5502,7 @@ pub unsafe fn vdup_n_s8(value: i8) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_s16(value: i16) -> int16x4_t {
@@ -5516,7 +5516,7 @@ pub unsafe fn vdup_n_s16(value: i16) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_s32(value: i32) -> int32x2_t {
@@ -5530,7 +5530,7 @@ pub unsafe fn vdup_n_s32(value: i32) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(fmov))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_s64(value: i64) -> int64x1_t {
@@ -5544,7 +5544,7 @@ pub unsafe fn vdup_n_s64(value: i64) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_u8(value: u8) -> uint8x8_t {
@@ -5558,7 +5558,7 @@ pub unsafe fn vdup_n_u8(value: u8) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_u16(value: u16) -> uint16x4_t {
@@ -5572,7 +5572,7 @@ pub unsafe fn vdup_n_u16(value: u16) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_u32(value: u32) -> uint32x2_t {
@@ -5586,7 +5586,7 @@ pub unsafe fn vdup_n_u32(value: u32) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(fmov))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_u64(value: u64) -> uint64x1_t {
@@ -5600,7 +5600,7 @@ pub unsafe fn vdup_n_u64(value: u64) -> uint64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_p8(value: p8) -> poly8x8_t {
@@ -5614,7 +5614,7 @@ pub unsafe fn vdup_n_p8(value: p8) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_p16(value: p16) -> poly16x4_t {
@@ -5628,7 +5628,7 @@ pub unsafe fn vdup_n_p16(value: p16) -> poly16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vdup_n_f32(value: f32) -> float32x2_t {
@@ -5645,7 +5645,7 @@ pub unsafe fn vdup_n_f32(value: f32) -> float32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
unsafe fn vdup_n_f32_vfp4(value: f32) -> float32x2_t {
@@ -5659,7 +5659,7 @@ unsafe fn vdup_n_f32_vfp4(value: f32) -> float32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(nop))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vldrq_p128(a: *const p128) -> p128 {
@@ -5673,7 +5673,7 @@ pub unsafe fn vldrq_p128(a: *const p128) -> p128 {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(nop))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(nop))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vstrq_p128(a: *mut p128, b: p128) {
@@ -5687,7 +5687,7 @@ pub unsafe fn vstrq_p128(a: *mut p128, b: p128) {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_s8(value: i8) -> int8x8_t {
@@ -5701,7 +5701,7 @@ pub unsafe fn vmov_n_s8(value: i8) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_s16(value: i16) -> int16x4_t {
@@ -5715,7 +5715,7 @@ pub unsafe fn vmov_n_s16(value: i16) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_s32(value: i32) -> int32x2_t {
@@ -5729,7 +5729,7 @@ pub unsafe fn vmov_n_s32(value: i32) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(fmov))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_s64(value: i64) -> int64x1_t {
@@ -5743,7 +5743,7 @@ pub unsafe fn vmov_n_s64(value: i64) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_u8(value: u8) -> uint8x8_t {
@@ -5757,7 +5757,7 @@ pub unsafe fn vmov_n_u8(value: u8) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_u16(value: u16) -> uint16x4_t {
@@ -5771,7 +5771,7 @@ pub unsafe fn vmov_n_u16(value: u16) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_u32(value: u32) -> uint32x2_t {
@@ -5785,7 +5785,7 @@ pub unsafe fn vmov_n_u32(value: u32) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(fmov))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_u64(value: u64) -> uint64x1_t {
@@ -5799,7 +5799,7 @@ pub unsafe fn vmov_n_u64(value: u64) -> uint64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_p8(value: p8) -> poly8x8_t {
@@ -5813,7 +5813,7 @@ pub unsafe fn vmov_n_p8(value: p8) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_p16(value: p16) -> poly16x4_t {
@@ -5827,7 +5827,7 @@ pub unsafe fn vmov_n_p16(value: p16) -> poly16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmov_n_f32(value: f32) -> float32x2_t {
@@ -5841,7 +5841,7 @@ pub unsafe fn vmov_n_f32(value: f32) -> float32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_s8(value: i8) -> int8x16_t {
@@ -5855,7 +5855,7 @@ pub unsafe fn vmovq_n_s8(value: i8) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_s16(value: i16) -> int16x8_t {
@@ -5869,7 +5869,7 @@ pub unsafe fn vmovq_n_s16(value: i16) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_s32(value: i32) -> int32x4_t {
@@ -5883,7 +5883,7 @@ pub unsafe fn vmovq_n_s32(value: i32) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_s64(value: i64) -> int64x2_t {
@@ -5897,7 +5897,7 @@ pub unsafe fn vmovq_n_s64(value: i64) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_u8(value: u8) -> uint8x16_t {
@@ -5911,7 +5911,7 @@ pub unsafe fn vmovq_n_u8(value: u8) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_u16(value: u16) -> uint16x8_t {
@@ -5925,7 +5925,7 @@ pub unsafe fn vmovq_n_u16(value: u16) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_u32(value: u32) -> uint32x4_t {
@@ -5939,7 +5939,7 @@ pub unsafe fn vmovq_n_u32(value: u32) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vmov"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_u64(value: u64) -> uint64x2_t {
@@ -5953,7 +5953,7 @@ pub unsafe fn vmovq_n_u64(value: u64) -> uint64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_p8(value: p8) -> poly8x16_t {
@@ -5967,7 +5967,7 @@ pub unsafe fn vmovq_n_p8(value: p8) -> poly8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_p16(value: p16) -> poly16x8_t {
@@ -5981,7 +5981,7 @@ pub unsafe fn vmovq_n_p16(value: p16) -> poly16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vdup.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(dup))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vmovq_n_f32(value: f32) -> float32x4_t {
@@ -5996,7 +5996,7 @@ pub unsafe fn vmovq_n_f32(value: f32) -> float32x4_t {
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("nop", N = 0))]
#[rustc_legacy_const_generics(2)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vext_s64<const N: i32>(a: int64x1_t, _b: int64x1_t) -> int64x1_t {
@@ -6012,7 +6012,7 @@ pub unsafe fn vext_s64<const N: i32>(a: int64x1_t, _b: int64x1_t) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr("nop", N = 0))]
#[rustc_legacy_const_generics(2)]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vext_u64<const N: i32>(a: uint64x1_t, _b: uint64x1_t) -> uint64x1_t {
@@ -6027,7 +6027,7 @@ pub unsafe fn vext_u64<const N: i32>(a: uint64x1_t, _b: uint64x1_t) -> uint64x1_
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vcnt))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(cnt))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vcnt_s8(a: int8x8_t) -> int8x8_t {
@@ -6040,7 +6040,7 @@ pub unsafe fn vcnt_s8(a: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vcnt))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(cnt))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vcntq_s8(a: int8x16_t) -> int8x16_t {
@@ -6053,7 +6053,7 @@ pub unsafe fn vcntq_s8(a: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vcnt))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(cnt))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vcnt_u8(a: uint8x8_t) -> uint8x8_t {
@@ -6066,7 +6066,7 @@ pub unsafe fn vcnt_u8(a: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vcnt))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(cnt))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vcntq_u8(a: uint8x16_t) -> uint8x16_t {
@@ -6079,7 +6079,7 @@ pub unsafe fn vcntq_u8(a: uint8x16_t) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vcnt))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(cnt))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vcnt_p8(a: poly8x8_t) -> poly8x8_t {
@@ -6092,7 +6092,7 @@ pub unsafe fn vcnt_p8(a: poly8x8_t) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vcnt))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(cnt))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vcntq_p8(a: poly8x16_t) -> poly8x16_t {
@@ -6106,7 +6106,7 @@ pub unsafe fn vcntq_p8(a: poly8x16_t) -> poly8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev16.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev16))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev16_s8(a: int8x8_t) -> int8x8_t {
@@ -6120,7 +6120,7 @@ pub unsafe fn vrev16_s8(a: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev16.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev16))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev16q_s8(a: int8x16_t) -> int8x16_t {
@@ -6134,7 +6134,7 @@ pub unsafe fn vrev16q_s8(a: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev16.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev16))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev16_u8(a: uint8x8_t) -> uint8x8_t {
@@ -6148,7 +6148,7 @@ pub unsafe fn vrev16_u8(a: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev16.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev16))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev16q_u8(a: uint8x16_t) -> uint8x16_t {
@@ -6162,7 +6162,7 @@ pub unsafe fn vrev16q_u8(a: uint8x16_t) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev16.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev16))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev16_p8(a: poly8x8_t) -> poly8x8_t {
@@ -6176,7 +6176,7 @@ pub unsafe fn vrev16_p8(a: poly8x8_t) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev16.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev16))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev16q_p8(a: poly8x16_t) -> poly8x16_t {
@@ -6190,7 +6190,7 @@ pub unsafe fn vrev16q_p8(a: poly8x16_t) -> poly8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32_s8(a: int8x8_t) -> int8x8_t {
@@ -6204,7 +6204,7 @@ pub unsafe fn vrev32_s8(a: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32q_s8(a: int8x16_t) -> int8x16_t {
@@ -6218,7 +6218,7 @@ pub unsafe fn vrev32q_s8(a: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32_u8(a: uint8x8_t) -> uint8x8_t {
@@ -6232,7 +6232,7 @@ pub unsafe fn vrev32_u8(a: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32q_u8(a: uint8x16_t) -> uint8x16_t {
@@ -6246,7 +6246,7 @@ pub unsafe fn vrev32q_u8(a: uint8x16_t) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32_s16(a: int16x4_t) -> int16x4_t {
@@ -6260,7 +6260,7 @@ pub unsafe fn vrev32_s16(a: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32q_s16(a: int16x8_t) -> int16x8_t {
@@ -6274,7 +6274,7 @@ pub unsafe fn vrev32q_s16(a: int16x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32_p16(a: poly16x4_t) -> poly16x4_t {
@@ -6288,7 +6288,7 @@ pub unsafe fn vrev32_p16(a: poly16x4_t) -> poly16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32q_p16(a: poly16x8_t) -> poly16x8_t {
@@ -6302,7 +6302,7 @@ pub unsafe fn vrev32q_p16(a: poly16x8_t) -> poly16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32_u16(a: uint16x4_t) -> uint16x4_t {
@@ -6316,7 +6316,7 @@ pub unsafe fn vrev32_u16(a: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32q_u16(a: uint16x8_t) -> uint16x8_t {
@@ -6330,7 +6330,7 @@ pub unsafe fn vrev32q_u16(a: uint16x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32_p8(a: poly8x8_t) -> poly8x8_t {
@@ -6344,7 +6344,7 @@ pub unsafe fn vrev32_p8(a: poly8x8_t) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev32.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev32))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev32q_p8(a: poly8x16_t) -> poly8x16_t {
@@ -6358,7 +6358,7 @@ pub unsafe fn vrev32q_p8(a: poly8x16_t) -> poly8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_s8(a: int8x8_t) -> int8x8_t {
@@ -6372,7 +6372,7 @@ pub unsafe fn vrev64_s8(a: int8x8_t) -> int8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_s8(a: int8x16_t) -> int8x16_t {
@@ -6386,7 +6386,7 @@ pub unsafe fn vrev64q_s8(a: int8x16_t) -> int8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_s16(a: int16x4_t) -> int16x4_t {
@@ -6400,7 +6400,7 @@ pub unsafe fn vrev64_s16(a: int16x4_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_s16(a: int16x8_t) -> int16x8_t {
@@ -6414,7 +6414,7 @@ pub unsafe fn vrev64q_s16(a: int16x8_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_s32(a: int32x2_t) -> int32x2_t {
@@ -6428,7 +6428,7 @@ pub unsafe fn vrev64_s32(a: int32x2_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_s32(a: int32x4_t) -> int32x4_t {
@@ -6442,7 +6442,7 @@ pub unsafe fn vrev64q_s32(a: int32x4_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_u8(a: uint8x8_t) -> uint8x8_t {
@@ -6456,7 +6456,7 @@ pub unsafe fn vrev64_u8(a: uint8x8_t) -> uint8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_u8(a: uint8x16_t) -> uint8x16_t {
@@ -6470,7 +6470,7 @@ pub unsafe fn vrev64q_u8(a: uint8x16_t) -> uint8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_u16(a: uint16x4_t) -> uint16x4_t {
@@ -6484,7 +6484,7 @@ pub unsafe fn vrev64_u16(a: uint16x4_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_u16(a: uint16x8_t) -> uint16x8_t {
@@ -6498,7 +6498,7 @@ pub unsafe fn vrev64q_u16(a: uint16x8_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_u32(a: uint32x2_t) -> uint32x2_t {
@@ -6512,7 +6512,7 @@ pub unsafe fn vrev64_u32(a: uint32x2_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_u32(a: uint32x4_t) -> uint32x4_t {
@@ -6526,7 +6526,7 @@ pub unsafe fn vrev64q_u32(a: uint32x4_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_f32(a: float32x2_t) -> float32x2_t {
@@ -6540,7 +6540,7 @@ pub unsafe fn vrev64_f32(a: float32x2_t) -> float32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.32"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_f32(a: float32x4_t) -> float32x4_t {
@@ -6554,7 +6554,7 @@ pub unsafe fn vrev64q_f32(a: float32x4_t) -> float32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_p8(a: poly8x8_t) -> poly8x8_t {
@@ -6568,7 +6568,7 @@ pub unsafe fn vrev64_p8(a: poly8x8_t) -> poly8x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.8"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_p8(a: poly8x16_t) -> poly8x16_t {
@@ -6582,7 +6582,7 @@ pub unsafe fn vrev64q_p8(a: poly8x16_t) -> poly8x16_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64_p16(a: poly16x4_t) -> poly16x4_t {
@@ -6596,7 +6596,7 @@ pub unsafe fn vrev64_p16(a: poly16x4_t) -> poly16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr("vrev64.16"))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(rev64))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vrev64q_p16(a: poly16x8_t) -> poly16x8_t {
@@ -6610,7 +6610,7 @@ pub unsafe fn vrev64q_p16(a: poly16x8_t) -> poly16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.s8))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadal_s8(a: int16x4_t, b: int8x8_t) -> int16x4_t {
@@ -6631,7 +6631,7 @@ pub unsafe fn vpadal_s8(a: int16x4_t, b: int8x8_t) -> int16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.s16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadal_s16(a: int32x2_t, b: int16x4_t) -> int32x2_t {
@@ -6652,7 +6652,7 @@ pub unsafe fn vpadal_s16(a: int32x2_t, b: int16x4_t) -> int32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.s32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadal_s32(a: int64x1_t, b: int32x2_t) -> int64x1_t {
@@ -6673,7 +6673,7 @@ pub unsafe fn vpadal_s32(a: int64x1_t, b: int32x2_t) -> int64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.s8))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadalq_s8(a: int16x8_t, b: int8x16_t) -> int16x8_t {
@@ -6694,7 +6694,7 @@ pub unsafe fn vpadalq_s8(a: int16x8_t, b: int8x16_t) -> int16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.s16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadalq_s16(a: int32x4_t, b: int16x8_t) -> int32x4_t {
@@ -6715,7 +6715,7 @@ pub unsafe fn vpadalq_s16(a: int32x4_t, b: int16x8_t) -> int32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.s32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(sadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadalq_s32(a: int64x2_t, b: int32x4_t) -> int64x2_t {
@@ -6736,7 +6736,7 @@ pub unsafe fn vpadalq_s32(a: int64x2_t, b: int32x4_t) -> int64x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.u8))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadal_u8(a: uint16x4_t, b: uint8x8_t) -> uint16x4_t {
@@ -6757,7 +6757,7 @@ pub unsafe fn vpadal_u8(a: uint16x4_t, b: uint8x8_t) -> uint16x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.u16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadal_u16(a: uint32x2_t, b: uint16x4_t) -> uint32x2_t {
@@ -6778,7 +6778,7 @@ pub unsafe fn vpadal_u16(a: uint32x2_t, b: uint16x4_t) -> uint32x2_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.u32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadal_u32(a: uint64x1_t, b: uint32x2_t) -> uint64x1_t {
@@ -6799,7 +6799,7 @@ pub unsafe fn vpadal_u32(a: uint64x1_t, b: uint32x2_t) -> uint64x1_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.u8))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadalq_u8(a: uint16x8_t, b: uint8x16_t) -> uint16x8_t {
@@ -6820,7 +6820,7 @@ pub unsafe fn vpadalq_u8(a: uint16x8_t, b: uint8x16_t) -> uint16x8_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.u16))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadalq_u16(a: uint32x4_t, b: uint16x8_t) -> uint32x4_t {
@@ -6841,7 +6841,7 @@ pub unsafe fn vpadalq_u16(a: uint32x4_t, b: uint16x8_t) -> uint32x4_t {
#[cfg_attr(all(test, target_arch = "arm"), assert_instr(vpadal.u32))]
#[cfg_attr(all(test, target_arch = "aarch64"), assert_instr(uadalp))]
#[cfg_attr(
- target_arch = "aarch64",
+ not(target_arch = "arm"),
stable(feature = "neon_intrinsics", since = "1.59.0")
)]
pub unsafe fn vpadalq_u32(a: uint64x2_t, b: uint32x4_t) -> uint64x2_t {
diff --git a/library/stdarch/crates/core_arch/src/powerpc/altivec.rs b/library/stdarch/crates/core_arch/src/powerpc/altivec.rs
index 70344c88b..419fd4fee 100644
--- a/library/stdarch/crates/core_arch/src/powerpc/altivec.rs
+++ b/library/stdarch/crates/core_arch/src/powerpc/altivec.rs
@@ -53,6 +53,17 @@ types! {
extern "C" {
#[link_name = "llvm.ppc.altivec.lvx"]
fn lvx(p: *const i8) -> vector_unsigned_int;
+
+ #[link_name = "llvm.ppc.altivec.lvebx"]
+ fn lvebx(p: *const i8) -> vector_signed_char;
+ #[link_name = "llvm.ppc.altivec.lvehx"]
+ fn lvehx(p: *const i8) -> vector_signed_short;
+ #[link_name = "llvm.ppc.altivec.lvewx"]
+ fn lvewx(p: *const i8) -> vector_signed_int;
+
+ #[link_name = "llvm.ppc.altivec.lvxl"]
+ fn lvxl(p: *const i8) -> vector_unsigned_int;
+
#[link_name = "llvm.ppc.altivec.vperm"]
fn vperm(
a: vector_signed_int,
@@ -244,6 +255,46 @@ extern "C" {
#[link_name = "llvm.floor.v4f32"]
fn vfloor(a: vector_float) -> vector_float;
+
+ #[link_name = "llvm.ppc.altivec.vcmpequb.p"]
+ fn vcmpequb_p(cr: i32, a: vector_unsigned_char, b: vector_unsigned_char) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpequh.p"]
+ fn vcmpequh_p(cr: i32, a: vector_unsigned_short, b: vector_unsigned_short) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpequw.p"]
+ fn vcmpequw_p(cr: i32, a: vector_unsigned_int, b: vector_unsigned_int) -> i32;
+
+ #[link_name = "llvm.ppc.altivec.vcmpeqfp.p"]
+ fn vcmpeqfp_p(cr: i32, a: vector_float, b: vector_float) -> i32;
+
+ #[link_name = "llvm.ppc.altivec.vcmpgtub.p"]
+ fn vcmpgtub_p(cr: i32, a: vector_unsigned_char, b: vector_unsigned_char) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpgtuh.p"]
+ fn vcmpgtuh_p(cr: i32, a: vector_unsigned_short, b: vector_unsigned_short) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpgtuw.p"]
+ fn vcmpgtuw_p(cr: i32, a: vector_unsigned_int, b: vector_unsigned_int) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpgtsb.p"]
+ fn vcmpgtsb_p(cr: i32, a: vector_signed_char, b: vector_signed_char) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpgtsh.p"]
+ fn vcmpgtsh_p(cr: i32, a: vector_signed_short, b: vector_signed_short) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpgtsw.p"]
+ fn vcmpgtsw_p(cr: i32, a: vector_signed_int, b: vector_signed_int) -> i32;
+
+ #[link_name = "llvm.ppc.altivec.vcmpgefp.p"]
+ fn vcmpgefp_p(cr: i32, a: vector_float, b: vector_float) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpgtfp.p"]
+ fn vcmpgtfp_p(cr: i32, a: vector_float, b: vector_float) -> i32;
+ #[link_name = "llvm.ppc.altivec.vcmpbfp.p"]
+ fn vcmpbfp_p(cr: i32, a: vector_float, b: vector_float) -> i32;
+
+ #[link_name = "llvm.ppc.altivec.vcfsx"]
+ fn vcfsx(a: vector_signed_int, b: i32) -> vector_float;
+ #[link_name = "llvm.ppc.altivec.vcfux"]
+ fn vcfux(a: vector_unsigned_int, b: i32) -> vector_float;
+
+ #[link_name = "llvm.ppc.altivec.vctsxs"]
+ fn vctsxs(a: vector_float, b: i32) -> vector_signed_int;
+ #[link_name = "llvm.ppc.altivec.vctuxs"]
+ fn vctuxs(a: vector_float, b: i32) -> vector_unsigned_int;
}
macro_rules! s_t_l {
@@ -337,96 +388,6 @@ impl_neg! { f32x4 : 0f32 }
mod sealed {
use super::*;
- macro_rules! test_impl {
- ($fun:ident ($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, $instr:ident]) => {
- #[inline]
- #[target_feature(enable = "altivec")]
- #[cfg_attr(test, assert_instr($instr))]
- pub unsafe fn $fun ($($v : $ty),*) -> $r {
- $call ($($v),*)
- }
- };
- ($fun:ident ($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, $instr_altivec:ident / $instr_vsx:ident]) => {
- #[inline]
- #[target_feature(enable = "altivec")]
- #[cfg_attr(all(test, not(target_feature="vsx")), assert_instr($instr_altivec))]
- #[cfg_attr(all(test, target_feature="vsx"), assert_instr($instr_vsx))]
- pub unsafe fn $fun ($($v : $ty),*) -> $r {
- $call ($($v),*)
- }
- }
-
- }
-
- #[allow(unknown_lints, unused_macro_rules)]
- macro_rules! impl_vec_trait {
- ([$Trait:ident $m:ident] $fun:ident ($a:ty)) => {
- impl $Trait for $a {
- #[inline]
- #[target_feature(enable = "altivec")]
- unsafe fn $m(self) -> Self {
- $fun(transmute(self))
- }
- }
- };
- ([$Trait:ident $m:ident] $fun:ident ($a:ty) -> $r:ty) => {
- impl $Trait for $a {
- type Result = $r;
- #[inline]
- #[target_feature(enable = "altivec")]
- unsafe fn $m(self) -> Self::Result {
- $fun(transmute(self))
- }
- }
- };
- ([$Trait:ident $m:ident] 1 ($ub:ident, $sb:ident, $uh:ident, $sh:ident, $uw:ident, $sw:ident, $sf: ident)) => {
- impl_vec_trait!{ [$Trait $m] $ub (vector_unsigned_char) -> vector_unsigned_char }
- impl_vec_trait!{ [$Trait $m] $sb (vector_signed_char) -> vector_signed_char }
- impl_vec_trait!{ [$Trait $m] $uh (vector_unsigned_short) -> vector_unsigned_short }
- impl_vec_trait!{ [$Trait $m] $sh (vector_signed_short) -> vector_signed_short }
- impl_vec_trait!{ [$Trait $m] $uw (vector_unsigned_int) -> vector_unsigned_int }
- impl_vec_trait!{ [$Trait $m] $sw (vector_signed_int) -> vector_signed_int }
- impl_vec_trait!{ [$Trait $m] $sf (vector_float) -> vector_float }
- };
- ([$Trait:ident $m:ident] $fun:ident ($a:ty, $b:ty) -> $r:ty) => {
- impl $Trait<$b> for $a {
- type Result = $r;
- #[inline]
- #[target_feature(enable = "altivec")]
- unsafe fn $m(self, b: $b) -> Self::Result {
- $fun(transmute(self), transmute(b))
- }
- }
- };
- ([$Trait:ident $m:ident] $fun:ident ($a:ty, ~$b:ty) -> $r:ty) => {
- impl_vec_trait!{ [$Trait $m] $fun ($a, $a) -> $r }
- impl_vec_trait!{ [$Trait $m] $fun ($a, $b) -> $r }
- impl_vec_trait!{ [$Trait $m] $fun ($b, $a) -> $r }
- };
- ([$Trait:ident $m:ident] ~($ub:ident, $sb:ident, $uh:ident, $sh:ident, $uw:ident, $sw:ident)) => {
- impl_vec_trait!{ [$Trait $m] $ub (vector_unsigned_char, ~vector_bool_char) -> vector_unsigned_char }
- impl_vec_trait!{ [$Trait $m] $sb (vector_signed_char, ~vector_bool_char) -> vector_signed_char }
- impl_vec_trait!{ [$Trait $m] $uh (vector_unsigned_short, ~vector_bool_short) -> vector_unsigned_short }
- impl_vec_trait!{ [$Trait $m] $sh (vector_signed_short, ~vector_bool_short) -> vector_signed_short }
- impl_vec_trait!{ [$Trait $m] $uw (vector_unsigned_int, ~vector_bool_int) -> vector_unsigned_int }
- impl_vec_trait!{ [$Trait $m] $sw (vector_signed_int, ~vector_bool_int) -> vector_signed_int }
- };
- ([$Trait:ident $m:ident] ~($fn:ident)) => {
- impl_vec_trait!{ [$Trait $m] ~($fn, $fn, $fn, $fn, $fn, $fn) }
- };
- ([$Trait:ident $m:ident] 2 ($ub:ident, $sb:ident, $uh:ident, $sh:ident, $uw:ident, $sw:ident)) => {
- impl_vec_trait!{ [$Trait $m] $ub (vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_char }
- impl_vec_trait!{ [$Trait $m] $sb (vector_signed_char, vector_signed_char) -> vector_signed_char }
- impl_vec_trait!{ [$Trait $m] $uh (vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short }
- impl_vec_trait!{ [$Trait $m] $sh (vector_signed_short, vector_signed_short) -> vector_signed_short }
- impl_vec_trait!{ [$Trait $m] $uw (vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
- impl_vec_trait!{ [$Trait $m] $sw (vector_signed_int, vector_signed_int) -> vector_signed_int }
- };
- ([$Trait:ident $m:ident] 2 ($fn:ident)) => {
- impl_vec_trait!{ [$Trait $m] ($fn, $fn, $fn, $fn, $fn, $fn) }
- }
- }
-
macro_rules! impl_vec_cmp {
([$Trait:ident $m:ident] ($b:ident, $h:ident, $w:ident)) => {
impl_vec_cmp! { [$Trait $m] ($b, $b, $h, $h, $w, $w) }
@@ -441,50 +402,107 @@ mod sealed {
}
}
- #[inline(always)]
- unsafe fn load(off: i32, p: *const i8) -> u32x4 {
- let addr = p.offset(off as isize);
- transmute(lvx(addr))
+ macro_rules! impl_vec_any_all {
+ ([$Trait:ident $m:ident] ($b:ident, $h:ident, $w:ident)) => {
+ impl_vec_any_all! { [$Trait $m] ($b, $b, $h, $h, $w, $w) }
+ };
+ ([$Trait:ident $m:ident] ($ub:ident, $sb:ident, $uh:ident, $sh:ident, $uw:ident, $sw:ident)) => {
+ impl_vec_trait!{ [$Trait $m] $ub (vector_unsigned_char, vector_unsigned_char) -> bool }
+ impl_vec_trait!{ [$Trait $m] $sb (vector_signed_char, vector_signed_char) -> bool }
+ impl_vec_trait!{ [$Trait $m] $uh (vector_unsigned_short, vector_unsigned_short) -> bool }
+ impl_vec_trait!{ [$Trait $m] $sh (vector_signed_short, vector_signed_short) -> bool }
+ impl_vec_trait!{ [$Trait $m] $uw (vector_unsigned_int, vector_unsigned_int) -> bool }
+ impl_vec_trait!{ [$Trait $m] $sw (vector_signed_int, vector_signed_int) -> bool }
+ }
}
pub trait VectorLd {
type Result;
- unsafe fn vec_ld(self, off: i32) -> Self::Result;
+ unsafe fn vec_ld(self, off: isize) -> Self::Result;
+ unsafe fn vec_ldl(self, off: isize) -> Self::Result;
}
macro_rules! impl_vec_ld {
- ($fun:ident $ty:ident [$instr:ident]) => {
+ ($fun:ident $fun_lru:ident $ty:ident) => {
#[inline]
#[target_feature(enable = "altivec")]
- #[cfg_attr(test, assert_instr($instr))]
- pub unsafe fn $fun(off: i32, p: *const $ty) -> t_t_l!($ty) {
- transmute(load(off, p as *const i8))
+ #[cfg_attr(test, assert_instr(lvx))]
+ pub unsafe fn $fun(off: isize, p: *const $ty) -> t_t_l!($ty) {
+ let addr = (p as *const i8).offset(off);
+ transmute(lvx(addr))
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(lvxl))]
+ pub unsafe fn $fun_lru(off: i32, p: *const $ty) -> t_t_l!($ty) {
+ let addr = (p as *const i8).offset(off as isize);
+ transmute(lvxl(addr))
}
impl VectorLd for *const $ty {
type Result = t_t_l!($ty);
#[inline]
#[target_feature(enable = "altivec")]
- unsafe fn vec_ld(self, off: i32) -> Self::Result {
+ unsafe fn vec_ld(self, off: isize) -> Self::Result {
+ $fun(off, self)
+ }
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ unsafe fn vec_ldl(self, off: isize) -> Self::Result {
$fun(off, self)
}
}
};
- ($fun:ident $ty:ident) => {
- impl_vec_ld! { $fun $ty [lvx] }
+ }
+
+ impl_vec_ld! { vec_ld_u8 vec_ldl_u8 u8 }
+ impl_vec_ld! { vec_ld_i8 vec_ldl_i8 i8 }
+
+ impl_vec_ld! { vec_ld_u16 vec_ldl_u16 u16 }
+ impl_vec_ld! { vec_ld_i16 vec_ldl_i16 i16 }
+
+ impl_vec_ld! { vec_ld_u32 vec_ldl_u32 u32 }
+ impl_vec_ld! { vec_ld_i32 vec_ldl_i32 i32 }
+
+ impl_vec_ld! { vec_ld_f32 vec_ldl_f32 f32 }
+
+ pub trait VectorLde {
+ type Result;
+ unsafe fn vec_lde(self, a: isize) -> Self::Result;
+ }
+
+ macro_rules! impl_vec_lde {
+ ($fun:ident $instr:ident $ty:ident) => {
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr($instr))]
+ pub unsafe fn $fun(a: isize, b: *const $ty) -> t_t_l!($ty) {
+ let addr = (b as *const i8).offset(a);
+ transmute($instr(addr))
+ }
+
+ impl VectorLde for *const $ty {
+ type Result = t_t_l!($ty);
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ unsafe fn vec_lde(self, a: isize) -> Self::Result {
+ $fun(a, self)
+ }
+ }
};
}
- impl_vec_ld! { vec_ld_u8 u8 }
- impl_vec_ld! { vec_ld_i8 i8 }
+ impl_vec_lde! { vec_lde_u8 lvebx u8 }
+ impl_vec_lde! { vec_lde_i8 lvebx i8 }
- impl_vec_ld! { vec_ld_u16 u16 }
- impl_vec_ld! { vec_ld_i16 i16 }
+ impl_vec_lde! { vec_lde_u16 lvehx u16 }
+ impl_vec_lde! { vec_lde_i16 lvehx i16 }
- impl_vec_ld! { vec_ld_u32 u32 }
- impl_vec_ld! { vec_ld_i32 i32 }
+ impl_vec_lde! { vec_lde_u32 lvewx u32 }
+ impl_vec_lde! { vec_lde_i32 lvewx i32 }
- impl_vec_ld! { vec_ld_f32 f32 }
+ impl_vec_lde! { vec_lde_f32 lvewx f32 }
test_impl! { vec_floor(a: vector_float) -> vector_float [ vfloor, vrfim / xvrspim ] }
@@ -520,6 +538,460 @@ mod sealed {
test_impl! { vec_vcmpbfp(a: vector_float, b: vector_float) -> vector_signed_int [vcmpbfp, vcmpbfp] }
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequb.))]
+ unsafe fn vcmpequb_all(a: vector_unsigned_char, b: vector_unsigned_char) -> bool {
+ vcmpequb_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequb.))]
+ unsafe fn vcmpequb_any(a: vector_unsigned_char, b: vector_unsigned_char) -> bool {
+ vcmpequb_p(1, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequh.))]
+ unsafe fn vcmpequh_all(a: vector_unsigned_short, b: vector_unsigned_short) -> bool {
+ vcmpequh_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequh.))]
+ unsafe fn vcmpequh_any(a: vector_unsigned_short, b: vector_unsigned_short) -> bool {
+ vcmpequh_p(1, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequw.))]
+ unsafe fn vcmpequw_all(a: vector_unsigned_int, b: vector_unsigned_int) -> bool {
+ vcmpequw_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequw.))]
+ unsafe fn vcmpequw_any(a: vector_unsigned_int, b: vector_unsigned_int) -> bool {
+ vcmpequw_p(1, a, b) != 0
+ }
+
+ pub trait VectorAllEq<Other> {
+ type Result;
+ unsafe fn vec_all_eq(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_any_all! { [VectorAllEq vec_all_eq] (vcmpequb_all, vcmpequh_all, vcmpequw_all) }
+
+ // TODO: vsx encoding
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpeqfp.))]
+ unsafe fn vcmpeqfp_all(a: vector_float, b: vector_float) -> bool {
+ vcmpeqfp_p(2, a, b) != 0
+ }
+
+ impl VectorAllEq<vector_float> for vector_float {
+ type Result = bool;
+ #[inline]
+ unsafe fn vec_all_eq(self, b: vector_float) -> Self::Result {
+ vcmpeqfp_all(self, b)
+ }
+ }
+
+ pub trait VectorAnyEq<Other> {
+ type Result;
+ unsafe fn vec_any_eq(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_any_all! { [VectorAnyEq vec_any_eq] (vcmpequb_any, vcmpequh_any, vcmpequw_any) }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpeqfp.))]
+ unsafe fn vcmpeqfp_any(a: vector_float, b: vector_float) -> bool {
+ vcmpeqfp_p(1, a, b) != 0
+ }
+
+ impl VectorAnyEq<vector_float> for vector_float {
+ type Result = bool;
+ #[inline]
+ unsafe fn vec_any_eq(self, b: vector_float) -> Self::Result {
+ vcmpeqfp_any(self, b)
+ }
+ }
+
+ // All/Any GreaterEqual
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsb.))]
+ unsafe fn vcmpgesb_all(a: vector_signed_char, b: vector_signed_char) -> bool {
+ vcmpgtsb_p(0, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsb.))]
+ unsafe fn vcmpgesb_any(a: vector_signed_char, b: vector_signed_char) -> bool {
+ vcmpgtsb_p(3, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsh.))]
+ unsafe fn vcmpgesh_all(a: vector_signed_short, b: vector_signed_short) -> bool {
+ vcmpgtsh_p(0, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsh.))]
+ unsafe fn vcmpgesh_any(a: vector_signed_short, b: vector_signed_short) -> bool {
+ vcmpgtsh_p(3, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsw.))]
+ unsafe fn vcmpgesw_all(a: vector_signed_int, b: vector_signed_int) -> bool {
+ vcmpgtsw_p(0, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsw.))]
+ unsafe fn vcmpgesw_any(a: vector_signed_int, b: vector_signed_int) -> bool {
+ vcmpgtsw_p(3, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtub.))]
+ unsafe fn vcmpgeub_all(a: vector_unsigned_char, b: vector_unsigned_char) -> bool {
+ vcmpgtub_p(0, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtub.))]
+ unsafe fn vcmpgeub_any(a: vector_unsigned_char, b: vector_unsigned_char) -> bool {
+ vcmpgtub_p(3, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtuh.))]
+ unsafe fn vcmpgeuh_all(a: vector_unsigned_short, b: vector_unsigned_short) -> bool {
+ vcmpgtuh_p(0, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtuh.))]
+ unsafe fn vcmpgeuh_any(a: vector_unsigned_short, b: vector_unsigned_short) -> bool {
+ vcmpgtuh_p(3, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtuw.))]
+ unsafe fn vcmpgeuw_all(a: vector_unsigned_int, b: vector_unsigned_int) -> bool {
+ vcmpgtuw_p(0, b, a) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtuw.))]
+ unsafe fn vcmpgeuw_any(a: vector_unsigned_int, b: vector_unsigned_int) -> bool {
+ vcmpgtuw_p(3, b, a) != 0
+ }
+
+ pub trait VectorAllGe<Other> {
+ type Result;
+ unsafe fn vec_all_ge(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_any_all! { [VectorAllGe vec_all_ge] (
+ vcmpgeub_all, vcmpgesb_all,
+ vcmpgeuh_all, vcmpgesh_all,
+ vcmpgeuw_all, vcmpgesw_all
+ ) }
+
+ // TODO: vsx encoding
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgefp.))]
+ unsafe fn vcmpgefp_all(a: vector_float, b: vector_float) -> bool {
+ vcmpgefp_p(2, a, b) != 0
+ }
+
+ impl VectorAllGe<vector_float> for vector_float {
+ type Result = bool;
+ #[inline]
+ unsafe fn vec_all_ge(self, b: vector_float) -> Self::Result {
+ vcmpgefp_all(self, b)
+ }
+ }
+
+ pub trait VectorAnyGe<Other> {
+ type Result;
+ unsafe fn vec_any_ge(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_any_all! { [VectorAnyGe vec_any_ge] (
+ vcmpgeub_any, vcmpgesb_any,
+ vcmpgeuh_any, vcmpgesh_any,
+ vcmpgeuw_any, vcmpgesw_any
+ ) }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgefp.))]
+ unsafe fn vcmpgefp_any(a: vector_float, b: vector_float) -> bool {
+ vcmpgefp_p(1, a, b) != 0
+ }
+
+ impl VectorAnyGe<vector_float> for vector_float {
+ type Result = bool;
+ #[inline]
+ unsafe fn vec_any_ge(self, b: vector_float) -> Self::Result {
+ vcmpgefp_any(self, b)
+ }
+ }
+
+ // All/Any Greater Than
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsb.))]
+ unsafe fn vcmpgtsb_all(a: vector_signed_char, b: vector_signed_char) -> bool {
+ vcmpgtsb_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsb.))]
+ unsafe fn vcmpgtsb_any(a: vector_signed_char, b: vector_signed_char) -> bool {
+ vcmpgtsb_p(1, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsh.))]
+ unsafe fn vcmpgtsh_all(a: vector_signed_short, b: vector_signed_short) -> bool {
+ vcmpgtsh_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsh.))]
+ unsafe fn vcmpgtsh_any(a: vector_signed_short, b: vector_signed_short) -> bool {
+ vcmpgtsh_p(1, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsw.))]
+ unsafe fn vcmpgtsw_all(a: vector_signed_int, b: vector_signed_int) -> bool {
+ vcmpgtsw_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtsw.))]
+ unsafe fn vcmpgtsw_any(a: vector_signed_int, b: vector_signed_int) -> bool {
+ vcmpgtsw_p(1, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtub.))]
+ unsafe fn vcmpgtub_all(a: vector_unsigned_char, b: vector_unsigned_char) -> bool {
+ vcmpgtub_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtub.))]
+ unsafe fn vcmpgtub_any(a: vector_unsigned_char, b: vector_unsigned_char) -> bool {
+ vcmpgtub_p(1, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtuh.))]
+ unsafe fn vcmpgtuh_all(a: vector_unsigned_short, b: vector_unsigned_short) -> bool {
+ vcmpgtuh_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtuh.))]
+ unsafe fn vcmpgtuh_any(a: vector_unsigned_short, b: vector_unsigned_short) -> bool {
+ vcmpgtuh_p(1, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtuw.))]
+ unsafe fn vcmpgtuw_all(a: vector_unsigned_int, b: vector_unsigned_int) -> bool {
+ vcmpgtuw_p(2, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtuw.))]
+ unsafe fn vcmpgtuw_any(a: vector_unsigned_int, b: vector_unsigned_int) -> bool {
+ vcmpgtuw_p(1, a, b) != 0
+ }
+
+ pub trait VectorAllGt<Other> {
+ type Result;
+ unsafe fn vec_all_gt(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_any_all! { [VectorAllGt vec_all_gt] (
+ vcmpgtub_all, vcmpgtsb_all,
+ vcmpgtuh_all, vcmpgtsh_all,
+ vcmpgtuw_all, vcmpgtsw_all
+ ) }
+
+ // TODO: vsx encoding
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtfp.))]
+ unsafe fn vcmpgtfp_all(a: vector_float, b: vector_float) -> bool {
+ vcmpgtfp_p(2, a, b) != 0
+ }
+
+ impl VectorAllGt<vector_float> for vector_float {
+ type Result = bool;
+ #[inline]
+ unsafe fn vec_all_gt(self, b: vector_float) -> Self::Result {
+ vcmpgtfp_all(self, b)
+ }
+ }
+
+ pub trait VectorAnyGt<Other> {
+ type Result;
+ unsafe fn vec_any_gt(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_any_all! { [VectorAnyGt vec_any_gt] (
+ vcmpgtub_any, vcmpgtsb_any,
+ vcmpgtuh_any, vcmpgtsh_any,
+ vcmpgtuw_any, vcmpgtsw_any
+ ) }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpgtfp.))]
+ unsafe fn vcmpgtfp_any(a: vector_float, b: vector_float) -> bool {
+ vcmpgtfp_p(1, a, b) != 0
+ }
+
+ impl VectorAnyGt<vector_float> for vector_float {
+ type Result = bool;
+ #[inline]
+ unsafe fn vec_any_gt(self, b: vector_float) -> Self::Result {
+ vcmpgtfp_any(self, b)
+ }
+ }
+
+ // All/Any Elements Not Equal
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequb.))]
+ unsafe fn vcmpneub_all(a: vector_unsigned_char, b: vector_unsigned_char) -> bool {
+ vcmpequb_p(0, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequb.))]
+ unsafe fn vcmpneub_any(a: vector_unsigned_char, b: vector_unsigned_char) -> bool {
+ vcmpequb_p(3, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequh.))]
+ unsafe fn vcmpneuh_all(a: vector_unsigned_short, b: vector_unsigned_short) -> bool {
+ vcmpequh_p(0, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequh.))]
+ unsafe fn vcmpneuh_any(a: vector_unsigned_short, b: vector_unsigned_short) -> bool {
+ vcmpequh_p(3, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequw.))]
+ unsafe fn vcmpneuw_all(a: vector_unsigned_int, b: vector_unsigned_int) -> bool {
+ vcmpequw_p(0, a, b) != 0
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpequw.))]
+ unsafe fn vcmpneuw_any(a: vector_unsigned_int, b: vector_unsigned_int) -> bool {
+ vcmpequw_p(3, a, b) != 0
+ }
+
+ pub trait VectorAllNe<Other> {
+ type Result;
+ unsafe fn vec_all_ne(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_any_all! { [VectorAllNe vec_all_ne] (vcmpneub_all, vcmpneuh_all, vcmpneuw_all) }
+
+ // TODO: vsx encoding
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpeqfp.))]
+ unsafe fn vcmpnefp_all(a: vector_float, b: vector_float) -> bool {
+ vcmpeqfp_p(0, a, b) != 0
+ }
+
+ impl VectorAllNe<vector_float> for vector_float {
+ type Result = bool;
+ #[inline]
+ unsafe fn vec_all_ne(self, b: vector_float) -> Self::Result {
+ vcmpnefp_all(self, b)
+ }
+ }
+
+ pub trait VectorAnyNe<Other> {
+ type Result;
+ unsafe fn vec_any_ne(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_any_all! { [VectorAnyNe vec_any_ne] (vcmpneub_any, vcmpneuh_any, vcmpneuw_any) }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcmpeqfp.))]
+ unsafe fn vcmpnefp_any(a: vector_float, b: vector_float) -> bool {
+ vcmpeqfp_p(3, a, b) != 0
+ }
+
+ impl VectorAnyNe<vector_float> for vector_float {
+ type Result = bool;
+ #[inline]
+ unsafe fn vec_any_ne(self, b: vector_float) -> Self::Result {
+ vcmpnefp_any(self, b)
+ }
+ }
+
test_impl! { vec_vceil(a: vector_float) -> vector_float [vceil, vrfip / xvrspip ] }
test_impl! { vec_vavgsb(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char [ vavgsb, vavgsb ] }
@@ -540,8 +1012,10 @@ mod sealed {
#[target_feature(enable = "altivec")]
#[cfg_attr(all(test, not(target_feature = "vsx")), assert_instr(vandc))]
#[cfg_attr(all(test, target_feature = "vsx"), assert_instr(xxlandc))]
- unsafe fn andc(a: u8x16, b: u8x16) -> u8x16 {
- simd_and(simd_xor(u8x16::splat(0xff), b), a)
+ unsafe fn andc(a: vector_signed_char, b: vector_signed_char) -> vector_signed_char {
+ let a = transmute(a);
+ let b = transmute(b);
+ transmute(simd_and(simd_xor(u8x16::splat(0xff), b), a))
}
pub trait VectorAndc<Other> {
@@ -1423,8 +1897,15 @@ mod sealed {
#[inline]
#[target_feature(enable = "altivec")]
#[cfg_attr(test, assert_instr(vmladduhm))]
- unsafe fn mladd(a: i16x8, b: i16x8, c: i16x8) -> i16x8 {
- simd_add(simd_mul(a, b), c)
+ unsafe fn mladd(
+ a: vector_signed_short,
+ b: vector_signed_short,
+ c: vector_signed_short,
+ ) -> vector_signed_short {
+ let a: i16x8 = transmute(a);
+ let b: i16x8 = transmute(b);
+ let c: i16x8 = transmute(c);
+ transmute(simd_add(simd_mul(a, b), c))
}
macro_rules! vector_mladd {
@@ -1434,9 +1915,9 @@ mod sealed {
#[inline]
#[target_feature(enable = "altivec")]
unsafe fn vec_mladd(self, b: $bc, c: $bc) -> Self::Result {
- let a: i16x8 = transmute(self);
- let b: i16x8 = transmute(b);
- let c: i16x8 = transmute(c);
+ let a = transmute(self);
+ let b = transmute(b);
+ let c = transmute(c);
transmute(mladd(a, b, c))
}
@@ -1448,18 +1929,111 @@ mod sealed {
vector_mladd! { vector_unsigned_short, vector_signed_short, vector_signed_short }
vector_mladd! { vector_signed_short, vector_unsigned_short, vector_signed_short }
vector_mladd! { vector_signed_short, vector_signed_short, vector_signed_short }
+
+ pub trait VectorOr<Other> {
+ type Result;
+ unsafe fn vec_or(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_trait! { [VectorOr vec_or] ~(simd_or) }
+
+ pub trait VectorXor<Other> {
+ type Result;
+ unsafe fn vec_xor(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_trait! { [VectorXor vec_xor] ~(simd_xor) }
+
+ macro_rules! vector_vnor {
+ ($fun:ident $ty:ident) => {
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(all(test, not(target_feature = "vsx")), assert_instr(vnor))]
+ #[cfg_attr(all(test, target_feature = "vsx"), assert_instr(xxlnor))]
+ pub unsafe fn $fun(a: t_t_l!($ty), b: t_t_l!($ty)) -> t_t_l!($ty) {
+ let o = vec_splats(!0 as $ty);
+ vec_xor(vec_or(a, b), o)
+ }
+ };
+ }
+
+ vector_vnor! { vec_vnorsb i8 }
+ vector_vnor! { vec_vnorsh i16 }
+ vector_vnor! { vec_vnorsw i32 }
+ vector_vnor! { vec_vnorub u8 }
+ vector_vnor! { vec_vnoruh u16 }
+ vector_vnor! { vec_vnoruw u32 }
+
+ pub trait VectorNor<Other> {
+ type Result;
+ unsafe fn vec_nor(self, b: Other) -> Self::Result;
+ }
+
+ impl_vec_trait! { [VectorNor vec_nor] 2 (vec_vnorub, vec_vnorsb, vec_vnoruh, vec_vnorsh, vec_vnoruw, vec_vnorsw) }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcfsx, IMM5 = 1))]
+ unsafe fn vec_ctf_i32<const IMM5: i32>(a: vector_signed_int) -> vector_float {
+ static_assert_uimm_bits!(IMM5, 5);
+ vcfsx(a, IMM5)
+ }
+
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr(vcfux, IMM5 = 1))]
+ unsafe fn vec_ctf_u32<const IMM5: i32>(a: vector_unsigned_int) -> vector_float {
+ static_assert_uimm_bits!(IMM5, 5);
+ vcfux(a, IMM5)
+ }
+
+ pub trait VectorCtf {
+ unsafe fn vec_ctf<const IMM5: i32>(self) -> vector_float;
+ }
+
+ impl VectorCtf for vector_signed_int {
+ unsafe fn vec_ctf<const IMM5: i32>(self) -> vector_float {
+ vec_ctf_i32::<IMM5>(self)
+ }
+ }
+
+ impl VectorCtf for vector_unsigned_int {
+ unsafe fn vec_ctf<const IMM5: i32>(self) -> vector_float {
+ vec_ctf_u32::<IMM5>(self)
+ }
+ }
}
-/// Vector ld.
+/// Vector Load Indexed.
#[inline]
#[target_feature(enable = "altivec")]
-pub unsafe fn vec_ld<T>(off: i32, p: T) -> <T as sealed::VectorLd>::Result
+pub unsafe fn vec_ld<T>(off: isize, p: T) -> <T as sealed::VectorLd>::Result
where
T: sealed::VectorLd,
{
p.vec_ld(off)
}
+/// Vector Load Indexed Least Recently Used.
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_ldl<T>(off: isize, p: T) -> <T as sealed::VectorLd>::Result
+where
+ T: sealed::VectorLd,
+{
+ p.vec_ldl(off)
+}
+
+/// Vector Load Element Indexed.
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_lde<T>(off: isize, p: T) -> <T as sealed::VectorLde>::Result
+where
+ T: sealed::VectorLde,
+{
+ p.vec_lde(off)
+}
+
/// Vector floor.
#[inline]
#[target_feature(enable = "altivec")]
@@ -1562,6 +2136,36 @@ where
a.vec_and(b)
}
+/// Vector or.
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_or<T, U>(a: T, b: U) -> <T as sealed::VectorOr<U>>::Result
+where
+ T: sealed::VectorOr<U>,
+{
+ a.vec_or(b)
+}
+
+/// Vector nor.
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_nor<T, U>(a: T, b: U) -> <T as sealed::VectorNor<U>>::Result
+where
+ T: sealed::VectorNor<U>,
+{
+ a.vec_nor(b)
+}
+
+/// Vector xor.
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_xor<T, U>(a: T, b: U) -> <T as sealed::VectorXor<U>>::Result
+where
+ T: sealed::VectorXor<U>,
+{
+ a.vec_xor(b)
+}
+
/// Vector adds.
#[inline]
#[target_feature(enable = "altivec")]
@@ -1659,6 +2263,36 @@ where
a.vec_add(b)
}
+/// Vector Convert to Floating-Point
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_ctf<const IMM5: i32, T>(a: T) -> vector_float
+where
+ T: sealed::VectorCtf,
+{
+ a.vec_ctf::<IMM5>()
+}
+
+/// Vector Convert to Signed Integer
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr(vctsxs, IMM5 = 1))]
+pub unsafe fn vec_cts<const IMM5: i32>(a: vector_float) -> vector_signed_int {
+ static_assert_uimm_bits!(IMM5, 5);
+
+ vctsxs(a, IMM5)
+}
+
+/// Vector Convert to Signed Integer
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr(vctuxs, IMM5 = 1))]
+pub unsafe fn vec_ctu<const IMM5: i32>(a: vector_float) -> vector_unsigned_int {
+ static_assert_uimm_bits!(IMM5, 5);
+
+ vctuxs(a, IMM5)
+}
+
/// Endian-biased intrinsics
#[cfg(target_endian = "little")]
mod endian {
@@ -1796,6 +2430,238 @@ where
a.vec_sum4s(b)
}
+/// Vector All Elements Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_all_eq<T, U>(a: T, b: U) -> <T as sealed::VectorAllEq<U>>::Result
+where
+ T: sealed::VectorAllEq<U>,
+{
+ a.vec_all_eq(b)
+}
+
+/// Vector All Elements Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_any_eq<T, U>(a: T, b: U) -> <T as sealed::VectorAnyEq<U>>::Result
+where
+ T: sealed::VectorAnyEq<U>,
+{
+ a.vec_any_eq(b)
+}
+
+/// Vector All Elements Greater or Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_all_ge<T, U>(a: T, b: U) -> <T as sealed::VectorAllGe<U>>::Result
+where
+ T: sealed::VectorAllGe<U>,
+{
+ a.vec_all_ge(b)
+}
+
+/// Vector Any Element Greater or Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_any_ge<T, U>(a: T, b: U) -> <T as sealed::VectorAnyGe<U>>::Result
+where
+ T: sealed::VectorAnyGe<U>,
+{
+ a.vec_any_ge(b)
+}
+
+/// Vector All Elements Greater Than
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_all_gt<T, U>(a: T, b: U) -> <T as sealed::VectorAllGt<U>>::Result
+where
+ T: sealed::VectorAllGt<U>,
+{
+ a.vec_all_gt(b)
+}
+
+/// Vector Any Element Greater Than
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_any_gt<T, U>(a: T, b: U) -> <T as sealed::VectorAnyGt<U>>::Result
+where
+ T: sealed::VectorAnyGt<U>,
+{
+ a.vec_any_gt(b)
+}
+
+/// Vector All In
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpbfp."))]
+pub unsafe fn vec_all_in(a: vector_float, b: vector_float) -> bool {
+ vcmpbfp_p(0, a, b) != 0
+}
+
+/// Vector All Elements Less Than or Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_all_le<T, U>(a: U, b: T) -> <T as sealed::VectorAllGe<U>>::Result
+where
+ T: sealed::VectorAllGe<U>,
+{
+ b.vec_all_ge(a)
+}
+
+/// Vector Any Element Less Than or Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_any_le<T, U>(a: U, b: T) -> <T as sealed::VectorAnyGe<U>>::Result
+where
+ T: sealed::VectorAnyGe<U>,
+{
+ b.vec_any_ge(a)
+}
+
+/// Vector All Elements Less Than
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_all_lt<T, U>(a: U, b: T) -> <T as sealed::VectorAllGt<U>>::Result
+where
+ T: sealed::VectorAllGt<U>,
+{
+ b.vec_all_gt(a)
+}
+
+/// Vector Any Element Less Than
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_any_lt<T, U>(a: U, b: T) -> <T as sealed::VectorAnyGt<U>>::Result
+where
+ T: sealed::VectorAnyGt<U>,
+{
+ b.vec_any_gt(a)
+}
+
+/// All Elements Not a Number
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpeqfp."))]
+pub unsafe fn vec_all_nan(a: vector_float) -> bool {
+ vcmpeqfp_p(0, a, a) != 0
+}
+
+/// Any Elements Not a Number
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpeqfp."))]
+pub unsafe fn vec_any_nan(a: vector_float) -> bool {
+ vcmpeqfp_p(3, a, a) != 0
+}
+
+/// Vector All Elements Not Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_all_ne<T, U>(a: T, b: U) -> <T as sealed::VectorAllNe<U>>::Result
+where
+ T: sealed::VectorAllNe<U>,
+{
+ a.vec_all_ne(b)
+}
+
+/// Vector Any Elements Not Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+pub unsafe fn vec_any_ne<T, U>(a: T, b: U) -> <T as sealed::VectorAnyNe<U>>::Result
+where
+ T: sealed::VectorAnyNe<U>,
+{
+ a.vec_any_ne(b)
+}
+
+/// All Elements Not Greater Than or Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgefp."))]
+pub unsafe fn vec_all_nge(a: vector_float, b: vector_float) -> bool {
+ vcmpgefp_p(0, a, b) != 0
+}
+
+/// All Elements Not Greater Than
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgtfp."))]
+pub unsafe fn vec_all_ngt(a: vector_float, b: vector_float) -> bool {
+ vcmpgtfp_p(0, a, b) != 0
+}
+
+/// All Elements Not Less Than or Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgefp."))]
+pub unsafe fn vec_all_nle(a: vector_float, b: vector_float) -> bool {
+ vcmpgefp_p(0, b, a) != 0
+}
+
+/// All Elements Not Less Than
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgtfp."))]
+pub unsafe fn vec_all_nlt(a: vector_float, b: vector_float) -> bool {
+ vcmpgtfp_p(0, b, a) != 0
+}
+
+/// All Elements Numeric
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgefp."))]
+pub unsafe fn vec_all_numeric(a: vector_float) -> bool {
+ vcmpgefp_p(2, a, a) != 0
+}
+
+/// Any Elements Not Greater Than or Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgefp."))]
+pub unsafe fn vec_any_nge(a: vector_float, b: vector_float) -> bool {
+ vcmpgefp_p(3, a, b) != 0
+}
+
+/// Any Elements Not Greater Than
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgtfp."))]
+pub unsafe fn vec_any_ngt(a: vector_float, b: vector_float) -> bool {
+ vcmpgtfp_p(3, a, b) != 0
+}
+
+/// Any Elements Not Less Than or Equal
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgefp."))]
+pub unsafe fn vec_any_nle(a: vector_float, b: vector_float) -> bool {
+ vcmpgefp_p(3, b, a) != 0
+}
+
+/// Any Elements Not Less Than
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgtfp."))]
+pub unsafe fn vec_any_nlt(a: vector_float, b: vector_float) -> bool {
+ vcmpgtfp_p(3, b, a) != 0
+}
+
+/// Any Elements Numeric
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpgefp."))]
+pub unsafe fn vec_any_numeric(a: vector_float) -> bool {
+ vcmpgefp_p(1, a, a) != 0
+}
+
+/// Any Element Out of Bounds
+#[inline]
+#[target_feature(enable = "altivec")]
+#[cfg_attr(test, assert_instr("vcmpeqfp."))]
+pub unsafe fn vec_any_out(a: vector_float) -> bool {
+ vcmpeqfp_p(1, a, a) != 0
+}
+
#[cfg(target_endian = "big")]
mod endian {
use super::*;
@@ -1865,8 +2731,18 @@ mod tests {
let r : $ty_out = transmute($fn(a, b));
assert_eq!(d, r);
}
+ };
+ { $name: ident, $fn:ident, $ty: ident -> $ty_out: ident, [$($a:expr),+], [$($b:expr),+], $d:expr } => {
+ #[simd_test(enable = "altivec")]
+ unsafe fn $name() {
+ let a: s_t_l!($ty) = transmute($ty::new($($a),+));
+ let b: s_t_l!($ty) = transmute($ty::new($($b),+));
+
+ let r : $ty_out = transmute($fn(a, b));
+ assert_eq!($d, r);
+ }
}
- }
+ }
macro_rules! test_vec_1 {
{ $name: ident, $fn:ident, f32x4, [$($a:expr),+], ~[$($d:expr),+] } => {
@@ -1920,6 +2796,60 @@ mod tests {
}
}
+ #[simd_test(enable = "altivec")]
+ unsafe fn test_vec_ldl() {
+ let pat = [
+ u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15),
+ u8x16::new(
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ ),
+ ];
+
+ for off in 0..16 {
+ let v: u8x16 = transmute(vec_ldl(0, (pat.as_ptr() as *const u8).offset(off)));
+ assert_eq!(
+ v,
+ u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
+ );
+ }
+ for off in 16..32 {
+ let v: u8x16 = transmute(vec_ldl(0, (pat.as_ptr() as *const u8).offset(off)));
+ assert_eq!(
+ v,
+ u8x16::new(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31)
+ );
+ }
+ }
+
+ #[simd_test(enable = "altivec")]
+ unsafe fn test_vec_lde_u8() {
+ let pat = [u8x16::new(
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ )];
+ for off in 0..16 {
+ let v: u8x16 = transmute(vec_lde(off, pat.as_ptr() as *const u8));
+ assert_eq!(off as u8, v.extract(off as _));
+ }
+ }
+
+ #[simd_test(enable = "altivec")]
+ unsafe fn test_vec_lde_u16() {
+ let pat = [u16x8::new(0, 1, 2, 3, 4, 5, 6, 7)];
+ for off in 0..8 {
+ let v: u16x8 = transmute(vec_lde(off * 2, pat.as_ptr() as *const u8));
+ assert_eq!(off as u16, v.extract(off as _));
+ }
+ }
+
+ #[simd_test(enable = "altivec")]
+ unsafe fn test_vec_lde_u32() {
+ let pat = [u32x4::new(0, 1, 2, 3)];
+ for off in 0..4 {
+ let v: u32x4 = transmute(vec_lde(off * 4, pat.as_ptr() as *const u8));
+ assert_eq!(off as u32, v.extract(off as _));
+ }
+ }
+
test_vec_1! { test_vec_floor, vec_floor, f32x4,
[1.1, 1.9, -0.5, -0.9],
[1.0, 1.0, -1.0, -1.0]
@@ -2008,6 +2938,882 @@ mod tests {
[false, true, true, false]
}
+ test_vec_2! { test_vec_all_eq_i8_false, vec_all_eq, i8x16 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_eq_u8_false, vec_all_eq, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_eq_i16_false, vec_all_eq, i16x8 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_eq_u16_false, vec_all_eq, u16x8 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_eq_i32_false, vec_all_eq, i32x4 -> bool,
+ [1, -1, 0, 0],
+ [0, -1, 0, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_all_eq_u32_false, vec_all_eq, u32x4 -> bool,
+ [1, 255, 0, 0],
+ [0, 255, 0, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_all_eq_i8_true, vec_all_eq, i8x16 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_eq_u8_true, vec_all_eq, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_eq_i16_true, vec_all_eq, i16x8 -> bool,
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_eq_u16_true, vec_all_eq, u16x8 -> bool,
+ [1, 255, 1, 0, 0, 0, 0, 0],
+ [1, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_eq_i32_true, vec_all_eq, i32x4 -> bool,
+ [1, -1, 0, 1],
+ [1, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_eq_u32_true, vec_all_eq, u32x4 -> bool,
+ [1, 255, 0, 1],
+ [1, 255, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_eq_i8_false, vec_any_eq, i8x16 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_eq_u8_false, vec_any_eq, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_eq_i16_false, vec_any_eq, i16x8 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_eq_u16_false, vec_any_eq, u16x8 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_eq_i32_false, vec_any_eq, i32x4 -> bool,
+ [1, -1, 0, 0],
+ [0, -2, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_eq_u32_false, vec_any_eq, u32x4 -> bool,
+ [1, 2, 1, 0],
+ [0, 255, 0, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_eq_i8_true, vec_any_eq, i8x16 -> bool,
+ [1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_eq_u8_true, vec_any_eq, u8x16 -> bool,
+ [0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_eq_i16_true, vec_any_eq, i16x8 -> bool,
+ [0, -1, 1, 0, 0, 0, 0, 0],
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_eq_u16_true, vec_any_eq, u16x8 -> bool,
+ [0, 255, 1, 0, 0, 0, 0, 0],
+ [1, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_eq_i32_true, vec_any_eq, i32x4 -> bool,
+ [0, -1, 0, 1],
+ [1, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_eq_u32_true, vec_any_eq, u32x4 -> bool,
+ [0, 255, 0, 1],
+ [1, 255, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ge_i8_false, vec_all_ge, i8x16 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ge_u8_false, vec_all_ge, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ge_i16_false, vec_all_ge, i16x8 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ge_u16_false, vec_all_ge, u16x8 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ge_i32_false, vec_all_ge, i32x4 -> bool,
+ [1, -1, 0, 0],
+ [0, -1, 0, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ge_u32_false, vec_all_ge, u32x4 -> bool,
+ [1, 255, 0, 0],
+ [0, 255, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ge_i8_true, vec_all_ge, i8x16 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ge_u8_true, vec_all_ge, u8x16 -> bool,
+ [1, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ge_i16_true, vec_all_ge, i16x8 -> bool,
+ [1, -1, 42, 0, 0, 0, 0, 0],
+ [1, -5, 2, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ge_u16_true, vec_all_ge, u16x8 -> bool,
+ [42, 255, 1, 0, 0, 0, 0, 0],
+ [2, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ge_i32_true, vec_all_ge, i32x4 -> bool,
+ [1, -1, 0, 1],
+ [0, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ge_u32_true, vec_all_ge, u32x4 -> bool,
+ [1, 255, 0, 1],
+ [1, 254, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ge_i8_false, vec_any_ge, i8x16 -> bool,
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ge_u8_false, vec_any_ge, u8x16 -> bool,
+ [1, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [42, 255, 255, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ge_i16_false, vec_any_ge, i16x8 -> bool,
+ [1, -1, -2, 0, 0, 0, 0, 0],
+ [2, 0, -1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ge_u16_false, vec_any_ge, u16x8 -> bool,
+ [1, 2, 0, 0, 0, 0, 0, 0],
+ [2, 42, 255, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ge_i32_false, vec_any_ge, i32x4 -> bool,
+ [1, -1, 0, 0],
+ [2, 0, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ge_u32_false, vec_any_ge, u32x4 -> bool,
+ [1, 2, 1, 0],
+ [4, 255, 4, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ge_i8_true, vec_any_ge, i8x16 -> bool,
+ [1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ge_u8_true, vec_any_ge, u8x16 -> bool,
+ [0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ge_i16_true, vec_any_ge, i16x8 -> bool,
+ [0, -1, 1, 0, 0, 0, 0, 0],
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ge_u16_true, vec_any_ge, u16x8 -> bool,
+ [0, 255, 1, 0, 0, 0, 0, 0],
+ [1, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ge_i32_true, vec_any_ge, i32x4 -> bool,
+ [0, -1, 0, 1],
+ [1, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ge_u32_true, vec_any_ge, u32x4 -> bool,
+ [0, 255, 0, 1],
+ [1, 255, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_gt_i8_false, vec_all_gt, i8x16 -> bool,
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_gt_u8_false, vec_all_gt, u8x16 -> bool,
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_gt_i16_false, vec_all_gt, i16x8 -> bool,
+ [1, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_gt_u16_false, vec_all_gt, u16x8 -> bool,
+ [1, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_gt_i32_false, vec_all_gt, i32x4 -> bool,
+ [1, -1, 0, 0],
+ [0, -1, 0, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_all_gt_u32_false, vec_all_gt, u32x4 -> bool,
+ [1, 255, 0, 0],
+ [0, 255, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_all_gt_i8_true, vec_all_gt, i8x16 -> bool,
+ [2, 1, -1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_gt_u8_true, vec_all_gt, u8x16 -> bool,
+ [1, 255, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_gt_i16_true, vec_all_gt, i16x8 -> bool,
+ [1, -1, 42, 1, 1, 1, 1, 1],
+ [0, -5, 2, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_gt_u16_true, vec_all_gt, u16x8 -> bool,
+ [42, 255, 1, 1, 1, 1, 1, 1],
+ [2, 254, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_gt_i32_true, vec_all_gt, i32x4 -> bool,
+ [1, -1, 1, 1],
+ [0, -2, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_gt_u32_true, vec_all_gt, u32x4 -> bool,
+ [1, 255, 1, 1],
+ [0, 254, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_gt_i8_false, vec_any_gt, i8x16 -> bool,
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_gt_u8_false, vec_any_gt, u8x16 -> bool,
+ [1, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [42, 255, 255, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_gt_i16_false, vec_any_gt, i16x8 -> bool,
+ [1, -1, -2, 0, 0, 0, 0, 0],
+ [2, 0, -1, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_gt_u16_false, vec_any_gt, u16x8 -> bool,
+ [1, 2, 0, 0, 0, 0, 0, 0],
+ [2, 42, 255, 1, 1, 1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_gt_i32_false, vec_any_gt, i32x4 -> bool,
+ [1, -1, 0, 0],
+ [2, 0, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_gt_u32_false, vec_any_gt, u32x4 -> bool,
+ [1, 2, 1, 0],
+ [4, 255, 4, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_gt_i8_true, vec_any_gt, i8x16 -> bool,
+ [1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_gt_u8_true, vec_any_gt, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_gt_i16_true, vec_any_gt, i16x8 -> bool,
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ [0, -1, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_gt_u16_true, vec_any_gt, u16x8 -> bool,
+ [1, 255, 1, 0, 0, 0, 0, 0],
+ [0, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_gt_i32_true, vec_any_gt, i32x4 -> bool,
+ [1, -1, 0, 1],
+ [0, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_gt_u32_true, vec_any_gt, u32x4 -> bool,
+ [1, 255, 0, 1],
+ [0, 255, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_in_true, vec_all_in, f32x4 -> bool,
+ [0.0, -0.1, 0.0, 0.0],
+ [0.1, 0.2, 0.0, 0.0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_in_false, vec_all_in, f32x4 -> bool,
+ [0.5, 0.4, -0.5, 0.8],
+ [0.1, 0.4, -0.5, 0.8],
+ false
+ }
+
+ test_vec_2! { test_vec_all_le_i8_false, vec_all_le, i8x16 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_le_u8_false, vec_all_le, u8x16 -> bool,
+ [0, 0, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_le_i16_false, vec_all_le, i16x8 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 0],
+ [1, -1, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_le_u16_false, vec_all_le, u16x8 -> bool,
+ [0, 0, 255, 1, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_le_i32_false, vec_all_le, i32x4 -> bool,
+ [0, -1, 0, 1],
+ [1, -1, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_le_u32_false, vec_all_le, u32x4 -> bool,
+ [0, 255, 1, 1],
+ [1, 255, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_le_i8_true, vec_all_le, i8x16 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_le_u8_true, vec_all_le, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_le_i16_true, vec_all_le, i16x8 -> bool,
+ [1, -5, 2, 0, 0, 0, 0, 0],
+ [1, -1, 42, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_le_u16_true, vec_all_le, u16x8 -> bool,
+ [2, 255, 1, 0, 0, 0, 0, 0],
+ [42, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_le_i32_true, vec_all_le, i32x4 -> bool,
+ [0, -1, 0, 1],
+ [1, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_le_u32_true, vec_all_le, u32x4 -> bool,
+ [1, 254, 0, 0],
+ [1, 255, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_le_i8_false, vec_any_le, i8x16 -> bool,
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_le_u8_false, vec_any_le, u8x16 -> bool,
+ [42, 255, 255, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_le_i16_false, vec_any_le, i16x8 -> bool,
+ [2, 0, -1, 1, 1, 1, 1, 1],
+ [1, -1, -2, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_le_u16_false, vec_any_le, u16x8 -> bool,
+ [2, 42, 255, 1, 1, 1, 1, 1],
+ [1, 2, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_le_i32_false, vec_any_le, i32x4 -> bool,
+ [2, 0, 1, 1],
+ [1, -1, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_le_u32_false, vec_any_le, u32x4 -> bool,
+ [4, 255, 4, 1],
+ [1, 2, 1, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_le_i8_true, vec_any_le, i8x16 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_le_u8_true, vec_any_le, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_le_i16_true, vec_any_le, i16x8 -> bool,
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ [0, -1, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_le_u16_true, vec_any_le, u16x8 -> bool,
+ [1, 255, 1, 0, 0, 0, 0, 0],
+ [0, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_le_i32_true, vec_any_le, i32x4 -> bool,
+ [1, -1, 0, 1],
+ [0, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_le_u32_true, vec_any_le, u32x4 -> bool,
+ [1, 255, 0, 1],
+ [0, 255, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_lt_i8_false, vec_all_lt, i8x16 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_lt_u8_false, vec_all_lt, u8x16 -> bool,
+ [0, 0, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_lt_i16_false, vec_all_lt, i16x8 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 0],
+ [1, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_lt_u16_false, vec_all_lt, u16x8 -> bool,
+ [0, 0, 255, 1, 0, 0, 0, 0],
+ [1, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_lt_i32_false, vec_all_lt, i32x4 -> bool,
+ [0, -1, 0, 1],
+ [1, -1, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_lt_u32_false, vec_all_lt, u32x4 -> bool,
+ [0, 255, 1, 1],
+ [1, 255, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_lt_i8_true, vec_all_lt, i8x16 -> bool,
+ [0, 0, -2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
+ [2, 1, -1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_lt_u8_true, vec_all_lt, u8x16 -> bool,
+ [0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_lt_i16_true, vec_all_lt, i16x8 -> bool,
+ [0, -5, 2, 0, 0, 0, 0, 0],
+ [1, -1, 42, 1, 1, 1, 1, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_lt_u16_true, vec_all_lt, u16x8 -> bool,
+ [2, 254, 0, 0, 0, 0, 0, 0],
+ [42, 255, 1, 1, 1, 1, 1, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_lt_i32_true, vec_all_lt, i32x4 -> bool,
+ [0, -2, 0, 0],
+ [1, -1, 1, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_lt_u32_true, vec_all_lt, u32x4 -> bool,
+ [0, 254, 0, 0],
+ [1, 255, 1, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_lt_i8_false, vec_any_lt, i8x16 -> bool,
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_lt_u8_false, vec_any_lt, u8x16 -> bool,
+ [42, 255, 255, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_lt_i16_false, vec_any_lt, i16x8 -> bool,
+ [2, 0, -1, 1, 1, 1, 1, 1],
+ [1, -1, -2, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_lt_u16_false, vec_any_lt, u16x8 -> bool,
+ [2, 42, 255, 1, 1, 1, 1, 1],
+ [1, 2, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_lt_i32_false, vec_any_lt, i32x4 -> bool,
+ [2, 0, 1, 1],
+ [1, -1, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_lt_u32_false, vec_any_lt, u32x4 -> bool,
+ [4, 255, 4, 1],
+ [1, 2, 1, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_lt_i8_true, vec_any_lt, i8x16 -> bool,
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_lt_u8_true, vec_any_lt, u8x16 -> bool,
+ [0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_lt_i16_true, vec_any_lt, i16x8 -> bool,
+ [0, -1, 1, 0, 0, 0, 0, 0],
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_lt_u16_true, vec_any_lt, u16x8 -> bool,
+ [0, 255, 1, 0, 0, 0, 0, 0],
+ [1, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_lt_i32_true, vec_any_lt, i32x4 -> bool,
+ [0, -1, 0, 1],
+ [1, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_lt_u32_true, vec_any_lt, u32x4 -> bool,
+ [0, 255, 0, 1],
+ [1, 255, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ne_i8_false, vec_all_ne, i8x16 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ne_u8_false, vec_all_ne, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ne_i16_false, vec_all_ne, i16x8 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0],
+ [0, -1, 1, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ne_u16_false, vec_all_ne, u16x8 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0],
+ [0, 255, 0, 1, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ne_i32_false, vec_all_ne, i32x4 -> bool,
+ [1, -1, 0, 0],
+ [0, -1, 0, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ne_u32_false, vec_all_ne, u32x4 -> bool,
+ [1, 255, 0, 0],
+ [0, 255, 0, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_all_ne_i8_true, vec_all_ne, i8x16 -> bool,
+ [0, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ne_u8_true, vec_all_ne, u8x16 -> bool,
+ [0, 254, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ne_i16_true, vec_all_ne, i16x8 -> bool,
+ [2, -2, 0, 1, 1, 1, 1, 1],
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ne_u16_true, vec_all_ne, u16x8 -> bool,
+ [0, 254, 1, 1, 0, 0, 1, 0],
+ [1, 255, 0, 0, 1, 1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ne_i32_true, vec_all_ne, i32x4 -> bool,
+ [0, -2, 0, 0],
+ [1, -1, 1, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_all_ne_u32_true, vec_all_ne, u32x4 -> bool,
+ [1, 255, 0, 0],
+ [0, 254, 1, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ne_i8_false, vec_any_ne, i8x16 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ne_u8_false, vec_any_ne, u8x16 -> bool,
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ne_i16_false, vec_any_ne, i16x8 -> bool,
+ [1, -1, 0, 0, 0, 0, 0, 0],
+ [1, -1, 0, 0, 0, 0, 0, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ne_u16_false, vec_any_ne, u16x8 -> bool,
+ [1, 255, 1, 1, 1, 1, 1, 0],
+ [1, 255, 1, 1, 1, 1, 1, 0],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ne_i32_false, vec_any_ne, i32x4 -> bool,
+ [0, -1, 1, 1],
+ [0, -1, 1, 1],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ne_u32_false, vec_any_ne, u32x4 -> bool,
+ [1, 2, 1, 255],
+ [1, 2, 1, 255],
+ false
+ }
+
+ test_vec_2! { test_vec_any_ne_i8_true, vec_any_ne, i8x16 -> bool,
+ [1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ne_u8_true, vec_any_ne, u8x16 -> bool,
+ [0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [1, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ne_i16_true, vec_any_ne, i16x8 -> bool,
+ [0, -1, 1, 0, 0, 0, 0, 0],
+ [1, -1, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ne_u16_true, vec_any_ne, u16x8 -> bool,
+ [0, 255, 1, 0, 0, 0, 0, 0],
+ [1, 255, 1, 0, 0, 0, 0, 0],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ne_i32_true, vec_any_ne, i32x4 -> bool,
+ [0, -1, 0, 1],
+ [1, -1, 0, 1],
+ true
+ }
+
+ test_vec_2! { test_vec_any_ne_u32_true, vec_any_ne, u32x4 -> bool,
+ [0, 255, 0, 1],
+ [1, 255, 0, 1],
+ true
+ }
+
#[simd_test(enable = "altivec")]
unsafe fn test_vec_cmpb() {
let a: vector_float = transmute(f32x4::new(0.1, 0.5, 0.6, 0.9));
@@ -2776,4 +4582,108 @@ mod tests {
let z = vec_add(x, y);
assert_eq!(i32x4::splat(5), transmute(z));
}
+
+ #[simd_test(enable = "altivec")]
+ unsafe fn vec_ctf_u32() {
+ let v: vector_unsigned_int = transmute(u32x4::new(u32::MIN, u32::MAX, u32::MAX, 42));
+ let v2 = vec_ctf::<1, _>(v);
+ let r2: vector_float = transmute(f32x4::new(0.0, 2147483600.0, 2147483600.0, 21.0));
+ let v4 = vec_ctf::<2, _>(v);
+ let r4: vector_float = transmute(f32x4::new(0.0, 1073741800.0, 1073741800.0, 10.5));
+ let v8 = vec_ctf::<3, _>(v);
+ let r8: vector_float = transmute(f32x4::new(0.0, 536870900.0, 536870900.0, 5.25));
+
+ let check = |a, b| {
+ let r = transmute(vec_cmple(
+ vec_abs(vec_sub(a, b)),
+ vec_splats(std::f32::EPSILON),
+ ));
+ let e = m32x4::new(true, true, true, true);
+ assert_eq!(e, r);
+ };
+
+ check(v2, r2);
+ check(v4, r4);
+ check(v8, r8);
+ }
+
+ #[simd_test(enable = "altivec")]
+ unsafe fn test_vec_ctu() {
+ let v = u32x4::new(u32::MIN, u32::MAX, u32::MAX, 42);
+ let v2: u32x4 = transmute(vec_ctu::<1>(transmute(f32x4::new(
+ 0.0,
+ 2147483600.0,
+ 2147483600.0,
+ 21.0,
+ ))));
+ let v4: u32x4 = transmute(vec_ctu::<2>(transmute(f32x4::new(
+ 0.0,
+ 1073741800.0,
+ 1073741800.0,
+ 10.5,
+ ))));
+ let v8: u32x4 = transmute(vec_ctu::<3>(transmute(f32x4::new(
+ 0.0,
+ 536870900.0,
+ 536870900.0,
+ 5.25,
+ ))));
+
+ assert_eq!(v2, v);
+ assert_eq!(v4, v);
+ assert_eq!(v8, v);
+ }
+
+ #[simd_test(enable = "altivec")]
+ unsafe fn vec_ctf_i32() {
+ let v: vector_signed_int = transmute(i32x4::new(i32::MIN, i32::MAX, i32::MAX - 42, 42));
+ let v2 = vec_ctf::<1, _>(v);
+ let r2: vector_float =
+ transmute(f32x4::new(-1073741800.0, 1073741800.0, 1073741800.0, 21.0));
+ let v4 = vec_ctf::<2, _>(v);
+ let r4: vector_float = transmute(f32x4::new(-536870900.0, 536870900.0, 536870900.0, 10.5));
+ let v8 = vec_ctf::<3, _>(v);
+ let r8: vector_float = transmute(f32x4::new(-268435460.0, 268435460.0, 268435460.0, 5.25));
+
+ let check = |a, b| {
+ let r = transmute(vec_cmple(
+ vec_abs(vec_sub(a, b)),
+ vec_splats(std::f32::EPSILON),
+ ));
+ println!("{:?} {:?}", a, b);
+ let e = m32x4::new(true, true, true, true);
+ assert_eq!(e, r);
+ };
+
+ check(v2, r2);
+ check(v4, r4);
+ check(v8, r8);
+ }
+
+ #[simd_test(enable = "altivec")]
+ unsafe fn test_vec_cts() {
+ let v = i32x4::new(i32::MIN, i32::MAX, i32::MAX, 42);
+ let v2: i32x4 = transmute(vec_cts::<1>(transmute(f32x4::new(
+ -1073741800.0,
+ 1073741800.0,
+ 1073741800.0,
+ 21.0,
+ ))));
+ let v4: i32x4 = transmute(vec_cts::<2>(transmute(f32x4::new(
+ -536870900.0,
+ 536870900.0,
+ 536870900.0,
+ 10.5,
+ ))));
+ let v8: i32x4 = transmute(vec_cts::<3>(transmute(f32x4::new(
+ -268435460.0,
+ 268435460.0,
+ 268435460.0,
+ 5.25,
+ ))));
+
+ assert_eq!(v2, v);
+ assert_eq!(v4, v);
+ assert_eq!(v8, v);
+ }
}
diff --git a/library/stdarch/crates/core_arch/src/powerpc/macros.rs b/library/stdarch/crates/core_arch/src/powerpc/macros.rs
new file mode 100644
index 000000000..3b61dd5e7
--- /dev/null
+++ b/library/stdarch/crates/core_arch/src/powerpc/macros.rs
@@ -0,0 +1,88 @@
+macro_rules! test_impl {
+ ($fun:ident ($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, $instr:ident]) => {
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(test, assert_instr($instr))]
+ pub unsafe fn $fun ($($v : $ty),*) -> $r {
+ $call ($($v),*)
+ }
+ };
+ ($fun:ident ($($v:ident : $ty:ty),*) -> $r:ty [$call:ident, $instr_altivec:ident / $instr_vsx:ident]) => {
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[cfg_attr(all(test, not(target_feature="vsx")), assert_instr($instr_altivec))]
+ #[cfg_attr(all(test, target_feature="vsx"), assert_instr($instr_vsx))]
+ pub unsafe fn $fun ($($v : $ty),*) -> $r {
+ $call ($($v),*)
+ }
+ }
+}
+
+#[allow(unknown_lints, unused_macro_rules)]
+macro_rules! impl_vec_trait {
+ ([$Trait:ident $m:ident] $fun:ident ($a:ty)) => {
+ impl $Trait for $a {
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ unsafe fn $m(self) -> Self {
+ $fun(transmute(self))
+ }
+ }
+ };
+ ([$Trait:ident $m:ident] $fun:ident ($a:ty) -> $r:ty) => {
+ impl $Trait for $a {
+ type Result = $r;
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ unsafe fn $m(self) -> Self::Result {
+ $fun(transmute(self))
+ }
+ }
+ };
+ ([$Trait:ident $m:ident] 1 ($ub:ident, $sb:ident, $uh:ident, $sh:ident, $uw:ident, $sw:ident, $sf: ident)) => {
+ impl_vec_trait!{ [$Trait $m] $ub (vector_unsigned_char) -> vector_unsigned_char }
+ impl_vec_trait!{ [$Trait $m] $sb (vector_signed_char) -> vector_signed_char }
+ impl_vec_trait!{ [$Trait $m] $uh (vector_unsigned_short) -> vector_unsigned_short }
+ impl_vec_trait!{ [$Trait $m] $sh (vector_signed_short) -> vector_signed_short }
+ impl_vec_trait!{ [$Trait $m] $uw (vector_unsigned_int) -> vector_unsigned_int }
+ impl_vec_trait!{ [$Trait $m] $sw (vector_signed_int) -> vector_signed_int }
+ impl_vec_trait!{ [$Trait $m] $sf (vector_float) -> vector_float }
+ };
+ ([$Trait:ident $m:ident] $fun:ident ($a:ty, $b:ty) -> $r:ty) => {
+ impl $Trait<$b> for $a {
+ type Result = $r;
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ unsafe fn $m(self, b: $b) -> Self::Result {
+ $fun(transmute(self), transmute(b))
+ }
+ }
+ };
+ ([$Trait:ident $m:ident] $fun:ident ($a:ty, ~$b:ty) -> $r:ty) => {
+ impl_vec_trait!{ [$Trait $m] $fun ($a, $a) -> $r }
+ impl_vec_trait!{ [$Trait $m] $fun ($a, $b) -> $r }
+ impl_vec_trait!{ [$Trait $m] $fun ($b, $a) -> $r }
+ };
+ ([$Trait:ident $m:ident] ~($ub:ident, $sb:ident, $uh:ident, $sh:ident, $uw:ident, $sw:ident)) => {
+ impl_vec_trait!{ [$Trait $m] $ub (vector_unsigned_char, ~vector_bool_char) -> vector_unsigned_char }
+ impl_vec_trait!{ [$Trait $m] $sb (vector_signed_char, ~vector_bool_char) -> vector_signed_char }
+ impl_vec_trait!{ [$Trait $m] $uh (vector_unsigned_short, ~vector_bool_short) -> vector_unsigned_short }
+ impl_vec_trait!{ [$Trait $m] $sh (vector_signed_short, ~vector_bool_short) -> vector_signed_short }
+ impl_vec_trait!{ [$Trait $m] $uw (vector_unsigned_int, ~vector_bool_int) -> vector_unsigned_int }
+ impl_vec_trait!{ [$Trait $m] $sw (vector_signed_int, ~vector_bool_int) -> vector_signed_int }
+ };
+ ([$Trait:ident $m:ident] ~($fn:ident)) => {
+ impl_vec_trait!{ [$Trait $m] ~($fn, $fn, $fn, $fn, $fn, $fn) }
+ };
+ ([$Trait:ident $m:ident] 2 ($ub:ident, $sb:ident, $uh:ident, $sh:ident, $uw:ident, $sw:ident)) => {
+ impl_vec_trait!{ [$Trait $m] $ub (vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_char }
+ impl_vec_trait!{ [$Trait $m] $sb (vector_signed_char, vector_signed_char) -> vector_signed_char }
+ impl_vec_trait!{ [$Trait $m] $uh (vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short }
+ impl_vec_trait!{ [$Trait $m] $sh (vector_signed_short, vector_signed_short) -> vector_signed_short }
+ impl_vec_trait!{ [$Trait $m] $uw (vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
+ impl_vec_trait!{ [$Trait $m] $sw (vector_signed_int, vector_signed_int) -> vector_signed_int }
+ };
+ ([$Trait:ident $m:ident] 2 ($fn:ident)) => {
+ impl_vec_trait!{ [$Trait $m] ($fn, $fn, $fn, $fn, $fn, $fn) }
+ }
+}
diff --git a/library/stdarch/crates/core_arch/src/powerpc/mod.rs b/library/stdarch/crates/core_arch/src/powerpc/mod.rs
index 9765d11d1..753f84b0b 100644
--- a/library/stdarch/crates/core_arch/src/powerpc/mod.rs
+++ b/library/stdarch/crates/core_arch/src/powerpc/mod.rs
@@ -1,8 +1,9 @@
//! PowerPC intrinsics
-#[cfg(target_feature = "altivec")]
+#[macro_use]
+mod macros;
+
mod altivec;
-#[cfg(target_feature = "altivec")]
pub use self::altivec::*;
mod vsx;
diff --git a/library/stdarch/crates/core_arch/src/powerpc/vsx.rs b/library/stdarch/crates/core_arch/src/powerpc/vsx.rs
index 283a7e5ce..f2ebc23b2 100644
--- a/library/stdarch/crates/core_arch/src/powerpc/vsx.rs
+++ b/library/stdarch/crates/core_arch/src/powerpc/vsx.rs
@@ -13,7 +13,7 @@ use crate::core_arch::simd_llvm::*;
#[cfg(test)]
use stdarch_test::assert_instr;
-use crate::mem;
+use crate::mem::transmute;
types! {
// pub struct vector_Float16 = f16x8;
@@ -45,13 +45,16 @@ mod sealed {
#[target_feature(enable = "vsx")]
#[cfg_attr(all(test, target_endian = "little"), assert_instr(xxmrgld, dm = 0x0))]
#[cfg_attr(all(test, target_endian = "big"), assert_instr(xxspltd, dm = 0x0))]
- unsafe fn xxpermdi(a: i64x2, b: i64x2, dm: u8) -> i64x2 {
- match dm & 0b11 {
+ unsafe fn xxpermdi(a: vector_signed_long, b: vector_signed_long, dm: u8) -> vector_signed_long {
+ let a: i64x2 = transmute(a);
+ let b: i64x2 = transmute(b);
+ let r: i64x2 = match dm & 0b11 {
0 => simd_shuffle!(a, b, [0b00, 0b10]),
1 => simd_shuffle!(a, b, [0b01, 0b10]),
2 => simd_shuffle!(a, b, [0b00, 0b11]),
_ => simd_shuffle!(a, b, [0b01, 0b11]),
- }
+ };
+ transmute(r)
}
macro_rules! vec_xxpermdi {
@@ -60,7 +63,7 @@ mod sealed {
#[inline]
#[target_feature(enable = "vsx")]
unsafe fn vec_xxpermdi(self, b: Self, dm: u8) -> Self {
- mem::transmute(xxpermdi(mem::transmute(self), mem::transmute(b), dm))
+ transmute(xxpermdi(transmute(self), transmute(b), dm))
}
}
}
@@ -92,21 +95,21 @@ mod tests {
#[cfg(target_arch = "powerpc64")]
use crate::core_arch::arch::powerpc64::*;
- use super::mem;
use crate::core_arch::simd::*;
+ use crate::mem::transmute;
use stdarch_test::simd_test;
macro_rules! test_vec_xxpermdi {
{$name:ident, $shorttype:ident, $longtype:ident, [$($a:expr),+], [$($b:expr),+], [$($c:expr),+], [$($d:expr),+]} => {
#[simd_test(enable = "vsx")]
unsafe fn $name() {
- let a: $longtype = mem::transmute($shorttype::new($($a),+, $($b),+));
- let b = mem::transmute($shorttype::new($($c),+, $($d),+));
+ let a: $longtype = transmute($shorttype::new($($a),+, $($b),+));
+ let b = transmute($shorttype::new($($c),+, $($d),+));
- assert_eq!($shorttype::new($($a),+, $($c),+), mem::transmute(vec_xxpermdi::<_, 0>(a, b)));
- assert_eq!($shorttype::new($($b),+, $($c),+), mem::transmute(vec_xxpermdi::<_, 1>(a, b)));
- assert_eq!($shorttype::new($($a),+, $($d),+), mem::transmute(vec_xxpermdi::<_, 2>(a, b)));
- assert_eq!($shorttype::new($($b),+, $($d),+), mem::transmute(vec_xxpermdi::<_, 3>(a, b)));
+ assert_eq!($shorttype::new($($a),+, $($c),+), transmute(vec_xxpermdi::<_, 0>(a, b)));
+ assert_eq!($shorttype::new($($b),+, $($c),+), transmute(vec_xxpermdi::<_, 1>(a, b)));
+ assert_eq!($shorttype::new($($a),+, $($d),+), transmute(vec_xxpermdi::<_, 2>(a, b)));
+ assert_eq!($shorttype::new($($b),+, $($d),+), transmute(vec_xxpermdi::<_, 3>(a, b)));
}
}
}
diff --git a/library/stdarch/crates/core_arch/src/wasm32/simd128.rs b/library/stdarch/crates/core_arch/src/wasm32/simd128.rs
index 5220fa74f..e974d9e56 100644
--- a/library/stdarch/crates/core_arch/src/wasm32/simd128.rs
+++ b/library/stdarch/crates/core_arch/src/wasm32/simd128.rs
@@ -4719,7 +4719,7 @@ pub mod tests {
let v2_v128: v128 = mem::transmute(v2);
let v3_v128 = super::$f(v1_v128, v2_v128);
let mut v3 = [$($vec1)*];
- drop(v3);
+ let _ignore = v3;
v3 = mem::transmute(v3_v128);
for (i, actual) in v3.iter().enumerate() {
@@ -4746,7 +4746,7 @@ pub mod tests {
let v1_v128: v128 = mem::transmute(v1);
let v2_v128 = super::$f(v1_v128);
let mut v2 = [$($vec1)*];
- drop(v2);
+ let _ignore = v2;
v2 = mem::transmute(v2_v128);
for (i, actual) in v2.iter().enumerate() {
diff --git a/library/stdarch/crates/core_arch/src/x86/avx.rs b/library/stdarch/crates/core_arch/src/x86/avx.rs
index a77005c0e..fafee5c0b 100644
--- a/library/stdarch/crates/core_arch/src/x86/avx.rs
+++ b/library/stdarch/crates/core_arch/src/x86/avx.rs
@@ -2436,8 +2436,6 @@ pub unsafe fn _mm256_set1_ps(a: f32) -> __m256 {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_set1_epi8)
#[inline]
#[target_feature(enable = "avx")]
-#[cfg_attr(test, assert_instr(vpshufb))]
-#[cfg_attr(test, assert_instr(vinsertf128))]
// This intrinsic has no corresponding instruction.
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_set1_epi8(a: i8) -> __m256i {
@@ -2689,7 +2687,9 @@ pub unsafe fn _mm256_zextpd128_pd256(a: __m128d) -> __m256d {
simd_shuffle!(a, _mm_setzero_pd(), [0, 1, 2, 3])
}
-/// Returns vector of type `__m256` with undefined elements.
+/// Returns vector of type `__m256` with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_undefined_ps)
#[inline]
@@ -2700,7 +2700,9 @@ pub unsafe fn _mm256_undefined_ps() -> __m256 {
_mm256_set1_ps(0.0)
}
-/// Returns vector of type `__m256d` with undefined elements.
+/// Returns vector of type `__m256d` with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_undefined_pd)
#[inline]
@@ -2711,7 +2713,9 @@ pub unsafe fn _mm256_undefined_pd() -> __m256d {
_mm256_set1_pd(0.0)
}
-/// Returns vector of type __m256i with undefined elements.
+/// Returns vector of type __m256i with with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_undefined_si256)
#[inline]
diff --git a/library/stdarch/crates/core_arch/src/x86/avx2.rs b/library/stdarch/crates/core_arch/src/x86/avx2.rs
index 5262628e1..cdf84b382 100644
--- a/library/stdarch/crates/core_arch/src/x86/avx2.rs
+++ b/library/stdarch/crates/core_arch/src/x86/avx2.rs
@@ -3592,7 +3592,6 @@ pub unsafe fn _mm256_cvtsd_f64(a: __m256d) -> f64 {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_cvtsi256_si32)
#[inline]
#[target_feature(enable = "avx2")]
-//#[cfg_attr(test, assert_instr(movd))] FIXME
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_cvtsi256_si32(a: __m256i) -> i32 {
simd_extract(a.as_i32x8(), 0)
diff --git a/library/stdarch/crates/core_arch/src/x86/avx512bw.rs b/library/stdarch/crates/core_arch/src/x86/avx512bw.rs
index 0ef919617..bc1e7ddfb 100644
--- a/library/stdarch/crates/core_arch/src/x86/avx512bw.rs
+++ b/library/stdarch/crates/core_arch/src/x86/avx512bw.rs
@@ -7386,7 +7386,7 @@ pub unsafe fn _mm_maskz_set1_epi16(k: __mmask8, a: i16) -> __m128i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm512_mask_set1_epi8&expand=4970)
#[inline]
#[target_feature(enable = "avx512bw")]
-#[cfg_attr(test, assert_instr(vpbroadcastb))]
+#[cfg_attr(test, assert_instr(vpbroadcast))]
pub unsafe fn _mm512_mask_set1_epi8(src: __m512i, k: __mmask64, a: i8) -> __m512i {
let r = _mm512_set1_epi8(a).as_i8x64();
transmute(simd_select_bitmask(k, r, src.as_i8x64()))
@@ -7397,7 +7397,7 @@ pub unsafe fn _mm512_mask_set1_epi8(src: __m512i, k: __mmask64, a: i8) -> __m512
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm512_maskz_set1_epi8&expand=4971)
#[inline]
#[target_feature(enable = "avx512bw")]
-#[cfg_attr(test, assert_instr(vpbroadcastb))]
+#[cfg_attr(test, assert_instr(vpbroadcast))]
pub unsafe fn _mm512_maskz_set1_epi8(k: __mmask64, a: i8) -> __m512i {
let r = _mm512_set1_epi8(a).as_i8x64();
let zero = _mm512_setzero_si512().as_i8x64();
@@ -7409,7 +7409,7 @@ pub unsafe fn _mm512_maskz_set1_epi8(k: __mmask64, a: i8) -> __m512i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_mask_set1_epi8&expand=4967)
#[inline]
#[target_feature(enable = "avx512bw,avx512vl")]
-#[cfg_attr(test, assert_instr(vpbroadcastb))]
+#[cfg_attr(test, assert_instr(vpbroadcast))]
pub unsafe fn _mm256_mask_set1_epi8(src: __m256i, k: __mmask32, a: i8) -> __m256i {
let r = _mm256_set1_epi8(a).as_i8x32();
transmute(simd_select_bitmask(k, r, src.as_i8x32()))
@@ -7420,7 +7420,7 @@ pub unsafe fn _mm256_mask_set1_epi8(src: __m256i, k: __mmask32, a: i8) -> __m256
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_maskz_set1_epi8&expand=4968)
#[inline]
#[target_feature(enable = "avx512bw,avx512vl")]
-#[cfg_attr(test, assert_instr(vpbroadcastb))]
+#[cfg_attr(test, assert_instr(vpbroadcast))]
pub unsafe fn _mm256_maskz_set1_epi8(k: __mmask32, a: i8) -> __m256i {
let r = _mm256_set1_epi8(a).as_i8x32();
let zero = _mm256_setzero_si256().as_i8x32();
@@ -7432,7 +7432,7 @@ pub unsafe fn _mm256_maskz_set1_epi8(k: __mmask32, a: i8) -> __m256i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mask_set1_epi8&expand=4964)
#[inline]
#[target_feature(enable = "avx512bw,avx512vl")]
-#[cfg_attr(test, assert_instr(vpbroadcastb))]
+#[cfg_attr(test, assert_instr(vpbroadcast))]
pub unsafe fn _mm_mask_set1_epi8(src: __m128i, k: __mmask16, a: i8) -> __m128i {
let r = _mm_set1_epi8(a).as_i8x16();
transmute(simd_select_bitmask(k, r, src.as_i8x16()))
@@ -7443,7 +7443,7 @@ pub unsafe fn _mm_mask_set1_epi8(src: __m128i, k: __mmask16, a: i8) -> __m128i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_maskz_set1_epi8&expand=4965)
#[inline]
#[target_feature(enable = "avx512bw,avx512vl")]
-#[cfg_attr(test, assert_instr(vpbroadcastb))]
+#[cfg_attr(test, assert_instr(vpbroadcast))]
pub unsafe fn _mm_maskz_set1_epi8(k: __mmask16, a: i8) -> __m128i {
let r = _mm_set1_epi8(a).as_i8x16();
let zero = _mm_setzero_si128().as_i8x16();
diff --git a/library/stdarch/crates/core_arch/src/x86/avx512f.rs b/library/stdarch/crates/core_arch/src/x86/avx512f.rs
index e0014f7ed..9baa7eeca 100644
--- a/library/stdarch/crates/core_arch/src/x86/avx512f.rs
+++ b/library/stdarch/crates/core_arch/src/x86/avx512f.rs
@@ -15757,6 +15757,26 @@ pub unsafe fn _mm512_mask_i32scatter_epi64<const SCALE: i32>(
vpscatterdq(slice, mask, offsets, src, SCALE);
}
+/// Scatter 64-bit integers from a into memory using 32-bit indices. 64-bit elements are stored at addresses starting at base_addr and offset by each 32-bit element in vindex (each index is scaled by the factor in scale). scale should be 1, 2, 4 or 8.
+///
+/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_i32scatter_epi64&expand=4099)
+#[inline]
+#[target_feature(enable = "avx512f,avx512vl")]
+#[cfg_attr(test, assert_instr(vpscatterdq, SCALE = 1))]
+#[rustc_legacy_const_generics(3)]
+pub unsafe fn _mm256_i32scatter_epi64<const SCALE: i32>(
+ slice: *mut u8,
+ offsets: __m128i,
+ src: __m256i,
+) {
+ static_assert_imm8_scale!(SCALE);
+ let src = src.as_i64x4();
+ let neg_one = -1;
+ let slice = slice as *mut i8;
+ let offsets = offsets.as_i32x4();
+ vpscatterdq256(slice, neg_one, offsets, src, SCALE);
+}
+
/// Scatter 64-bit integers from a into memory using 64-bit indices. 64-bit elements are stored at addresses starting at base_addr and offset by each 64-bit element in vindex (each index is scaled by the factor in scale). scale should be 1, 2, 4 or 8.
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm512_i64scatter_epi64&expand=3116)
@@ -29616,7 +29636,9 @@ pub unsafe fn _mm512_mask_reduce_or_epi64(k: __mmask8, a: __m512i) -> i64 {
))
}
-/// Returns vector of type `__m512d` with undefined elements.
+/// Returns vector of type `__m512d` with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm512_undefined_pd)
#[inline]
@@ -29626,7 +29648,9 @@ pub unsafe fn _mm512_undefined_pd() -> __m512d {
_mm512_set1_pd(0.0)
}
-/// Returns vector of type `__m512` with undefined elements.
+/// Returns vector of type `__m512` with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm512_undefined_ps)
#[inline]
@@ -29636,7 +29660,9 @@ pub unsafe fn _mm512_undefined_ps() -> __m512 {
_mm512_set1_ps(0.0)
}
-/// Return vector of type __m512i with undefined elements.
+/// Return vector of type __m512i with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm512_undefined_epi32&expand=5995)
#[inline]
@@ -29646,7 +29672,9 @@ pub unsafe fn _mm512_undefined_epi32() -> __m512i {
_mm512_set1_epi32(0)
}
-/// Return vector of type __m512 with undefined elements.
+/// Return vector of type __m512 with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm512_undefined&expand=5994)
#[inline]
@@ -38299,6 +38327,8 @@ extern "C" {
fn vscatterqps(slice: *mut i8, mask: i8, offsets: i64x8, src: f32x8, scale: i32);
#[link_name = "llvm.x86.avx512.scatter.dpq.512"]
fn vpscatterdq(slice: *mut i8, mask: i8, offsets: i32x8, src: i64x8, scale: i32);
+ #[link_name = "llvm.x86.avx512.scattersiv4.di"]
+ fn vpscatterdq256(slice: *mut i8, mask: i8, offsets: i32x4, src: i64x4, scale: i32);
#[link_name = "llvm.x86.avx512.scatter.dpi.512"]
fn vpscatterdd(slice: *mut i8, mask: i16, offsets: i32x16, src: i32x16, scale: i32);
diff --git a/library/stdarch/crates/core_arch/src/x86/sse.rs b/library/stdarch/crates/core_arch/src/x86/sse.rs
index 7e4b352df..3d4471ba3 100644
--- a/library/stdarch/crates/core_arch/src/x86/sse.rs
+++ b/library/stdarch/crates/core_arch/src/x86/sse.rs
@@ -1374,7 +1374,7 @@ pub unsafe fn _mm_sfence() {
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_getcsr() -> u32 {
let mut result = 0_i32;
- stmxcsr((&mut result) as *mut _ as *mut i8);
+ stmxcsr(&mut result as *mut _ as *mut i8);
result as u32
}
@@ -1754,7 +1754,9 @@ pub unsafe fn _mm_prefetch<const STRATEGY: i32>(p: *const i8) {
prefetch(p, (STRATEGY >> 2) & 1, STRATEGY & 3, 1);
}
-/// Returns vector of type __m128 with undefined elements.
+/// Returns vector of type __m128 with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_undefined_ps)
#[inline]
diff --git a/library/stdarch/crates/core_arch/src/x86/sse2.rs b/library/stdarch/crates/core_arch/src/x86/sse2.rs
index e118ac05f..f4fdb5046 100644
--- a/library/stdarch/crates/core_arch/src/x86/sse2.rs
+++ b/library/stdarch/crates/core_arch/src/x86/sse2.rs
@@ -949,7 +949,6 @@ pub unsafe fn _mm_cvtps_epi32(a: __m128) -> __m128i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi32_si128)
#[inline]
#[target_feature(enable = "sse2")]
-#[cfg_attr(all(test, target_arch = "x86_64"), assert_instr(movd))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_cvtsi32_si128(a: i32) -> __m128i {
transmute(i32x4::new(a, 0, 0, 0))
@@ -960,7 +959,6 @@ pub unsafe fn _mm_cvtsi32_si128(a: i32) -> __m128i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtsi128_si32)
#[inline]
#[target_feature(enable = "sse2")]
-#[cfg_attr(all(test, not(target_os = "windows")), assert_instr(movd))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_cvtsi128_si32(a: __m128i) -> i32 {
simd_extract(a.as_i32x4(), 0)
@@ -2739,7 +2737,9 @@ pub unsafe fn _mm_castsi128_ps(a: __m128i) -> __m128 {
transmute(a)
}
-/// Returns vector of type __m128d with undefined elements.
+/// Returns vector of type __m128d with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_undefined_pd)
#[inline]
@@ -2749,7 +2749,9 @@ pub unsafe fn _mm_undefined_pd() -> __m128d {
__m128d(0.0, 0.0)
}
-/// Returns vector of type __m128i with undefined elements.
+/// Returns vector of type __m128i with indeterminate elements.
+/// Despite being "undefined", this is some valid value and not equivalent to [`mem::MaybeUninit`].
+/// In practice, this is equivalent to [`mem::zeroed`].
///
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_undefined_si128)
#[inline]
diff --git a/library/stdarch/crates/core_arch/src/x86_64/avx512f.rs b/library/stdarch/crates/core_arch/src/x86_64/avx512f.rs
index d414effa7..68f332767 100644
--- a/library/stdarch/crates/core_arch/src/x86_64/avx512f.rs
+++ b/library/stdarch/crates/core_arch/src/x86_64/avx512f.rs
@@ -7551,6 +7551,20 @@ mod tests {
assert_eq!(&arr[..], &expected[..],);
}
+ #[simd_test(enable = "avx512f,avx512vl")]
+ unsafe fn test_mm256_i32scatter_epi64() {
+ let mut arr = [0i64; 64];
+ let index = _mm_setr_epi32(0, 16, 32, 48);
+ let src = _mm256_setr_epi64x(1, 2, 3, 4);
+ // A multiplier of 8 is word-addressing
+ _mm256_i32scatter_epi64::<8>(arr.as_mut_ptr() as *mut u8, index, src);
+ let mut expected = [0i64; 64];
+ for i in 0..4 {
+ expected[i * 16] = (i + 1) as i64;
+ }
+ assert_eq!(&arr[..], &expected[..],);
+ }
+
#[simd_test(enable = "avx512f")]
unsafe fn test_mm512_i64scatter_epi64() {
let mut arr = [0i64; 128];
diff --git a/library/stdarch/crates/std_detect/README.md b/library/stdarch/crates/std_detect/README.md
index 71f474d65..521177104 100644
--- a/library/stdarch/crates/std_detect/README.md
+++ b/library/stdarch/crates/std_detect/README.md
@@ -30,14 +30,19 @@ run-time feature detection. When this feature is disabled, `std_detect` assumes
that [`getauxval`] is linked to the binary. If that is not the case the behavior
is undefined.
- Note: This feature is ignored on `*-linux-gnu*` targets, since all `*-linux-gnu*` targets ([since Rust 1.64](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html)) have glibc requirements higher than [glibc 2.16 that added `getauxval`](https://sourceware.org/legacy-ml/libc-announce/2012/msg00000.html), and we can safely assume [`getauxval`] is linked to the binary.
+ Note: This feature is ignored on `*-linux-gnu*` and `*-android*` targets
+ because we can safely assume `getauxval` is linked to the binary.
+ * `*-linux-gnu*` targets ([since Rust 1.64](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html))
+ have glibc requirements higher than [glibc 2.16 that added `getauxval`](https://sourceware.org/legacy-ml/libc-announce/2012/msg00000.html).
+ * `*-android*` targets ([since Rust 1.68](https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html))
+ have the minimum supported API level higher than [Android 4.3 (API level 18) that added `getauxval`](https://github.com/aosp-mirror/platform_bionic/blob/d3ebc2f7c49a9893b114124d4a6b315f3a328764/libc/include/sys/auxv.h#L49).
* `std_detect_file_io` (enabled by default, requires `std`): Enable to perform run-time feature
detection using file APIs (e.g. `/proc/cpuinfo`, etc.) if other more performant
methods fail. This feature requires `libstd` as a dependency, preventing the
crate from working on applications in which `std` is not available.
-[`getauxval`]: http://man7.org/linux/man-pages/man3/getauxval.3.html
+[`getauxval`]: https://man7.org/linux/man-pages/man3/getauxval.3.html
# Platform support
diff --git a/library/stdarch/crates/std_detect/src/detect/arch/arm.rs b/library/stdarch/crates/std_detect/src/detect/arch/arm.rs
index 897dc314c..a7dea27fb 100644
--- a/library/stdarch/crates/std_detect/src/detect/arch/arm.rs
+++ b/library/stdarch/crates/std_detect/src/detect/arch/arm.rs
@@ -17,8 +17,6 @@ features! {
/// Polynomial Multiply
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] crc: "crc";
/// CRC32 (Cyclic Redundancy Check)
- @FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] crypto: "crypto";
- /// Crypto: AES + PMULL + SHA1 + SHA256. Prefer using the individual features where possible.
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] aes: "aes";
/// FEAT_AES (AES instructions)
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] sha2: "sha2";
diff --git a/library/stdarch/crates/std_detect/src/detect/os/freebsd/arm.rs b/library/stdarch/crates/std_detect/src/detect/os/freebsd/arm.rs
index 97ede1d26..d904eaebd 100644
--- a/library/stdarch/crates/std_detect/src/detect/os/freebsd/arm.rs
+++ b/library/stdarch/crates/std_detect/src/detect/os/freebsd/arm.rs
@@ -23,16 +23,13 @@ pub(crate) fn detect_features() -> cache::Initializer {
if let Ok(auxv) = auxvec::auxv() {
enable_feature(&mut value, Feature::neon, auxv.hwcap & HWCAP_NEON != 0);
- let pmull = auxv.hwcap2 & HWCAP2_PMULL != 0;
- enable_feature(&mut value, Feature::pmull, pmull);
+ enable_feature(&mut value, Feature::pmull, auxv.hwcap2 & HWCAP2_PMULL != 0);
enable_feature(&mut value, Feature::crc, auxv.hwcap2 & HWCAP2_CRC32 != 0);
- let aes = auxv.hwcap2 & HWCAP2_AES != 0;
- enable_feature(&mut value, Feature::aes, aes);
+ enable_feature(&mut value, Feature::aes, auxv.hwcap2 & HWCAP2_AES != 0);
// SHA2 requires SHA1 & SHA2 features
let sha1 = auxv.hwcap2 & HWCAP2_SHA1 != 0;
let sha2 = auxv.hwcap2 & HWCAP2_SHA2 != 0;
enable_feature(&mut value, Feature::sha2, sha1 && sha2);
- enable_feature(&mut value, Feature::crypto, aes && pmull && sha1 && sha2);
return value;
}
value
diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/arm.rs b/library/stdarch/crates/std_detect/src/detect/os/linux/arm.rs
index 7383e487f..7601cf0a8 100644
--- a/library/stdarch/crates/std_detect/src/detect/os/linux/arm.rs
+++ b/library/stdarch/crates/std_detect/src/detect/os/linux/arm.rs
@@ -20,14 +20,6 @@ pub(crate) fn detect_features() -> cache::Initializer {
enable_feature(&mut value, Feature::neon, bit::test(auxv.hwcap, 12));
enable_feature(&mut value, Feature::pmull, bit::test(auxv.hwcap2, 1));
enable_feature(&mut value, Feature::crc, bit::test(auxv.hwcap2, 4));
- enable_feature(
- &mut value,
- Feature::crypto,
- bit::test(auxv.hwcap2, 0)
- && bit::test(auxv.hwcap2, 1)
- && bit::test(auxv.hwcap2, 2)
- && bit::test(auxv.hwcap2, 3),
- );
enable_feature(&mut value, Feature::aes, bit::test(auxv.hwcap2, 0));
// SHA2 requires SHA1 & SHA2 features
enable_feature(
@@ -47,14 +39,6 @@ pub(crate) fn detect_features() -> cache::Initializer {
);
enable_feature(&mut value, Feature::pmull, c.field("Features").has("pmull"));
enable_feature(&mut value, Feature::crc, c.field("Features").has("crc32"));
- enable_feature(
- &mut value,
- Feature::crypto,
- c.field("Features").has("aes")
- && c.field("Features").has("pmull")
- && c.field("Features").has("sha1")
- && c.field("Features").has("sha2"),
- );
enable_feature(&mut value, Feature::aes, c.field("Features").has("aes"));
enable_feature(
&mut value,
diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs b/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs
index 11d9c103e..8bc0b30c3 100644
--- a/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs
+++ b/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs
@@ -54,10 +54,13 @@ pub(crate) struct AuxVec {
/// error, cpuinfo still can (and will) be used to try to perform run-time
/// feature detection on some platforms.
///
-/// Note: The `std_detect_dlsym_getauxval` cargo feature is ignored on `*-linux-gnu*` targets,
-/// since [all `*-linux-gnu*` targets ([since Rust 1.64](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html))
-/// have glibc requirements higher than [glibc 2.16 that added `getauxval`](https://sourceware.org/legacy-ml/libc-announce/2012/msg00000.html),
-/// and we can safely assume [`getauxval`] is linked to the binary.
+/// Note: The `std_detect_dlsym_getauxval` cargo feature is ignored on
+/// `*-linux-gnu*` and `*-android*` targets because we can safely assume `getauxval`
+/// is linked to the binary.
+/// - `*-linux-gnu*` targets ([since Rust 1.64](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html))
+/// have glibc requirements higher than [glibc 2.16 that added `getauxval`](https://sourceware.org/legacy-ml/libc-announce/2012/msg00000.html).
+/// - `*-android*` targets ([since Rust 1.68](https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html))
+/// have the minimum supported API level higher than [Android 4.3 (API level 18) that added `getauxval`](https://github.com/aosp-mirror/platform_bionic/blob/d3ebc2f7c49a9893b114124d4a6b315f3a328764/libc/include/sys/auxv.h#L49).
///
/// For more information about when `getauxval` is available check the great
/// [`auxv` crate documentation][auxv_docs].
@@ -67,7 +70,9 @@ pub(crate) struct AuxVec {
pub(crate) fn auxv() -> Result<AuxVec, ()> {
#[cfg(all(
feature = "std_detect_dlsym_getauxval",
- not(all(target_os = "linux", target_env = "gnu"))
+ not(all(target_os = "linux", target_env = "gnu")),
+ // TODO: libc crate currently doesn't provide getauxval on 32-bit Android.
+ not(all(target_os = "android", target_pointer_width = "64")),
))]
{
// Try to call a dynamically-linked getauxval function.
@@ -105,13 +110,17 @@ pub(crate) fn auxv() -> Result<AuxVec, ()> {
}
}
}
- drop(hwcap);
+
+ // Intentionnaly not used
+ let _ = hwcap;
}
}
#[cfg(any(
not(feature = "std_detect_dlsym_getauxval"),
- all(target_os = "linux", target_env = "gnu")
+ all(target_os = "linux", target_env = "gnu"),
+ // TODO: libc crate currently doesn't provide getauxval on 32-bit Android.
+ all(target_os = "android", target_pointer_width = "64"),
))]
{
// Targets with only AT_HWCAP:
@@ -189,13 +198,12 @@ fn getauxval(key: usize) -> Result<usize, ()> {
pub(super) fn auxv_from_file(file: &str) -> Result<AuxVec, ()> {
let file = super::read_file(file)?;
- // See <https://github.com/torvalds/linux/blob/v3.19/include/uapi/linux/auxvec.h>.
+ // See <https://github.com/torvalds/linux/blob/v5.15/include/uapi/linux/auxvec.h>.
//
- // The auxiliary vector contains at most 32 (key,value) fields: from
- // `AT_EXECFN = 31` to `AT_NULL = 0`. That is, a buffer of
- // 2*32 `usize` elements is enough to read the whole vector.
- let mut buf = [0_usize; 64];
- let len = core::mem::size_of_val(&buf).max(file.len());
+ // The auxiliary vector contains at most 34 (key,value) fields: from
+ // `AT_MINSIGSTKSZ` to `AT_NULL`, but its number may increase.
+ let len = file.len();
+ let mut buf = alloc::vec![0_usize; 1 + len / core::mem::size_of::<usize>()];
unsafe {
core::ptr::copy_nonoverlapping(file.as_ptr(), buf.as_mut_ptr() as *mut u8, len);
}
@@ -206,7 +214,7 @@ pub(super) fn auxv_from_file(file: &str) -> Result<AuxVec, ()> {
/// Tries to interpret the `buffer` as an auxiliary vector. If that fails, this
/// function returns `Err`.
#[cfg(feature = "std_detect_file_io")]
-fn auxv_from_buf(buf: &[usize; 64]) -> Result<AuxVec, ()> {
+fn auxv_from_buf(buf: &[usize]) -> Result<AuxVec, ()> {
// Targets with only AT_HWCAP:
#[cfg(any(
target_arch = "riscv32",
@@ -247,7 +255,8 @@ fn auxv_from_buf(buf: &[usize; 64]) -> Result<AuxVec, ()> {
return Ok(AuxVec { hwcap, hwcap2 });
}
}
- drop(buf);
+ // Suppress unused variable
+ let _ = buf;
Err(())
}
diff --git a/library/stdarch/crates/std_detect/tests/cpu-detection.rs b/library/stdarch/crates/std_detect/tests/cpu-detection.rs
index eb3a3e409..38bdb5bbd 100644
--- a/library/stdarch/crates/std_detect/tests/cpu-detection.rs
+++ b/library/stdarch/crates/std_detect/tests/cpu-detection.rs
@@ -28,7 +28,6 @@ fn arm_linux_or_freebsd() {
println!("neon: {}", is_arm_feature_detected!("neon"));
println!("pmull: {}", is_arm_feature_detected!("pmull"));
println!("crc: {}", is_arm_feature_detected!("crc"));
- println!("crypto: {}", is_arm_feature_detected!("crypto"));
println!("aes: {}", is_arm_feature_detected!("aes"));
println!("sha2: {}", is_arm_feature_detected!("sha2"));
}
diff --git a/library/stdarch/crates/stdarch-gen/neon.spec b/library/stdarch/crates/stdarch-gen/neon.spec
index f2c1e200d..06090e669 100644
--- a/library/stdarch/crates/stdarch-gen/neon.spec
+++ b/library/stdarch/crates/stdarch-gen/neon.spec
@@ -492,7 +492,7 @@ generate int64x1_t:uint64x1_t, int64x2_t:uint64x2_t
arm = vcgt.s
generate int8x8_t:uint8x8_t, int8x16_t:uint8x16_t, int16x4_t:uint16x4_t, int16x8_t:uint16x8_t, int32x2_t:uint32x2_t, int32x4_t:uint32x4_t
-/// Compare unsigned highe
+/// Compare unsigned greater than
name = vcgt
fn = simd_gt
a = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
@@ -732,7 +732,7 @@ a = MIN, -1, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0
fixed = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
validate FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE
-aarch64 = cmge
+aarch64 = cmgt
generate int8x8_t:uint8x8_t, int8x16_t:uint8x16_t, int16x4_t:uint16x4_t, int16x8_t:uint16x8_t, int32x2_t:uint32x2_t, int32x4_t:uint32x4_t, int64x1_t:uint64x1_t, int64x2_t:uint64x2_t
/// Floating-point compare greater than or equal to zero
@@ -751,7 +751,7 @@ multi_fn = transmute, {vcgez-in_ntt-noext, {transmute, a}}
a = -1
validate 0
-aarch64 = eor
+aarch64 = nop
generate i64:u64
/// Floating-point compare greater than or equal to zero
@@ -5138,8 +5138,20 @@ b = 1
c = 2
validate 5
-aarch64 = sqdmull
-generate i32:i16:i16:i32, i64:i32:i32:i64
+aarch64 = sqdmlal
+generate i32:i16:i16:i32
+
+/// Signed saturating doubling multiply-add long
+name = vqdmlal
+multi_fn = vqadd-out-noext, x:out_t, a, {vqdmulls-in_ntt-noext, b, c}
+multi_fn = x as out_t
+a = 1
+b = 1
+c = 2
+validate 5
+
+aarch64 = sqdmlal
+generate i64:i32:i32:i64
/// Signed saturating doubling multiply-add long
name = vqdmlalh_lane
@@ -5156,7 +5168,7 @@ validate 5
aarch64 = sqdmlal
generate i32:i16:int16x4_t:i32, i32:i16:int16x8_t:i32
name = vqdmlals_lane
-aarch64 = sqdmull
+aarch64 = sqdmlal
generate i64:i32:int32x2_t:i64, i64:i32:int32x4_t:i64
/// Signed saturating doubling multiply-subtract long
@@ -5250,8 +5262,20 @@ b = 1
c = 2
validate 6
-aarch64 = sqdmull
-generate i32:i16:i16:i32, i64:i32:i32:i64
+aarch64 = sqdmlsl
+generate i32:i16:i16:i32
+
+/// Signed saturating doubling multiply-subtract long
+name = vqdmlsl
+multi_fn = vqsub-out-noext, x:out_t, a, {vqdmulls-in_ntt-noext, b, c}
+multi_fn = x as out_t
+a = 10
+b = 1
+c = 2
+validate 6
+
+aarch64 = sqdmlsl
+generate i64:i32:i32:i64
/// Signed saturating doubling multiply-subtract long
name = vqdmlslh_lane
@@ -5268,7 +5292,7 @@ validate 6
aarch64 = sqdmlsl
generate i32:i16:int16x4_t:i32, i32:i16:int16x8_t:i32
name = vqdmlsls_lane
-aarch64 = sqdmull
+aarch64 = sqdmlsl
generate i64:i32:int32x2_t:i64, i64:i32:int32x4_t:i64
/// Signed saturating doubling multiply returning high half
diff --git a/library/stdarch/crates/stdarch-test/src/disassembly.rs b/library/stdarch/crates/stdarch-test/src/disassembly.rs
index 8e4d57d4e..5d7a27e8a 100644
--- a/library/stdarch/crates/stdarch-test/src/disassembly.rs
+++ b/library/stdarch/crates/stdarch-test/src/disassembly.rs
@@ -148,7 +148,7 @@ fn parse(output: &str) -> HashSet<Function> {
instruction
.split_whitespace()
.skip(1)
- .skip_while(|s| *s == "lock") // skip x86-specific prefix
+ .skip_while(|s| *s == "lock" || *s == "{evex}") // skip x86-specific prefix
.map(std::string::ToString::to_string)
.collect::<Vec<String>>()
};
diff --git a/library/sysroot/Cargo.toml b/library/sysroot/Cargo.toml
new file mode 100644
index 000000000..5356ee277
--- /dev/null
+++ b/library/sysroot/Cargo.toml
@@ -0,0 +1,27 @@
+[package]
+name = "sysroot"
+version = "0.0.0"
+edition = "2021"
+
+# this is a dummy crate to ensure that all required crates appear in the sysroot
+[dependencies]
+proc_macro = { path = "../proc_macro" }
+std = { path = "../std" }
+test = { path = "../test" }
+
+# Forward features to the `std` crate as necessary
+[features]
+default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"]
+backtrace = ["std/backtrace"]
+compiler-builtins-c = ["std/compiler-builtins-c"]
+compiler-builtins-mem = ["std/compiler-builtins-mem"]
+compiler-builtins-no-asm = ["std/compiler-builtins-no-asm"]
+compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"]
+llvm-libunwind = ["std/llvm-libunwind"]
+system-llvm-libunwind = ["std/system-llvm-libunwind"]
+panic-unwind = ["std/panic_unwind"]
+panic_immediate_abort = ["std/panic_immediate_abort"]
+profiler = ["std/profiler"]
+std_detect_file_io = ["std/std_detect_file_io"]
+std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"]
+std_detect_env_override = ["std/std_detect_env_override"]
diff --git a/library/sysroot/src/lib.rs b/library/sysroot/src/lib.rs
new file mode 100644
index 000000000..71ceb580a
--- /dev/null
+++ b/library/sysroot/src/lib.rs
@@ -0,0 +1 @@
+// This is intentionally empty since this crate is only used to depend on other library crates.
diff --git a/library/test/Cargo.toml b/library/test/Cargo.toml
index 18cb023d2..91a1abde0 100644
--- a/library/test/Cargo.toml
+++ b/library/test/Cargo.toml
@@ -12,23 +12,3 @@ std = { path = "../std" }
core = { path = "../core" }
panic_unwind = { path = "../panic_unwind" }
panic_abort = { path = "../panic_abort" }
-
-# not actually used but needed to always have proc_macro in the sysroot
-proc_macro = { path = "../proc_macro" }
-
-# Forward features to the `std` crate as necessary
-[features]
-default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"]
-backtrace = ["std/backtrace"]
-compiler-builtins-c = ["std/compiler-builtins-c"]
-compiler-builtins-mem = ["std/compiler-builtins-mem"]
-compiler-builtins-no-asm = ["std/compiler-builtins-no-asm"]
-compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"]
-llvm-libunwind = ["std/llvm-libunwind"]
-system-llvm-libunwind = ["std/system-llvm-libunwind"]
-panic-unwind = ["std/panic_unwind"]
-panic_immediate_abort = ["std/panic_immediate_abort"]
-profiler = ["std/profiler"]
-std_detect_file_io = ["std/std_detect_file_io"]
-std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"]
-std_detect_env_override = ["std/std_detect_env_override"]
diff --git a/library/test/src/cli.rs b/library/test/src/cli.rs
index 9d22ebbee..6ac3b3eaa 100644
--- a/library/test/src/cli.rs
+++ b/library/test/src/cli.rs
@@ -404,13 +404,13 @@ fn get_format(
Some("terse") => OutputFormat::Terse,
Some("json") => {
if !allow_unstable {
- return Err("The \"json\" format is only accepted on the nightly compiler".into());
+ return Err("The \"json\" format is only accepted on the nightly compiler with -Z unstable-options".into());
}
OutputFormat::Json
}
Some("junit") => {
if !allow_unstable {
- return Err("The \"junit\" format is only accepted on the nightly compiler".into());
+ return Err("The \"junit\" format is only accepted on the nightly compiler with -Z unstable-options".into());
}
OutputFormat::Junit
}
diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs
index 40976ec5e..47c4e7757 100644
--- a/library/test/src/formatters/json.rs
+++ b/library/test/src/formatters/json.rs
@@ -18,14 +18,10 @@ impl<T: Write> JsonFormatter<T> {
}
fn writeln_message(&mut self, s: &str) -> io::Result<()> {
- assert!(!s.contains('\n'));
-
- self.out.write_all(s.as_ref())?;
- self.out.write_all(b"\n")
- }
-
- fn write_message(&mut self, s: &str) -> io::Result<()> {
- assert!(!s.contains('\n'));
+ // self.out will take a lock, but that lock is released when write_all returns. This
+ // results in a race condition and json output may not end with a new line. We avoid this
+ // by issuing `write_all` calls line-by-line.
+ assert_eq!(s.chars().last(), Some('\n'));
self.out.write_all(s.as_ref())
}
@@ -34,34 +30,35 @@ impl<T: Write> JsonFormatter<T> {
&mut self,
ty: &str,
name: &str,
- evt: &str,
+ event: &str,
exec_time: Option<&time::TestExecTime>,
stdout: Option<Cow<'_, str>>,
extra: Option<&str>,
) -> io::Result<()> {
// A doc test's name includes a filename which must be escaped for correct json.
- self.write_message(&format!(
- r#"{{ "type": "{}", "name": "{}", "event": "{}""#,
- ty,
- EscapedString(name),
- evt
- ))?;
- if let Some(exec_time) = exec_time {
- self.write_message(&format!(r#", "exec_time": {}"#, exec_time.0.as_secs_f64()))?;
- }
- if let Some(stdout) = stdout {
- self.write_message(&format!(r#", "stdout": "{}""#, EscapedString(stdout)))?;
- }
- if let Some(extra) = extra {
- self.write_message(&format!(r#", {extra}"#))?;
- }
- self.writeln_message(" }")
+ let name = EscapedString(name);
+ let exec_time_json = if let Some(exec_time) = exec_time {
+ format!(r#", "exec_time": {}"#, exec_time.0.as_secs_f64())
+ } else {
+ String::from("")
+ };
+ let stdout_json = if let Some(stdout) = stdout {
+ format!(r#", "stdout": "{}""#, EscapedString(stdout))
+ } else {
+ String::from("")
+ };
+ let extra_json =
+ if let Some(extra) = extra { format!(r#", {extra}"#) } else { String::from("") };
+ let newline = "\n";
+
+ self.writeln_message(&format!(
+ r#"{{ "type": "{ty}", "name": "{name}", "event": "{event}"{exec_time_json}{stdout_json}{extra_json} }}{newline}"#))
}
}
impl<T: Write> OutputFormatter for JsonFormatter<T> {
fn write_discovery_start(&mut self) -> io::Result<()> {
- self.writeln_message(&format!(r#"{{ "type": "suite", "event": "discovery" }}"#))
+ self.writeln_message(concat!(r#"{ "type": "suite", "event": "discovery" }"#, "\n"))
}
fn write_test_discovered(&mut self, desc: &TestDesc, test_type: &str) -> io::Result<()> {
@@ -69,35 +66,21 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
name,
ignore,
ignore_message,
- #[cfg(not(bootstrap))]
source_file,
- #[cfg(not(bootstrap))]
start_line,
- #[cfg(not(bootstrap))]
start_col,
- #[cfg(not(bootstrap))]
end_line,
- #[cfg(not(bootstrap))]
end_col,
..
} = desc;
- #[cfg(bootstrap)]
- let source_file = "";
- #[cfg(bootstrap)]
- let start_line = 0;
- #[cfg(bootstrap)]
- let start_col = 0;
- #[cfg(bootstrap)]
- let end_line = 0;
- #[cfg(bootstrap)]
- let end_col = 0;
+ let name = EscapedString(name.as_slice());
+ let ignore_message = ignore_message.unwrap_or("");
+ let source_path = EscapedString(source_file);
+ let newline = "\n";
self.writeln_message(&format!(
- r#"{{ "type": "{test_type}", "event": "discovered", "name": "{}", "ignore": {ignore}, "ignore_message": "{}", "source_path": "{}", "start_line": {start_line}, "start_col": {start_col}, "end_line": {end_line}, "end_col": {end_col} }}"#,
- EscapedString(name.as_slice()),
- ignore_message.unwrap_or(""),
- EscapedString(source_file),
+ r#"{{ "type": "{test_type}", "event": "discovered", "name": "{name}", "ignore": {ignore}, "ignore_message": "{ignore_message}", "source_path": "{source_path}", "start_line": {start_line}, "start_col": {start_col}, "end_line": {end_line}, "end_col": {end_col} }}{newline}"#
))
}
@@ -105,9 +88,10 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
let ConsoleTestDiscoveryState { tests, benchmarks, ignored, .. } = state;
let total = tests + benchmarks;
+ let newline = "\n";
self.writeln_message(&format!(
- r#"{{ "type": "suite", "event": "completed", "tests": {tests}, "benchmarks": {benchmarks}, "total": {total}, "ignored": {ignored} }}"#
- ))
+ r#"{{ "type": "suite", "event": "completed", "tests": {tests}, "benchmarks": {benchmarks}, "total": {total}, "ignored": {ignored} }}{newline}"#
+ ))
}
fn write_run_start(&mut self, test_count: usize, shuffle_seed: Option<u64>) -> io::Result<()> {
@@ -116,15 +100,17 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
} else {
String::new()
};
+ let newline = "\n";
self.writeln_message(&format!(
- r#"{{ "type": "suite", "event": "started", "test_count": {test_count}{shuffle_seed_json} }}"#
- ))
+ r#"{{ "type": "suite", "event": "started", "test_count": {test_count}{shuffle_seed_json} }}{newline}"#
+ ))
}
fn write_test_start(&mut self, desc: &TestDesc) -> io::Result<()> {
+ let name = EscapedString(desc.name.as_slice());
+ let newline = "\n";
self.writeln_message(&format!(
- r#"{{ "type": "test", "event": "started", "name": "{}" }}"#,
- EscapedString(desc.name.as_slice())
+ r#"{{ "type": "test", "event": "started", "name": "{name}" }}{newline}"#
))
}
@@ -189,53 +175,43 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
} else {
format!(r#", "mib_per_second": {}"#, bs.mb_s)
};
+ let name = EscapedString(desc.name.as_slice());
- let line = format!(
+ self.writeln_message(&format!(
"{{ \"type\": \"bench\", \
- \"name\": \"{}\", \
- \"median\": {}, \
- \"deviation\": {}{} }}",
- EscapedString(desc.name.as_slice()),
- median,
- deviation,
- mbps
- );
-
- self.writeln_message(&line)
+ \"name\": \"{name}\", \
+ \"median\": {median}, \
+ \"deviation\": {deviation}{mbps} }}\n",
+ ))
}
}
}
fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()> {
+ let name = EscapedString(desc.name.as_slice());
+ let newline = "\n";
self.writeln_message(&format!(
- r#"{{ "type": "test", "event": "timeout", "name": "{}" }}"#,
- EscapedString(desc.name.as_slice())
+ r#"{{ "type": "test", "event": "timeout", "name": "{name}" }}{newline}"#,
))
}
fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
- self.write_message(&format!(
- "{{ \"type\": \"suite\", \
- \"event\": \"{}\", \
- \"passed\": {}, \
- \"failed\": {}, \
- \"ignored\": {}, \
- \"measured\": {}, \
- \"filtered_out\": {}",
- if state.failed == 0 { "ok" } else { "failed" },
- state.passed,
- state.failed,
- state.ignored,
- state.measured,
- state.filtered_out,
- ))?;
-
- if let Some(ref exec_time) = state.exec_time {
- let time_str = format!(", \"exec_time\": {}", exec_time.0.as_secs_f64());
- self.write_message(&time_str)?;
- }
+ let event = if state.failed == 0 { "ok" } else { "failed" };
+ let passed = state.passed;
+ let failed = state.failed;
+ let ignored = state.ignored;
+ let measured = state.measured;
+ let filtered_out = state.filtered_out;
+ let exec_time_json = if let Some(ref exec_time) = state.exec_time {
+ format!(r#", "exec_time": {}"#, exec_time.0.as_secs_f64())
+ } else {
+ String::from("")
+ };
+ let newline = "\n";
- self.writeln_message(" }")?;
+ self.writeln_message(&format!(
+ r#"{{ "type": "suite", "event": "{event}", "passed": {passed}, "failed": {failed}, "ignored": {ignored}, "measured": {measured}, "filtered_out": {filtered_out}{exec_time_json} }}{newline}"#
+ ))?;
Ok(state.failed == 0)
}
diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs
index 2e07ce3c0..9f5bf2436 100644
--- a/library/test/src/formatters/junit.rs
+++ b/library/test/src/formatters/junit.rs
@@ -11,7 +11,7 @@ use crate::{
pub struct JunitFormatter<T> {
out: OutputLocation<T>,
- results: Vec<(TestDesc, TestResult, Duration)>,
+ results: Vec<(TestDesc, TestResult, Duration, Vec<u8>)>,
}
impl<T: Write> JunitFormatter<T> {
@@ -26,6 +26,18 @@ impl<T: Write> JunitFormatter<T> {
}
}
+fn str_to_cdata(s: &str) -> String {
+ // Drop the stdout in a cdata. Unfortunately, you can't put either of `]]>` or
+ // `<?'` in a CDATA block, so the escaping gets a little weird.
+ let escaped_output = s.replace("]]>", "]]]]><![CDATA[>");
+ let escaped_output = escaped_output.replace("<?", "<]]><![CDATA[?");
+ // We also smuggle newlines as &#xa so as to keep all the output on one line
+ let escaped_output = escaped_output.replace("\n", "]]>&#xA;<![CDATA[");
+ // Prune empty CDATA blocks resulting from any escaping
+ let escaped_output = escaped_output.replace("<![CDATA[]]>", "");
+ format!("<![CDATA[{}]]>", escaped_output)
+}
+
impl<T: Write> OutputFormatter for JunitFormatter<T> {
fn write_discovery_start(&mut self) -> io::Result<()> {
Err(io::Error::new(io::ErrorKind::NotFound, "Not yet implemented!"))
@@ -63,14 +75,14 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> {
desc: &TestDesc,
result: &TestResult,
exec_time: Option<&time::TestExecTime>,
- _stdout: &[u8],
+ stdout: &[u8],
_state: &ConsoleTestState,
) -> io::Result<()> {
// Because the testsuite node holds some of the information as attributes, we can't write it
// until all of the tests have finished. Instead of writing every result as they come in, we add
// them to a Vec and write them all at once when run is complete.
let duration = exec_time.map(|t| t.0).unwrap_or_default();
- self.results.push((desc.clone(), result.clone(), duration));
+ self.results.push((desc.clone(), result.clone(), duration, stdout.to_vec()));
Ok(())
}
fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
@@ -85,7 +97,7 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> {
>",
state.failed, state.total, state.ignored
))?;
- for (desc, result, duration) in std::mem::take(&mut self.results) {
+ for (desc, result, duration, stdout) in std::mem::take(&mut self.results) {
let (class_name, test_name) = parse_class_name(&desc);
match result {
TestResult::TrIgnored => { /* no-op */ }
@@ -98,6 +110,11 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> {
duration.as_secs_f64()
))?;
self.write_message("<failure type=\"assert\"/>")?;
+ if !stdout.is_empty() {
+ self.write_message("<system-out>")?;
+ self.write_message(&str_to_cdata(&String::from_utf8_lossy(&stdout)))?;
+ self.write_message("</system-out>")?;
+ }
self.write_message("</testcase>")?;
}
@@ -110,6 +127,11 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> {
duration.as_secs_f64()
))?;
self.write_message(&format!("<failure message=\"{m}\" type=\"assert\"/>"))?;
+ if !stdout.is_empty() {
+ self.write_message("<system-out>")?;
+ self.write_message(&str_to_cdata(&String::from_utf8_lossy(&stdout)))?;
+ self.write_message("</system-out>")?;
+ }
self.write_message("</testcase>")?;
}
@@ -136,11 +158,19 @@ impl<T: Write> OutputFormatter for JunitFormatter<T> {
TestResult::TrOk => {
self.write_message(&format!(
"<testcase classname=\"{}\" \
- name=\"{}\" time=\"{}\"/>",
+ name=\"{}\" time=\"{}\"",
class_name,
test_name,
duration.as_secs_f64()
))?;
+ if stdout.is_empty() || !state.options.display_output {
+ self.write_message("/>")?;
+ } else {
+ self.write_message("><system-out>")?;
+ self.write_message(&str_to_cdata(&String::from_utf8_lossy(&stdout)))?;
+ self.write_message("</system-out>")?;
+ self.write_message("</testcase>")?;
+ }
}
}
}
diff --git a/library/test/src/options.rs b/library/test/src/options.rs
index 75ec0b616..3eaad5947 100644
--- a/library/test/src/options.rs
+++ b/library/test/src/options.rs
@@ -16,19 +16,21 @@ pub enum ShouldPanic {
}
/// Whether should console output be colored or not
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Default, Debug)]
pub enum ColorConfig {
+ #[default]
AutoColor,
AlwaysColor,
NeverColor,
}
/// Format of the test results output
-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum OutputFormat {
/// Verbose output
Pretty,
/// Quiet output
+ #[default]
Terse,
/// JSON output
Json,
diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs
index 5ffdbf73f..c34583e69 100644
--- a/library/test/src/tests.rs
+++ b/library/test/src/tests.rs
@@ -63,15 +63,10 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
name: StaticTestName("1"),
ignore: true,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -85,15 +80,10 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
name: StaticTestName("2"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -115,15 +105,10 @@ pub fn do_not_run_ignored_tests() {
name: StaticTestName("whatever"),
ignore: true,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -148,15 +133,10 @@ pub fn ignored_tests_result_in_ignored() {
name: StaticTestName("whatever"),
ignore: true,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -183,15 +163,10 @@ fn test_should_panic() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::Yes,
compile_fail: false,
@@ -218,15 +193,10 @@ fn test_should_panic_good_message() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::YesWithMessage("error message"),
compile_fail: false,
@@ -258,15 +228,10 @@ fn test_should_panic_bad_message() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::YesWithMessage(expected),
compile_fail: false,
@@ -302,15 +267,10 @@ fn test_should_panic_non_string_message_type() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::YesWithMessage(expected),
compile_fail: false,
@@ -340,15 +300,10 @@ fn test_should_panic_but_succeeds() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic,
compile_fail: false,
@@ -378,15 +333,10 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -425,15 +375,10 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -474,15 +419,10 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -596,15 +536,10 @@ pub fn exclude_should_panic_option() {
name: StaticTestName("3"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::Yes,
compile_fail: false,
@@ -630,15 +565,10 @@ pub fn exact_filter_match() {
name: StaticTestName(name),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -731,15 +661,10 @@ fn sample_tests() -> Vec<TestDescAndFn> {
name: DynTestName((*name).clone()),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -870,15 +795,10 @@ pub fn test_bench_no_iter() {
name: StaticTestName("f"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -903,15 +823,10 @@ pub fn test_bench_iter() {
name: StaticTestName("f"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -929,15 +844,10 @@ fn should_sort_failures_before_printing_them() {
name: StaticTestName("a"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -949,15 +859,10 @@ fn should_sort_failures_before_printing_them() {
name: StaticTestName("b"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
@@ -1006,15 +911,10 @@ fn test_dyn_bench_returning_err_fails_when_run_as_test() {
name: StaticTestName("whatever"),
ignore: false,
ignore_message: None,
- #[cfg(not(bootstrap))]
source_file: "",
- #[cfg(not(bootstrap))]
start_line: 0,
- #[cfg(not(bootstrap))]
start_col: 0,
- #[cfg(not(bootstrap))]
end_line: 0,
- #[cfg(not(bootstrap))]
end_col: 0,
should_panic: ShouldPanic::No,
compile_fail: false,
diff --git a/library/test/src/types.rs b/library/test/src/types.rs
index 8d4e204c8..e79914dbf 100644
--- a/library/test/src/types.rs
+++ b/library/test/src/types.rs
@@ -119,15 +119,10 @@ pub struct TestDesc {
pub name: TestName,
pub ignore: bool,
pub ignore_message: Option<&'static str>,
- #[cfg(not(bootstrap))]
pub source_file: &'static str,
- #[cfg(not(bootstrap))]
pub start_line: usize,
- #[cfg(not(bootstrap))]
pub start_col: usize,
- #[cfg(not(bootstrap))]
pub end_line: usize,
- #[cfg(not(bootstrap))]
pub end_col: usize,
pub should_panic: options::ShouldPanic,
pub compile_fail: bool,