Commit Graph

5474 Commits

Author SHA1 Message Date
Ralf Jung
585e51aabd disable MIR opts for ZST-related tests 2021-03-25 12:44:30 +01:00
Ralf Jung
726495f489 rustup 2021-03-25 12:17:02 +01:00
bors
91aeb04408 Auto merge of #1748 - jrvanwhy:track-raw-pointers-doc, r=RalfJung
Improvements to the README item on `-Zmiri-track-raw-pointers`.

[Rendered](https://github.com/jrvanwhy/miri/tree/track-raw-pointers-doc)

Minor change: I changed the quotes around `<untagged>` into backticks, so they render correctly in markdown.

~~Significant change: I documented that `-Zmiri-track-raw-pointers` is a strictly more restrictive model that "normal" Stacked Borrows. **I am not confident this change is correct, please verify it.** If this change is not correct, let me know, and I'll update this PR to document that :-)~~

EDIT: I was wrong, `-Zmiri-track-raw-pointers` may not be strictly more restrictive. I added the following sentence to prevent others from making the same assumption that I did:

> Note that it is not currently guaranteed that code that works with `-Zmiri-track-raw-pointers` also works without `-Zmiri-track-raw-pointers`.
2021-03-25 08:27:25 +00:00
Johnathan Van Why
12005612ab
README.md: Apply RalfJung's suggestion
`-Zmiri-track-raw-pointers` isn't *much* more restrictive than normal Stacked Borrows.

Co-authored-by: Ralf Jung <post@ralfj.de>
2021-03-24 16:20:54 -07:00
bors
b3f81fc610 Auto merge of #1750 - hyd-dev:rustup, r=RalfJung
Remove `#![feature(or_patterns)]`

Fix a warning on CI: https://github.com/rust-lang/miri/runs/2173037929#step:8:59
2021-03-23 09:08:26 +00:00
hyd-dev
08aef5a8aa
Update rust-version 2021-03-23 16:58:37 +08:00
hyd-dev
4eed610723
Remove #![feature(or_patterns)] 2021-03-23 16:58:00 +08:00
Johnathan Van Why
03be4138ed -Zmiri-track-raw-pointers doc correction: it is not strictly more restrictive than Stacked Borrows.
This change is based on the following comment:
https://github.com/rust-lang/miri/pull/1748#issuecomment-803279473
2021-03-22 15:35:18 -07:00
bors
f409454156 Auto merge of #1749 - RalfJung:rustup, r=RalfJung
rustup; better comment in storage_dead_dangling test
2021-03-22 11:37:52 +00:00
Ralf Jung
b4b048cc86 rustup; better comment in storage_dead_dangling test 2021-03-22 12:35:30 +01:00
Johnathan Van Why
263be25484 Improvements to the README item on -Zmiri-track-raw-pointers.
1. The double quotes around <untagged> are changed to backspaces, so <untagged>
   will render correctly in markdown.
2. Clarify that -Zmiri-track-raw-pointers will never accept code that Miri
   would not have accepted without -Zmiri-track-raw-pointers.
2021-03-19 09:27:36 -07:00
bors
12dac5c0f7 Auto merge of #1746 - bstrie:depfix, r=RalfJung
Replace deprecated `collections::Bound` with `ops::Bound`

Cc https://github.com/rust-lang/rust/issues/83242 , which resulted from https://github.com/rust-lang/rust/pull/82122 .
2021-03-17 23:20:59 +00:00
Ralf Jung
fc88c6ccca rustup 2021-03-18 00:20:03 +01:00
bstrie
4f899ce9ac Replace deprecated collections::Bound 2021-03-17 18:34:44 -04:00
bors
80d6b56954 Auto merge of #1745 - hyd-dev:unsup-foreign-calls-are-not-ub, r=RalfJung
Improve error message of calling unsupported non-"C"/"system"-ABI foreign function

Miri currently reports the following `foo()` call has ABI-mismatch UB:
```rust
#[cfg(unix)]
extern "Rust" { // or any non-"C" ABI
    fn foo();
}

#[cfg(windows)]
extern "C" { // or any non-"system" ABI
    fn foo();
}

fn main() {
    unsafe {
        foo();
    }
}
```
[Output when targeting Linux](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=72afc3bd4d9fdab962422cfc2c5a2166) (and maybe also macOS):
```
error: Undefined Behavior: calling a function with ABI C using caller ABI Rust
  --> src/main.rs:13:9
   |
13 |         foo();
   |         ^^^^^ calling a function with ABI C using caller ABI Rust
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavio
```
Output when targeting Windows:
```
error: Undefined Behavior: calling a function with ABI system using caller ABI C
  --> <anon>:13:9
   |
13 |         foo();
   |         ^^^^^ 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
```

However, to my knowledge, that's not UB -- it's just unsupported by Miri (and Miri can't assume the function has `"C"` or `"system"` ABI since Miri doesn't know about it). I believe that is because of the overzealous `check_abi()` call before the long `match` in `src/shims/{posix,windows}/foreign_items.rs`. The ABI is checked to match the system one (`"system"` on Windows, `"C"` otherwise) no matter the callee is recognized as a shim or an unsupported foreign function.

Therefore, this PR removes the `check_abi()` call before the `match` and inserts a `check_abi()` call to each non-wildcard match.
2021-03-17 17:47:51 +00:00
hyd-dev
7ec919daa4
Remove the macro and expand it manually 2021-03-17 22:27:57 +08:00
hyd-dev
633ac2a222
Remove meaningless tests 2021-03-17 21:55:45 +08:00
hyd-dev
3ee865461f
Revert "Don't duplicate check_abi()"
This reverts commit 1c7d7471da.
2021-03-17 21:51:07 +08:00
hyd-dev
bbc348539b
Unsupported foreign non-"C"/"system"-ABI function calls are not UB 2021-03-17 21:20:04 +08:00
hyd-dev
1c7d7471da
Don't duplicate check_abi() 2021-03-17 00:40:53 +08:00
bors
0788188c7b Auto merge of #1743 - RalfJung:callee-checks, r=RalfJung
Check callee ABI when Miri calls closures

Fixes https://github.com/rust-lang/miri/issues/1741
2021-03-14 18:05:18 +00:00
bors
a798792f1e Auto merge of #1744 - rust-lang:bad-unwind, r=RalfJung
ensure we catch incorrectly unwinding calls

Fixes https://github.com/rust-lang/miri/issues/1740
2021-03-14 16:11:21 +00:00
Ralf Jung
15465a5881 don't ICE when we unwind despite panic=abort 2021-03-14 17:10:45 +01:00
Ralf Jung
c9ff02f549 ensure we catch incorrectly unwinding calls 2021-03-14 17:03:20 +01:00
Ralf Jung
d1dec9cd23 don't ICE when callee has the wrong number of arguments 2021-03-14 15:38:22 +01:00
Ralf Jung
893843fd45 when Miri calls a function ptr, make sure it has the right ABI 2021-03-14 15:30:37 +01:00
bors
ae964207bb Auto merge of #1739 - RalfJung:rustup, r=RalfJung
rustup
2021-03-11 08:07:36 +00:00
Ralf Jung
98f28ac9c8 rustup 2021-03-11 09:07:05 +01:00
bors
a6539934d9 Auto merge of #1738 - RalfJung:rustup, r=RalfJung
rustup

The error message is not entirely right now, but close enough... let's get CI to pass before we miss other breakage.
2021-03-10 15:00:43 +00:00
Ralf Jung
7a7f7b1a7a rustup 2021-03-10 15:21:12 +01:00
bors
fc41a9cdd4 Auto merge of #1736 - DJMcNab:rust-analyzer-private, r=RalfJung
Opt-in to rustc_private for `rust-analyzer`

rust-analyzer/rust-analyzer#7891
2021-03-09 18:38:22 +00:00
Daniel McNab
6106ee214c Add link to pr for documentation 2021-03-09 18:27:22 +00:00
bors
c765effa89 Auto merge of #1737 - rust-lang:oli-obk-patch-1, r=oli-obk
mir-opt-level 4 is the new 3

cc https://github.com/rust-lang/rust/pull/82736
2021-03-09 13:51:10 +00:00
Oli Scherer
38da1fab78
mir-opt-level 4 is the new 3 2021-03-09 14:50:38 +01:00
bors
413e341eb4 Auto merge of #1735 - m-ou-se:remove-unwrap-none, r=RalfJung
Remove unwrap_none/expect_none, take 2.

This is https://github.com/rust-lang/miri/pull/1734, but now with a better alternative.

This also upgrades rustc to the latest version, to be able to use the better alternative (`try_insert`).
2021-03-08 18:06:30 +00:00
Daniel McNab
1e19150d1e Opt-in to rustc_private for rust-analyzer
rust-analyzer/rust-analyzer#7891
2021-03-08 17:28:52 +00:00
Mara Bos
90e218ad90 Fix panic test. 2021-03-08 17:06:50 +01:00
Mara Bos
5bd5ea21ea Remove unwrap_none as it won't be stabilized.
This upgrades to the latest rustc to be able to use try_insert()
instead.
2021-03-08 16:59:20 +01:00
bors
0a0e366ccf Auto merge of #1733 - Smittyvb:breakpoint-intrinsic, r=RalfJung
Support breakpoint intrinsic

The `breakpoint` intrinsic raises a `SIGTRAP` signal. If a debugger is attached to a normal program, then `SIGTRAP` can be used to trigger breakpoints in debuggers like `gdb`. If there is no debugger, then the program exits with a message like `Trace/breakpoint trap (core dumped)`. This adds support for the intrinsic in Miri. While actually passing through the `SIGTRAP` doesn't make sense in a Miri context (if it just raised the signal normally then it would allow for debugging Miri itself, not the program being evaluated). As such, it just raises an error.
2021-03-05 12:29:32 +00:00
Smittyvb
8d43d727f4
Check arg count
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-03-05 07:16:50 -05:00
Smitty
26e97ec54f Support breakpoint intrinsic 2021-03-04 07:48:28 -05:00
bors
d6d0109de6 Auto merge of #1732 - RalfJung:atomic_op, r=RalfJung
rename atomic_op_min_max -> atomic_op

The corresponding enum is called `AtomicOp` so IMO this also makes more sense as the name for the function.
2021-03-03 08:06:15 +00:00
Ralf Jung
9f3dbad5d0 rename atomic_op_min_max -> atomic_op 2021-03-02 19:54:45 +01:00
bors
2670839e1a Auto merge of #1721 - henryboisdequin:add-atomic-min-and-max, r=oli-obk
Add atomic min and max

Closes #1718
Previous attempt: #1653

TODO:

- [x] Merge `atomic_op` and `atomic_min_max` functions
- [x] Fix CI

**Note:** this PR also removes arbitrary trailing whitespace and generally formats the affected files
2021-03-02 14:52:32 +00:00
Henry Boisdequin
f8440d6c99 Add in atomic_{min,max}_x intrinsics
Co-authored-by: Greg Bowyer <gbowyer@fastmail.co.uk>
2021-03-02 20:17:05 +05:30
Henry Boisdequin
7d1531f3c1 fmt data_race.rs and intrinsics.rs 2021-03-02 18:06:12 +05:30
bors
904e66a7a6 Auto merge of #1730 - RalfJung:zulip, r=oli-obk
add date to Zulip notification subject

We sometimes have discussions in those threads; let's make sure we have a new thread for each new day (which likely means a new problem... or nobody got around to fixing things yet^^).
2021-03-02 11:08:27 +00:00
bors
debbe9e85c Auto merge of #1731 - RalfJung:ci, r=oli-obk
adjust CI test flags

`RUST_TEST_NOCAPTURE` seems to make no difference except for making compiletest output not use colors any more; `RUST_BACKTRACE` is already set by `compiletest.rs`.
2021-03-02 10:51:12 +00:00
Ralf Jung
47ec9b878e adjust CI test flags 2021-03-02 11:25:02 +01:00
bors
0fc9aee973 Auto merge of #1729 - RalfJung:rustup, r=RalfJung
rustup; fix tests for new MIR optimization

Somehow https://github.com/rust-lang/rust/pull/78360 manages to mask UB. This would make sense if there were loops or things like that, but there are not, so really this is just very confusing...
2021-03-02 10:11:02 +00:00