Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crust functions passed as arguments can't be treated as *u8 #3239

Closed
jdm opened this issue Aug 21, 2012 · 5 comments
Closed

crust functions passed as arguments can't be treated as *u8 #3239

jdm opened this issue Aug 21, 2012 · 5 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries A-type-system Area: Type system

Comments

@jdm
Copy link
Contributor

jdm commented Aug 21, 2012

fn instance_jsclass(finalize: extern fn(*JSFreeOp, *JSObject)) -> fn(bare_compartment) -> JSClass {
 ...
}

Attempts to use finalize inside a JSClass struct (which expects a *u8) fail, whereas inlining this code in the caller work fine.

@pcwalton
Copy link
Contributor

Soon this will be obsolete since the type of crust functions won't be *u8 anymore.

@emberian
Copy link
Member

Visiting for triage; still relevant.

@catamorphism
Copy link
Contributor

(bug triage) Is this still relevant? @pcwalton ?

@jdm
Copy link
Contributor Author

jdm commented Sep 3, 2013

Now you need to pass extern "C" fn, so this should be moot.

@jdm jdm closed this as completed Sep 3, 2013
RalfJung pushed a commit to RalfJung/rust that referenced this issue Jan 4, 2024
…Jung

Use `windows-sys` in windows tests

This PR adds `windows-sys` to `test_dependencies` so that we don't have to write out windows api bindings for each test.
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test result: ok. 320 passed; 7 ignored;


FAILED TEST: tests/pass-dep/concurrency/windows_join_multiple.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-pc-windows-gnu" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-05b12b9c5d72676e.rlib" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-05b12b9c5d72676e.rmeta" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-00224480fb87db84.rlib" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-00224480fb87db84.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/liblibc-d8eeef198237e489.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/liblibc-d8eeef198237e489.rmeta" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libnum_cpus-888469fa0ff3d493.rlib" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libnum_cpus-888469fa0ff3d493.rmeta" "--extern" "rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/librand-3ce088fe5404111c.rlib" "--extern" "rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/librand-3ce088fe5404111c.rmeta" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtempfile-151866a30fd9ac01.rlib" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtempfile-151866a30fd9ac01.rmeta" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libpage_size-eb655f7354e5b89c.rlib" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libpage_size-eb655f7354e5b89c.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtokio-948b613bda81142f.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtokio-948b613bda81142f.rmeta" "--extern" "windows_sys=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-24c27061cb0bf9e3.rlib" "--extern" "windows_sys=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-24c27061cb0bf9e3.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/tests/pass-dep/concurrency" "tests/pass-dep/concurrency/windows_join_multiple.rs" "-Zmiri-preemption-rate=0" "--edition" "2021"
Error: 
   0: tests failed


Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Caused by:
Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/compiletest-c5fd2d04bfeca068 pass --quiet` (exit status: 1)
error: pass test got exit status: 1, but expected 0
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_join_multiple.stderr` to the actual output
--- tests/pass-dep/concurrency/windows_join_multiple.stderr
+++ <stderr output>
+++ <stderr output>
+error: Undefined Behavior: calling a function with ABI system using caller ABI C
+  --> $DIR/windows_join_multiple.rs:LL:CC
+   |
+LL |         assert_eq!(WaitForSingleObject(blocker, INFINITE), WAIT_OBJECT_0);
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C
+   = 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 closure at $DIR/windows_join_multiple.rs:LL:CC
---

error: there were 1 unmatched diagnostics
##[error]  --> tests/pass-dep/concurrency/windows_join_multiple.rs:23:20
   |
23 |         assert_eq!(WaitForSingleObject(blocker, INFINITE), WAIT_OBJECT_0);
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: Undefined Behavior: calling a function with ABI system using caller ABI C

full stderr:
error: Undefined Behavior: calling a function with ABI system using caller ABI C
##[error]  --> tests/pass-dep/concurrency/windows_join_multiple.rs:23:20
##[error]  --> tests/pass-dep/concurrency/windows_join_multiple.rs:23:20
   |
LL |         assert_eq!(WaitForSingleObject(blocker, INFINITE), WAIT_OBJECT_0);
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C
   = 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 closure at tests/pass-dep/concurrency/windows_join_multiple.rs:23:20: 23:58
---



FAILED TEST: tests/pass-dep/concurrency/windows_init_once.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-pc-windows-gnu" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-05b12b9c5d72676e.rlib" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-05b12b9c5d72676e.rmeta" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-00224480fb87db84.rlib" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-00224480fb87db84.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/liblibc-d8eeef198237e489.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/liblibc-d8eeef198237e489.rmeta" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libnum_cpus-888469fa0ff3d493.rlib" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libnum_cpus-888469fa0ff3d493.rmeta" "--extern" "rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/librand-3ce088fe5404111c.rlib" "--extern" "rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/librand-3ce088fe5404111c.rmeta" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtempfile-151866a30fd9ac01.rlib" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtempfile-151866a30fd9ac01.rmeta" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libpage_size-eb655f7354e5b89c.rlib" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libpage_size-eb655f7354e5b89c.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtokio-948b613bda81142f.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtokio-948b613bda81142f.rmeta" "--extern" "windows_sys=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-24c27061cb0bf9e3.rlib" "--extern" "windows_sys=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-24c27061cb0bf9e3.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/tests/pass-dep/concurrency" "tests/pass-dep/concurrency/windows_init_once.rs" "-Zmiri-preemption-rate=0" "--edition" "2021"
error: pass test got exit status: 1, but expected 0

