]> git.lizzy.rs Git - rust.git/commitdiff
kill xargo dir and update docs
authorRalf Jung <post@ralfj.de>
Sun, 25 Nov 2018 17:27:24 +0000 (18:27 +0100)
committerRalf Jung <post@ralfj.de>
Tue, 27 Nov 2018 07:16:58 +0000 (08:16 +0100)
README.md
cargo-miri-test/run-test.py
src/bin/cargo-miri.rs
xargo/Cargo.lock [deleted file]
xargo/Cargo.toml [deleted file]
xargo/Xargo.toml [deleted file]
xargo/build.sh [deleted file]
xargo/src/lib.rs [deleted file]

index 5e5a7a23c6afe04441ab31b0b6d343c2b293d8fa..5dced653bb007cb3f66a08fe68a3681fe9e52e50 100644 (file)
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ in this directory.
 
 [rustup]: https://www.rustup.rs
 
-## Running Miri
+## Running Miri on tiny examples
 
 ```sh
 cargo +nightly run -- -Zmiri-disable-validation tests/run-pass/vecs.rs # Or whatever test you like.
@@ -51,74 +51,42 @@ cargo +nightly run -- -Zmiri-disable-validation tests/run-pass/vecs.rs # Or what
 We have to disable validation because that can lead to errors when libstd is not
 compiled the right way.
 
-## Running Miri with full libstd
-
-Per default libstd does not contain the MIR of non-polymorphic functions, and
-also does not contain some extra MIR statements that miri needs for validation.
-When Miri hits a call to such a function, execution terminates, and even when
-the MIR is present, validation can fail.  To fix this, it is possible to compile
-libstd with full MIR:
-
-```sh
-rustup component add --toolchain nightly rust-src
-cargo +nightly install xargo
-rustup run nightly xargo/build.sh
-```
-
-Now you can run Miri against the libstd compiled by xargo:
-
-```sh
-MIRI_SYSROOT=~/.xargo/HOST cargo +nightly run tests/run-pass-fullmir/hashmap.rs
-```
-
-Notice that you will have to re-run the last step of the preparations above
-(`xargo/build.sh`) when your toolchain changes (e.g., when you update the
-nightly).
-
 ## Running Miri on your own project('s test suite)
 
-Install Miri as a cargo subcommand with `cargo +nightly install --all-features
---path .`.  Be aware that if you used `rustup override set` to fix a particular
-Rust version for the miri directory, that will *not* apply to your own project
-directory!  You have to use a consistent Rust version for building miri and your
-project for this to work, so remember to either always specify the nightly
-version manually, overriding it in your project directory as well, or use
-`rustup default nightly` (or `rustup default nightly-YYYY-MM-DD`) to globally
-make `nightly` the default toolchain.
-
-We assume that you have prepared a MIR-enabled libstd as described above.  Now
-compile your project and its dependencies against that libstd:
-
-1. Run `cargo clean` to eliminate any cached dependencies that were built against
-the non-MIR `libstd`.
-2. To run all tests in your project through, Miri, use
-`MIRI_SYSROOT=~/.xargo/HOST cargo +nightly miri test`. **NOTE**: This is
-currently broken, see the discussion in
-[#479](https://github.com/solson/miri/issues/479).
-3. If you have a binary project, you can run it through Miri using
-`MIRI_SYSROOT=~/.xargo/HOST cargo +nightly miri`.
+Install Miri as a cargo subcommand with `cargo +nightly install --path .`.  Be
+aware that if you used `rustup override set` to fix a particular Rust version
+for the miri directory, that will *not* apply to your own project directory!
+You have to use a consistent Rust version for building miri and your project for
+this to work, so remember to either always specify the nightly version manually,
+overriding it in your project directory as well, or use `rustup default nightly`
+(or `rustup default nightly-YYYY-MM-DD`) to globally make `nightly` the default
+toolchain.
+
+1. Run `cargo clean` to eliminate any cached dependencies.  Miri needs your
+   dependencies to be compiled the right way, that would not happen if they have
+   previously already been compiled.
+2. To run all tests in your project through Miri, use `cargo +nightly miri test`.
+   **NOTE**: This is currently broken, see the discussion in
+   [#479](https://github.com/solson/miri/issues/479).
+3. If you have a binary project, you can run it through Miri using `cargo
+   +nightly miri run`.
 
 ### Common Problems
 
 When using the above instructions, you may encounter a number of confusing compiler
 errors.
 
-#### "constant evaluation error: no mir for `<function>`"
-
-You may have forgotten to set `MIRI_SYSROOT` when calling `cargo miri`, and
-your program called into `std` or `core`. Be sure to set `MIRI_SYSROOT=~/.xargo/HOST`.
-
 #### "found possibly newer version of crate `std` which `<dependency>` depends on"
 
-Your build directory may contain artifacts from an earlier build that did/did not
-have `MIRI_SYSROOT` set. Run `cargo clean` before switching from non-Miri to Miri
-builds and vice-versa.
+Your build directory may contain artifacts from an earlier build that have/have
+not been built for Miri. Run `cargo clean` before switching from non-Miri to
+Miri builds and vice-versa.
 
 #### "found crate `std` compiled by an incompatible version of rustc"
 
 You may be running `cargo miri` with a different compiler version than the one
-used to build the MIR-enabled `std`. Be sure to consistently use the same toolchain,
-which should be the toolchain specified in the `rust-version` file.
+used to build the custom libstd that Miri uses, and Miri failed to detect that.
+Try deleting `~/.miri`.
 
 ## Miri `-Z` flags
 
index f686cc47449dd8f55892d3ca39fe1a04b02c30ae..42745535e0ef4f01589767293d01343fa4176257 100755 (executable)
@@ -8,10 +8,10 @@ and the working directory to contain the cargo-miri-test project.
 import sys, subprocess
 
 def test_cargo_miri():
-    print("==> Testing `cargo miri` <==")
+    print("==> Testing `cargo miri run` <==")
     ## Call `cargo miri`, capture all output
     p = subprocess.Popen(
-        ["cargo", "miri", "-q"],
+        ["cargo", "miri", "run", "-q"],
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE
     )
index 20d9e9ba71e4cbce66e8d27dda1f5389493eff33..5b6ff084024d91cb57008c64227a721c38e83376 100644 (file)
@@ -174,7 +174,7 @@ fn setup(ask_user: bool) {
         "#).unwrap();
     File::create(dir.join("lib.rs")).unwrap();
     // Run xargo
-    if !Command::new("xargo").arg("build")
+    if !Command::new("xargo").arg("build").arg("-q")
         .current_dir(&dir)
         .env("RUSTFLAGS", miri::miri_default_args().join(" "))
         .env("XARGO_HOME", dir.to_str().unwrap())
diff --git a/xargo/Cargo.lock b/xargo/Cargo.lock
deleted file mode 100644 (file)
index c85820b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-[[package]]
-name = "miri-xargo"
-version = "0.0.0"
-
diff --git a/xargo/Cargo.toml b/xargo/Cargo.toml
deleted file mode 100644 (file)
index 9129c10..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-[package]
-name = "miri-xargo"
-description = "A dummy project for building libstd with xargo."
-version = "0.0.0"
-
-[dependencies]
diff --git a/xargo/Xargo.toml b/xargo/Xargo.toml
deleted file mode 100644 (file)
index e49b0db..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-[dependencies.std]
-features = ["panic_unwind", "backtrace"]
-
-[dependencies.test]
-stage = 1
diff --git a/xargo/build.sh b/xargo/build.sh
deleted file mode 100755 (executable)
index 25c56d3..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-cd "$(dirname "$0")"
-# The flags here should be kept in sync with `add_miri_default_args` in `src/lib.rs`.
-RUSTFLAGS='-Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0' xargo build
diff --git a/xargo/src/lib.rs b/xargo/src/lib.rs
deleted file mode 100644 (file)
index e69de29..0000000