Commit Graph

4361 Commits

Author SHA1 Message Date
Ralf Jung
699685c07c rename test_cast -> test_both_cast to make purpose clearer 2020-04-18 13:07:50 +02:00
bors
45113eb6a4 Auto merge of #1325 - RalfJung:float_to_int_unchecked, r=RalfJung
implement float_to_int_unchecked

@hanna-kruppe would be great if you could have a look at this.

`float.rs` tests legal casts. `test_cast` checks that both `as` casts and unchecked casts work (i.e., these are not saturating). The `compile-fail` tests should ensure that illegal casts via the intrinsic are detected as such.

Fixes https://github.com/rust-lang/miri/issues/1264
2020-04-18 08:13:24 +00:00
Ralf Jung
bb38ab4340 use u128::MAX symbolic name 2020-04-18 10:11:45 +02:00
bors
72667b58b8 Auto merge of #1346 - RalfJung:dyn-layout-test, r=RalfJung
Test that we enforce dynamic layout properties (not just static ones of sized prefix)
2020-04-18 07:16:35 +00:00
Ralf Jung
0345ee42da some UB gets masked by optimizations 2020-04-18 09:15:59 +02:00
Ralf Jung
c6ab27577b test that we check dynamic actual size of object 2020-04-18 02:06:36 +02:00
Ralf Jung
521e77d712 test that we properly check dynamic alignment 2020-04-17 20:43:54 +02:00
bors
216e686cc6 Auto merge of #1344 - RalfJung:rustup, r=RalfJung
rustup for FieldsShape::Primitive
2020-04-17 12:20:03 +00:00
Ralf Jung
6ad0187265 rustup for FieldsShape::Primitive 2020-04-17 14:19:26 +02:00
bors
562d602422 Auto merge of #1343 - RalfJung:derive-packed, r=RalfJung
test #[derive] on packed struct
2020-04-17 09:05:56 +00:00
Ralf Jung
6a81014ae9 test #[derive] on packed struct 2020-04-17 11:04:48 +02:00
David Cook
57c7119315 Handle std::sync::atomic::spin_loop_hint() 2020-04-16 23:24:57 -05:00
bors
9b4af73eb0 Auto merge of #1341 - RalfJung:force-ptr-everywhere, r=oli-obk
ReadBytesAsPointer is always supported

Cc @oli-obk
2020-04-16 19:07:08 +00:00
Ralf Jung
ff3b382b14 ReadBytesAsPointer is always supported 2020-04-16 18:36:03 +02:00
bors
d481e0818c Auto merge of #1338 - RalfJung:test-cleanup, r=RalfJung
Cleanup some run-pass tests
2020-04-16 07:46:57 +00:00
Ralf Jung
3e3613f2e2 merge packed_static and packed_struct 2020-04-16 09:33:22 +02:00
Ralf Jung
974f9c3023 avoid test-wide allowance of unused/dead code 2020-04-16 09:25:12 +02:00
Ralf Jung
b0fe99e81d consolidate ptr tests in fewer files 2020-04-16 09:06:21 +02:00
bors
5c823a1ec1 Auto merge of #1337 - RalfJung:intrinsic-tests, r=RalfJung
test some so-far untested intrinsics
2020-04-15 16:09:40 +00:00
Ralf Jung
07c696e27e test some so-far untested intrinsics 2020-04-15 18:00:16 +02:00
bors
b6fca87d66 Auto merge of #1334 - KrishnaSannasi:track-dealloc, r=RalfJung
add deallocation tracking

fixes #1314
2020-04-15 15:48:07 +00:00
Ozaren
b77968e8bd
added deallocation tracking 2020-04-15 11:29:35 -04:00
bors
e4eceba7d3 Auto merge of #1336 - RalfJung:instance-sanity, r=RalfJung
tighten Instance sanity check

Let's see if we can get away with this...
2020-04-15 11:34:34 +00:00
Ralf Jung
a85dab42ea tighten Instance sanity check 2020-04-15 13:13:17 +02:00
bors
fbea3e57f3 Auto merge of #1330 - RalfJung:retag-return-place, r=RalfJung
retag return place

@eddyb suggested that return places should be treated like unique references for Stacked Borrows. That is implemented by this patch, but it is unfortunately quite the hack because otherwise we are retagging *references*, not places.

@eddyb does this roughly correspond to what you had in mind? (Except for whatever it is you think should happen with argument passing, which is a much bigger issue.) Also, do you think there is any way we can *test* this?

