From 99128b7e45f8b95d962da2e6ea584767f0c85455 Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:10:25 +0100 Subject: [PATCH 01/13] std: begin moving platform support modules into `pal` --- library/std/src/sys/mod.rs | 132 ++---------------- library/std/src/sys/{ => pal}/common/alloc.rs | 0 library/std/src/sys/{ => pal}/common/mod.rs | 0 .../sys/{ => pal}/common/small_c_string.rs | 0 library/std/src/sys/{ => pal}/common/tests.rs | 0 .../common/thread_local/fast_local.rs | 0 .../sys/{ => pal}/common/thread_local/mod.rs | 0 .../{ => pal}/common/thread_local/os_local.rs | 0 .../common/thread_local/static_local.rs | 0 library/std/src/sys/{ => pal}/hermit/alloc.rs | 0 library/std/src/sys/{ => pal}/hermit/args.rs | 0 library/std/src/sys/{ => pal}/hermit/env.rs | 0 library/std/src/sys/{ => pal}/hermit/fd.rs | 0 library/std/src/sys/{ => pal}/hermit/fs.rs | 0 library/std/src/sys/{ => pal}/hermit/futex.rs | 0 .../std/src/sys/{ => pal}/hermit/memchr.rs | 0 library/std/src/sys/{ => pal}/hermit/mod.rs | 0 library/std/src/sys/{ => pal}/hermit/net.rs | 0 library/std/src/sys/{ => pal}/hermit/os.rs | 0 library/std/src/sys/{ => pal}/hermit/stdio.rs | 0 .../std/src/sys/{ => pal}/hermit/thread.rs | 0 .../sys/{ => pal}/hermit/thread_local_dtor.rs | 0 library/std/src/sys/{ => pal}/hermit/time.rs | 0 library/std/src/sys/{ => pal}/itron/abi.rs | 0 .../std/src/sys/{ => pal}/itron/condvar.rs | 0 library/std/src/sys/{ => pal}/itron/error.rs | 0 library/std/src/sys/{ => pal}/itron/mutex.rs | 0 library/std/src/sys/{ => pal}/itron/spin.rs | 0 library/std/src/sys/{ => pal}/itron/task.rs | 0 library/std/src/sys/{ => pal}/itron/thread.rs | 0 .../src/sys/{ => pal}/itron/thread_parking.rs | 0 library/std/src/sys/{ => pal}/itron/time.rs | 0 .../std/src/sys/{ => pal}/itron/time/tests.rs | 0 library/std/src/sys/pal/mod.rs | 124 ++++++++++++++++ .../src/sys/{ => pal}/personality/dwarf/eh.rs | 0 .../sys/{ => pal}/personality/dwarf/mod.rs | 0 .../sys/{ => pal}/personality/dwarf/tests.rs | 0 .../std/src/sys/{ => pal}/personality/emcc.rs | 0 .../std/src/sys/{ => pal}/personality/gcc.rs | 0 .../std/src/sys/{ => pal}/personality/mod.rs | 0 library/std/src/sys/{ => pal}/sgx/abi/entry.S | 0 library/std/src/sys/{ => pal}/sgx/abi/mem.rs | 0 library/std/src/sys/{ => pal}/sgx/abi/mod.rs | 0 .../std/src/sys/{ => pal}/sgx/abi/panic.rs | 0 .../std/src/sys/{ => pal}/sgx/abi/reloc.rs | 0 .../std/src/sys/{ => pal}/sgx/abi/thread.rs | 0 .../std/src/sys/{ => pal}/sgx/abi/tls/mod.rs | 0 .../sys/{ => pal}/sgx/abi/tls/sync_bitset.rs | 0 .../sgx/abi/tls/sync_bitset/tests.rs | 0 .../sys/{ => pal}/sgx/abi/usercalls/alloc.rs | 0 .../sys/{ => pal}/sgx/abi/usercalls/mod.rs | 0 .../sys/{ => pal}/sgx/abi/usercalls/raw.rs | 0 .../sys/{ => pal}/sgx/abi/usercalls/tests.rs | 0 library/std/src/sys/{ => pal}/sgx/alloc.rs | 0 library/std/src/sys/{ => pal}/sgx/args.rs | 0 library/std/src/sys/{ => pal}/sgx/condvar.rs | 0 library/std/src/sys/{ => pal}/sgx/env.rs | 0 library/std/src/sys/{ => pal}/sgx/fd.rs | 0 library/std/src/sys/{ => pal}/sgx/memchr.rs | 0 library/std/src/sys/{ => pal}/sgx/mod.rs | 0 library/std/src/sys/{ => pal}/sgx/mutex.rs | 0 library/std/src/sys/{ => pal}/sgx/net.rs | 0 library/std/src/sys/{ => pal}/sgx/os.rs | 0 library/std/src/sys/{ => pal}/sgx/path.rs | 0 library/std/src/sys/{ => pal}/sgx/rwlock.rs | 0 .../std/src/sys/{ => pal}/sgx/rwlock/tests.rs | 0 library/std/src/sys/{ => pal}/sgx/stdio.rs | 0 library/std/src/sys/{ => pal}/sgx/thread.rs | 0 .../src/sys/{ => pal}/sgx/thread_local_key.rs | 0 .../src/sys/{ => pal}/sgx/thread_parking.rs | 0 library/std/src/sys/{ => pal}/sgx/time.rs | 0 .../src/sys/{ => pal}/sgx/waitqueue/mod.rs | 0 .../sys/{ => pal}/sgx/waitqueue/spin_mutex.rs | 0 .../sgx/waitqueue/spin_mutex/tests.rs | 0 .../src/sys/{ => pal}/sgx/waitqueue/tests.rs | 0 .../{ => pal}/sgx/waitqueue/unsafe_list.rs | 0 .../sgx/waitqueue/unsafe_list/tests.rs | 0 library/std/src/sys/{ => pal}/solid/abi/fs.rs | 0 .../std/src/sys/{ => pal}/solid/abi/mod.rs | 0 .../src/sys/{ => pal}/solid/abi/sockets.rs | 0 library/std/src/sys/{ => pal}/solid/alloc.rs | 0 library/std/src/sys/{ => pal}/solid/env.rs | 0 library/std/src/sys/{ => pal}/solid/error.rs | 0 library/std/src/sys/{ => pal}/solid/fs.rs | 0 library/std/src/sys/{ => pal}/solid/io.rs | 0 library/std/src/sys/{ => pal}/solid/memchr.rs | 0 library/std/src/sys/{ => pal}/solid/mod.rs | 0 library/std/src/sys/{ => pal}/solid/net.rs | 0 library/std/src/sys/{ => pal}/solid/os.rs | 0 library/std/src/sys/{ => pal}/solid/path.rs | 0 library/std/src/sys/{ => pal}/solid/rwlock.rs | 0 library/std/src/sys/{ => pal}/solid/stdio.rs | 0 .../sys/{ => pal}/solid/thread_local_dtor.rs | 0 .../sys/{ => pal}/solid/thread_local_key.rs | 0 library/std/src/sys/{ => pal}/solid/time.rs | 0 library/std/src/sys/{ => pal}/teeos/alloc.rs | 0 .../src/sys/{ => pal}/teeos/locks/condvar.rs | 0 .../std/src/sys/{ => pal}/teeos/locks/mod.rs | 0 .../src/sys/{ => pal}/teeos/locks/rwlock.rs | 0 library/std/src/sys/{ => pal}/teeos/mod.rs | 0 library/std/src/sys/{ => pal}/teeos/net.rs | 0 library/std/src/sys/{ => pal}/teeos/os.rs | 0 library/std/src/sys/{ => pal}/teeos/rand.rs | 0 library/std/src/sys/{ => pal}/teeos/stdio.rs | 0 library/std/src/sys/{ => pal}/teeos/thread.rs | 0 .../sys/{ => pal}/teeos/thread_local_dtor.rs | 0 library/std/src/sys/{ => pal}/uefi/alloc.rs | 0 library/std/src/sys/{ => pal}/uefi/args.rs | 0 library/std/src/sys/{ => pal}/uefi/env.rs | 0 library/std/src/sys/{ => pal}/uefi/helpers.rs | 0 library/std/src/sys/{ => pal}/uefi/mod.rs | 0 library/std/src/sys/{ => pal}/uefi/os.rs | 0 library/std/src/sys/{ => pal}/uefi/path.rs | 0 library/std/src/sys/{ => pal}/uefi/stdio.rs | 0 library/std/src/sys/{ => pal}/uefi/tests.rs | 0 library/std/src/sys/{ => pal}/unix/alloc.rs | 0 library/std/src/sys/{ => pal}/unix/android.rs | 0 library/std/src/sys/{ => pal}/unix/args.rs | 0 library/std/src/sys/{ => pal}/unix/cmath.rs | 0 library/std/src/sys/{ => pal}/unix/env.rs | 0 library/std/src/sys/{ => pal}/unix/fd.rs | 0 .../std/src/sys/{ => pal}/unix/fd/tests.rs | 0 library/std/src/sys/{ => pal}/unix/fs.rs | 0 library/std/src/sys/{ => pal}/unix/futex.rs | 0 library/std/src/sys/{ => pal}/unix/io.rs | 0 .../std/src/sys/{ => pal}/unix/kernel_copy.rs | 0 .../sys/{ => pal}/unix/kernel_copy/tests.rs | 0 library/std/src/sys/{ => pal}/unix/l4re.rs | 0 .../sys/{ => pal}/unix/locks/fuchsia_mutex.rs | 0 .../sys/{ => pal}/unix/locks/futex_condvar.rs | 0 .../sys/{ => pal}/unix/locks/futex_mutex.rs | 0 .../sys/{ => pal}/unix/locks/futex_rwlock.rs | 0 .../std/src/sys/{ => pal}/unix/locks/mod.rs | 0 .../{ => pal}/unix/locks/pthread_condvar.rs | 0 .../sys/{ => pal}/unix/locks/pthread_mutex.rs | 0 .../{ => pal}/unix/locks/pthread_rwlock.rs | 0 library/std/src/sys/{ => pal}/unix/memchr.rs | 0 library/std/src/sys/{ => pal}/unix/mod.rs | 0 library/std/src/sys/{ => pal}/unix/net.rs | 0 library/std/src/sys/{ => pal}/unix/os.rs | 0 .../std/src/sys/{ => pal}/unix/os/tests.rs | 0 library/std/src/sys/{ => pal}/unix/os_str.rs | 0 .../src/sys/{ => pal}/unix/os_str/tests.rs | 0 library/std/src/sys/{ => pal}/unix/path.rs | 0 library/std/src/sys/{ => pal}/unix/pipe.rs | 0 .../std/src/sys/{ => pal}/unix/process/mod.rs | 0 .../{ => pal}/unix/process/process_common.rs | 0 .../unix/process/process_common/tests.rs | 0 .../{ => pal}/unix/process/process_fuchsia.rs | 0 .../{ => pal}/unix/process/process_unix.rs | 0 .../unix/process/process_unix/tests.rs | 0 .../unix/process/process_unsupported.rs | 0 .../process_unsupported/wait_status.rs | 0 .../process_unsupported/wait_status/tests.rs | 0 .../{ => pal}/unix/process/process_vxworks.rs | 0 .../src/sys/{ => pal}/unix/process/zircon.rs | 0 library/std/src/sys/{ => pal}/unix/rand.rs | 0 .../src/sys/{ => pal}/unix/stack_overflow.rs | 0 library/std/src/sys/{ => pal}/unix/stdio.rs | 0 library/std/src/sys/{ => pal}/unix/thread.rs | 0 .../sys/{ => pal}/unix/thread_local_dtor.rs | 0 .../sys/{ => pal}/unix/thread_local_key.rs | 0 .../{ => pal}/unix/thread_parking/darwin.rs | 0 .../sys/{ => pal}/unix/thread_parking/mod.rs | 0 .../{ => pal}/unix/thread_parking/netbsd.rs | 0 .../{ => pal}/unix/thread_parking/pthread.rs | 0 library/std/src/sys/{ => pal}/unix/time.rs | 0 library/std/src/sys/{ => pal}/unix/weak.rs | 0 .../src/sys/{ => pal}/unsupported/alloc.rs | 0 .../std/src/sys/{ => pal}/unsupported/args.rs | 0 .../src/sys/{ => pal}/unsupported/common.rs | 0 .../std/src/sys/{ => pal}/unsupported/env.rs | 0 .../std/src/sys/{ => pal}/unsupported/fs.rs | 0 .../std/src/sys/{ => pal}/unsupported/io.rs | 0 .../{ => pal}/unsupported/locks/condvar.rs | 0 .../sys/{ => pal}/unsupported/locks/mod.rs | 0 .../sys/{ => pal}/unsupported/locks/mutex.rs | 0 .../sys/{ => pal}/unsupported/locks/rwlock.rs | 0 .../std/src/sys/{ => pal}/unsupported/mod.rs | 0 .../std/src/sys/{ => pal}/unsupported/net.rs | 0 .../std/src/sys/{ => pal}/unsupported/once.rs | 0 .../std/src/sys/{ => pal}/unsupported/os.rs | 0 .../std/src/sys/{ => pal}/unsupported/pipe.rs | 0 .../src/sys/{ => pal}/unsupported/process.rs | 0 .../src/sys/{ => pal}/unsupported/stdio.rs | 0 .../src/sys/{ => pal}/unsupported/thread.rs | 0 .../unsupported/thread_local_dtor.rs | 0 .../{ => pal}/unsupported/thread_local_key.rs | 0 .../{ => pal}/unsupported/thread_parking.rs | 0 .../std/src/sys/{ => pal}/unsupported/time.rs | 0 library/std/src/sys/{ => pal}/wasi/args.rs | 0 library/std/src/sys/{ => pal}/wasi/env.rs | 0 library/std/src/sys/{ => pal}/wasi/fd.rs | 0 library/std/src/sys/{ => pal}/wasi/fs.rs | 0 library/std/src/sys/{ => pal}/wasi/io.rs | 0 library/std/src/sys/{ => pal}/wasi/mod.rs | 0 library/std/src/sys/{ => pal}/wasi/net.rs | 0 library/std/src/sys/{ => pal}/wasi/os.rs | 0 library/std/src/sys/{ => pal}/wasi/stdio.rs | 0 library/std/src/sys/{ => pal}/wasi/thread.rs | 0 library/std/src/sys/{ => pal}/wasi/time.rs | 0 library/std/src/sys/{ => pal}/wasm/alloc.rs | 0 .../src/sys/{ => pal}/wasm/atomics/futex.rs | 0 .../src/sys/{ => pal}/wasm/atomics/thread.rs | 0 library/std/src/sys/{ => pal}/wasm/env.rs | 0 library/std/src/sys/{ => pal}/wasm/mod.rs | 0 .../std/src/sys/{ => pal}/windows/alloc.rs | 0 .../src/sys/{ => pal}/windows/alloc/tests.rs | 0 library/std/src/sys/{ => pal}/windows/api.rs | 0 library/std/src/sys/{ => pal}/windows/args.rs | 0 .../src/sys/{ => pal}/windows/args/tests.rs | 0 library/std/src/sys/{ => pal}/windows/c.rs | 0 .../sys/{ => pal}/windows/c/windows_sys.lst | 0 .../sys/{ => pal}/windows/c/windows_sys.rs | 0 .../std/src/sys/{ => pal}/windows/cmath.rs | 0 .../std/src/sys/{ => pal}/windows/compat.rs | 0 library/std/src/sys/{ => pal}/windows/env.rs | 0 library/std/src/sys/{ => pal}/windows/fs.rs | 0 .../std/src/sys/{ => pal}/windows/handle.rs | 0 .../src/sys/{ => pal}/windows/handle/tests.rs | 0 library/std/src/sys/{ => pal}/windows/io.rs | 0 .../sys/{ => pal}/windows/locks/condvar.rs | 0 .../src/sys/{ => pal}/windows/locks/mod.rs | 0 .../src/sys/{ => pal}/windows/locks/mutex.rs | 0 .../src/sys/{ => pal}/windows/locks/rwlock.rs | 0 .../std/src/sys/{ => pal}/windows/memchr.rs | 0 library/std/src/sys/{ => pal}/windows/mod.rs | 0 library/std/src/sys/{ => pal}/windows/net.rs | 0 library/std/src/sys/{ => pal}/windows/os.rs | 0 .../std/src/sys/{ => pal}/windows/os/tests.rs | 0 .../std/src/sys/{ => pal}/windows/os_str.rs | 0 library/std/src/sys/{ => pal}/windows/path.rs | 0 .../src/sys/{ => pal}/windows/path/tests.rs | 0 library/std/src/sys/{ => pal}/windows/pipe.rs | 0 .../std/src/sys/{ => pal}/windows/process.rs | 0 .../sys/{ => pal}/windows/process/tests.rs | 0 library/std/src/sys/{ => pal}/windows/rand.rs | 0 .../sys/{ => pal}/windows/stack_overflow.rs | 0 .../{ => pal}/windows/stack_overflow_uwp.rs | 0 .../std/src/sys/{ => pal}/windows/stdio.rs | 0 .../src/sys/{ => pal}/windows/stdio/tests.rs | 0 .../std/src/sys/{ => pal}/windows/thread.rs | 0 .../{ => pal}/windows/thread_local_dtor.rs | 0 .../sys/{ => pal}/windows/thread_local_key.rs | 0 .../windows/thread_local_key/tests.rs | 0 .../sys/{ => pal}/windows/thread_parking.rs | 0 library/std/src/sys/{ => pal}/windows/time.rs | 0 library/std/src/sys/{ => pal}/xous/alloc.rs | 0 .../src/sys/{ => pal}/xous/locks/condvar.rs | 0 .../std/src/sys/{ => pal}/xous/locks/mod.rs | 0 .../std/src/sys/{ => pal}/xous/locks/mutex.rs | 0 .../src/sys/{ => pal}/xous/locks/rwlock.rs | 0 library/std/src/sys/{ => pal}/xous/mod.rs | 0 library/std/src/sys/{ => pal}/xous/os.rs | 0 library/std/src/sys/{ => pal}/xous/stdio.rs | 0 library/std/src/sys/{ => pal}/xous/thread.rs | 0 .../sys/{ => pal}/xous/thread_local_key.rs | 0 .../src/sys/{ => pal}/xous/thread_parking.rs | 0 library/std/src/sys/{ => pal}/xous/time.rs | 0 259 files changed, 132 insertions(+), 124 deletions(-) rename library/std/src/sys/{ => pal}/common/alloc.rs (100%) rename library/std/src/sys/{ => pal}/common/mod.rs (100%) rename library/std/src/sys/{ => pal}/common/small_c_string.rs (100%) rename library/std/src/sys/{ => pal}/common/tests.rs (100%) rename library/std/src/sys/{ => pal}/common/thread_local/fast_local.rs (100%) rename library/std/src/sys/{ => pal}/common/thread_local/mod.rs (100%) rename library/std/src/sys/{ => pal}/common/thread_local/os_local.rs (100%) rename library/std/src/sys/{ => pal}/common/thread_local/static_local.rs (100%) rename library/std/src/sys/{ => pal}/hermit/alloc.rs (100%) rename library/std/src/sys/{ => pal}/hermit/args.rs (100%) rename library/std/src/sys/{ => pal}/hermit/env.rs (100%) rename library/std/src/sys/{ => pal}/hermit/fd.rs (100%) rename library/std/src/sys/{ => pal}/hermit/fs.rs (100%) rename library/std/src/sys/{ => pal}/hermit/futex.rs (100%) rename library/std/src/sys/{ => pal}/hermit/memchr.rs (100%) rename library/std/src/sys/{ => pal}/hermit/mod.rs (100%) rename library/std/src/sys/{ => pal}/hermit/net.rs (100%) rename library/std/src/sys/{ => pal}/hermit/os.rs (100%) rename library/std/src/sys/{ => pal}/hermit/stdio.rs (100%) rename library/std/src/sys/{ => pal}/hermit/thread.rs (100%) rename library/std/src/sys/{ => pal}/hermit/thread_local_dtor.rs (100%) rename library/std/src/sys/{ => pal}/hermit/time.rs (100%) rename library/std/src/sys/{ => pal}/itron/abi.rs (100%) rename library/std/src/sys/{ => pal}/itron/condvar.rs (100%) rename library/std/src/sys/{ => pal}/itron/error.rs (100%) rename library/std/src/sys/{ => pal}/itron/mutex.rs (100%) rename library/std/src/sys/{ => pal}/itron/spin.rs (100%) rename library/std/src/sys/{ => pal}/itron/task.rs (100%) rename library/std/src/sys/{ => pal}/itron/thread.rs (100%) rename library/std/src/sys/{ => pal}/itron/thread_parking.rs (100%) rename library/std/src/sys/{ => pal}/itron/time.rs (100%) rename library/std/src/sys/{ => pal}/itron/time/tests.rs (100%) create mode 100644 library/std/src/sys/pal/mod.rs rename library/std/src/sys/{ => pal}/personality/dwarf/eh.rs (100%) rename library/std/src/sys/{ => pal}/personality/dwarf/mod.rs (100%) rename library/std/src/sys/{ => pal}/personality/dwarf/tests.rs (100%) rename library/std/src/sys/{ => pal}/personality/emcc.rs (100%) rename library/std/src/sys/{ => pal}/personality/gcc.rs (100%) rename library/std/src/sys/{ => pal}/personality/mod.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/entry.S (100%) rename library/std/src/sys/{ => pal}/sgx/abi/mem.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/mod.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/panic.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/reloc.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/thread.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/tls/mod.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/tls/sync_bitset.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/tls/sync_bitset/tests.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/usercalls/alloc.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/usercalls/mod.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/usercalls/raw.rs (100%) rename library/std/src/sys/{ => pal}/sgx/abi/usercalls/tests.rs (100%) rename library/std/src/sys/{ => pal}/sgx/alloc.rs (100%) rename library/std/src/sys/{ => pal}/sgx/args.rs (100%) rename library/std/src/sys/{ => pal}/sgx/condvar.rs (100%) rename library/std/src/sys/{ => pal}/sgx/env.rs (100%) rename library/std/src/sys/{ => pal}/sgx/fd.rs (100%) rename library/std/src/sys/{ => pal}/sgx/memchr.rs (100%) rename library/std/src/sys/{ => pal}/sgx/mod.rs (100%) rename library/std/src/sys/{ => pal}/sgx/mutex.rs (100%) rename library/std/src/sys/{ => pal}/sgx/net.rs (100%) rename library/std/src/sys/{ => pal}/sgx/os.rs (100%) rename library/std/src/sys/{ => pal}/sgx/path.rs (100%) rename library/std/src/sys/{ => pal}/sgx/rwlock.rs (100%) rename library/std/src/sys/{ => pal}/sgx/rwlock/tests.rs (100%) rename library/std/src/sys/{ => pal}/sgx/stdio.rs (100%) rename library/std/src/sys/{ => pal}/sgx/thread.rs (100%) rename library/std/src/sys/{ => pal}/sgx/thread_local_key.rs (100%) rename library/std/src/sys/{ => pal}/sgx/thread_parking.rs (100%) rename library/std/src/sys/{ => pal}/sgx/time.rs (100%) rename library/std/src/sys/{ => pal}/sgx/waitqueue/mod.rs (100%) rename library/std/src/sys/{ => pal}/sgx/waitqueue/spin_mutex.rs (100%) rename library/std/src/sys/{ => pal}/sgx/waitqueue/spin_mutex/tests.rs (100%) rename library/std/src/sys/{ => pal}/sgx/waitqueue/tests.rs (100%) rename library/std/src/sys/{ => pal}/sgx/waitqueue/unsafe_list.rs (100%) rename library/std/src/sys/{ => pal}/sgx/waitqueue/unsafe_list/tests.rs (100%) rename library/std/src/sys/{ => pal}/solid/abi/fs.rs (100%) rename library/std/src/sys/{ => pal}/solid/abi/mod.rs (100%) rename library/std/src/sys/{ => pal}/solid/abi/sockets.rs (100%) rename library/std/src/sys/{ => pal}/solid/alloc.rs (100%) rename library/std/src/sys/{ => pal}/solid/env.rs (100%) rename library/std/src/sys/{ => pal}/solid/error.rs (100%) rename library/std/src/sys/{ => pal}/solid/fs.rs (100%) rename library/std/src/sys/{ => pal}/solid/io.rs (100%) rename library/std/src/sys/{ => pal}/solid/memchr.rs (100%) rename library/std/src/sys/{ => pal}/solid/mod.rs (100%) rename library/std/src/sys/{ => pal}/solid/net.rs (100%) rename library/std/src/sys/{ => pal}/solid/os.rs (100%) rename library/std/src/sys/{ => pal}/solid/path.rs (100%) rename library/std/src/sys/{ => pal}/solid/rwlock.rs (100%) rename library/std/src/sys/{ => pal}/solid/stdio.rs (100%) rename library/std/src/sys/{ => pal}/solid/thread_local_dtor.rs (100%) rename library/std/src/sys/{ => pal}/solid/thread_local_key.rs (100%) rename library/std/src/sys/{ => pal}/solid/time.rs (100%) rename library/std/src/sys/{ => pal}/teeos/alloc.rs (100%) rename library/std/src/sys/{ => pal}/teeos/locks/condvar.rs (100%) rename library/std/src/sys/{ => pal}/teeos/locks/mod.rs (100%) rename library/std/src/sys/{ => pal}/teeos/locks/rwlock.rs (100%) rename library/std/src/sys/{ => pal}/teeos/mod.rs (100%) rename library/std/src/sys/{ => pal}/teeos/net.rs (100%) rename library/std/src/sys/{ => pal}/teeos/os.rs (100%) rename library/std/src/sys/{ => pal}/teeos/rand.rs (100%) rename library/std/src/sys/{ => pal}/teeos/stdio.rs (100%) rename library/std/src/sys/{ => pal}/teeos/thread.rs (100%) rename library/std/src/sys/{ => pal}/teeos/thread_local_dtor.rs (100%) rename library/std/src/sys/{ => pal}/uefi/alloc.rs (100%) rename library/std/src/sys/{ => pal}/uefi/args.rs (100%) rename library/std/src/sys/{ => pal}/uefi/env.rs (100%) rename library/std/src/sys/{ => pal}/uefi/helpers.rs (100%) rename library/std/src/sys/{ => pal}/uefi/mod.rs (100%) rename library/std/src/sys/{ => pal}/uefi/os.rs (100%) rename library/std/src/sys/{ => pal}/uefi/path.rs (100%) rename library/std/src/sys/{ => pal}/uefi/stdio.rs (100%) rename library/std/src/sys/{ => pal}/uefi/tests.rs (100%) rename library/std/src/sys/{ => pal}/unix/alloc.rs (100%) rename library/std/src/sys/{ => pal}/unix/android.rs (100%) rename library/std/src/sys/{ => pal}/unix/args.rs (100%) rename library/std/src/sys/{ => pal}/unix/cmath.rs (100%) rename library/std/src/sys/{ => pal}/unix/env.rs (100%) rename library/std/src/sys/{ => pal}/unix/fd.rs (100%) rename library/std/src/sys/{ => pal}/unix/fd/tests.rs (100%) rename library/std/src/sys/{ => pal}/unix/fs.rs (100%) rename library/std/src/sys/{ => pal}/unix/futex.rs (100%) rename library/std/src/sys/{ => pal}/unix/io.rs (100%) rename library/std/src/sys/{ => pal}/unix/kernel_copy.rs (100%) rename library/std/src/sys/{ => pal}/unix/kernel_copy/tests.rs (100%) rename library/std/src/sys/{ => pal}/unix/l4re.rs (100%) rename library/std/src/sys/{ => pal}/unix/locks/fuchsia_mutex.rs (100%) rename library/std/src/sys/{ => pal}/unix/locks/futex_condvar.rs (100%) rename library/std/src/sys/{ => pal}/unix/locks/futex_mutex.rs (100%) rename library/std/src/sys/{ => pal}/unix/locks/futex_rwlock.rs (100%) rename library/std/src/sys/{ => pal}/unix/locks/mod.rs (100%) rename library/std/src/sys/{ => pal}/unix/locks/pthread_condvar.rs (100%) rename library/std/src/sys/{ => pal}/unix/locks/pthread_mutex.rs (100%) rename library/std/src/sys/{ => pal}/unix/locks/pthread_rwlock.rs (100%) rename library/std/src/sys/{ => pal}/unix/memchr.rs (100%) rename library/std/src/sys/{ => pal}/unix/mod.rs (100%) rename library/std/src/sys/{ => pal}/unix/net.rs (100%) rename library/std/src/sys/{ => pal}/unix/os.rs (100%) rename library/std/src/sys/{ => pal}/unix/os/tests.rs (100%) rename library/std/src/sys/{ => pal}/unix/os_str.rs (100%) rename library/std/src/sys/{ => pal}/unix/os_str/tests.rs (100%) rename library/std/src/sys/{ => pal}/unix/path.rs (100%) rename library/std/src/sys/{ => pal}/unix/pipe.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/mod.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_common.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_common/tests.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_fuchsia.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_unix.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_unix/tests.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_unsupported.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_unsupported/wait_status.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_unsupported/wait_status/tests.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/process_vxworks.rs (100%) rename library/std/src/sys/{ => pal}/unix/process/zircon.rs (100%) rename library/std/src/sys/{ => pal}/unix/rand.rs (100%) rename library/std/src/sys/{ => pal}/unix/stack_overflow.rs (100%) rename library/std/src/sys/{ => pal}/unix/stdio.rs (100%) rename library/std/src/sys/{ => pal}/unix/thread.rs (100%) rename library/std/src/sys/{ => pal}/unix/thread_local_dtor.rs (100%) rename library/std/src/sys/{ => pal}/unix/thread_local_key.rs (100%) rename library/std/src/sys/{ => pal}/unix/thread_parking/darwin.rs (100%) rename library/std/src/sys/{ => pal}/unix/thread_parking/mod.rs (100%) rename library/std/src/sys/{ => pal}/unix/thread_parking/netbsd.rs (100%) rename library/std/src/sys/{ => pal}/unix/thread_parking/pthread.rs (100%) rename library/std/src/sys/{ => pal}/unix/time.rs (100%) rename library/std/src/sys/{ => pal}/unix/weak.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/alloc.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/args.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/common.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/env.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/fs.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/io.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/locks/condvar.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/locks/mod.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/locks/mutex.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/locks/rwlock.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/mod.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/net.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/once.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/os.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/pipe.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/process.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/stdio.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/thread.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/thread_local_dtor.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/thread_local_key.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/thread_parking.rs (100%) rename library/std/src/sys/{ => pal}/unsupported/time.rs (100%) rename library/std/src/sys/{ => pal}/wasi/args.rs (100%) rename library/std/src/sys/{ => pal}/wasi/env.rs (100%) rename library/std/src/sys/{ => pal}/wasi/fd.rs (100%) rename library/std/src/sys/{ => pal}/wasi/fs.rs (100%) rename library/std/src/sys/{ => pal}/wasi/io.rs (100%) rename library/std/src/sys/{ => pal}/wasi/mod.rs (100%) rename library/std/src/sys/{ => pal}/wasi/net.rs (100%) rename library/std/src/sys/{ => pal}/wasi/os.rs (100%) rename library/std/src/sys/{ => pal}/wasi/stdio.rs (100%) rename library/std/src/sys/{ => pal}/wasi/thread.rs (100%) rename library/std/src/sys/{ => pal}/wasi/time.rs (100%) rename library/std/src/sys/{ => pal}/wasm/alloc.rs (100%) rename library/std/src/sys/{ => pal}/wasm/atomics/futex.rs (100%) rename library/std/src/sys/{ => pal}/wasm/atomics/thread.rs (100%) rename library/std/src/sys/{ => pal}/wasm/env.rs (100%) rename library/std/src/sys/{ => pal}/wasm/mod.rs (100%) rename library/std/src/sys/{ => pal}/windows/alloc.rs (100%) rename library/std/src/sys/{ => pal}/windows/alloc/tests.rs (100%) rename library/std/src/sys/{ => pal}/windows/api.rs (100%) rename library/std/src/sys/{ => pal}/windows/args.rs (100%) rename library/std/src/sys/{ => pal}/windows/args/tests.rs (100%) rename library/std/src/sys/{ => pal}/windows/c.rs (100%) rename library/std/src/sys/{ => pal}/windows/c/windows_sys.lst (100%) rename library/std/src/sys/{ => pal}/windows/c/windows_sys.rs (100%) rename library/std/src/sys/{ => pal}/windows/cmath.rs (100%) rename library/std/src/sys/{ => pal}/windows/compat.rs (100%) rename library/std/src/sys/{ => pal}/windows/env.rs (100%) rename library/std/src/sys/{ => pal}/windows/fs.rs (100%) rename library/std/src/sys/{ => pal}/windows/handle.rs (100%) rename library/std/src/sys/{ => pal}/windows/handle/tests.rs (100%) rename library/std/src/sys/{ => pal}/windows/io.rs (100%) rename library/std/src/sys/{ => pal}/windows/locks/condvar.rs (100%) rename library/std/src/sys/{ => pal}/windows/locks/mod.rs (100%) rename library/std/src/sys/{ => pal}/windows/locks/mutex.rs (100%) rename library/std/src/sys/{ => pal}/windows/locks/rwlock.rs (100%) rename library/std/src/sys/{ => pal}/windows/memchr.rs (100%) rename library/std/src/sys/{ => pal}/windows/mod.rs (100%) rename library/std/src/sys/{ => pal}/windows/net.rs (100%) rename library/std/src/sys/{ => pal}/windows/os.rs (100%) rename library/std/src/sys/{ => pal}/windows/os/tests.rs (100%) rename library/std/src/sys/{ => pal}/windows/os_str.rs (100%) rename library/std/src/sys/{ => pal}/windows/path.rs (100%) rename library/std/src/sys/{ => pal}/windows/path/tests.rs (100%) rename library/std/src/sys/{ => pal}/windows/pipe.rs (100%) rename library/std/src/sys/{ => pal}/windows/process.rs (100%) rename library/std/src/sys/{ => pal}/windows/process/tests.rs (100%) rename library/std/src/sys/{ => pal}/windows/rand.rs (100%) rename library/std/src/sys/{ => pal}/windows/stack_overflow.rs (100%) rename library/std/src/sys/{ => pal}/windows/stack_overflow_uwp.rs (100%) rename library/std/src/sys/{ => pal}/windows/stdio.rs (100%) rename library/std/src/sys/{ => pal}/windows/stdio/tests.rs (100%) rename library/std/src/sys/{ => pal}/windows/thread.rs (100%) rename library/std/src/sys/{ => pal}/windows/thread_local_dtor.rs (100%) rename library/std/src/sys/{ => pal}/windows/thread_local_key.rs (100%) rename library/std/src/sys/{ => pal}/windows/thread_local_key/tests.rs (100%) rename library/std/src/sys/{ => pal}/windows/thread_parking.rs (100%) rename library/std/src/sys/{ => pal}/windows/time.rs (100%) rename library/std/src/sys/{ => pal}/xous/alloc.rs (100%) rename library/std/src/sys/{ => pal}/xous/locks/condvar.rs (100%) rename library/std/src/sys/{ => pal}/xous/locks/mod.rs (100%) rename library/std/src/sys/{ => pal}/xous/locks/mutex.rs (100%) rename library/std/src/sys/{ => pal}/xous/locks/rwlock.rs (100%) rename library/std/src/sys/{ => pal}/xous/mod.rs (100%) rename library/std/src/sys/{ => pal}/xous/os.rs (100%) rename library/std/src/sys/{ => pal}/xous/stdio.rs (100%) rename library/std/src/sys/{ => pal}/xous/thread.rs (100%) rename library/std/src/sys/{ => pal}/xous/thread_local_key.rs (100%) rename library/std/src/sys/{ => pal}/xous/thread_parking.rs (100%) rename library/std/src/sys/{ => pal}/xous/time.rs (100%) diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs index 88420bd3612c8..0cd4528b69e15 100644 --- a/library/std/src/sys/mod.rs +++ b/library/std/src/sys/mod.rs @@ -1,124 +1,8 @@ -//! Platform-dependent platform abstraction. -//! -//! The `std::sys` module is the abstracted interface through which -//! `std` talks to the underlying operating system. It has different -//! implementations for different operating system families, today -//! just Unix and Windows, and initial support for Redox. -//! -//! The centralization of platform-specific code in this module is -//! enforced by the "platform abstraction layer" tidy script in -//! `tools/tidy/src/pal.rs`. -//! -//! This module is closely related to the platform-independent system -//! integration code in `std::sys_common`. See that module's -//! documentation for details. -//! -//! In the future it would be desirable for the independent -//! implementations of this module to be extracted to their own crates -//! that `std` can link to, thus enabling their implementation -//! out-of-tree via crate replacement. Though due to the complex -//! inter-dependencies within `std` that will be a challenging goal to -//! achieve. - -#![allow(missing_debug_implementations)] - -pub mod common; -mod personality; - -cfg_if::cfg_if! { - if #[cfg(unix)] { - mod unix; - pub use self::unix::*; - } else if #[cfg(windows)] { - mod windows; - pub use self::windows::*; - } else if #[cfg(target_os = "solid_asp3")] { - mod solid; - pub use self::solid::*; - } else if #[cfg(target_os = "hermit")] { - mod hermit; - pub use self::hermit::*; - } else if #[cfg(target_os = "wasi")] { - mod wasi; - pub use self::wasi::*; - } else if #[cfg(target_family = "wasm")] { - mod wasm; - pub use self::wasm::*; - } else if #[cfg(target_os = "xous")] { - mod xous; - pub use self::xous::*; - } else if #[cfg(target_os = "uefi")] { - mod uefi; - pub use self::uefi::*; - } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { - mod sgx; - pub use self::sgx::*; - } else if #[cfg(target_os = "teeos")] { - mod teeos; - pub use self::teeos::*; - } else { - mod unsupported; - pub use self::unsupported::*; - } -} - -cfg_if::cfg_if! { - // Fuchsia components default to full backtrace. - if #[cfg(target_os = "fuchsia")] { - pub const FULL_BACKTRACE_DEFAULT: bool = true; - } else { - pub const FULL_BACKTRACE_DEFAULT: bool = false; - } -} - -#[cfg(not(test))] -cfg_if::cfg_if! { - if #[cfg(target_os = "android")] { - pub use self::android::log2f32; - pub use self::android::log2f64; - } else { - #[inline] - pub fn log2f32(n: f32) -> f32 { - unsafe { crate::intrinsics::log2f32(n) } - } - - #[inline] - pub fn log2f64(n: f64) -> f64 { - unsafe { crate::intrinsics::log2f64(n) } - } - } -} - -// Solaris/Illumos requires a wrapper around log, log2, and log10 functions -// because of their non-standard behavior (e.g., log(-n) returns -Inf instead -// of expected NaN). -#[cfg(not(test))] -#[cfg(any(target_os = "solaris", target_os = "illumos"))] -#[inline] -pub fn log_wrapper f64>(n: f64, log_fn: F) -> f64 { - if n.is_finite() { - if n > 0.0 { - log_fn(n) - } else if n == 0.0 { - f64::NEG_INFINITY // log(0) = -Inf - } else { - f64::NAN // log(-n) = NaN - } - } else if n.is_nan() { - n // log(NaN) = NaN - } else if n > 0.0 { - n // log(Inf) = Inf - } else { - f64::NAN // log(-Inf) = NaN - } -} - -#[cfg(not(test))] -#[cfg(not(any(target_os = "solaris", target_os = "illumos")))] -#[inline] -pub fn log_wrapper f64>(n: f64, log_fn: F) -> f64 { - log_fn(n) -} - -#[cfg(not(target_os = "uefi"))] -pub type RawOsError = i32; +/// The PAL (platform abstraction layer) contains platform-specific abstractions +/// for implementing the features in the other submodules, e.g. UNIX file +/// descriptors. +mod pal; + +// FIXME(117276): remove this, move feature implementations into individual +// submodules. +pub use pal::*; diff --git a/library/std/src/sys/common/alloc.rs b/library/std/src/sys/pal/common/alloc.rs similarity index 100% rename from library/std/src/sys/common/alloc.rs rename to library/std/src/sys/pal/common/alloc.rs diff --git a/library/std/src/sys/common/mod.rs b/library/std/src/sys/pal/common/mod.rs similarity index 100% rename from library/std/src/sys/common/mod.rs rename to library/std/src/sys/pal/common/mod.rs diff --git a/library/std/src/sys/common/small_c_string.rs b/library/std/src/sys/pal/common/small_c_string.rs similarity index 100% rename from library/std/src/sys/common/small_c_string.rs rename to library/std/src/sys/pal/common/small_c_string.rs diff --git a/library/std/src/sys/common/tests.rs b/library/std/src/sys/pal/common/tests.rs similarity index 100% rename from library/std/src/sys/common/tests.rs rename to library/std/src/sys/pal/common/tests.rs diff --git a/library/std/src/sys/common/thread_local/fast_local.rs b/library/std/src/sys/pal/common/thread_local/fast_local.rs similarity index 100% rename from library/std/src/sys/common/thread_local/fast_local.rs rename to library/std/src/sys/pal/common/thread_local/fast_local.rs diff --git a/library/std/src/sys/common/thread_local/mod.rs b/library/std/src/sys/pal/common/thread_local/mod.rs similarity index 100% rename from library/std/src/sys/common/thread_local/mod.rs rename to library/std/src/sys/pal/common/thread_local/mod.rs diff --git a/library/std/src/sys/common/thread_local/os_local.rs b/library/std/src/sys/pal/common/thread_local/os_local.rs similarity index 100% rename from library/std/src/sys/common/thread_local/os_local.rs rename to library/std/src/sys/pal/common/thread_local/os_local.rs diff --git a/library/std/src/sys/common/thread_local/static_local.rs b/library/std/src/sys/pal/common/thread_local/static_local.rs similarity index 100% rename from library/std/src/sys/common/thread_local/static_local.rs rename to library/std/src/sys/pal/common/thread_local/static_local.rs diff --git a/library/std/src/sys/hermit/alloc.rs b/library/std/src/sys/pal/hermit/alloc.rs similarity index 100% rename from library/std/src/sys/hermit/alloc.rs rename to library/std/src/sys/pal/hermit/alloc.rs diff --git a/library/std/src/sys/hermit/args.rs b/library/std/src/sys/pal/hermit/args.rs similarity index 100% rename from library/std/src/sys/hermit/args.rs rename to library/std/src/sys/pal/hermit/args.rs diff --git a/library/std/src/sys/hermit/env.rs b/library/std/src/sys/pal/hermit/env.rs similarity index 100% rename from library/std/src/sys/hermit/env.rs rename to library/std/src/sys/pal/hermit/env.rs diff --git a/library/std/src/sys/hermit/fd.rs b/library/std/src/sys/pal/hermit/fd.rs similarity index 100% rename from library/std/src/sys/hermit/fd.rs rename to library/std/src/sys/pal/hermit/fd.rs diff --git a/library/std/src/sys/hermit/fs.rs b/library/std/src/sys/pal/hermit/fs.rs similarity index 100% rename from library/std/src/sys/hermit/fs.rs rename to library/std/src/sys/pal/hermit/fs.rs diff --git a/library/std/src/sys/hermit/futex.rs b/library/std/src/sys/pal/hermit/futex.rs similarity index 100% rename from library/std/src/sys/hermit/futex.rs rename to library/std/src/sys/pal/hermit/futex.rs diff --git a/library/std/src/sys/hermit/memchr.rs b/library/std/src/sys/pal/hermit/memchr.rs similarity index 100% rename from library/std/src/sys/hermit/memchr.rs rename to library/std/src/sys/pal/hermit/memchr.rs diff --git a/library/std/src/sys/hermit/mod.rs b/library/std/src/sys/pal/hermit/mod.rs similarity index 100% rename from library/std/src/sys/hermit/mod.rs rename to library/std/src/sys/pal/hermit/mod.rs diff --git a/library/std/src/sys/hermit/net.rs b/library/std/src/sys/pal/hermit/net.rs similarity index 100% rename from library/std/src/sys/hermit/net.rs rename to library/std/src/sys/pal/hermit/net.rs diff --git a/library/std/src/sys/hermit/os.rs b/library/std/src/sys/pal/hermit/os.rs similarity index 100% rename from library/std/src/sys/hermit/os.rs rename to library/std/src/sys/pal/hermit/os.rs diff --git a/library/std/src/sys/hermit/stdio.rs b/library/std/src/sys/pal/hermit/stdio.rs similarity index 100% rename from library/std/src/sys/hermit/stdio.rs rename to library/std/src/sys/pal/hermit/stdio.rs diff --git a/library/std/src/sys/hermit/thread.rs b/library/std/src/sys/pal/hermit/thread.rs similarity index 100% rename from library/std/src/sys/hermit/thread.rs rename to library/std/src/sys/pal/hermit/thread.rs diff --git a/library/std/src/sys/hermit/thread_local_dtor.rs b/library/std/src/sys/pal/hermit/thread_local_dtor.rs similarity index 100% rename from library/std/src/sys/hermit/thread_local_dtor.rs rename to library/std/src/sys/pal/hermit/thread_local_dtor.rs diff --git a/library/std/src/sys/hermit/time.rs b/library/std/src/sys/pal/hermit/time.rs similarity index 100% rename from library/std/src/sys/hermit/time.rs rename to library/std/src/sys/pal/hermit/time.rs diff --git a/library/std/src/sys/itron/abi.rs b/library/std/src/sys/pal/itron/abi.rs similarity index 100% rename from library/std/src/sys/itron/abi.rs rename to library/std/src/sys/pal/itron/abi.rs diff --git a/library/std/src/sys/itron/condvar.rs b/library/std/src/sys/pal/itron/condvar.rs similarity index 100% rename from library/std/src/sys/itron/condvar.rs rename to library/std/src/sys/pal/itron/condvar.rs diff --git a/library/std/src/sys/itron/error.rs b/library/std/src/sys/pal/itron/error.rs similarity index 100% rename from library/std/src/sys/itron/error.rs rename to library/std/src/sys/pal/itron/error.rs diff --git a/library/std/src/sys/itron/mutex.rs b/library/std/src/sys/pal/itron/mutex.rs similarity index 100% rename from library/std/src/sys/itron/mutex.rs rename to library/std/src/sys/pal/itron/mutex.rs diff --git a/library/std/src/sys/itron/spin.rs b/library/std/src/sys/pal/itron/spin.rs similarity index 100% rename from library/std/src/sys/itron/spin.rs rename to library/std/src/sys/pal/itron/spin.rs diff --git a/library/std/src/sys/itron/task.rs b/library/std/src/sys/pal/itron/task.rs similarity index 100% rename from library/std/src/sys/itron/task.rs rename to library/std/src/sys/pal/itron/task.rs diff --git a/library/std/src/sys/itron/thread.rs b/library/std/src/sys/pal/itron/thread.rs similarity index 100% rename from library/std/src/sys/itron/thread.rs rename to library/std/src/sys/pal/itron/thread.rs diff --git a/library/std/src/sys/itron/thread_parking.rs b/library/std/src/sys/pal/itron/thread_parking.rs similarity index 100% rename from library/std/src/sys/itron/thread_parking.rs rename to library/std/src/sys/pal/itron/thread_parking.rs diff --git a/library/std/src/sys/itron/time.rs b/library/std/src/sys/pal/itron/time.rs similarity index 100% rename from library/std/src/sys/itron/time.rs rename to library/std/src/sys/pal/itron/time.rs diff --git a/library/std/src/sys/itron/time/tests.rs b/library/std/src/sys/pal/itron/time/tests.rs similarity index 100% rename from library/std/src/sys/itron/time/tests.rs rename to library/std/src/sys/pal/itron/time/tests.rs diff --git a/library/std/src/sys/pal/mod.rs b/library/std/src/sys/pal/mod.rs new file mode 100644 index 0000000000000..88420bd3612c8 --- /dev/null +++ b/library/std/src/sys/pal/mod.rs @@ -0,0 +1,124 @@ +//! Platform-dependent platform abstraction. +//! +//! The `std::sys` module is the abstracted interface through which +//! `std` talks to the underlying operating system. It has different +//! implementations for different operating system families, today +//! just Unix and Windows, and initial support for Redox. +//! +//! The centralization of platform-specific code in this module is +//! enforced by the "platform abstraction layer" tidy script in +//! `tools/tidy/src/pal.rs`. +//! +//! This module is closely related to the platform-independent system +//! integration code in `std::sys_common`. See that module's +//! documentation for details. +//! +//! In the future it would be desirable for the independent +//! implementations of this module to be extracted to their own crates +//! that `std` can link to, thus enabling their implementation +//! out-of-tree via crate replacement. Though due to the complex +//! inter-dependencies within `std` that will be a challenging goal to +//! achieve. + +#![allow(missing_debug_implementations)] + +pub mod common; +mod personality; + +cfg_if::cfg_if! { + if #[cfg(unix)] { + mod unix; + pub use self::unix::*; + } else if #[cfg(windows)] { + mod windows; + pub use self::windows::*; + } else if #[cfg(target_os = "solid_asp3")] { + mod solid; + pub use self::solid::*; + } else if #[cfg(target_os = "hermit")] { + mod hermit; + pub use self::hermit::*; + } else if #[cfg(target_os = "wasi")] { + mod wasi; + pub use self::wasi::*; + } else if #[cfg(target_family = "wasm")] { + mod wasm; + pub use self::wasm::*; + } else if #[cfg(target_os = "xous")] { + mod xous; + pub use self::xous::*; + } else if #[cfg(target_os = "uefi")] { + mod uefi; + pub use self::uefi::*; + } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] { + mod sgx; + pub use self::sgx::*; + } else if #[cfg(target_os = "teeos")] { + mod teeos; + pub use self::teeos::*; + } else { + mod unsupported; + pub use self::unsupported::*; + } +} + +cfg_if::cfg_if! { + // Fuchsia components default to full backtrace. + if #[cfg(target_os = "fuchsia")] { + pub const FULL_BACKTRACE_DEFAULT: bool = true; + } else { + pub const FULL_BACKTRACE_DEFAULT: bool = false; + } +} + +#[cfg(not(test))] +cfg_if::cfg_if! { + if #[cfg(target_os = "android")] { + pub use self::android::log2f32; + pub use self::android::log2f64; + } else { + #[inline] + pub fn log2f32(n: f32) -> f32 { + unsafe { crate::intrinsics::log2f32(n) } + } + + #[inline] + pub fn log2f64(n: f64) -> f64 { + unsafe { crate::intrinsics::log2f64(n) } + } + } +} + +// Solaris/Illumos requires a wrapper around log, log2, and log10 functions +// because of their non-standard behavior (e.g., log(-n) returns -Inf instead +// of expected NaN). +#[cfg(not(test))] +#[cfg(any(target_os = "solaris", target_os = "illumos"))] +#[inline] +pub fn log_wrapper f64>(n: f64, log_fn: F) -> f64 { + if n.is_finite() { + if n > 0.0 { + log_fn(n) + } else if n == 0.0 { + f64::NEG_INFINITY // log(0) = -Inf + } else { + f64::NAN // log(-n) = NaN + } + } else if n.is_nan() { + n // log(NaN) = NaN + } else if n > 0.0 { + n // log(Inf) = Inf + } else { + f64::NAN // log(-Inf) = NaN + } +} + +#[cfg(not(test))] +#[cfg(not(any(target_os = "solaris", target_os = "illumos")))] +#[inline] +pub fn log_wrapper f64>(n: f64, log_fn: F) -> f64 { + log_fn(n) +} + +#[cfg(not(target_os = "uefi"))] +pub type RawOsError = i32; diff --git a/library/std/src/sys/personality/dwarf/eh.rs b/library/std/src/sys/pal/personality/dwarf/eh.rs similarity index 100% rename from library/std/src/sys/personality/dwarf/eh.rs rename to library/std/src/sys/pal/personality/dwarf/eh.rs diff --git a/library/std/src/sys/personality/dwarf/mod.rs b/library/std/src/sys/pal/personality/dwarf/mod.rs similarity index 100% rename from library/std/src/sys/personality/dwarf/mod.rs rename to library/std/src/sys/pal/personality/dwarf/mod.rs diff --git a/library/std/src/sys/personality/dwarf/tests.rs b/library/std/src/sys/pal/personality/dwarf/tests.rs similarity index 100% rename from library/std/src/sys/personality/dwarf/tests.rs rename to library/std/src/sys/pal/personality/dwarf/tests.rs diff --git a/library/std/src/sys/personality/emcc.rs b/library/std/src/sys/pal/personality/emcc.rs similarity index 100% rename from library/std/src/sys/personality/emcc.rs rename to library/std/src/sys/pal/personality/emcc.rs diff --git a/library/std/src/sys/personality/gcc.rs b/library/std/src/sys/pal/personality/gcc.rs similarity index 100% rename from library/std/src/sys/personality/gcc.rs rename to library/std/src/sys/pal/personality/gcc.rs diff --git a/library/std/src/sys/personality/mod.rs b/library/std/src/sys/pal/personality/mod.rs similarity index 100% rename from library/std/src/sys/personality/mod.rs rename to library/std/src/sys/pal/personality/mod.rs diff --git a/library/std/src/sys/sgx/abi/entry.S b/library/std/src/sys/pal/sgx/abi/entry.S similarity index 100% rename from library/std/src/sys/sgx/abi/entry.S rename to library/std/src/sys/pal/sgx/abi/entry.S diff --git a/library/std/src/sys/sgx/abi/mem.rs b/library/std/src/sys/pal/sgx/abi/mem.rs similarity index 100% rename from library/std/src/sys/sgx/abi/mem.rs rename to library/std/src/sys/pal/sgx/abi/mem.rs diff --git a/library/std/src/sys/sgx/abi/mod.rs b/library/std/src/sys/pal/sgx/abi/mod.rs similarity index 100% rename from library/std/src/sys/sgx/abi/mod.rs rename to library/std/src/sys/pal/sgx/abi/mod.rs diff --git a/library/std/src/sys/sgx/abi/panic.rs b/library/std/src/sys/pal/sgx/abi/panic.rs similarity index 100% rename from library/std/src/sys/sgx/abi/panic.rs rename to library/std/src/sys/pal/sgx/abi/panic.rs diff --git a/library/std/src/sys/sgx/abi/reloc.rs b/library/std/src/sys/pal/sgx/abi/reloc.rs similarity index 100% rename from library/std/src/sys/sgx/abi/reloc.rs rename to library/std/src/sys/pal/sgx/abi/reloc.rs diff --git a/library/std/src/sys/sgx/abi/thread.rs b/library/std/src/sys/pal/sgx/abi/thread.rs similarity index 100% rename from library/std/src/sys/sgx/abi/thread.rs rename to library/std/src/sys/pal/sgx/abi/thread.rs diff --git a/library/std/src/sys/sgx/abi/tls/mod.rs b/library/std/src/sys/pal/sgx/abi/tls/mod.rs similarity index 100% rename from library/std/src/sys/sgx/abi/tls/mod.rs rename to library/std/src/sys/pal/sgx/abi/tls/mod.rs diff --git a/library/std/src/sys/sgx/abi/tls/sync_bitset.rs b/library/std/src/sys/pal/sgx/abi/tls/sync_bitset.rs similarity index 100% rename from library/std/src/sys/sgx/abi/tls/sync_bitset.rs rename to library/std/src/sys/pal/sgx/abi/tls/sync_bitset.rs diff --git a/library/std/src/sys/sgx/abi/tls/sync_bitset/tests.rs b/library/std/src/sys/pal/sgx/abi/tls/sync_bitset/tests.rs similarity index 100% rename from library/std/src/sys/sgx/abi/tls/sync_bitset/tests.rs rename to library/std/src/sys/pal/sgx/abi/tls/sync_bitset/tests.rs diff --git a/library/std/src/sys/sgx/abi/usercalls/alloc.rs b/library/std/src/sys/pal/sgx/abi/usercalls/alloc.rs similarity index 100% rename from library/std/src/sys/sgx/abi/usercalls/alloc.rs rename to library/std/src/sys/pal/sgx/abi/usercalls/alloc.rs diff --git a/library/std/src/sys/sgx/abi/usercalls/mod.rs b/library/std/src/sys/pal/sgx/abi/usercalls/mod.rs similarity index 100% rename from library/std/src/sys/sgx/abi/usercalls/mod.rs rename to library/std/src/sys/pal/sgx/abi/usercalls/mod.rs diff --git a/library/std/src/sys/sgx/abi/usercalls/raw.rs b/library/std/src/sys/pal/sgx/abi/usercalls/raw.rs similarity index 100% rename from library/std/src/sys/sgx/abi/usercalls/raw.rs rename to library/std/src/sys/pal/sgx/abi/usercalls/raw.rs diff --git a/library/std/src/sys/sgx/abi/usercalls/tests.rs b/library/std/src/sys/pal/sgx/abi/usercalls/tests.rs similarity index 100% rename from library/std/src/sys/sgx/abi/usercalls/tests.rs rename to library/std/src/sys/pal/sgx/abi/usercalls/tests.rs diff --git a/library/std/src/sys/sgx/alloc.rs b/library/std/src/sys/pal/sgx/alloc.rs similarity index 100% rename from library/std/src/sys/sgx/alloc.rs rename to library/std/src/sys/pal/sgx/alloc.rs diff --git a/library/std/src/sys/sgx/args.rs b/library/std/src/sys/pal/sgx/args.rs similarity index 100% rename from library/std/src/sys/sgx/args.rs rename to library/std/src/sys/pal/sgx/args.rs diff --git a/library/std/src/sys/sgx/condvar.rs b/library/std/src/sys/pal/sgx/condvar.rs similarity index 100% rename from library/std/src/sys/sgx/condvar.rs rename to library/std/src/sys/pal/sgx/condvar.rs diff --git a/library/std/src/sys/sgx/env.rs b/library/std/src/sys/pal/sgx/env.rs similarity index 100% rename from library/std/src/sys/sgx/env.rs rename to library/std/src/sys/pal/sgx/env.rs diff --git a/library/std/src/sys/sgx/fd.rs b/library/std/src/sys/pal/sgx/fd.rs similarity index 100% rename from library/std/src/sys/sgx/fd.rs rename to library/std/src/sys/pal/sgx/fd.rs diff --git a/library/std/src/sys/sgx/memchr.rs b/library/std/src/sys/pal/sgx/memchr.rs similarity index 100% rename from library/std/src/sys/sgx/memchr.rs rename to library/std/src/sys/pal/sgx/memchr.rs diff --git a/library/std/src/sys/sgx/mod.rs b/library/std/src/sys/pal/sgx/mod.rs similarity index 100% rename from library/std/src/sys/sgx/mod.rs rename to library/std/src/sys/pal/sgx/mod.rs diff --git a/library/std/src/sys/sgx/mutex.rs b/library/std/src/sys/pal/sgx/mutex.rs similarity index 100% rename from library/std/src/sys/sgx/mutex.rs rename to library/std/src/sys/pal/sgx/mutex.rs diff --git a/library/std/src/sys/sgx/net.rs b/library/std/src/sys/pal/sgx/net.rs similarity index 100% rename from library/std/src/sys/sgx/net.rs rename to library/std/src/sys/pal/sgx/net.rs diff --git a/library/std/src/sys/sgx/os.rs b/library/std/src/sys/pal/sgx/os.rs similarity index 100% rename from library/std/src/sys/sgx/os.rs rename to library/std/src/sys/pal/sgx/os.rs diff --git a/library/std/src/sys/sgx/path.rs b/library/std/src/sys/pal/sgx/path.rs similarity index 100% rename from library/std/src/sys/sgx/path.rs rename to library/std/src/sys/pal/sgx/path.rs diff --git a/library/std/src/sys/sgx/rwlock.rs b/library/std/src/sys/pal/sgx/rwlock.rs similarity index 100% rename from library/std/src/sys/sgx/rwlock.rs rename to library/std/src/sys/pal/sgx/rwlock.rs diff --git a/library/std/src/sys/sgx/rwlock/tests.rs b/library/std/src/sys/pal/sgx/rwlock/tests.rs similarity index 100% rename from library/std/src/sys/sgx/rwlock/tests.rs rename to library/std/src/sys/pal/sgx/rwlock/tests.rs diff --git a/library/std/src/sys/sgx/stdio.rs b/library/std/src/sys/pal/sgx/stdio.rs similarity index 100% rename from library/std/src/sys/sgx/stdio.rs rename to library/std/src/sys/pal/sgx/stdio.rs diff --git a/library/std/src/sys/sgx/thread.rs b/library/std/src/sys/pal/sgx/thread.rs similarity index 100% rename from library/std/src/sys/sgx/thread.rs rename to library/std/src/sys/pal/sgx/thread.rs diff --git a/library/std/src/sys/sgx/thread_local_key.rs b/library/std/src/sys/pal/sgx/thread_local_key.rs similarity index 100% rename from library/std/src/sys/sgx/thread_local_key.rs rename to library/std/src/sys/pal/sgx/thread_local_key.rs diff --git a/library/std/src/sys/sgx/thread_parking.rs b/library/std/src/sys/pal/sgx/thread_parking.rs similarity index 100% rename from library/std/src/sys/sgx/thread_parking.rs rename to library/std/src/sys/pal/sgx/thread_parking.rs diff --git a/library/std/src/sys/sgx/time.rs b/library/std/src/sys/pal/sgx/time.rs similarity index 100% rename from library/std/src/sys/sgx/time.rs rename to library/std/src/sys/pal/sgx/time.rs diff --git a/library/std/src/sys/sgx/waitqueue/mod.rs b/library/std/src/sys/pal/sgx/waitqueue/mod.rs similarity index 100% rename from library/std/src/sys/sgx/waitqueue/mod.rs rename to library/std/src/sys/pal/sgx/waitqueue/mod.rs diff --git a/library/std/src/sys/sgx/waitqueue/spin_mutex.rs b/library/std/src/sys/pal/sgx/waitqueue/spin_mutex.rs similarity index 100% rename from library/std/src/sys/sgx/waitqueue/spin_mutex.rs rename to library/std/src/sys/pal/sgx/waitqueue/spin_mutex.rs diff --git a/library/std/src/sys/sgx/waitqueue/spin_mutex/tests.rs b/library/std/src/sys/pal/sgx/waitqueue/spin_mutex/tests.rs similarity index 100% rename from library/std/src/sys/sgx/waitqueue/spin_mutex/tests.rs rename to library/std/src/sys/pal/sgx/waitqueue/spin_mutex/tests.rs diff --git a/library/std/src/sys/sgx/waitqueue/tests.rs b/library/std/src/sys/pal/sgx/waitqueue/tests.rs similarity index 100% rename from library/std/src/sys/sgx/waitqueue/tests.rs rename to library/std/src/sys/pal/sgx/waitqueue/tests.rs diff --git a/library/std/src/sys/sgx/waitqueue/unsafe_list.rs b/library/std/src/sys/pal/sgx/waitqueue/unsafe_list.rs similarity index 100% rename from library/std/src/sys/sgx/waitqueue/unsafe_list.rs rename to library/std/src/sys/pal/sgx/waitqueue/unsafe_list.rs diff --git a/library/std/src/sys/sgx/waitqueue/unsafe_list/tests.rs b/library/std/src/sys/pal/sgx/waitqueue/unsafe_list/tests.rs similarity index 100% rename from library/std/src/sys/sgx/waitqueue/unsafe_list/tests.rs rename to library/std/src/sys/pal/sgx/waitqueue/unsafe_list/tests.rs diff --git a/library/std/src/sys/solid/abi/fs.rs b/library/std/src/sys/pal/solid/abi/fs.rs similarity index 100% rename from library/std/src/sys/solid/abi/fs.rs rename to library/std/src/sys/pal/solid/abi/fs.rs diff --git a/library/std/src/sys/solid/abi/mod.rs b/library/std/src/sys/pal/solid/abi/mod.rs similarity index 100% rename from library/std/src/sys/solid/abi/mod.rs rename to library/std/src/sys/pal/solid/abi/mod.rs diff --git a/library/std/src/sys/solid/abi/sockets.rs b/library/std/src/sys/pal/solid/abi/sockets.rs similarity index 100% rename from library/std/src/sys/solid/abi/sockets.rs rename to library/std/src/sys/pal/solid/abi/sockets.rs diff --git a/library/std/src/sys/solid/alloc.rs b/library/std/src/sys/pal/solid/alloc.rs similarity index 100% rename from library/std/src/sys/solid/alloc.rs rename to library/std/src/sys/pal/solid/alloc.rs diff --git a/library/std/src/sys/solid/env.rs b/library/std/src/sys/pal/solid/env.rs similarity index 100% rename from library/std/src/sys/solid/env.rs rename to library/std/src/sys/pal/solid/env.rs diff --git a/library/std/src/sys/solid/error.rs b/library/std/src/sys/pal/solid/error.rs similarity index 100% rename from library/std/src/sys/solid/error.rs rename to library/std/src/sys/pal/solid/error.rs diff --git a/library/std/src/sys/solid/fs.rs b/library/std/src/sys/pal/solid/fs.rs similarity index 100% rename from library/std/src/sys/solid/fs.rs rename to library/std/src/sys/pal/solid/fs.rs diff --git a/library/std/src/sys/solid/io.rs b/library/std/src/sys/pal/solid/io.rs similarity index 100% rename from library/std/src/sys/solid/io.rs rename to library/std/src/sys/pal/solid/io.rs diff --git a/library/std/src/sys/solid/memchr.rs b/library/std/src/sys/pal/solid/memchr.rs similarity index 100% rename from library/std/src/sys/solid/memchr.rs rename to library/std/src/sys/pal/solid/memchr.rs diff --git a/library/std/src/sys/solid/mod.rs b/library/std/src/sys/pal/solid/mod.rs similarity index 100% rename from library/std/src/sys/solid/mod.rs rename to library/std/src/sys/pal/solid/mod.rs diff --git a/library/std/src/sys/solid/net.rs b/library/std/src/sys/pal/solid/net.rs similarity index 100% rename from library/std/src/sys/solid/net.rs rename to library/std/src/sys/pal/solid/net.rs diff --git a/library/std/src/sys/solid/os.rs b/library/std/src/sys/pal/solid/os.rs similarity index 100% rename from library/std/src/sys/solid/os.rs rename to library/std/src/sys/pal/solid/os.rs diff --git a/library/std/src/sys/solid/path.rs b/library/std/src/sys/pal/solid/path.rs similarity index 100% rename from library/std/src/sys/solid/path.rs rename to library/std/src/sys/pal/solid/path.rs diff --git a/library/std/src/sys/solid/rwlock.rs b/library/std/src/sys/pal/solid/rwlock.rs similarity index 100% rename from library/std/src/sys/solid/rwlock.rs rename to library/std/src/sys/pal/solid/rwlock.rs diff --git a/library/std/src/sys/solid/stdio.rs b/library/std/src/sys/pal/solid/stdio.rs similarity index 100% rename from library/std/src/sys/solid/stdio.rs rename to library/std/src/sys/pal/solid/stdio.rs diff --git a/library/std/src/sys/solid/thread_local_dtor.rs b/library/std/src/sys/pal/solid/thread_local_dtor.rs similarity index 100% rename from library/std/src/sys/solid/thread_local_dtor.rs rename to library/std/src/sys/pal/solid/thread_local_dtor.rs diff --git a/library/std/src/sys/solid/thread_local_key.rs b/library/std/src/sys/pal/solid/thread_local_key.rs similarity index 100% rename from library/std/src/sys/solid/thread_local_key.rs rename to library/std/src/sys/pal/solid/thread_local_key.rs diff --git a/library/std/src/sys/solid/time.rs b/library/std/src/sys/pal/solid/time.rs similarity index 100% rename from library/std/src/sys/solid/time.rs rename to library/std/src/sys/pal/solid/time.rs diff --git a/library/std/src/sys/teeos/alloc.rs b/library/std/src/sys/pal/teeos/alloc.rs similarity index 100% rename from library/std/src/sys/teeos/alloc.rs rename to library/std/src/sys/pal/teeos/alloc.rs diff --git a/library/std/src/sys/teeos/locks/condvar.rs b/library/std/src/sys/pal/teeos/locks/condvar.rs similarity index 100% rename from library/std/src/sys/teeos/locks/condvar.rs rename to library/std/src/sys/pal/teeos/locks/condvar.rs diff --git a/library/std/src/sys/teeos/locks/mod.rs b/library/std/src/sys/pal/teeos/locks/mod.rs similarity index 100% rename from library/std/src/sys/teeos/locks/mod.rs rename to library/std/src/sys/pal/teeos/locks/mod.rs diff --git a/library/std/src/sys/teeos/locks/rwlock.rs b/library/std/src/sys/pal/teeos/locks/rwlock.rs similarity index 100% rename from library/std/src/sys/teeos/locks/rwlock.rs rename to library/std/src/sys/pal/teeos/locks/rwlock.rs diff --git a/library/std/src/sys/teeos/mod.rs b/library/std/src/sys/pal/teeos/mod.rs similarity index 100% rename from library/std/src/sys/teeos/mod.rs rename to library/std/src/sys/pal/teeos/mod.rs diff --git a/library/std/src/sys/teeos/net.rs b/library/std/src/sys/pal/teeos/net.rs similarity index 100% rename from library/std/src/sys/teeos/net.rs rename to library/std/src/sys/pal/teeos/net.rs diff --git a/library/std/src/sys/teeos/os.rs b/library/std/src/sys/pal/teeos/os.rs similarity index 100% rename from library/std/src/sys/teeos/os.rs rename to library/std/src/sys/pal/teeos/os.rs diff --git a/library/std/src/sys/teeos/rand.rs b/library/std/src/sys/pal/teeos/rand.rs similarity index 100% rename from library/std/src/sys/teeos/rand.rs rename to library/std/src/sys/pal/teeos/rand.rs diff --git a/library/std/src/sys/teeos/stdio.rs b/library/std/src/sys/pal/teeos/stdio.rs similarity index 100% rename from library/std/src/sys/teeos/stdio.rs rename to library/std/src/sys/pal/teeos/stdio.rs diff --git a/library/std/src/sys/teeos/thread.rs b/library/std/src/sys/pal/teeos/thread.rs similarity index 100% rename from library/std/src/sys/teeos/thread.rs rename to library/std/src/sys/pal/teeos/thread.rs diff --git a/library/std/src/sys/teeos/thread_local_dtor.rs b/library/std/src/sys/pal/teeos/thread_local_dtor.rs similarity index 100% rename from library/std/src/sys/teeos/thread_local_dtor.rs rename to library/std/src/sys/pal/teeos/thread_local_dtor.rs diff --git a/library/std/src/sys/uefi/alloc.rs b/library/std/src/sys/pal/uefi/alloc.rs similarity index 100% rename from library/std/src/sys/uefi/alloc.rs rename to library/std/src/sys/pal/uefi/alloc.rs diff --git a/library/std/src/sys/uefi/args.rs b/library/std/src/sys/pal/uefi/args.rs similarity index 100% rename from library/std/src/sys/uefi/args.rs rename to library/std/src/sys/pal/uefi/args.rs diff --git a/library/std/src/sys/uefi/env.rs b/library/std/src/sys/pal/uefi/env.rs similarity index 100% rename from library/std/src/sys/uefi/env.rs rename to library/std/src/sys/pal/uefi/env.rs diff --git a/library/std/src/sys/uefi/helpers.rs b/library/std/src/sys/pal/uefi/helpers.rs similarity index 100% rename from library/std/src/sys/uefi/helpers.rs rename to library/std/src/sys/pal/uefi/helpers.rs diff --git a/library/std/src/sys/uefi/mod.rs b/library/std/src/sys/pal/uefi/mod.rs similarity index 100% rename from library/std/src/sys/uefi/mod.rs rename to library/std/src/sys/pal/uefi/mod.rs diff --git a/library/std/src/sys/uefi/os.rs b/library/std/src/sys/pal/uefi/os.rs similarity index 100% rename from library/std/src/sys/uefi/os.rs rename to library/std/src/sys/pal/uefi/os.rs diff --git a/library/std/src/sys/uefi/path.rs b/library/std/src/sys/pal/uefi/path.rs similarity index 100% rename from library/std/src/sys/uefi/path.rs rename to library/std/src/sys/pal/uefi/path.rs diff --git a/library/std/src/sys/uefi/stdio.rs b/library/std/src/sys/pal/uefi/stdio.rs similarity index 100% rename from library/std/src/sys/uefi/stdio.rs rename to library/std/src/sys/pal/uefi/stdio.rs diff --git a/library/std/src/sys/uefi/tests.rs b/library/std/src/sys/pal/uefi/tests.rs similarity index 100% rename from library/std/src/sys/uefi/tests.rs rename to library/std/src/sys/pal/uefi/tests.rs diff --git a/library/std/src/sys/unix/alloc.rs b/library/std/src/sys/pal/unix/alloc.rs similarity index 100% rename from library/std/src/sys/unix/alloc.rs rename to library/std/src/sys/pal/unix/alloc.rs diff --git a/library/std/src/sys/unix/android.rs b/library/std/src/sys/pal/unix/android.rs similarity index 100% rename from library/std/src/sys/unix/android.rs rename to library/std/src/sys/pal/unix/android.rs diff --git a/library/std/src/sys/unix/args.rs b/library/std/src/sys/pal/unix/args.rs similarity index 100% rename from library/std/src/sys/unix/args.rs rename to library/std/src/sys/pal/unix/args.rs diff --git a/library/std/src/sys/unix/cmath.rs b/library/std/src/sys/pal/unix/cmath.rs similarity index 100% rename from library/std/src/sys/unix/cmath.rs rename to library/std/src/sys/pal/unix/cmath.rs diff --git a/library/std/src/sys/unix/env.rs b/library/std/src/sys/pal/unix/env.rs similarity index 100% rename from library/std/src/sys/unix/env.rs rename to library/std/src/sys/pal/unix/env.rs diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/pal/unix/fd.rs similarity index 100% rename from library/std/src/sys/unix/fd.rs rename to library/std/src/sys/pal/unix/fd.rs diff --git a/library/std/src/sys/unix/fd/tests.rs b/library/std/src/sys/pal/unix/fd/tests.rs similarity index 100% rename from library/std/src/sys/unix/fd/tests.rs rename to library/std/src/sys/pal/unix/fd/tests.rs diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs similarity index 100% rename from library/std/src/sys/unix/fs.rs rename to library/std/src/sys/pal/unix/fs.rs diff --git a/library/std/src/sys/unix/futex.rs b/library/std/src/sys/pal/unix/futex.rs similarity index 100% rename from library/std/src/sys/unix/futex.rs rename to library/std/src/sys/pal/unix/futex.rs diff --git a/library/std/src/sys/unix/io.rs b/library/std/src/sys/pal/unix/io.rs similarity index 100% rename from library/std/src/sys/unix/io.rs rename to library/std/src/sys/pal/unix/io.rs diff --git a/library/std/src/sys/unix/kernel_copy.rs b/library/std/src/sys/pal/unix/kernel_copy.rs similarity index 100% rename from library/std/src/sys/unix/kernel_copy.rs rename to library/std/src/sys/pal/unix/kernel_copy.rs diff --git a/library/std/src/sys/unix/kernel_copy/tests.rs b/library/std/src/sys/pal/unix/kernel_copy/tests.rs similarity index 100% rename from library/std/src/sys/unix/kernel_copy/tests.rs rename to library/std/src/sys/pal/unix/kernel_copy/tests.rs diff --git a/library/std/src/sys/unix/l4re.rs b/library/std/src/sys/pal/unix/l4re.rs similarity index 100% rename from library/std/src/sys/unix/l4re.rs rename to library/std/src/sys/pal/unix/l4re.rs diff --git a/library/std/src/sys/unix/locks/fuchsia_mutex.rs b/library/std/src/sys/pal/unix/locks/fuchsia_mutex.rs similarity index 100% rename from library/std/src/sys/unix/locks/fuchsia_mutex.rs rename to library/std/src/sys/pal/unix/locks/fuchsia_mutex.rs diff --git a/library/std/src/sys/unix/locks/futex_condvar.rs b/library/std/src/sys/pal/unix/locks/futex_condvar.rs similarity index 100% rename from library/std/src/sys/unix/locks/futex_condvar.rs rename to library/std/src/sys/pal/unix/locks/futex_condvar.rs diff --git a/library/std/src/sys/unix/locks/futex_mutex.rs b/library/std/src/sys/pal/unix/locks/futex_mutex.rs similarity index 100% rename from library/std/src/sys/unix/locks/futex_mutex.rs rename to library/std/src/sys/pal/unix/locks/futex_mutex.rs diff --git a/library/std/src/sys/unix/locks/futex_rwlock.rs b/library/std/src/sys/pal/unix/locks/futex_rwlock.rs similarity index 100% rename from library/std/src/sys/unix/locks/futex_rwlock.rs rename to library/std/src/sys/pal/unix/locks/futex_rwlock.rs diff --git a/library/std/src/sys/unix/locks/mod.rs b/library/std/src/sys/pal/unix/locks/mod.rs similarity index 100% rename from library/std/src/sys/unix/locks/mod.rs rename to library/std/src/sys/pal/unix/locks/mod.rs diff --git a/library/std/src/sys/unix/locks/pthread_condvar.rs b/library/std/src/sys/pal/unix/locks/pthread_condvar.rs similarity index 100% rename from library/std/src/sys/unix/locks/pthread_condvar.rs rename to library/std/src/sys/pal/unix/locks/pthread_condvar.rs diff --git a/library/std/src/sys/unix/locks/pthread_mutex.rs b/library/std/src/sys/pal/unix/locks/pthread_mutex.rs similarity index 100% rename from library/std/src/sys/unix/locks/pthread_mutex.rs rename to library/std/src/sys/pal/unix/locks/pthread_mutex.rs diff --git a/library/std/src/sys/unix/locks/pthread_rwlock.rs b/library/std/src/sys/pal/unix/locks/pthread_rwlock.rs similarity index 100% rename from library/std/src/sys/unix/locks/pthread_rwlock.rs rename to library/std/src/sys/pal/unix/locks/pthread_rwlock.rs diff --git a/library/std/src/sys/unix/memchr.rs b/library/std/src/sys/pal/unix/memchr.rs similarity index 100% rename from library/std/src/sys/unix/memchr.rs rename to library/std/src/sys/pal/unix/memchr.rs diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs similarity index 100% rename from library/std/src/sys/unix/mod.rs rename to library/std/src/sys/pal/unix/mod.rs diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/pal/unix/net.rs similarity index 100% rename from library/std/src/sys/unix/net.rs rename to library/std/src/sys/pal/unix/net.rs diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/pal/unix/os.rs similarity index 100% rename from library/std/src/sys/unix/os.rs rename to library/std/src/sys/pal/unix/os.rs diff --git a/library/std/src/sys/unix/os/tests.rs b/library/std/src/sys/pal/unix/os/tests.rs similarity index 100% rename from library/std/src/sys/unix/os/tests.rs rename to library/std/src/sys/pal/unix/os/tests.rs diff --git a/library/std/src/sys/unix/os_str.rs b/library/std/src/sys/pal/unix/os_str.rs similarity index 100% rename from library/std/src/sys/unix/os_str.rs rename to library/std/src/sys/pal/unix/os_str.rs diff --git a/library/std/src/sys/unix/os_str/tests.rs b/library/std/src/sys/pal/unix/os_str/tests.rs similarity index 100% rename from library/std/src/sys/unix/os_str/tests.rs rename to library/std/src/sys/pal/unix/os_str/tests.rs diff --git a/library/std/src/sys/unix/path.rs b/library/std/src/sys/pal/unix/path.rs similarity index 100% rename from library/std/src/sys/unix/path.rs rename to library/std/src/sys/pal/unix/path.rs diff --git a/library/std/src/sys/unix/pipe.rs b/library/std/src/sys/pal/unix/pipe.rs similarity index 100% rename from library/std/src/sys/unix/pipe.rs rename to library/std/src/sys/pal/unix/pipe.rs diff --git a/library/std/src/sys/unix/process/mod.rs b/library/std/src/sys/pal/unix/process/mod.rs similarity index 100% rename from library/std/src/sys/unix/process/mod.rs rename to library/std/src/sys/pal/unix/process/mod.rs diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/pal/unix/process/process_common.rs similarity index 100% rename from library/std/src/sys/unix/process/process_common.rs rename to library/std/src/sys/pal/unix/process/process_common.rs diff --git a/library/std/src/sys/unix/process/process_common/tests.rs b/library/std/src/sys/pal/unix/process/process_common/tests.rs similarity index 100% rename from library/std/src/sys/unix/process/process_common/tests.rs rename to library/std/src/sys/pal/unix/process/process_common/tests.rs diff --git a/library/std/src/sys/unix/process/process_fuchsia.rs b/library/std/src/sys/pal/unix/process/process_fuchsia.rs similarity index 100% rename from library/std/src/sys/unix/process/process_fuchsia.rs rename to library/std/src/sys/pal/unix/process/process_fuchsia.rs diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs similarity index 100% rename from library/std/src/sys/unix/process/process_unix.rs rename to library/std/src/sys/pal/unix/process/process_unix.rs diff --git a/library/std/src/sys/unix/process/process_unix/tests.rs b/library/std/src/sys/pal/unix/process/process_unix/tests.rs similarity index 100% rename from library/std/src/sys/unix/process/process_unix/tests.rs rename to library/std/src/sys/pal/unix/process/process_unix/tests.rs diff --git a/library/std/src/sys/unix/process/process_unsupported.rs b/library/std/src/sys/pal/unix/process/process_unsupported.rs similarity index 100% rename from library/std/src/sys/unix/process/process_unsupported.rs rename to library/std/src/sys/pal/unix/process/process_unsupported.rs diff --git a/library/std/src/sys/unix/process/process_unsupported/wait_status.rs b/library/std/src/sys/pal/unix/process/process_unsupported/wait_status.rs similarity index 100% rename from library/std/src/sys/unix/process/process_unsupported/wait_status.rs rename to library/std/src/sys/pal/unix/process/process_unsupported/wait_status.rs diff --git a/library/std/src/sys/unix/process/process_unsupported/wait_status/tests.rs b/library/std/src/sys/pal/unix/process/process_unsupported/wait_status/tests.rs similarity index 100% rename from library/std/src/sys/unix/process/process_unsupported/wait_status/tests.rs rename to library/std/src/sys/pal/unix/process/process_unsupported/wait_status/tests.rs diff --git a/library/std/src/sys/unix/process/process_vxworks.rs b/library/std/src/sys/pal/unix/process/process_vxworks.rs similarity index 100% rename from library/std/src/sys/unix/process/process_vxworks.rs rename to library/std/src/sys/pal/unix/process/process_vxworks.rs diff --git a/library/std/src/sys/unix/process/zircon.rs b/library/std/src/sys/pal/unix/process/zircon.rs similarity index 100% rename from library/std/src/sys/unix/process/zircon.rs rename to library/std/src/sys/pal/unix/process/zircon.rs diff --git a/library/std/src/sys/unix/rand.rs b/library/std/src/sys/pal/unix/rand.rs similarity index 100% rename from library/std/src/sys/unix/rand.rs rename to library/std/src/sys/pal/unix/rand.rs diff --git a/library/std/src/sys/unix/stack_overflow.rs b/library/std/src/sys/pal/unix/stack_overflow.rs similarity index 100% rename from library/std/src/sys/unix/stack_overflow.rs rename to library/std/src/sys/pal/unix/stack_overflow.rs diff --git a/library/std/src/sys/unix/stdio.rs b/library/std/src/sys/pal/unix/stdio.rs similarity index 100% rename from library/std/src/sys/unix/stdio.rs rename to library/std/src/sys/pal/unix/stdio.rs diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs similarity index 100% rename from library/std/src/sys/unix/thread.rs rename to library/std/src/sys/pal/unix/thread.rs diff --git a/library/std/src/sys/unix/thread_local_dtor.rs b/library/std/src/sys/pal/unix/thread_local_dtor.rs similarity index 100% rename from library/std/src/sys/unix/thread_local_dtor.rs rename to library/std/src/sys/pal/unix/thread_local_dtor.rs diff --git a/library/std/src/sys/unix/thread_local_key.rs b/library/std/src/sys/pal/unix/thread_local_key.rs similarity index 100% rename from library/std/src/sys/unix/thread_local_key.rs rename to library/std/src/sys/pal/unix/thread_local_key.rs diff --git a/library/std/src/sys/unix/thread_parking/darwin.rs b/library/std/src/sys/pal/unix/thread_parking/darwin.rs similarity index 100% rename from library/std/src/sys/unix/thread_parking/darwin.rs rename to library/std/src/sys/pal/unix/thread_parking/darwin.rs diff --git a/library/std/src/sys/unix/thread_parking/mod.rs b/library/std/src/sys/pal/unix/thread_parking/mod.rs similarity index 100% rename from library/std/src/sys/unix/thread_parking/mod.rs rename to library/std/src/sys/pal/unix/thread_parking/mod.rs diff --git a/library/std/src/sys/unix/thread_parking/netbsd.rs b/library/std/src/sys/pal/unix/thread_parking/netbsd.rs similarity index 100% rename from library/std/src/sys/unix/thread_parking/netbsd.rs rename to library/std/src/sys/pal/unix/thread_parking/netbsd.rs diff --git a/library/std/src/sys/unix/thread_parking/pthread.rs b/library/std/src/sys/pal/unix/thread_parking/pthread.rs similarity index 100% rename from library/std/src/sys/unix/thread_parking/pthread.rs rename to library/std/src/sys/pal/unix/thread_parking/pthread.rs diff --git a/library/std/src/sys/unix/time.rs b/library/std/src/sys/pal/unix/time.rs similarity index 100% rename from library/std/src/sys/unix/time.rs rename to library/std/src/sys/pal/unix/time.rs diff --git a/library/std/src/sys/unix/weak.rs b/library/std/src/sys/pal/unix/weak.rs similarity index 100% rename from library/std/src/sys/unix/weak.rs rename to library/std/src/sys/pal/unix/weak.rs diff --git a/library/std/src/sys/unsupported/alloc.rs b/library/std/src/sys/pal/unsupported/alloc.rs similarity index 100% rename from library/std/src/sys/unsupported/alloc.rs rename to library/std/src/sys/pal/unsupported/alloc.rs diff --git a/library/std/src/sys/unsupported/args.rs b/library/std/src/sys/pal/unsupported/args.rs similarity index 100% rename from library/std/src/sys/unsupported/args.rs rename to library/std/src/sys/pal/unsupported/args.rs diff --git a/library/std/src/sys/unsupported/common.rs b/library/std/src/sys/pal/unsupported/common.rs similarity index 100% rename from library/std/src/sys/unsupported/common.rs rename to library/std/src/sys/pal/unsupported/common.rs diff --git a/library/std/src/sys/unsupported/env.rs b/library/std/src/sys/pal/unsupported/env.rs similarity index 100% rename from library/std/src/sys/unsupported/env.rs rename to library/std/src/sys/pal/unsupported/env.rs diff --git a/library/std/src/sys/unsupported/fs.rs b/library/std/src/sys/pal/unsupported/fs.rs similarity index 100% rename from library/std/src/sys/unsupported/fs.rs rename to library/std/src/sys/pal/unsupported/fs.rs diff --git a/library/std/src/sys/unsupported/io.rs b/library/std/src/sys/pal/unsupported/io.rs similarity index 100% rename from library/std/src/sys/unsupported/io.rs rename to library/std/src/sys/pal/unsupported/io.rs diff --git a/library/std/src/sys/unsupported/locks/condvar.rs b/library/std/src/sys/pal/unsupported/locks/condvar.rs similarity index 100% rename from library/std/src/sys/unsupported/locks/condvar.rs rename to library/std/src/sys/pal/unsupported/locks/condvar.rs diff --git a/library/std/src/sys/unsupported/locks/mod.rs b/library/std/src/sys/pal/unsupported/locks/mod.rs similarity index 100% rename from library/std/src/sys/unsupported/locks/mod.rs rename to library/std/src/sys/pal/unsupported/locks/mod.rs diff --git a/library/std/src/sys/unsupported/locks/mutex.rs b/library/std/src/sys/pal/unsupported/locks/mutex.rs similarity index 100% rename from library/std/src/sys/unsupported/locks/mutex.rs rename to library/std/src/sys/pal/unsupported/locks/mutex.rs diff --git a/library/std/src/sys/unsupported/locks/rwlock.rs b/library/std/src/sys/pal/unsupported/locks/rwlock.rs similarity index 100% rename from library/std/src/sys/unsupported/locks/rwlock.rs rename to library/std/src/sys/pal/unsupported/locks/rwlock.rs diff --git a/library/std/src/sys/unsupported/mod.rs b/library/std/src/sys/pal/unsupported/mod.rs similarity index 100% rename from library/std/src/sys/unsupported/mod.rs rename to library/std/src/sys/pal/unsupported/mod.rs diff --git a/library/std/src/sys/unsupported/net.rs b/library/std/src/sys/pal/unsupported/net.rs similarity index 100% rename from library/std/src/sys/unsupported/net.rs rename to library/std/src/sys/pal/unsupported/net.rs diff --git a/library/std/src/sys/unsupported/once.rs b/library/std/src/sys/pal/unsupported/once.rs similarity index 100% rename from library/std/src/sys/unsupported/once.rs rename to library/std/src/sys/pal/unsupported/once.rs diff --git a/library/std/src/sys/unsupported/os.rs b/library/std/src/sys/pal/unsupported/os.rs similarity index 100% rename from library/std/src/sys/unsupported/os.rs rename to library/std/src/sys/pal/unsupported/os.rs diff --git a/library/std/src/sys/unsupported/pipe.rs b/library/std/src/sys/pal/unsupported/pipe.rs similarity index 100% rename from library/std/src/sys/unsupported/pipe.rs rename to library/std/src/sys/pal/unsupported/pipe.rs diff --git a/library/std/src/sys/unsupported/process.rs b/library/std/src/sys/pal/unsupported/process.rs similarity index 100% rename from library/std/src/sys/unsupported/process.rs rename to library/std/src/sys/pal/unsupported/process.rs diff --git a/library/std/src/sys/unsupported/stdio.rs b/library/std/src/sys/pal/unsupported/stdio.rs similarity index 100% rename from library/std/src/sys/unsupported/stdio.rs rename to library/std/src/sys/pal/unsupported/stdio.rs diff --git a/library/std/src/sys/unsupported/thread.rs b/library/std/src/sys/pal/unsupported/thread.rs similarity index 100% rename from library/std/src/sys/unsupported/thread.rs rename to library/std/src/sys/pal/unsupported/thread.rs diff --git a/library/std/src/sys/unsupported/thread_local_dtor.rs b/library/std/src/sys/pal/unsupported/thread_local_dtor.rs similarity index 100% rename from library/std/src/sys/unsupported/thread_local_dtor.rs rename to library/std/src/sys/pal/unsupported/thread_local_dtor.rs diff --git a/library/std/src/sys/unsupported/thread_local_key.rs b/library/std/src/sys/pal/unsupported/thread_local_key.rs similarity index 100% rename from library/std/src/sys/unsupported/thread_local_key.rs rename to library/std/src/sys/pal/unsupported/thread_local_key.rs diff --git a/library/std/src/sys/unsupported/thread_parking.rs b/library/std/src/sys/pal/unsupported/thread_parking.rs similarity index 100% rename from library/std/src/sys/unsupported/thread_parking.rs rename to library/std/src/sys/pal/unsupported/thread_parking.rs diff --git a/library/std/src/sys/unsupported/time.rs b/library/std/src/sys/pal/unsupported/time.rs similarity index 100% rename from library/std/src/sys/unsupported/time.rs rename to library/std/src/sys/pal/unsupported/time.rs diff --git a/library/std/src/sys/wasi/args.rs b/library/std/src/sys/pal/wasi/args.rs similarity index 100% rename from library/std/src/sys/wasi/args.rs rename to library/std/src/sys/pal/wasi/args.rs diff --git a/library/std/src/sys/wasi/env.rs b/library/std/src/sys/pal/wasi/env.rs similarity index 100% rename from library/std/src/sys/wasi/env.rs rename to library/std/src/sys/pal/wasi/env.rs diff --git a/library/std/src/sys/wasi/fd.rs b/library/std/src/sys/pal/wasi/fd.rs similarity index 100% rename from library/std/src/sys/wasi/fd.rs rename to library/std/src/sys/pal/wasi/fd.rs diff --git a/library/std/src/sys/wasi/fs.rs b/library/std/src/sys/pal/wasi/fs.rs similarity index 100% rename from library/std/src/sys/wasi/fs.rs rename to library/std/src/sys/pal/wasi/fs.rs diff --git a/library/std/src/sys/wasi/io.rs b/library/std/src/sys/pal/wasi/io.rs similarity index 100% rename from library/std/src/sys/wasi/io.rs rename to library/std/src/sys/pal/wasi/io.rs diff --git a/library/std/src/sys/wasi/mod.rs b/library/std/src/sys/pal/wasi/mod.rs similarity index 100% rename from library/std/src/sys/wasi/mod.rs rename to library/std/src/sys/pal/wasi/mod.rs diff --git a/library/std/src/sys/wasi/net.rs b/library/std/src/sys/pal/wasi/net.rs similarity index 100% rename from library/std/src/sys/wasi/net.rs rename to library/std/src/sys/pal/wasi/net.rs diff --git a/library/std/src/sys/wasi/os.rs b/library/std/src/sys/pal/wasi/os.rs similarity index 100% rename from library/std/src/sys/wasi/os.rs rename to library/std/src/sys/pal/wasi/os.rs diff --git a/library/std/src/sys/wasi/stdio.rs b/library/std/src/sys/pal/wasi/stdio.rs similarity index 100% rename from library/std/src/sys/wasi/stdio.rs rename to library/std/src/sys/pal/wasi/stdio.rs diff --git a/library/std/src/sys/wasi/thread.rs b/library/std/src/sys/pal/wasi/thread.rs similarity index 100% rename from library/std/src/sys/wasi/thread.rs rename to library/std/src/sys/pal/wasi/thread.rs diff --git a/library/std/src/sys/wasi/time.rs b/library/std/src/sys/pal/wasi/time.rs similarity index 100% rename from library/std/src/sys/wasi/time.rs rename to library/std/src/sys/pal/wasi/time.rs diff --git a/library/std/src/sys/wasm/alloc.rs b/library/std/src/sys/pal/wasm/alloc.rs similarity index 100% rename from library/std/src/sys/wasm/alloc.rs rename to library/std/src/sys/pal/wasm/alloc.rs diff --git a/library/std/src/sys/wasm/atomics/futex.rs b/library/std/src/sys/pal/wasm/atomics/futex.rs similarity index 100% rename from library/std/src/sys/wasm/atomics/futex.rs rename to library/std/src/sys/pal/wasm/atomics/futex.rs diff --git a/library/std/src/sys/wasm/atomics/thread.rs b/library/std/src/sys/pal/wasm/atomics/thread.rs similarity index 100% rename from library/std/src/sys/wasm/atomics/thread.rs rename to library/std/src/sys/pal/wasm/atomics/thread.rs diff --git a/library/std/src/sys/wasm/env.rs b/library/std/src/sys/pal/wasm/env.rs similarity index 100% rename from library/std/src/sys/wasm/env.rs rename to library/std/src/sys/pal/wasm/env.rs diff --git a/library/std/src/sys/wasm/mod.rs b/library/std/src/sys/pal/wasm/mod.rs similarity index 100% rename from library/std/src/sys/wasm/mod.rs rename to library/std/src/sys/pal/wasm/mod.rs diff --git a/library/std/src/sys/windows/alloc.rs b/library/std/src/sys/pal/windows/alloc.rs similarity index 100% rename from library/std/src/sys/windows/alloc.rs rename to library/std/src/sys/pal/windows/alloc.rs diff --git a/library/std/src/sys/windows/alloc/tests.rs b/library/std/src/sys/pal/windows/alloc/tests.rs similarity index 100% rename from library/std/src/sys/windows/alloc/tests.rs rename to library/std/src/sys/pal/windows/alloc/tests.rs diff --git a/library/std/src/sys/windows/api.rs b/library/std/src/sys/pal/windows/api.rs similarity index 100% rename from library/std/src/sys/windows/api.rs rename to library/std/src/sys/pal/windows/api.rs diff --git a/library/std/src/sys/windows/args.rs b/library/std/src/sys/pal/windows/args.rs similarity index 100% rename from library/std/src/sys/windows/args.rs rename to library/std/src/sys/pal/windows/args.rs diff --git a/library/std/src/sys/windows/args/tests.rs b/library/std/src/sys/pal/windows/args/tests.rs similarity index 100% rename from library/std/src/sys/windows/args/tests.rs rename to library/std/src/sys/pal/windows/args/tests.rs diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/pal/windows/c.rs similarity index 100% rename from library/std/src/sys/windows/c.rs rename to library/std/src/sys/pal/windows/c.rs diff --git a/library/std/src/sys/windows/c/windows_sys.lst b/library/std/src/sys/pal/windows/c/windows_sys.lst similarity index 100% rename from library/std/src/sys/windows/c/windows_sys.lst rename to library/std/src/sys/pal/windows/c/windows_sys.lst diff --git a/library/std/src/sys/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs similarity index 100% rename from library/std/src/sys/windows/c/windows_sys.rs rename to library/std/src/sys/pal/windows/c/windows_sys.rs diff --git a/library/std/src/sys/windows/cmath.rs b/library/std/src/sys/pal/windows/cmath.rs similarity index 100% rename from library/std/src/sys/windows/cmath.rs rename to library/std/src/sys/pal/windows/cmath.rs diff --git a/library/std/src/sys/windows/compat.rs b/library/std/src/sys/pal/windows/compat.rs similarity index 100% rename from library/std/src/sys/windows/compat.rs rename to library/std/src/sys/pal/windows/compat.rs diff --git a/library/std/src/sys/windows/env.rs b/library/std/src/sys/pal/windows/env.rs similarity index 100% rename from library/std/src/sys/windows/env.rs rename to library/std/src/sys/pal/windows/env.rs diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/pal/windows/fs.rs similarity index 100% rename from library/std/src/sys/windows/fs.rs rename to library/std/src/sys/pal/windows/fs.rs diff --git a/library/std/src/sys/windows/handle.rs b/library/std/src/sys/pal/windows/handle.rs similarity index 100% rename from library/std/src/sys/windows/handle.rs rename to library/std/src/sys/pal/windows/handle.rs diff --git a/library/std/src/sys/windows/handle/tests.rs b/library/std/src/sys/pal/windows/handle/tests.rs similarity index 100% rename from library/std/src/sys/windows/handle/tests.rs rename to library/std/src/sys/pal/windows/handle/tests.rs diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/pal/windows/io.rs similarity index 100% rename from library/std/src/sys/windows/io.rs rename to library/std/src/sys/pal/windows/io.rs diff --git a/library/std/src/sys/windows/locks/condvar.rs b/library/std/src/sys/pal/windows/locks/condvar.rs similarity index 100% rename from library/std/src/sys/windows/locks/condvar.rs rename to library/std/src/sys/pal/windows/locks/condvar.rs diff --git a/library/std/src/sys/windows/locks/mod.rs b/library/std/src/sys/pal/windows/locks/mod.rs similarity index 100% rename from library/std/src/sys/windows/locks/mod.rs rename to library/std/src/sys/pal/windows/locks/mod.rs diff --git a/library/std/src/sys/windows/locks/mutex.rs b/library/std/src/sys/pal/windows/locks/mutex.rs similarity index 100% rename from library/std/src/sys/windows/locks/mutex.rs rename to library/std/src/sys/pal/windows/locks/mutex.rs diff --git a/library/std/src/sys/windows/locks/rwlock.rs b/library/std/src/sys/pal/windows/locks/rwlock.rs similarity index 100% rename from library/std/src/sys/windows/locks/rwlock.rs rename to library/std/src/sys/pal/windows/locks/rwlock.rs diff --git a/library/std/src/sys/windows/memchr.rs b/library/std/src/sys/pal/windows/memchr.rs similarity index 100% rename from library/std/src/sys/windows/memchr.rs rename to library/std/src/sys/pal/windows/memchr.rs diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs similarity index 100% rename from library/std/src/sys/windows/mod.rs rename to library/std/src/sys/pal/windows/mod.rs diff --git a/library/std/src/sys/windows/net.rs b/library/std/src/sys/pal/windows/net.rs similarity index 100% rename from library/std/src/sys/windows/net.rs rename to library/std/src/sys/pal/windows/net.rs diff --git a/library/std/src/sys/windows/os.rs b/library/std/src/sys/pal/windows/os.rs similarity index 100% rename from library/std/src/sys/windows/os.rs rename to library/std/src/sys/pal/windows/os.rs diff --git a/library/std/src/sys/windows/os/tests.rs b/library/std/src/sys/pal/windows/os/tests.rs similarity index 100% rename from library/std/src/sys/windows/os/tests.rs rename to library/std/src/sys/pal/windows/os/tests.rs diff --git a/library/std/src/sys/windows/os_str.rs b/library/std/src/sys/pal/windows/os_str.rs similarity index 100% rename from library/std/src/sys/windows/os_str.rs rename to library/std/src/sys/pal/windows/os_str.rs diff --git a/library/std/src/sys/windows/path.rs b/library/std/src/sys/pal/windows/path.rs similarity index 100% rename from library/std/src/sys/windows/path.rs rename to library/std/src/sys/pal/windows/path.rs diff --git a/library/std/src/sys/windows/path/tests.rs b/library/std/src/sys/pal/windows/path/tests.rs similarity index 100% rename from library/std/src/sys/windows/path/tests.rs rename to library/std/src/sys/pal/windows/path/tests.rs diff --git a/library/std/src/sys/windows/pipe.rs b/library/std/src/sys/pal/windows/pipe.rs similarity index 100% rename from library/std/src/sys/windows/pipe.rs rename to library/std/src/sys/pal/windows/pipe.rs diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/pal/windows/process.rs similarity index 100% rename from library/std/src/sys/windows/process.rs rename to library/std/src/sys/pal/windows/process.rs diff --git a/library/std/src/sys/windows/process/tests.rs b/library/std/src/sys/pal/windows/process/tests.rs similarity index 100% rename from library/std/src/sys/windows/process/tests.rs rename to library/std/src/sys/pal/windows/process/tests.rs diff --git a/library/std/src/sys/windows/rand.rs b/library/std/src/sys/pal/windows/rand.rs similarity index 100% rename from library/std/src/sys/windows/rand.rs rename to library/std/src/sys/pal/windows/rand.rs diff --git a/library/std/src/sys/windows/stack_overflow.rs b/library/std/src/sys/pal/windows/stack_overflow.rs similarity index 100% rename from library/std/src/sys/windows/stack_overflow.rs rename to library/std/src/sys/pal/windows/stack_overflow.rs diff --git a/library/std/src/sys/windows/stack_overflow_uwp.rs b/library/std/src/sys/pal/windows/stack_overflow_uwp.rs similarity index 100% rename from library/std/src/sys/windows/stack_overflow_uwp.rs rename to library/std/src/sys/pal/windows/stack_overflow_uwp.rs diff --git a/library/std/src/sys/windows/stdio.rs b/library/std/src/sys/pal/windows/stdio.rs similarity index 100% rename from library/std/src/sys/windows/stdio.rs rename to library/std/src/sys/pal/windows/stdio.rs diff --git a/library/std/src/sys/windows/stdio/tests.rs b/library/std/src/sys/pal/windows/stdio/tests.rs similarity index 100% rename from library/std/src/sys/windows/stdio/tests.rs rename to library/std/src/sys/pal/windows/stdio/tests.rs diff --git a/library/std/src/sys/windows/thread.rs b/library/std/src/sys/pal/windows/thread.rs similarity index 100% rename from library/std/src/sys/windows/thread.rs rename to library/std/src/sys/pal/windows/thread.rs diff --git a/library/std/src/sys/windows/thread_local_dtor.rs b/library/std/src/sys/pal/windows/thread_local_dtor.rs similarity index 100% rename from library/std/src/sys/windows/thread_local_dtor.rs rename to library/std/src/sys/pal/windows/thread_local_dtor.rs diff --git a/library/std/src/sys/windows/thread_local_key.rs b/library/std/src/sys/pal/windows/thread_local_key.rs similarity index 100% rename from library/std/src/sys/windows/thread_local_key.rs rename to library/std/src/sys/pal/windows/thread_local_key.rs diff --git a/library/std/src/sys/windows/thread_local_key/tests.rs b/library/std/src/sys/pal/windows/thread_local_key/tests.rs similarity index 100% rename from library/std/src/sys/windows/thread_local_key/tests.rs rename to library/std/src/sys/pal/windows/thread_local_key/tests.rs diff --git a/library/std/src/sys/windows/thread_parking.rs b/library/std/src/sys/pal/windows/thread_parking.rs similarity index 100% rename from library/std/src/sys/windows/thread_parking.rs rename to library/std/src/sys/pal/windows/thread_parking.rs diff --git a/library/std/src/sys/windows/time.rs b/library/std/src/sys/pal/windows/time.rs similarity index 100% rename from library/std/src/sys/windows/time.rs rename to library/std/src/sys/pal/windows/time.rs diff --git a/library/std/src/sys/xous/alloc.rs b/library/std/src/sys/pal/xous/alloc.rs similarity index 100% rename from library/std/src/sys/xous/alloc.rs rename to library/std/src/sys/pal/xous/alloc.rs diff --git a/library/std/src/sys/xous/locks/condvar.rs b/library/std/src/sys/pal/xous/locks/condvar.rs similarity index 100% rename from library/std/src/sys/xous/locks/condvar.rs rename to library/std/src/sys/pal/xous/locks/condvar.rs diff --git a/library/std/src/sys/xous/locks/mod.rs b/library/std/src/sys/pal/xous/locks/mod.rs similarity index 100% rename from library/std/src/sys/xous/locks/mod.rs rename to library/std/src/sys/pal/xous/locks/mod.rs diff --git a/library/std/src/sys/xous/locks/mutex.rs b/library/std/src/sys/pal/xous/locks/mutex.rs similarity index 100% rename from library/std/src/sys/xous/locks/mutex.rs rename to library/std/src/sys/pal/xous/locks/mutex.rs diff --git a/library/std/src/sys/xous/locks/rwlock.rs b/library/std/src/sys/pal/xous/locks/rwlock.rs similarity index 100% rename from library/std/src/sys/xous/locks/rwlock.rs rename to library/std/src/sys/pal/xous/locks/rwlock.rs diff --git a/library/std/src/sys/xous/mod.rs b/library/std/src/sys/pal/xous/mod.rs similarity index 100% rename from library/std/src/sys/xous/mod.rs rename to library/std/src/sys/pal/xous/mod.rs diff --git a/library/std/src/sys/xous/os.rs b/library/std/src/sys/pal/xous/os.rs similarity index 100% rename from library/std/src/sys/xous/os.rs rename to library/std/src/sys/pal/xous/os.rs diff --git a/library/std/src/sys/xous/stdio.rs b/library/std/src/sys/pal/xous/stdio.rs similarity index 100% rename from library/std/src/sys/xous/stdio.rs rename to library/std/src/sys/pal/xous/stdio.rs diff --git a/library/std/src/sys/xous/thread.rs b/library/std/src/sys/pal/xous/thread.rs similarity index 100% rename from library/std/src/sys/xous/thread.rs rename to library/std/src/sys/pal/xous/thread.rs diff --git a/library/std/src/sys/xous/thread_local_key.rs b/library/std/src/sys/pal/xous/thread_local_key.rs similarity index 100% rename from library/std/src/sys/xous/thread_local_key.rs rename to library/std/src/sys/pal/xous/thread_local_key.rs diff --git a/library/std/src/sys/xous/thread_parking.rs b/library/std/src/sys/pal/xous/thread_parking.rs similarity index 100% rename from library/std/src/sys/xous/thread_parking.rs rename to library/std/src/sys/pal/xous/thread_parking.rs diff --git a/library/std/src/sys/xous/time.rs b/library/std/src/sys/pal/xous/time.rs similarity index 100% rename from library/std/src/sys/xous/time.rs rename to library/std/src/sys/pal/xous/time.rs From 4da4958099f5ae9e9eaca745bd2cb4628eb82c7e Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:16:09 +0100 Subject: [PATCH 02/13] std: fix module references on hermit --- library/std/src/sys/pal/hermit/alloc.rs | 2 +- library/std/src/sys/pal/hermit/fd.rs | 2 +- library/std/src/sys/pal/hermit/fs.rs | 6 ++---- library/std/src/sys/pal/hermit/mod.rs | 2 +- library/std/src/sys/pal/hermit/net.rs | 2 +- library/std/src/sys/pal/hermit/os.rs | 2 +- library/std/src/sys/pal/hermit/stdio.rs | 2 +- library/std/src/sys/pal/hermit/thread.rs | 4 ++-- library/std/src/sys/pal/hermit/time.rs | 6 +++--- 9 files changed, 13 insertions(+), 15 deletions(-) diff --git a/library/std/src/sys/pal/hermit/alloc.rs b/library/std/src/sys/pal/hermit/alloc.rs index d153914e77e10..de550987a4357 100644 --- a/library/std/src/sys/pal/hermit/alloc.rs +++ b/library/std/src/sys/pal/hermit/alloc.rs @@ -1,6 +1,6 @@ +use super::abi; use crate::alloc::{GlobalAlloc, Layout, System}; use crate::ptr; -use crate::sys::hermit::abi; #[stable(feature = "alloc_system_type", since = "1.28.0")] unsafe impl GlobalAlloc for System { diff --git a/library/std/src/sys/pal/hermit/fd.rs b/library/std/src/sys/pal/hermit/fd.rs index ccde05aa1d7db..5eb828fea1f9e 100644 --- a/library/std/src/sys/pal/hermit/fd.rs +++ b/library/std/src/sys/pal/hermit/fd.rs @@ -1,9 +1,9 @@ #![unstable(reason = "not public", issue = "none", feature = "fd")] +use super::abi; use crate::io::{self, Read}; use crate::os::hermit::io::{FromRawFd, OwnedFd, RawFd}; use crate::sys::cvt; -use crate::sys::hermit::abi; use crate::sys::unsupported; use crate::sys_common::{AsInner, FromInner, IntoInner}; diff --git a/library/std/src/sys/pal/hermit/fs.rs b/library/std/src/sys/pal/hermit/fs.rs index 6aa4ea7f5b4fb..694482a8a30ac 100644 --- a/library/std/src/sys/pal/hermit/fs.rs +++ b/library/std/src/sys/pal/hermit/fs.rs @@ -1,3 +1,5 @@ +use super::abi::{self, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY}; +use super::fd::FileDesc; use crate::ffi::{CStr, OsString}; use crate::fmt; use crate::hash::{Hash, Hasher}; @@ -7,10 +9,6 @@ use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, Raw use crate::path::{Path, PathBuf}; use crate::sys::common::small_c_string::run_path_with_cstr; use crate::sys::cvt; -use crate::sys::hermit::abi::{ - self, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY, -}; -use crate::sys::hermit::fd::FileDesc; use crate::sys::time::SystemTime; use crate::sys::unsupported; use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; diff --git a/library/std/src/sys/pal/hermit/mod.rs b/library/std/src/sys/pal/hermit/mod.rs index abd7eb353f814..937603cfd8a0b 100644 --- a/library/std/src/sys/pal/hermit/mod.rs +++ b/library/std/src/sys/pal/hermit/mod.rs @@ -115,7 +115,7 @@ pub unsafe extern "C" fn runtime_entry( argv: *const *const c_char, env: *const *const c_char, ) -> ! { - use crate::sys::hermit::thread_local_dtor::run_dtors; + use thread_local_dtor::run_dtors; extern "C" { fn main(argc: isize, argv: *const *const c_char) -> i32; } diff --git a/library/std/src/sys/pal/hermit/net.rs b/library/std/src/sys/pal/hermit/net.rs index bd8b493d65aa3..3cf63fccf2e71 100644 --- a/library/std/src/sys/pal/hermit/net.rs +++ b/library/std/src/sys/pal/hermit/net.rs @@ -1,11 +1,11 @@ #![allow(dead_code)] +use super::fd::FileDesc; use crate::cmp; use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut}; use crate::mem; use crate::net::{Shutdown, SocketAddr}; use crate::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, RawFd}; -use crate::sys::hermit::fd::FileDesc; use crate::sys::time::Instant; use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr}; use crate::sys_common::{AsInner, FromInner, IntoInner}; diff --git a/library/std/src/sys/pal/hermit/os.rs b/library/std/src/sys/pal/hermit/os.rs index c79197a9ad1fa..a54536aecb8b2 100644 --- a/library/std/src/sys/pal/hermit/os.rs +++ b/library/std/src/sys/pal/hermit/os.rs @@ -1,3 +1,4 @@ +use super::abi; use crate::collections::HashMap; use crate::error::Error as StdError; use crate::ffi::{CStr, OsStr, OsString}; @@ -8,7 +9,6 @@ use crate::os::hermit::ffi::OsStringExt; use crate::path::{self, PathBuf}; use crate::str; use crate::sync::Mutex; -use crate::sys::hermit::abi; use crate::sys::memchr; use crate::sys::unsupported; use crate::vec; diff --git a/library/std/src/sys/pal/hermit/stdio.rs b/library/std/src/sys/pal/hermit/stdio.rs index 514de1df6f9c3..ac54385e8cec5 100644 --- a/library/std/src/sys/pal/hermit/stdio.rs +++ b/library/std/src/sys/pal/hermit/stdio.rs @@ -1,6 +1,6 @@ +use super::abi; use crate::io; use crate::io::{IoSlice, IoSliceMut}; -use crate::sys::hermit::abi; pub struct Stdin; pub struct Stdout; diff --git a/library/std/src/sys/pal/hermit/thread.rs b/library/std/src/sys/pal/hermit/thread.rs index 332151e40d026..3384906a15e3b 100644 --- a/library/std/src/sys/pal/hermit/thread.rs +++ b/library/std/src/sys/pal/hermit/thread.rs @@ -1,12 +1,12 @@ #![allow(dead_code)] +use super::abi; +use super::thread_local_dtor::run_dtors; use crate::ffi::CStr; use crate::io; use crate::mem; use crate::num::NonZeroUsize; use crate::ptr; -use crate::sys::hermit::abi; -use crate::sys::hermit::thread_local_dtor::run_dtors; use crate::time::Duration; pub type Tid = abi::Tid; diff --git a/library/std/src/sys/pal/hermit/time.rs b/library/std/src/sys/pal/hermit/time.rs index 7d91460aba3ee..b0e9634d2299c 100644 --- a/library/std/src/sys/pal/hermit/time.rs +++ b/library/std/src/sys/pal/hermit/time.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] +use super::abi; +use super::abi::timespec; +use super::abi::{CLOCK_MONOTONIC, CLOCK_REALTIME, NSEC_PER_SEC}; use crate::cmp::Ordering; use crate::ops::{Add, AddAssign, Sub, SubAssign}; -use crate::sys::hermit::abi; -use crate::sys::hermit::abi::timespec; -use crate::sys::hermit::abi::{CLOCK_MONOTONIC, CLOCK_REALTIME, NSEC_PER_SEC}; use crate::time::Duration; use core::hash::{Hash, Hasher}; From 4ab475dfb59f71694b0e50f79a014c695d3d717c Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:18:17 +0100 Subject: [PATCH 03/13] std: fix module reference on SGX --- library/std/src/sys/pal/sgx/alloc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/sys/pal/sgx/alloc.rs b/library/std/src/sys/pal/sgx/alloc.rs index 4aea28cb83e23..0c7bf9a9201f2 100644 --- a/library/std/src/sys/pal/sgx/alloc.rs +++ b/library/std/src/sys/pal/sgx/alloc.rs @@ -1,8 +1,8 @@ use crate::alloc::{GlobalAlloc, Layout, System}; use crate::ptr; -use crate::sys::sgx::abi::mem as sgx_mem; use core::sync::atomic::{AtomicBool, Ordering}; +use super::abi::mem as sgx_mem; use super::waitqueue::SpinMutex; // Using a SpinMutex because we never want to exit the enclave waiting for the From cac470cde1dfe56013fe24b35795f465551bb27d Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:21:05 +0100 Subject: [PATCH 04/13] std: fix module references on UEFI --- library/std/src/sys/pal/uefi/alloc.rs | 2 +- library/std/src/sys/pal/uefi/args.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys/pal/uefi/alloc.rs b/library/std/src/sys/pal/uefi/alloc.rs index ad3904d82f3ff..15404ac3ea696 100644 --- a/library/std/src/sys/pal/uefi/alloc.rs +++ b/library/std/src/sys/pal/uefi/alloc.rs @@ -3,9 +3,9 @@ use r_efi::protocols::loaded_image; +use super::helpers; use crate::alloc::{GlobalAlloc, Layout, System}; use crate::sync::OnceLock; -use crate::sys::uefi::helpers; #[stable(feature = "alloc_system_type", since = "1.28.0")] unsafe impl GlobalAlloc for System { diff --git a/library/std/src/sys/pal/uefi/args.rs b/library/std/src/sys/pal/uefi/args.rs index 4ff7be748e90b..18a69afa7d91b 100644 --- a/library/std/src/sys/pal/uefi/args.rs +++ b/library/std/src/sys/pal/uefi/args.rs @@ -1,11 +1,11 @@ use r_efi::protocols::loaded_image; +use super::helpers; use crate::env::current_exe; use crate::ffi::OsString; use crate::fmt; use crate::iter::Iterator; use crate::mem::size_of; -use crate::sys::uefi::helpers; use crate::vec; pub struct Args { From 411f34b782e4fdf6793962412384bc0bbd8e8c39 Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:26:06 +0100 Subject: [PATCH 05/13] std: fix module references on UNIX --- library/std/src/sys/pal/unix/fs.rs | 6 +++--- library/std/src/sys/pal/unix/net.rs | 2 +- library/std/src/sys/pal/unix/process/process_common.rs | 2 +- library/std/src/sys/pal/unix/process/process_unix.rs | 2 +- library/std/src/sys/pal/unix/process/process_unsupported.rs | 2 +- library/std/src/sys/pal/unix/stack_overflow.rs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs index 72e7b1b1fc306..6d0b892ea2f41 100644 --- a/library/std/src/sys/pal/unix/fs.rs +++ b/library/std/src/sys/pal/unix/fs.rs @@ -2008,7 +2008,7 @@ mod remove_dir_impl { pub unsafe fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int { get_openat_fn().map(|openat| openat(dirfd, pathname, flags)).unwrap_or_else(|| { - crate::sys::unix::os::set_errno(libc::ENOSYS); + crate::sys::pal::unix::os::set_errno(libc::ENOSYS); -1 }) } @@ -2019,7 +2019,7 @@ mod remove_dir_impl { #[cfg(all(target_os = "macos", target_arch = "x86_64"))] weak!(fn fdopendir(c_int) -> *mut DIR, "fdopendir$INODE64"); fdopendir.get().map(|fdopendir| fdopendir(fd)).unwrap_or_else(|| { - crate::sys::unix::os::set_errno(libc::ENOSYS); + crate::sys::pal::unix::os::set_errno(libc::ENOSYS); crate::ptr::null_mut() }) } @@ -2027,7 +2027,7 @@ mod remove_dir_impl { pub unsafe fn unlinkat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int { weak!(fn unlinkat(c_int, *const c_char, c_int) -> c_int); unlinkat.get().map(|unlinkat| unlinkat(dirfd, pathname, flags)).unwrap_or_else(|| { - crate::sys::unix::os::set_errno(libc::ENOSYS); + crate::sys::pal::unix::os::set_errno(libc::ENOSYS); -1 }) } diff --git a/library/std/src/sys/pal/unix/net.rs b/library/std/src/sys/pal/unix/net.rs index ec861f9cb8696..8f537de7026f5 100644 --- a/library/std/src/sys/pal/unix/net.rs +++ b/library/std/src/sys/pal/unix/net.rs @@ -6,7 +6,7 @@ use crate::net::{Shutdown, SocketAddr}; use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use crate::str; use crate::sys::fd::FileDesc; -use crate::sys::unix::IsMinusOne; +use crate::sys::pal::unix::IsMinusOne; use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr}; use crate::sys_common::{AsInner, FromInner, IntoInner}; use crate::time::{Duration, Instant}; diff --git a/library/std/src/sys/pal/unix/process/process_common.rs b/library/std/src/sys/pal/unix/process/process_common.rs index c5f04fb8b3b1a..f615e8086dccf 100644 --- a/library/std/src/sys/pal/unix/process/process_common.rs +++ b/library/std/src/sys/pal/unix/process/process_common.rs @@ -63,7 +63,7 @@ cfg_if::cfg_if! { let bit = (signum - 1) as usize; if set.is_null() || bit >= (8 * size_of::()) { - crate::sys::unix::os::set_errno(libc::EINVAL); + crate::sys::pal::unix::os::set_errno(libc::EINVAL); return -1; } let raw = slice::from_raw_parts_mut( diff --git a/library/std/src/sys/pal/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs index ee86a5f88dd78..fac6d92439ee8 100644 --- a/library/std/src/sys/pal/unix/process/process_unix.rs +++ b/library/std/src/sys/pal/unix/process/process_unix.rs @@ -362,7 +362,7 @@ impl Command { // If #[unix_sigpipe] is not specified, reset SIGPIPE to SIG_DFL for backward compatibility. // // #[unix_sigpipe] is an opportunity to change the default here. - if !crate::sys::unix_sigpipe_attr_specified() { + if !crate::sys::pal::unix_sigpipe_attr_specified() { #[cfg(target_os = "android")] // see issue #88585 { let mut action: libc::sigaction = mem::zeroed(); diff --git a/library/std/src/sys/pal/unix/process/process_unsupported.rs b/library/std/src/sys/pal/unix/process/process_unsupported.rs index 2fbb31922653c..9453c8a384e24 100644 --- a/library/std/src/sys/pal/unix/process/process_unsupported.rs +++ b/library/std/src/sys/pal/unix/process/process_unsupported.rs @@ -1,8 +1,8 @@ use crate::fmt; use crate::io; use crate::num::NonZeroI32; +use crate::sys::pal::unix::unsupported::*; use crate::sys::process::process_common::*; -use crate::sys::unix::unsupported::*; use core::ffi::NonZero_c_int; use libc::{c_int, pid_t}; diff --git a/library/std/src/sys/pal/unix/stack_overflow.rs b/library/std/src/sys/pal/unix/stack_overflow.rs index 3dbab4cc48643..923637cbaf260 100644 --- a/library/std/src/sys/pal/unix/stack_overflow.rs +++ b/library/std/src/sys/pal/unix/stack_overflow.rs @@ -55,7 +55,7 @@ mod imp { use libc::{MAP_ANON, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE, SIGSEGV}; use crate::sync::atomic::{AtomicBool, AtomicPtr, Ordering}; - use crate::sys::unix::os::page_size; + use crate::sys::pal::unix::os::page_size; use crate::sys_common::thread_info; // Signal handler for the SIGSEGV and SIGBUS handlers. We've got guard pages From d6efeadb06733a04479bfe57db897712440222be Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:26:20 +0100 Subject: [PATCH 06/13] std: fix module references on Windows --- library/std/src/sys/pal/windows/args.rs | 4 ++-- library/std/src/sys/pal/windows/args/tests.rs | 2 +- library/std/src/sys/pal/windows/locks/condvar.rs | 2 +- library/std/src/sys/pal/windows/stdio.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/std/src/sys/pal/windows/args.rs b/library/std/src/sys/pal/windows/args.rs index ee7dba6e5b362..fbbdbc2126595 100644 --- a/library/std/src/sys/pal/windows/args.rs +++ b/library/std/src/sys/pal/windows/args.rs @@ -6,6 +6,7 @@ #[cfg(test)] mod tests; +use super::os::current_exe; use crate::ffi::OsString; use crate::fmt; use crate::io; @@ -14,7 +15,6 @@ use crate::os::windows::prelude::*; use crate::path::{Path, PathBuf}; use crate::sys::path::get_long_path; use crate::sys::process::ensure_no_nuls; -use crate::sys::windows::os::current_exe; use crate::sys::{c, to_u16s}; use crate::sys_common::wstr::WStrUnits; use crate::vec; @@ -318,8 +318,8 @@ pub(crate) fn to_user_path(path: &Path) -> io::Result> { from_wide_to_user_path(to_u16s(path)?) } pub(crate) fn from_wide_to_user_path(mut path: Vec) -> io::Result> { + use super::fill_utf16_buf; use crate::ptr; - use crate::sys::windows::fill_utf16_buf; // UTF-16 encoded code points, used in parsing and building UTF-16 paths. // All of these are in the ASCII range so they can be cast directly to `u16`. diff --git a/library/std/src/sys/pal/windows/args/tests.rs b/library/std/src/sys/pal/windows/args/tests.rs index 82c32d08c5ea8..484a90ab056df 100644 --- a/library/std/src/sys/pal/windows/args/tests.rs +++ b/library/std/src/sys/pal/windows/args/tests.rs @@ -1,5 +1,5 @@ +use super::*; use crate::ffi::OsString; -use crate::sys::windows::args::*; fn chk(string: &str, parts: &[&str]) { let mut wide: Vec = OsString::from(string).encode_wide().collect(); diff --git a/library/std/src/sys/pal/windows/locks/condvar.rs b/library/std/src/sys/pal/windows/locks/condvar.rs index 66fafa2c00b00..953bcc27dee0d 100644 --- a/library/std/src/sys/pal/windows/locks/condvar.rs +++ b/library/std/src/sys/pal/windows/locks/condvar.rs @@ -27,7 +27,7 @@ impl Condvar { let r = c::SleepConditionVariableSRW( self.inner.get(), mutex::raw(mutex), - crate::sys::windows::dur2timeout(dur), + crate::sys::pal::windows::dur2timeout(dur), 0, ); if r == 0 { diff --git a/library/std/src/sys/pal/windows/stdio.rs b/library/std/src/sys/pal/windows/stdio.rs index 819a48266d949..96c23f82aec2e 100644 --- a/library/std/src/sys/pal/windows/stdio.rs +++ b/library/std/src/sys/pal/windows/stdio.rs @@ -1,5 +1,6 @@ #![unstable(issue = "none", feature = "windows_stdio")] +use super::api; use crate::cmp; use crate::io; use crate::mem::MaybeUninit; @@ -9,7 +10,6 @@ use crate::str; use crate::sys::c; use crate::sys::cvt; use crate::sys::handle::Handle; -use crate::sys::windows::api; use core::str::utf8_char_width; #[cfg(test)] From 41c05c46ed38966c2b7da5acc0a3a03e85eff982 Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:38:24 +0100 Subject: [PATCH 07/13] miri: update reference to PAL module on Windows --- src/tools/miri/src/helpers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index 14ba69b898b11..0be0be274b434 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -217,7 +217,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { /// Helper function to get a `windows` constant as a `Scalar`. fn eval_windows(&self, module: &str, name: &str) -> Scalar { - self.eval_context_ref().eval_path_scalar(&["std", "sys", "windows", module, name]) + self.eval_context_ref().eval_path_scalar(&["std", "sys", "pal","windows", module, name]) } /// Helper function to get a `windows` constant as a `u32`. @@ -249,7 +249,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { fn windows_ty_layout(&self, name: &str) -> TyAndLayout<'tcx> { let this = self.eval_context_ref(); let ty = this - .resolve_path(&["std", "sys", "windows", "c", name], Namespace::TypeNS) + .resolve_path(&["std", "sys", "pal","windows", "c", name], Namespace::TypeNS) .ty(*this.tcx, ty::ParamEnv::reveal_all()); this.layout_of(ty).unwrap() } From 54e1b89fd94f8d321c9e618c14c36e0bb4b78296 Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:36:45 +0100 Subject: [PATCH 08/13] std: update miri tests --- src/tools/miri/tests/compiletest.rs | 4 ++-- .../concurrency/windows_join_detached.stderr | 4 ++-- .../tests/fail/alloc/global_system_mixup.stderr | 4 ++-- .../exported_symbol_bad_unwind2.both.stderr | 4 ++-- ...exported_symbol_bad_unwind2.definition.stderr | 4 ++-- .../intrinsics/uninit_uninhabited_type.stderr | 4 ++-- .../tests/fail/intrinsics/zero_fn_ptr.stderr | 4 ++-- .../miri/tests/fail/panic/double_panic.stderr | 4 ++-- .../tests/fail/shims/fs/isolated_file.stderr | 16 ++++++++-------- .../miri/tests/fail/terminate-terminator.stderr | 4 ++-- .../tests/fail/unwind-action-terminate.stderr | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/tools/miri/tests/compiletest.rs b/src/tools/miri/tests/compiletest.rs index 074808b11227f..8bed321e6551c 100644 --- a/src/tools/miri/tests/compiletest.rs +++ b/src/tools/miri/tests/compiletest.rs @@ -192,13 +192,13 @@ regexes! { // erase thread caller ids r"call [0-9]+" => "call ID", // erase platform module paths - "sys::[a-z]+::" => "sys::PLATFORM::", + "sys::pal::[a-z]+::" => "sys::pal::PLATFORM::", // Windows file paths r"\\" => "/", // erase Rust stdlib path "[^ \n`]*/(rust[^/]*|checkout)/library/" => "RUSTLIB/", // erase platform file paths - "sys/[a-z]+/" => "sys/PLATFORM/", + "sys/pal/[a-z]+/" => "sys/pal/PLATFORM/", // erase paths into the crate registry r"[^ ]*/\.?cargo/registry/.*/(.*\.rs)" => "CARGO_REGISTRY/.../$1", } diff --git a/src/tools/miri/tests/fail-dep/concurrency/windows_join_detached.stderr b/src/tools/miri/tests/fail-dep/concurrency/windows_join_detached.stderr index 651c2eba0d9d1..19bfe56395e00 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/windows_join_detached.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/windows_join_detached.stderr @@ -1,5 +1,5 @@ error: Undefined Behavior: trying to join a detached thread - --> RUSTLIB/std/src/sys/PLATFORM/thread.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC | LL | let rc = unsafe { c::WaitForSingleObject(self.handle.as_raw_handle(), c::INFINITE) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join a detached thread @@ -7,7 +7,7 @@ LL | let rc = unsafe { c::WaitForSingleObject(self.handle.as_raw_handle( = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: BACKTRACE: - = note: inside `std::sys::PLATFORM::thread::Thread::join` at RUSTLIB/std/src/sys/PLATFORM/thread.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::thread::Thread::join` at RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC = note: inside `std::thread::JoinInner::<'_, ()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC = note: inside `std::thread::JoinHandle::<()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC note: inside `main` diff --git a/src/tools/miri/tests/fail/alloc/global_system_mixup.stderr b/src/tools/miri/tests/fail/alloc/global_system_mixup.stderr index de76e925c11cf..7006b96ee1e61 100644 --- a/src/tools/miri/tests/fail/alloc/global_system_mixup.stderr +++ b/src/tools/miri/tests/fail/alloc/global_system_mixup.stderr @@ -1,5 +1,5 @@ error: Undefined Behavior: deallocating ALLOC, which is Rust heap memory, using PLATFORM heap deallocation operation - --> RUSTLIB/std/src/sys/PLATFORM/alloc.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/alloc.rs:LL:CC | LL | FREE(); | ^ deallocating ALLOC, which is Rust heap memory, using PLATFORM heap deallocation operation @@ -7,7 +7,7 @@ LL | FREE(); = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: BACKTRACE: - = note: inside `std::sys::PLATFORM::alloc::::dealloc` at RUSTLIB/std/src/sys/PLATFORM/alloc.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::alloc::::dealloc` at RUSTLIB/std/src/sys/pal/PLATFORM/alloc.rs:LL:CC = note: inside `::deallocate` at RUSTLIB/std/src/alloc.rs:LL:CC note: inside `main` --> $DIR/global_system_mixup.rs:LL:CC diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr index 2be02100a35fe..bccd532faca93 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr @@ -6,12 +6,12 @@ panic in a function that cannot unwind stack backtrace: thread caused non-unwinding panic. aborting. error: abnormal termination: the program aborted execution - --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC | LL | ABORT(); | ^ the program aborted execution | - = note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr index 2be02100a35fe..bccd532faca93 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr @@ -6,12 +6,12 @@ panic in a function that cannot unwind stack backtrace: thread caused non-unwinding panic. aborting. error: abnormal termination: the program aborted execution - --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC | LL | ABORT(); | ^ the program aborted execution | - = note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC diff --git a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr index 2196673c39ae0..5d4ea011581c3 100644 --- a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr +++ b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr @@ -3,12 +3,12 @@ aborted execution: attempted to instantiate uninhabited type `!` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread caused non-unwinding panic. aborting. error: abnormal termination: the program aborted execution - --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC | LL | ABORT(); | ^ the program aborted execution | - = note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC diff --git a/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr b/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr index 90ba5995cee63..935e79dfd8d35 100644 --- a/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr +++ b/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr @@ -3,12 +3,12 @@ aborted execution: attempted to zero-initialize type `fn()`, which is invalid note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread caused non-unwinding panic. aborting. error: abnormal termination: the program aborted execution - --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC | LL | ABORT(); | ^ the program aborted execution | - = note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/double_panic.stderr b/src/tools/miri/tests/fail/panic/double_panic.stderr index 75ca0901bc82f..2eb9354a4d04f 100644 --- a/src/tools/miri/tests/fail/panic/double_panic.stderr +++ b/src/tools/miri/tests/fail/panic/double_panic.stderr @@ -8,12 +8,12 @@ thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC: panic in a destructor during cleanup thread caused non-unwinding panic. aborting. error: abnormal termination: the program aborted execution - --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC | LL | ABORT(); | ^ the program aborted execution | - = note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC diff --git a/src/tools/miri/tests/fail/shims/fs/isolated_file.stderr b/src/tools/miri/tests/fail/shims/fs/isolated_file.stderr index e1b1800086672..ec670c4a391e4 100644 --- a/src/tools/miri/tests/fail/shims/fs/isolated_file.stderr +++ b/src/tools/miri/tests/fail/shims/fs/isolated_file.stderr @@ -1,5 +1,5 @@ error: unsupported operation: `open` not available when isolation is enabled - --> RUSTLIB/std/src/sys/PLATFORM/fs.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC | LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode as c_int) })?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `open` not available when isolation is enabled @@ -7,13 +7,13 @@ LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode a = help: pass the flag `-Zmiri-disable-isolation` to disable isolation; = help: or pass `-Zmiri-isolation-error=warn` to configure Miri to return an error code from isolated operations (if supported for that operation) and continue with a warning = note: BACKTRACE: - = note: inside closure at RUSTLIB/std/src/sys/PLATFORM/fs.rs:LL:CC - = note: inside `std::sys::PLATFORM::cvt_r::` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC - = note: inside `std::sys::PLATFORM::fs::File::open_c` at RUSTLIB/std/src/sys/PLATFORM/fs.rs:LL:CC - = note: inside closure at RUSTLIB/std/src/sys/PLATFORM/fs.rs:LL:CC - = note: inside `std::sys::PLATFORM::small_c_string::run_with_cstr::` at RUSTLIB/std/src/sys/PLATFORM/small_c_string.rs:LL:CC - = note: inside `std::sys::PLATFORM::small_c_string::run_path_with_cstr::` at RUSTLIB/std/src/sys/PLATFORM/small_c_string.rs:LL:CC - = note: inside `std::sys::PLATFORM::fs::File::open` at RUSTLIB/std/src/sys/PLATFORM/fs.rs:LL:CC + = note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::cvt_r::` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::fs::File::open_c` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC + = note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr::` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::small_c_string::run_path_with_cstr::` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::fs::File::open` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC = note: inside `std::fs::OpenOptions::_open` at RUSTLIB/std/src/fs.rs:LL:CC = note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at RUSTLIB/std/src/fs.rs:LL:CC = note: inside `std::fs::File::open::<&str>` at RUSTLIB/std/src/fs.rs:LL:CC diff --git a/src/tools/miri/tests/fail/terminate-terminator.stderr b/src/tools/miri/tests/fail/terminate-terminator.stderr index be66bad6fc35b..44c04b3ae9301 100644 --- a/src/tools/miri/tests/fail/terminate-terminator.stderr +++ b/src/tools/miri/tests/fail/terminate-terminator.stderr @@ -8,12 +8,12 @@ panic in a function that cannot unwind stack backtrace: thread caused non-unwinding panic. aborting. error: abnormal termination: the program aborted execution - --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC | LL | ABORT(); | ^ the program aborted execution | - = note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC diff --git a/src/tools/miri/tests/fail/unwind-action-terminate.stderr b/src/tools/miri/tests/fail/unwind-action-terminate.stderr index a7543df340dff..adb2967feaf5b 100644 --- a/src/tools/miri/tests/fail/unwind-action-terminate.stderr +++ b/src/tools/miri/tests/fail/unwind-action-terminate.stderr @@ -6,12 +6,12 @@ panic in a function that cannot unwind stack backtrace: thread caused non-unwinding panic. aborting. error: abnormal termination: the program aborted execution - --> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + --> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC | LL | ABORT(); | ^ the program aborted execution | - = note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC + = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<{closure@std::panicking::begin_panic_handler::{closure#0}}, !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC From 2d30a262d144ba68451a4a57c6f0cb6ee0b770ef Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 11 Jan 2024 20:37:32 +0100 Subject: [PATCH 09/13] update path reference in license definitions --- .reuse/dep5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.reuse/dep5 b/.reuse/dep5 index e62e3504090a2..9a0d498fa6be1 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -51,7 +51,7 @@ Copyright: 2019 The Crossbeam Project Developers The Rust Project Developers (see https://thanks.rust-lang.org) License: MIT OR Apache-2.0 -Files: library/std/src/sys/unix/locks/fuchsia_mutex.rs +Files: library/std/src/sys/pal/unix/locks/fuchsia_mutex.rs Copyright: 2016 The Fuchsia Authors The Rust Project Developers (see https://thanks.rust-lang.org) License: BSD-2-Clause AND (MIT OR Apache-2.0) From 762cd4842efb924242a629161d7263e074f17528 Mon Sep 17 00:00:00 2001 From: joboet Date: Fri, 12 Jan 2024 00:06:39 +0100 Subject: [PATCH 10/13] update paths in tools --- src/tools/generate-windows-sys/src/main.rs | 2 +- src/tools/tidy/src/pal.rs | 4 ++-- triagebot.toml | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/tools/generate-windows-sys/src/main.rs b/src/tools/generate-windows-sys/src/main.rs index dff2c5e467afa..dc95d969aede9 100644 --- a/src/tools/generate-windows-sys/src/main.rs +++ b/src/tools/generate-windows-sys/src/main.rs @@ -16,7 +16,7 @@ const PRELUDE: &str = r#"// This file is autogenerated. fn main() -> Result<(), Box> { let mut path: PathBuf = env::args_os().nth(1).expect("a path to the rust repository is required").into(); - path.push("library/std/src/sys/windows/c"); + path.push("library/std/src/sys/pal/windows/c"); env::set_current_dir(&path)?; let info = windows_bindgen::bindgen(["--etc", "windows_sys.lst"])?; diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index 5f6b63a67fda7..398257d2bc271 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -46,8 +46,8 @@ const EXCEPTION_PATHS: &[&str] = &[ // we must use `#[cfg(windows)]` to conditionally compile the // correct `VaList` structure for windows. "library/core/src/ffi/mod.rs", - "library/std/src/sys/", // Platform-specific code for std lives here. - "library/std/src/os", // Platform-specific public interfaces + "library/std/src/sys/pal/", // Platform-specific code for std lives here. + "library/std/src/os", // Platform-specific public interfaces // Temporary `std` exceptions // FIXME: platform-specific code should be moved to `sys` "library/std/src/io/copy.rs", diff --git a/triagebot.toml b/triagebot.toml index aac3a830a7875..ab051d693b1ba 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -202,7 +202,7 @@ trigger_files = [ [autolabel."O-hermit"] trigger_files = [ - "library/std/src/sys/hermit", + "library/std/src/sys/pal/hermit", "library/std/src/os/hermit" ] @@ -213,7 +213,7 @@ trigger_files = [ [autolabel."O-itron"] trigger_files = [ - "library/std/src/sys/itron" + "library/std/src/sys/pal/itron" ] [autolabel."O-linux"] @@ -238,7 +238,7 @@ trigger_files = [ [autolabel."O-SGX"] trigger_files = [ - "library/std/src/sys/sgx", + "library/std/src/sys/pal/sgx", "library/std/src/os/fortanix_sgx" ] @@ -249,25 +249,25 @@ trigger_files = [ [autolabel."O-solid"] trigger_files = [ - "library/std/src/sys/solid", + "library/std/src/sys/pal/solid", "library/std/src/os/solid" ] [autolabel."O-unix"] trigger_files = [ - "library/std/src/sys/unix", + "library/std/src/sys/pal/unix", "library/std/src/os/unix" ] [autolabel."O-wasi"] trigger_files = [ - "library/std/src/sys/wasi", + "library/std/src/sys/pal/wasi", "library/std/src/os/wasi" ] [autolabel."O-wasm"] trigger_files = [ - "library/std/src/sys/wasm", + "library/std/src/sys/pal/wasm", "library/std/src/os/wasm" ] @@ -278,7 +278,7 @@ trigger_files = [ [autolabel."O-windows"] trigger_files = [ - "library/std/src/sys/windows", + "library/std/src/sys/pal/windows", "library/std/src/os/windows" ] @@ -788,7 +788,7 @@ project-stable-mir = [ "/library/panic_unwind" = ["libs"] "/library/proc_macro" = ["@petrochenkov"] "/library/std" = ["libs"] -"/library/std/src/sys/windows" = ["@ChrisDenton", "@thomcc"] +"/library/std/src/sys/pal/windows" = ["@ChrisDenton", "@thomcc"] "/library/stdarch" = ["libs"] "/library/test" = ["libs"] "/src/bootstrap" = ["bootstrap"] From 7c436a8af4a6363f7c57abff6f85c152154d9d49 Mon Sep 17 00:00:00 2001 From: joboet Date: Fri, 12 Jan 2024 00:11:33 +0100 Subject: [PATCH 11/13] update paths in comments --- compiler/rustc_session/src/config/sigpipe.rs | 4 ++-- compiler/rustc_target/src/spec/base/illumos.rs | 2 +- library/core/tests/num/int_log.rs | 2 +- library/std/src/sys/pal/solid/net.rs | 2 +- library/std/src/sys/pal/wasi/os.rs | 2 +- library/std/src/sys/pal/windows/api.rs | 2 +- library/std/src/sys/pal/windows/net.rs | 2 +- src/tools/miri/src/helpers.rs | 2 +- src/tools/miri/src/shims/foreign_items.rs | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_session/src/config/sigpipe.rs b/compiler/rustc_session/src/config/sigpipe.rs index 53692ad7cc92b..1fadc75cfd0d2 100644 --- a/compiler/rustc_session/src/config/sigpipe.rs +++ b/compiler/rustc_session/src/config/sigpipe.rs @@ -1,7 +1,7 @@ -//! NOTE: Keep these constants in sync with `library/std/src/sys/unix/mod.rs`! +//! NOTE: Keep these constants in sync with `library/std/src/sys/pal/unix/mod.rs`! /// The default value if `#[unix_sigpipe]` is not specified. This resolves -/// to `SIG_IGN` in `library/std/src/sys/unix/mod.rs`. +/// to `SIG_IGN` in `library/std/src/sys/pal/unix/mod.rs`. /// /// Note that `SIG_IGN` has been the Rust default since 2014. See /// . diff --git a/compiler/rustc_target/src/spec/base/illumos.rs b/compiler/rustc_target/src/spec/base/illumos.rs index e63e789752bc7..f0a648b93ad04 100644 --- a/compiler/rustc_target/src/spec/base/illumos.rs +++ b/compiler/rustc_target/src/spec/base/illumos.rs @@ -39,7 +39,7 @@ pub fn opts() -> TargetOptions { // While we support ELF TLS, rust requires a way to register // cleanup handlers (in C, this would be something along the lines of: // void register_callback(void (*fn)(void *), void *arg); - // (see src/libstd/sys/unix/fast_thread_local.rs) that is currently + // (see src/libstd/sys/pal/unix/fast_thread_local.rs) that is currently // missing in illumos. For now at least, we must fallback to using // pthread_{get,set}specific. //has_thread_local: true, diff --git a/library/core/tests/num/int_log.rs b/library/core/tests/num/int_log.rs index a1edb1a518632..1236ce35583da 100644 --- a/library/core/tests/num/int_log.rs +++ b/library/core/tests/num/int_log.rs @@ -1,7 +1,7 @@ //! This tests the `Integer::{ilog,log2,log10}` methods. These tests are in a //! separate file because there's both a large number of them, and not all tests //! can be run on Android. This is because in Android `ilog2` uses an imprecise -//! approximation:https://github.com/rust-lang/rust/blob/4825e12fc9c79954aa0fe18f5521efa6c19c7539/src/libstd/sys/unix/android.rs#L27-L53 +//! approximation:https://github.com/rust-lang/rust/blob/4825e12fc9c79954aa0fe18f5521efa6c19c7539/src/libstd/sys/pal/unix/android.rs#L27-L53 #[test] fn checked_ilog() { diff --git a/library/std/src/sys/pal/solid/net.rs b/library/std/src/sys/pal/solid/net.rs index a768e2406c8a8..1c310648a3db5 100644 --- a/library/std/src/sys/pal/solid/net.rs +++ b/library/std/src/sys/pal/solid/net.rs @@ -68,7 +68,7 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> { } } -/// Just to provide the same interface as sys/unix/net.rs +/// Just to provide the same interface as sys/pal/unix/net.rs pub fn cvt_r(mut f: F) -> io::Result where T: IsMinusOne, diff --git a/library/std/src/sys/pal/wasi/os.rs b/library/std/src/sys/pal/wasi/os.rs index d53bddd8e9dfe..530d360217216 100644 --- a/library/std/src/sys/pal/wasi/os.rs +++ b/library/std/src/sys/pal/wasi/os.rs @@ -209,7 +209,7 @@ pub fn env() -> Env { return Env { iter: result.into_iter() }; } - // See src/libstd/sys/unix/os.rs, same as that + // See src/libstd/sys/pal/unix/os.rs, same as that fn parse(input: &[u8]) -> Option<(OsString, OsString)> { if input.is_empty() { return None; diff --git a/library/std/src/sys/pal/windows/api.rs b/library/std/src/sys/pal/windows/api.rs index a7ea59e85f786..90e1bff52a365 100644 --- a/library/std/src/sys/pal/windows/api.rs +++ b/library/std/src/sys/pal/windows/api.rs @@ -27,7 +27,7 @@ //! This module must only depend on core and not on std types as the eventual //! hope is to have std depend on sys and not the other way around. //! However, some amount of glue code may currently be necessary so such code -//! should go in sys/windows/mod.rs rather than here. See `IoResult` as an example. +//! should go in sys/pal/windows/mod.rs rather than here. See `IoResult` as an example. use core::ffi::c_void; use core::ptr::addr_of; diff --git a/library/std/src/sys/pal/windows/net.rs b/library/std/src/sys/pal/windows/net.rs index 6cd758ec5c32d..c34e01e000aca 100644 --- a/library/std/src/sys/pal/windows/net.rs +++ b/library/std/src/sys/pal/windows/net.rs @@ -90,7 +90,7 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> { if err == 0 { Ok(()) } else { Err(last_error()) } } -/// Just to provide the same interface as sys/unix/net.rs +/// Just to provide the same interface as sys/pal/unix/net.rs pub fn cvt_r(mut f: F) -> io::Result where T: IsMinusOne, diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index 0be0be274b434..905b2fc4d604b 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -25,7 +25,7 @@ use rand::RngCore; use crate::*; // This mapping should match `decode_error_kind` in -// . +// . const UNIX_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = { use std::io::ErrorKind::*; &[ diff --git a/src/tools/miri/src/shims/foreign_items.rs b/src/tools/miri/src/shims/foreign_items.rs index e7b2a6823ed6e..a002f2aad057c 100644 --- a/src/tools/miri/src/shims/foreign_items.rs +++ b/src/tools/miri/src/shims/foreign_items.rs @@ -342,7 +342,7 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { /// Returns the minimum alignment for the target architecture for allocations of the given size. fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align { let this = self.eval_context_ref(); - // List taken from `library/std/src/sys/common/alloc.rs`. + // List taken from `library/std/src/sys/pal/common/alloc.rs`. // This list should be kept in sync with the one from libstd. let min_align = match this.tcx.sess.target.arch.as_ref() { "x86" | "arm" | "mips" | "mips32r6" | "powerpc" | "powerpc64" | "wasm32" => 8, From df3cb23e01bb661ee06e28d9822e5ab320094788 Mon Sep 17 00:00:00 2001 From: joboet Date: Fri, 12 Jan 2024 08:50:14 +0100 Subject: [PATCH 12/13] update debuginfo tests on Windows --- tests/debuginfo/mutex.rs | 2 +- tests/debuginfo/rwlock-read.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/debuginfo/mutex.rs b/tests/debuginfo/mutex.rs index 61ec6a81243d5..7a58c5c2224be 100644 --- a/tests/debuginfo/mutex.rs +++ b/tests/debuginfo/mutex.rs @@ -10,7 +10,7 @@ // // cdb-command:dx m,d // cdb-check:m,d [Type: std::sync::mutex::Mutex] -// cdb-check: [...] inner [Type: std::sys::windows::locks::mutex::Mutex] +// cdb-check: [...] inner [Type: std::sys::pal::windows::locks::mutex::Mutex] // cdb-check: [...] poison [Type: std::sync::poison::Flag] // cdb-check: [...] data : 0 [Type: core::cell::UnsafeCell] diff --git a/tests/debuginfo/rwlock-read.rs b/tests/debuginfo/rwlock-read.rs index bc42f92f053d5..4ed1ebd0b37c4 100644 --- a/tests/debuginfo/rwlock-read.rs +++ b/tests/debuginfo/rwlock-read.rs @@ -16,7 +16,7 @@ // cdb-command:dx r // cdb-check:r [Type: std::sync::rwlock::RwLockReadGuard] // cdb-check: [...] data : NonNull([...]: 0) [Type: core::ptr::non_null::NonNull] -// cdb-check: [...] inner_lock : [...] [Type: std::sys::windows::locks::rwlock::RwLock *] +// cdb-check: [...] inner_lock : [...] [Type: std::sys::pal::windows::locks::rwlock::RwLock *] #[allow(unused_variables)] From 0cfc995814601cbaca2542ffa8b9bc5c44ea4fed Mon Sep 17 00:00:00 2001 From: joboet Date: Sat, 13 Jan 2024 09:18:36 +0100 Subject: [PATCH 13/13] don't break a good link Co-authored-by: klensy --- library/core/tests/num/int_log.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/tests/num/int_log.rs b/library/core/tests/num/int_log.rs index 1236ce35583da..a1edb1a518632 100644 --- a/library/core/tests/num/int_log.rs +++ b/library/core/tests/num/int_log.rs @@ -1,7 +1,7 @@ //! This tests the `Integer::{ilog,log2,log10}` methods. These tests are in a //! separate file because there's both a large number of them, and not all tests //! can be run on Android. This is because in Android `ilog2` uses an imprecise -//! approximation:https://github.com/rust-lang/rust/blob/4825e12fc9c79954aa0fe18f5521efa6c19c7539/src/libstd/sys/pal/unix/android.rs#L27-L53 +//! approximation:https://github.com/rust-lang/rust/blob/4825e12fc9c79954aa0fe18f5521efa6c19c7539/src/libstd/sys/unix/android.rs#L27-L53 #[test] fn checked_ilog() {