Commit Graph

4209 Commits

Author SHA1 Message Date
Ralf Jung
78ce616490 implement float_to_int_unchecked 2020-04-12 12:01:20 +02:00
Ralf Jung
8d1f5336c2 also test unsafe cast intrinsic (happy cases) 2020-04-12 12:01:20 +02:00
bors
85dff8b67a Auto merge of #1324 - RalfJung:intrinsic-orga, r=RalfJung
organize intrinsics in groups

Also remove `pref_align_of` as it was moved into rustc long ago, and `align_of_val` as it doesn't exist (the name is `min_align_of_val`, which we also already handle).
2020-04-12 09:07:21 +00:00
Ralf Jung
2a3ce5d618 there is no 'align_of_val' intrinsic 2020-04-12 11:04:18 +02:00
Ralf Jung
fd0957f5cd remove an intrinsic that was moved to rustc 2020-04-12 11:02:56 +02:00
Ralf Jung
6414003ab9 organize intrinsics into groups 2020-04-12 11:01:59 +02:00
bors
c827d1fd9c Auto merge of #1323 - RalfJung:noref, r=RalfJung
avoid a bunch of as_ref/as_mut
2020-04-12 08:40:32 +00:00
Ralf Jung
314e7238cf avoid a bunch of as_ref/as_mut 2020-04-12 10:32:36 +02:00
bors
a1c9ad8e1b Auto merge of #1322 - RalfJung:noref, r=RalfJung
avoid ref in matches

Inspired by https://internals.rust-lang.org/t/is-ref-more-powerful-than-match-ergonomics/12111
2020-04-12 08:09:30 +00:00
Ralf Jung
97791a56da avoid ref in matches 2020-04-12 10:08:12 +02:00
bors
aad2c5af06 Auto merge of #1321 - RalfJung:float, r=RalfJung
Even more float cast tests

Copy a bunch of float cast tests from https://github.com/WebAssembly/testsuite/blob/master/conversions.wast. I didn't do all of them though, too lazy... maybe we should have a wasm interpreter written in Rust and run that in Miri and use the wasm test suite directly that way? :P
2020-04-11 18:39:06 +00:00
bors
8c396609d0 Auto merge of #1320 - RalfJung:tests, r=RalfJung
compile-fail test organization

Move compile-fail tests to appropriate directories.

(run-pass tests often test many things in one file, organized by functions. But for compile-fail tests that is not possible.)
2020-04-11 18:11:35 +00:00
bors
e042e2ceef Auto merge of #1319 - RalfJung:readme, r=RalfJung
add push_str issue to trophy case
2020-04-11 16:32:54 +00:00
Ralf Jung
e5e0ced87e smoketest f32 fast-math intrinsics 2020-04-11 11:37:26 +02:00
Ralf Jung
faff175f3e some some int-to-float and float-to-float cast tests from wasm test suite 2020-04-11 11:37:26 +02:00
Ralf Jung
5db01f7371 copy lots of float-to-int cast tests from wasm test suite 2020-04-11 11:37:26 +02:00
Ralf Jung
c63c413331 a few more inf/nan/negz tests 2020-04-11 11:37:26 +02:00
Ralf Jung
b2bf4ec2f5 organize compile-fail tests in folders 2020-04-11 11:36:55 +02:00
Ralf Jung
ea37f580e4 add push_str issue to trophy case 2020-04-11 09:16:55 +02:00
bors
910afefcf6 Auto merge of #1308 - RalfJung:miri, r=RalfJung
More explicit build instructions

@ssomers does this help, or do you think there is more we should say?

Fixes https://github.com/rust-lang/miri/issues/1306
2020-04-10 17:09:02 +00:00
bors
c85ba0a166 Auto merge of #1316 - RalfJung:compiletest, r=RalfJung
bump compiletest
2020-04-10 12:58:10 +00:00
Ralf Jung
93027da5ed bump compiletest 2020-04-10 14:57:22 +02:00
bors
2e82a8dc9e Auto merge of #1304 - RalfJung:backtrace-sep, r=RalfJung
add empty line before backtrace, to separate it from help text

I think this improves how things look, and makes it easier to see the help text (it currently kind of drowns next to the backtrace).

Before:
```
error: unsupported operation: Miri does not support threading
  --> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
   |
68 |         let ret = libc::pthread_create(&mut native, &attr, thread_start, &*p as *const _ as *mut _);
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Miri does not support threading
   |
   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
   = note: inside `std::sys::unix:🧵:Thread::new` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
   = note: inside `std:🧵:Builder::spawn_unchecked::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:492:26
   = note: inside `std:🧵:Builder::spawn::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:386:18
   = note: inside `std:🧵:spawn::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:619:5
note: inside `main` at tests/compile-fail/thread-spawn.rs:6:5
  --> tests/compile-fail/thread-spawn.rs:6:5
   |
