Skip to content

Commit ae506aa

Browse files
committed
Auto merge of #117285 - joboet:move_platforms_to_pal, r=ChrisDenton
Move platform modules into `sys::pal` This is the initial step of #117276. `sys` just re-exports everything from the current `sys` for now, I'll move the implementations for the individual features one-by-one after this PR merges.
2 parents e7fc945 + bc00208 commit ae506aa

13 files changed

+32
-32
lines changed

src/helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rand::RngCore;
2525
use crate::*;
2626

2727
// This mapping should match `decode_error_kind` in
28-
// <https://github.com/rust-lang/rust/blob/master/library/std/src/sys/unix/mod.rs>.
28+
// <https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/unix/mod.rs>.
2929
const UNIX_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = {
3030
use std::io::ErrorKind::*;
3131
&[
@@ -217,7 +217,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
217217

218218
/// Helper function to get a `windows` constant as a `Scalar`.
219219
fn eval_windows(&self, module: &str, name: &str) -> Scalar<Provenance> {
220-
self.eval_context_ref().eval_path_scalar(&["std", "sys", "windows", module, name])
220+
self.eval_context_ref().eval_path_scalar(&["std", "sys", "pal","windows", module, name])
221221
}
222222

223223
/// Helper function to get a `windows` constant as a `u32`.
@@ -249,7 +249,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
249249
fn windows_ty_layout(&self, name: &str) -> TyAndLayout<'tcx> {
250250
let this = self.eval_context_ref();
251251
let ty = this
252-
.resolve_path(&["std", "sys", "windows", "c", name], Namespace::TypeNS)
252+
.resolve_path(&["std", "sys", "pal","windows", "c", name], Namespace::TypeNS)
253253
.ty(*this.tcx, ty::ParamEnv::reveal_all());
254254
this.layout_of(ty).unwrap()
255255
}

src/shims/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
342342
/// Returns the minimum alignment for the target architecture for allocations of the given size.
343343
fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align {
344344
let this = self.eval_context_ref();
345-
// List taken from `library/std/src/sys/common/alloc.rs`.
345+
// List taken from `library/std/src/sys/pal/common/alloc.rs`.
346346
// This list should be kept in sync with the one from libstd.
347347
let min_align = match this.tcx.sess.target.arch.as_ref() {
348348
"x86" | "arm" | "mips" | "mips32r6" | "powerpc" | "powerpc64" | "wasm32" => 8,

tests/compiletest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ regexes! {
192192
// erase thread caller ids
193193
r"call [0-9]+" => "call ID",
194194
// erase platform module paths
195-
"sys::[a-z]+::" => "sys::PLATFORM::",
195+
"sys::pal::[a-z]+::" => "sys::pal::PLATFORM::",
196196
// Windows file paths
197197
r"\\" => "/",
198198
// erase Rust stdlib path
199199
"[^ \n`]*/(rust[^/]*|checkout)/library/" => "RUSTLIB/",
200200
// erase platform file paths
201-
"sys/[a-z]+/" => "sys/PLATFORM/",
201+
"sys/pal/[a-z]+/" => "sys/pal/PLATFORM/",
202202
// erase paths into the crate registry
203203
r"[^ ]*/\.?cargo/registry/.*/(.*\.rs)" => "CARGO_REGISTRY/.../$1",
204204
}

tests/fail-dep/concurrency/windows_join_detached.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: Undefined Behavior: trying to join a detached thread
2-
--> RUSTLIB/std/src/sys/PLATFORM/thread.rs:LL:CC
2+
--> RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC
33
|
44
LL | let rc = unsafe { c::WaitForSingleObject(self.handle.as_raw_handle(), c::INFINITE) };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join a detached thread
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::sys::PLATFORM::thread::Thread::join` at RUSTLIB/std/src/sys/PLATFORM/thread.rs:LL:CC
10+
= note: inside `std::sys::pal::PLATFORM::thread::Thread::join` at RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC
1111
= note: inside `std::thread::JoinInner::<'_, ()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC
1212
= note: inside `std::thread::JoinHandle::<()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC
1313
note: inside `main`

tests/fail/alloc/global_system_mixup.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: Undefined Behavior: deallocating ALLOC, which is Rust heap memory, using PLATFORM heap deallocation operation
2-
--> RUSTLIB/std/src/sys/PLATFORM/alloc.rs:LL:CC
2+
--> RUSTLIB/std/src/sys/pal/PLATFORM/alloc.rs:LL:CC
33
|
44
LL | FREE();
55
| ^ deallocating ALLOC, which is Rust heap memory, using PLATFORM heap deallocation operation
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `std::sys::PLATFORM::alloc::<impl std::alloc::GlobalAlloc for std::alloc::System>::dealloc` at RUSTLIB/std/src/sys/PLATFORM/alloc.rs:LL:CC
10+
= note: inside `std::sys::pal::PLATFORM::alloc::<impl std::alloc::GlobalAlloc for std::alloc::System>::dealloc` at RUSTLIB/std/src/sys/pal/PLATFORM/alloc.rs:LL:CC
1111
= note: inside `<std::alloc::System as std::alloc::Allocator>::deallocate` at RUSTLIB/std/src/alloc.rs:LL:CC
1212
note: inside `main`
1313
--> $DIR/global_system_mixup.rs:LL:CC

tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ panic in a function that cannot unwind
66
stack backtrace:
77
thread caused non-unwinding panic. aborting.
88
error: abnormal termination: the program aborted execution
9-
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
9+
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1010
|
1111
LL | ABORT();
1212
| ^ the program aborted execution
1313
|
14-
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
14+
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1515
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1616
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
1717
= 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

tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ panic in a function that cannot unwind
66
stack backtrace:
77
thread caused non-unwinding panic. aborting.
88
error: abnormal termination: the program aborted execution
9-
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
9+
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1010
|
1111
LL | ABORT();
1212
| ^ the program aborted execution
1313
|
14-
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
14+
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1515
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1616
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
1717
= 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

tests/fail/intrinsics/uninit_uninhabited_type.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ aborted execution: attempted to instantiate uninhabited type `!`
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread caused non-unwinding panic. aborting.
55
error: abnormal termination: the program aborted execution
6-
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
6+
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
77
|
88
LL | ABORT();
99
| ^ the program aborted execution
1010
|
11-
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
11+
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1212
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1313
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
1414
= 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

tests/fail/intrinsics/zero_fn_ptr.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ aborted execution: attempted to zero-initialize type `fn()`, which is invalid
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
44
thread caused non-unwinding panic. aborting.
55
error: abnormal termination: the program aborted execution
6-
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
6+
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
77
|
88
LL | ABORT();
99
| ^ the program aborted execution
1010
|
11-
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
11+
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1212
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1313
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
1414
= 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

tests/fail/panic/double_panic.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
88
panic in a destructor during cleanup
99
thread caused non-unwinding panic. aborting.
1010
error: abnormal termination: the program aborted execution
11-
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
11+
--> RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1212
|
1313
LL | ABORT();
1414
| ^ the program aborted execution
1515
|
16-
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
16+
= note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
1717
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
1818
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
1919
= 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

0 commit comments

Comments
 (0)