Needs https://github.com/rust-lang/rust/pull/71100 to land.
2020-04-15 10:41:13 +00:00
Ralf Jung
3548dcf8cc rustup 2020-04-15 12:39:28 +02:00
Ralf Jung
0805b4bf2e retag return places 2020-04-15 12:39:19 +02:00
Ralf Jung
90d71cd13f adjust for frame hook changes 2020-04-15 12:33:52 +02:00
bors
669191bca9 Auto merge of #1331 - samrat:macos-mach-timebase-info, r=RalfJung
Implement `mach_timebase_info` for macOS

Since we return nanoseceonds instead of ticks from `mach_absolute_time`, we don't need to scale the absolute time

Fixes #1288
2020-04-14 09:30:22 +00:00
Samrat Man Singh
fff45b77ad
Reword comment in mach_timebase_info
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-04-14 13:59:43 +05:30
bors
4ed3d487a6 Auto merge of #1333 - RalfJung:flag-test, r=RalfJung
Make sure we find many failures even with other checks disabled
2020-04-14 08:25:34 +00:00
Ralf Jung
e6822d60b3 make sure we find some things without validation or stacked borrows, respectively 2020-04-14 10:23:47 +02:00
Ralf Jung
179e78d0ad make sure our disable flags do not miss all bugs; move type-assert intrinsic tests to their folder 2020-04-14 10:23:47 +02:00
Samrat Man Singh
90729bb039 Use precomputed TyLayout from machine.layouts
And add comment documenting successful return value from
`mach_timebase_info`.
2020-04-14 13:31:24 +05:30
bors
03715907f4 Auto merge of #1332 - RalfJung:disable-alignment-check, r=RalfJung
Add option to disable alignment check

Requires https://github.com/rust-lang/rust/pull/71101
Fixes https://github.com/rust-lang/miri/issues/1326
2020-04-14 07:50:41 +00:00
Ralf Jung
f4a15444cf fix comment in alignment test 2020-04-14 09:50:20 +02:00
Ralf Jung
8e73db6510 rustup 2020-04-14 09:40:00 +02:00
Ralf Jung
48aaf674f7 tweak flag section in README 2020-04-14 09:39:57 +02:00
Samrat Man Singh
f6bb8111f2 Use pre-defined u32 layout
Also fix typo and remove newline
2020-04-14 09:40:40 +05:30
Ralf Jung
0ad1114153 mention new option in README and diagnostics 2020-04-13 17:58:03 +02:00
Ralf Jung
fd8beaf5c4 add option to disable alignment checks 2020-04-13 17:58:03 +02:00
Samrat Man Singh
5f6d250b30 [macOS] Implement mach_timebase_info
Since we return nanoseceonds instead of ticks from
`mach_absolute_time`, we don't need to scale the absolute time
2020-04-13 21:18:34 +05:30
bors
df0e32c757 Auto merge of #1329 - RalfJung:readme, r=RalfJung
note Miri's leak check abilities and that they are disabled on Windows
2020-04-13 15:41:50 +00:00
Ralf Jung
a6b66c31d7 note Miri's leak check abilities and that they are disabled on Windows 2020-04-13 11:30:02 +02:00
bors
fbbd4428d0 Auto merge of #1328 - RalfJung:align-false-pos, r=RalfJung
for alignment errors, note that there might be false positives

Cc @shepmaster

```
error: Undefined Behavior: accessing memory with alignment 1, but alignment 8 is required
 --> tests/compile-fail/unaligned_pointers/alignment.rs:8:9
  |
8 |         *y_ptr = 42;
  |         ^^^^^^^^^^^ accessing memory with alignment 1, but alignment 8 is required
  |
  = help: this usually indicates that your program performed an invalid operation and caused Undefined Behavior
  = help: but alignment errors can also be false positives, see https://github.com/rust-lang/miri/issues/1074
```
2020-04-13 07:20:03 +00:00
Ralf Jung
75297d3536 for alignment errors, note that there might be false positives 2020-04-13 09:18:11 +02:00
bors
4545effbcf Auto merge of #1327 - RalfJung:rustup, r=RalfJung
rustup
2020-04-12 22:45:04 +00:00
Ralf Jung
91d7964513 rustup 2020-04-13 00:44:29 +02:00
Ralf Jung
a82efce590 remove some unnecessary trait bounds 2020-04-12 22:01:46 +02:00
Ralf Jung
17c52d47e7 add tests for invalid float-to-int casts 2020-04-12 12:01:20 +02:00