about summary refs log tree commit diff
path: root/library/std/src/sys/pal
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-25 17:05:22 +0100
committerGitHub <noreply@github.com>2024-02-25 17:05:22 +0100
commitf54863636ae19ea4255fb9c1ddf2a0e8a9c5dc9e (patch)
tree0152317b3db31f437fd494c34ebf65cb572175e6 /library/std/src/sys/pal
parent4d442f5a58e3a9858e9370945fccfeaa20203b3d (diff)
parente656844833e0e71416a84bf692240a7a8b809e0a (diff)
downloadrust-f54863636ae19ea4255fb9c1ddf2a0e8a9c5dc9e.tar.gz
rust-f54863636ae19ea4255fb9c1ddf2a0e8a9c5dc9e.zip
Rollup merge of #121513 - nshyrei:fix_tests_module, r=cuviper
Fix sgx unit test compilation

Fixes a compilation error:
```
error[E0583]: file not found for module `tests`
 --> library/std/src/sys/locks/rwlock/sgx.rs:2:1
  |
2 | mod tests;
  | ^^^^^^^^^^
  |
  = help: to create the module `tests`, create file "library/std/src/sys/locks/rwlock/sgx/tests.rs" or "library/std/src/sys/locks/rwlock/sgx/tests/mod.rs"
  = note: if there is a `mod tests` elsewhere in the crate already, import it with `use crate::...` instead

For more information about this error, try `rustc --explain E0583`.
error: could not compile `std` (lib test) due to 1 previous error`
```
When running command:
```
 `TF_BUILD=True RUST_TEST_THREADS=1 ./x.py test --stage 1 "library/std" tests/assembly tests/run-make --target=x86_64-fortanix-unknown-sgx --no-doc --exclude src/tools/linkchecker --exclude src/tools/rust-demangler --no-fail-fast 2>&1
```
The fix is done by moving a file to the location suggested by the compiler.

The issue was introduced by PR: https://github.com/rust-lang/rust/pull/121177
Diffstat (limited to 'library/std/src/sys/pal')
-rw-r--r--library/std/src/sys/pal/sgx/rwlock/tests.rs21
1 files changed, 0 insertions, 21 deletions
diff --git a/library/std/src/sys/pal/sgx/rwlock/tests.rs b/library/std/src/sys/pal/sgx/rwlock/tests.rs
deleted file mode 100644
index 5fd6670afd4..00000000000
--- a/library/std/src/sys/pal/sgx/rwlock/tests.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-use super::*;
-use crate::ptr;
-
-// Verify that the byte pattern libunwind uses to initialize an RwLock is
-// equivalent to the value of RwLock::new(). If the value changes,
-// `src/UnwindRustSgx.h` in libunwind needs to be changed too.
-#[test]
-fn test_c_rwlock_initializer() {
-    const C_RWLOCK_INIT: *mut () = ptr::null_mut();
-
-    // For the test to work, we need the padding/unused bytes in RwLock to be
-    // initialized as 0. In practice, this is the case with statics.
-    static RUST_RWLOCK_INIT: RwLock = RwLock::new();
-
-    unsafe {
-        // If the assertion fails, that not necessarily an issue with the value
-        // of C_RWLOCK_INIT. It might just be an issue with the way padding
-        // bytes are initialized in the test code.
-        assert_eq!(crate::mem::transmute_copy::<_, *mut ()>(&RUST_RWLOCK_INIT), C_RWLOCK_INIT);
-    };
-}