6  |     thread::spawn(|| {});
   |     ^^^^^^^^^^^^^^^^^^^^
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6030 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:13
   = note: inside `std::panicking::try::do_call::<[closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:331:40
   = note: inside `std::panicking::try::<i32, [closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:274:15
   = note: inside `std::panic::catch_unwind::<[closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panic.rs:394:14
   = note: inside `std::rt::lang_start_internal` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:51:25
   = note: inside `std::rt::lang_start::<()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:5
```
After:
```
error: unsupported operation: Miri does not support threading
  --> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
   |
68 |         let ret = libc::pthread_create(&mut native, &attr, thread_start, &*p as *const _ as *mut _);
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Miri does not support threading
   |
   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support

   = note: inside `std::sys::unix:🧵:Thread::new` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:68:19
   = note: inside `std:🧵:Builder::spawn_unchecked::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:492:26
   = note: inside `std:🧵:Builder::spawn::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:386:18
   = note: inside `std:🧵:spawn::<[closure@tests/compile-fail/thread-spawn.rs:6:19: 6:24], ()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/thread/mod.rs:619:5
note: inside `main` at tests/compile-fail/thread-spawn.rs:6:5
  --> tests/compile-fail/thread-spawn.rs:6:5
   |
6  |     thread::spawn(|| {});
   |     ^^^^^^^^^^^^^^^^^^^^
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6030 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5
   = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:13
   = note: inside `std::panicking::try::do_call::<[closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:331:40
   = note: inside `std::panicking::try::<i32, [closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panicking.rs:274:15
   = note: inside `std::panic::catch_unwind::<[closure@DefId(1:6029 ~ std[2f86]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/panic.rs:394:14
   = note: inside `std::rt::lang_start_internal` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:51:25
   = note: inside `std::rt::lang_start::<()>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:5
```

What do you think?
2020-04-10 09:29:35 +00:00
bors
910f87497c Auto merge of #1315 - RalfJung:housekeeping, r=RalfJung
Housekeeping
2020-04-10 08:35:16 +00:00
Ralf Jung
280394d366 cargo update 2020-04-10 10:28:45 +02:00
Ralf Jung
f77e0281c9 rustup 2020-04-10 10:28:07 +02:00
Ralf Jung
d276d952ff fix unused warnings in tests 2020-04-10 10:27:59 +02:00
Ralf Jung
fedca29e69 tweak wording 2020-04-08 15:56:59 +02:00
bors
bc65281438 Auto merge of #1313 - RalfJung:trophy, r=RalfJung
add EbrCell to trophy case

Thanks @Firstyear for letting me know about this :)
2020-04-08 13:22:21 +00:00
Ralf Jung
4069302a8c add EbrCell to trophy case 2020-04-08 15:17:26 +02:00
Ralf Jung
b1009c4aa5 more editing 2020-04-08 12:33:14 +02:00
Ralf Jung
925465ebab more editing for CONTRIBUTING guide 2020-04-08 11:43:19 +02:00
bors
325682ad56 Auto merge of #1301 - RalfJung:global-leaks, r=RalfJung
memory reachable through globals is not a leak

Blocked on https://github.com/rust-lang/rust/pull/70762
Fixes https://github.com/rust-lang/miri/issues/940
2020-04-07 17:33:24 +00:00
Ralf Jung
7841f44593 rustup 2020-04-07 19:33:03 +02:00
Ralf Jung
f462b4c257 memory reachable through globals is not a leak any more; adjust for better memory dumping 2020-04-07 19:03:41 +02:00
bors
3342f155e1 Auto merge of #1310 - RalfJung:float-assoc, r=RalfJung
prefer float assoc consts over std module
2020-04-07 14:42:34 +00:00
Ralf Jung
a46f8b66c3 prefer float assoc consts over std module 2020-04-07 16:13:19 +02:00
bors
d935f62172 Auto merge of #1157 - divergentdave:shim-pthread-try-lock, r=RalfJung
Add shims for RwLock::try_read/RwLock::try_write

This implements proper locking so that we can check for reentrancy and implement the `try_*` methods.

Fixes https://github.com/rust-lang/miri/issues/781
2020-04-06 13:55:53 +00:00
David Cook
80497e5d3c Clean up conditional compilation 2020-04-06 07:23:58 -05:00
Ralf Jung
ac3a24673c wording 2020-04-06 09:37:15 +02:00
Ralf Jung
3554f54173 make just ./miri print help text without 'unknown command' 2020-04-06 09:34:27 +02:00
Ralf Jung
86c57a8490 mention ./miri build 2020-04-06 09:33:36 +02:00
David Cook
0f5f0e1520 Fix spelling typo 2020-04-05 20:55:39 -05:00
David Cook
bc54c7628d Eagerly compute i32 and u32 layouts 2020-04-05 16:03:44 -05:00
David Cook
134d6a2faa Add tests, improve test coverage 2020-04-05 14:55:57 -05:00
David Cook
f9dc942cfd Changes to error handling 2020-04-05 13:53:03 -05:00
David Cook
d5d5a56926 Add tests 2020-04-05 13:25:49 -05:00
David Cook
e7944419d4 Use Deadlock machine stop uniformly 2020-04-05 12:44:23 -05:00
David Cook
100141f57c Remove null checks, fall through to UB upon deref 2020-04-05 12:32:09 -05:00
bors
d25589f0bd Auto merge of #1307 - RalfJung:vec-extend, r=RalfJung
also test push_str ptr stability (the original report)
2020-04-05 17:14:49 +00:00