Commit Graph

5449 Commits

Author SHA1 Message Date
bors
1ec52abb48 Auto merge of #1761 - hyd-dev:build-rs-proc-macro-no-default-args, r=RalfJung
Don't use `MIRI_DEFAULT_ARGS` to compile host crates

They (specifically, `--cfg=miri`) may cause procedural macros (and probably build scripts) to depend on Miri-only symbols, such as `miri_resolve_frame`.

This PR makes `miri` detect host crates inspecting the value of the `MIRI_BE_RUSTC` environment variable (`target` -> target crate, `host` -> host crate, other -> panic) and skip the insertion of `MIRI_DEFAULT_ARGS` if it's a host crate.

Fixes #1760
2021-04-08 17:07:15 +00:00
hyd-dev
3dff1d4fcd
Don't use MIRI_DEFAULT_ARGS to compile host crates 2021-04-09 00:57:59 +08:00
bors
7b2e325728 Auto merge of #1759 - RalfJung:readme, r=RalfJung
mention 'cargo miri test filter' in README

Also update the "unsupported" example to something that is actually unsupported.
2021-04-07 08:10:37 +00:00
Ralf Jung
a760aab828 mention 'cargo miri test filter' in README 2021-04-07 10:09:42 +02:00
bors
685ad70647 Auto merge of #1757 - RalfJung:rustdoc, r=RalfJung
add rustdoc support

`@teryror` did all the work in https://github.com/rust-lang/miri/pull/1671; I just finished things up and fixed conflicts. Also thanks to `@hyd-dev` for preemptively fixing a sysroot issue that would have taken me some time to diagnose.

Fixes https://github.com/rust-lang/miri/issues/584
2021-04-06 08:41:11 +00:00
Ralf Jung
2f6dff6da8 nits and fix non-deterministic test output 2021-04-05 13:18:59 +02:00
Ralf Jung
f9bd6b0756 nits; test running no doctests 2021-04-05 12:46:36 +02:00
Ralf Jung
e66a89c8af avoid some dead code and test no_run tests 2021-04-05 12:37:22 +02:00
Ralf Jung
29bc8a57b0 add test for compile_fail; de-duplicate sysroot forwarding 2021-04-05 12:16:31 +02:00
hyd-dev
65597951b7 Fix sysroot for rustdoc 2021-04-05 11:56:13 +02:00
Ralf Jung
9083e00b2c resolve semantic conflicts 2021-04-05 11:55:53 +02:00
Ralf Jung
dd393f21c7 make attempt to cross-interpret a hard error 2021-04-05 11:48:37 +02:00
Tristan Dannenberg
4fccde54ac make cargo-miri run doc-tests 2021-04-05 11:48:17 +02:00
bors
28f813f4d3 Auto merge of #1756 - RalfJung:getrandom, r=RalfJung
also test old getrandom

getrandom 0.1 is still in use, so let's make sure it also still works with Miri.
2021-04-04 13:36:30 +00:00
Ralf Jung
84f44900f4 also test old getrandom 2021-04-04 15:35:19 +02:00
bors
9c41b8b1cb Auto merge of #1755 - RalfJung:cargo-update, r=RalfJung
'cargo update' all the things

Also add a test directly calling `getrandom`.
2021-04-04 10:06:58 +00:00
Ralf Jung
3d15e47441 bump test-cargo-miri dependencies 2021-04-04 12:03:52 +02:00
Ralf Jung
8e661cc47e bump cargo-miri dependencies 2021-04-04 12:01:32 +02:00
Ralf Jung
31bd77c7d8 bump miri dependencies 2021-04-04 11:48:20 +02:00
Ralf Jung
20e31dbdad fix newer getrandom on Windows 2021-04-04 11:41:04 +02:00
Ralf Jung
0f7c01527a 'cargo update' all the things 2021-04-04 11:11:19 +02:00
Ralf Jung
650411492c also test getrandom directly 2021-04-04 11:09:40 +02:00
bors
2cdd1744b8 Auto merge of #1753 - RalfJung:rustup, r=RalfJung
rustup
2021-03-28 00:37:44 +00:00
Ralf Jung
de0f3f930b rustup 2021-03-28 01:36:41 +01:00
bors
3e4ad366fc Auto merge of #1752 - RalfJung:rustup, r=RalfJung
rustup

Just making sure that https://github.com/rust-lang/rust/pull/83445 indeed fixed our cron job failures.
2021-03-25 11:45:11 +00:00
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