error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_init_once.stderr` to the actual output
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_init_once.stderr` to the actual output
--- tests/pass-dep/concurrency/windows_init_once.stderr
+++ <stderr output>
+error: Undefined Behavior: calling a function with ABI system using caller ABI C
+  --> $DIR/windows_init_once.rs:LL:CC
+   |
+LL |         assert_eq!(InitOnceBeginInitialize(&mut init_once, 0, &mut pending, null_mut()), TRUE);
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C
+   = 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 `single_thread` at $DIR/windows_init_once.rs:LL:CC
---
+error: aborting due to 1 previous error
+


error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_init_once.stdout` to the actual output
+++ <stdout output>
-completing initialization
-finished waiting for initialization
-finished waiting for initialization
---

error: there were 1 unmatched diagnostics
##[error]  --> tests/pass-dep/concurrency/windows_init_once.rs:26:20
   |
26 |         assert_eq!(InitOnceBeginInitialize(&mut init_once, 0, &mut pending, null_mut()), TRUE);
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: Undefined Behavior: calling a function with ABI system using caller ABI C

full stderr:
error: Undefined Behavior: calling a function with ABI system using caller ABI C
##[error]  --> tests/pass-dep/concurrency/windows_init_once.rs:26:20
##[error]  --> tests/pass-dep/concurrency/windows_init_once.rs:26:20
   |
LL |         assert_eq!(InitOnceBeginInitialize(&mut init_once, 0, &mut pending, null_mut()), TRUE);
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C
   = 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 `single_thread` at tests/pass-dep/concurrency/windows_init_once.rs:26:20: 26:88
---



FAILED TEST: tests/pass-dep/concurrency/windows_detach_terminated.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-pc-windows-gnu" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-05b12b9c5d72676e.rlib" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-05b12b9c5d72676e.rmeta" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-00224480fb87db84.rlib" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-00224480fb87db84.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/liblibc-d8eeef198237e489.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/liblibc-d8eeef198237e489.rmeta" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libnum_cpus-888469fa0ff3d493.rlib" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libnum_cpus-888469fa0ff3d493.rmeta" "--extern" "rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/librand-3ce088fe5404111c.rlib" "--extern" "rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/librand-3ce088fe5404111c.rmeta" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtempfile-151866a30fd9ac01.rlib" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtempfile-151866a30fd9ac01.rmeta" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libpage_size-eb655f7354e5b89c.rlib" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libpage_size-eb655f7354e5b89c.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtokio-948b613bda81142f.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtokio-948b613bda81142f.rmeta" "--extern" "windows_sys=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-24c27061cb0bf9e3.rlib" "--extern" "windows_sys=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-24c27061cb0bf9e3.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/tests/pass-dep/concurrency" "tests/pass-dep/concurrency/windows_detach_terminated.rs" "-Zmiri-preemption-rate=0" "--edition" "2021"
error: pass test got exit status: 1, but expected 0

error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_detach_terminated.stderr` to the actual output
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_detach_terminated.stderr` to the actual output
--- tests/pass-dep/concurrency/windows_detach_terminated.stderr
+++ <stderr output>
+error: Undefined Behavior: calling a function with ABI system using caller ABI C
+  --> $DIR/windows_detach_terminated.rs:LL:CC
+   |
+LL |         assert_ne!(CloseHandle(thread), 0);
+   |                    ^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C
+   = 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 `main` at $DIR/windows_detach_terminated.rs:LL:CC
---

error: there were 1 unmatched diagnostics
##[error]  --> tests/pass-dep/concurrency/windows_detach_terminated.rs:17:20
   |
17 |         assert_ne!(CloseHandle(thread), 0);
   |                    ^^^^^^^^^^^^^^^^^^^ Error: Undefined Behavior: calling a function with ABI system using caller ABI C

full stderr:
error: Undefined Behavior: calling a function with ABI system using caller ABI C
##[error]  --> tests/pass-dep/concurrency/windows_detach_terminated.rs:17:20
##[error]  --> tests/pass-dep/concurrency/windows_detach_terminated.rs:17:20
   |
LL |         assert_ne!(CloseHandle(thread), 0);
   |                    ^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C
   = 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 `main` at tests/pass-dep/concurrency/windows_detach_terminated.rs:17:20: 17:39
---



FAILED TEST: tests/pass-dep/concurrency/windows_condvar_shared.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-pc-windows-gnu" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-05b12b9c5d72676e.rlib" "--extern" "getrandom_01=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-05b12b9c5d72676e.rmeta" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-00224480fb87db84.rlib" "--extern" "getrandom_02=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libgetrandom-00224480fb87db84.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/liblibc-d8eeef198237e489.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/liblibc-d8eeef198237e489.rmeta" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libnum_cpus-888469fa0ff3d493.rlib" "--extern" "num_cpus=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libnum_cpus-888469fa0ff3d493.rmeta" "--extern" "rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/librand-3ce088fe5404111c.rlib" "--extern" "rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/librand-3ce088fe5404111c.rmeta" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtempfile-151866a30fd9ac01.rlib" "--extern" "tempfile=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtempfile-151866a30fd9ac01.rmeta" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libpage_size-eb655f7354e5b89c.rlib" "--extern" "page_size=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libpage_size-eb655f7354e5b89c.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtokio-948b613bda81142f.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libtokio-948b613bda81142f.rmeta" "--extern" "windows_sys=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-24c27061cb0bf9e3.rlib" "--extern" "windows_sys=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-24c27061cb0bf9e3.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/miri/x86_64-pc-windows-gnu/debug/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui/tests/pass-dep/concurrency" "tests/pass-dep/concurrency/windows_condvar_shared.rs" "-Zmiri-preemption-rate=0" "--edition" "2021"
error: pass test got exit status: 1, but expected 0

error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_condvar_shared.stderr` to the actual output
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_condvar_shared.stderr` to the actual output
--- tests/pass-dep/concurrency/windows_condvar_shared.stderr
+++ <stderr output>
+error: Undefined Behavior: calling a function with ABI system using caller ABI C
+  --> $DIR/windows_condvar_shared.rs:LL:CC
+   |
+LL |                 AcquireSRWLockShared(lock_ptr.0);
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C
+   = 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 closure at $DIR/windows_condvar_shared.rs:LL:CC
+   = note: inside closure at $DIR/windows_condvar_shared.rs:LL:CC
+
+note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
+
+error: aborting due to 1 previous error
+


error: actual output differed from expected
Execute `./miri test --bless` to update `tests/pass-dep/concurrency/windows_condvar_shared.stdout` to the actual output
+++ <stdout output>
 all_shared
-exclusive waiter 0 locked
-exclusive waiter 1 locked
---
-shared waiter 3 locked
-shared waiter 4 locked
-main locked
-main unlocked
-shared waiter 0 reacquired lock
-shared waiter 1 reacquired lock
-shared waiter 2 reacquired lock
-shared waiter 3 reacquired lock
-shared waiter 4 reacquired lock
-exclusive_sleep_and_shared_lock
-exclusive waiter 0 locked
-exclusive waiter 1 locked
-exclusive waiter 2 locked
-exclusive waiter 3 locked
-exclusive waiter 4 locked
-reader 0 locked
-reader 1 locked
-reader 2 locked
-reader 3 locked
-reader 4 locked
-reader 0 unlocked
-reader 1 unlocked
-reader 2 unlocked
-reader 3 unlocked
-reader 4 unlocked
-exclusive waiter 0 reacquired lock
-exclusive waiter 0 unlocked
-exclusive waiter 1 reacquired lock
-exclusive waiter 1 unlocked
-exclusive waiter 2 reacquired lock
-exclusive waiter 2 unlocked
-exclusive waiter 3 reacquired lock
-exclusive waiter 3 unlocked
-exclusive waiter 4 reacquired lock
-exclusive waiter 4 unlocked

error: there were 1 unmatched diagnostics
##[error]  --> tests/pass-dep/concurrency/windows_condvar_shared.rs:41:17
   |
   |
41 |                 AcquireSRWLockShared(lock_ptr.0);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: Undefined Behavior: calling a function with ABI system using caller ABI C

full stderr:
error: Undefined Behavior: calling a function with ABI system using caller ABI C
##[error]  --> tests/pass-dep/concurrency/windows_condvar_shared.rs:41:17
##[error]  --> tests/pass-dep/concurrency/windows_condvar_shared.rs:41:17
   |
LL |                 AcquireSRWLockShared(lock_ptr.0);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C
   = 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 closure at tests/pass-dep/concurrency/windows_condvar_shared.rs:41:17: 41:49

jaisnan pushed a commit to jaisnan/rust-dev that referenced this issue Jul 29, 2024
The current method for creating the modifies wrapper requires changing
the `ensures` clause to have `_renamed` variables which are unsafe
copies of the original function arguments. This causes issues with
regards to some possible tests as in rust-lang#3239.

This change removes the `_renamed` variables and instead simply changes
the modifies clauses within the replace to unsafely dereference the
pointer to modify the contents of it unsafely, condensing all instances
of unsafe Rust into a single location.

Resolves rust-lang#3239
Resolves rust-lang#3026
May affect rust-lang#3027. In my attempt to run this example with slight
modification to fit the current implementation, I got the error `CBMC
appears to have run out of memory. You may want to rerun your proof in
an environment with additional memory or use stubbing to reduce the size
of the code the verifier reasons about.` This suggests that the
compilation is working appropriately but the test case is just too large
for CBMC.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

Co-authored-by: Matias Scharager <mscharag@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

5 participants