Skip to content

Commit 3a93831

Browse files
authored
Merge pull request #574 from solson/rustup2
fix for latest nightly
2 parents 5956b58 + 5fd0639 commit 3a93831

File tree

10 files changed

+56
-26
lines changed

10 files changed

+56
-26
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2018-12-08
1+
nightly-2018-12-14

src/bin/cargo-miri.rs

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
extern crate cargo_metadata;
44

55
use std::path::{PathBuf, Path};
6-
use std::io::{self, Write};
6+
use std::io::{self, Write, BufRead};
77
use std::process::Command;
88
use std::fs::{self, File};
99

@@ -114,6 +114,36 @@ fn list_targets() -> impl Iterator<Item=cargo_metadata::Target> {
114114
package.targets.into_iter()
115115
}
116116

117+
fn xargo_version() -> Option<(u32, u32, u32)> {
118+
let out = Command::new("xargo").arg("--version").output().ok()?;
119+
if !out.status.success() {
120+
return None;
121+
}
122+
// Parse output. The first line looks like "xargo 0.3.12 (b004f1c 2018-12-13)".
123+
let line = out.stderr.lines().nth(0)
124+
.expect("malformed `xargo --version` output: not at least one line")
125+
.expect("malformed `xargo --version` output: error reading first line");
126+
let version = line.split(' ').nth(1)
127+
.expect("malformed `xargo --version` output: not at least two words");
128+
let mut version_pieces = version.split('.');
129+
let major = version_pieces.next()
130+
.expect("malformed `xargo --version` output: not a major version piece")
131+
.parse()
132+
.expect("malformed `xargo --version` output: major version is not an integer");
133+
let minor = version_pieces.next()
134+
.expect("malformed `xargo --version` output: not a minor version piece")
135+
.parse()
136+
.expect("malformed `xargo --version` output: minor version is not an integer");
137+
let patch = version_pieces.next()
138+
.expect("malformed `xargo --version` output: not a patch version piece")
139+
.parse()
140+
.expect("malformed `xargo --version` output: patch version is not an integer");
141+
if !version_pieces.next().is_none() {
142+
panic!("malformed `xargo --version` output: more than three pieces in version");
143+
}
144+
Some((major, minor, patch))
145+
}
146+
117147
fn ask(question: &str) {
118148
let mut buf = String::new();
119149
print!("{} [Y/n] ", question);
@@ -134,14 +164,15 @@ fn setup(ask_user: bool) {
134164
}
135165

136166
// First, we need xargo
137-
if Command::new("xargo").arg("--version").output().is_err()
138-
{
167+
let xargo = xargo_version();
168+
if xargo.map_or(true, |v| v < (0, 3, 13)) {
139169
if ask_user {
140-
ask("It seems you do not have xargo installed. I will run `cargo install xargo`. Proceed?");
170+
ask("It seems you do not have a recent enough xargo installed. I will run `cargo install xargo -f`. Proceed?");
141171
} else {
142-
println!("Installing xargo: `cargo install xargo`");
172+
println!("Installing xargo: `cargo install xargo -f`");
143173
}
144-
if !Command::new("cargo").args(&["install", "xargo"]).status().unwrap().success() {
174+
// FIXME: Go back to using releases, once a 0.3.13 got released.
175+
if !Command::new("cargo").args(&["install", "xargo", "-f", "--git", "https://github.com/japaric/xargo"]).status().unwrap().success() {
145176
show_error(format!("Failed to install xargo"));
146177
}
147178
}

tests/compiletest.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ fn miri_pass(path: &str, target: &str, opt: bool) {
7777
flags.push("-Dwarnings -Dunused".to_owned()); // overwrite the -Aunused in compiletest-rs
7878
flags.push("--edition 2018".to_owned());
7979
if opt {
80-
// FIXME: We use opt level 1 because MIR inlining defeats the validation
81-
// whitelist.
82-
flags.push("-Zmir-opt-level=1".to_owned());
80+
flags.push("-Zmir-opt-level=3".to_owned());
8381
}
8482

8583
let mut config = mk_config("ui");

tests/run-pass/foreign-fn-linkname.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//ignore-windows: Uses POSIX APIs
1212

13-
#![feature(libc)]
13+
#![feature(rustc_private)]
1414
#![allow(unused_extern_crates)] // rustc bug https://github.com/rust-lang/rust/issues/56098
1515

1616
extern crate libc;

tests/run-pass/function_pointers.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ fn h(i: i32, j: i32) -> i32 {
1010
j * i * 7
1111
}
1212

13-
fn return_fn_ptr() -> fn() -> i32 {
13+
fn return_fn_ptr(f: fn() -> i32) -> fn() -> i32 {
1414
f
1515
}
1616

1717
fn call_fn_ptr() -> i32 {
18-
return_fn_ptr()()
18+
return_fn_ptr(f)()
1919
}
2020

2121
fn indirect<F: Fn() -> i32>(f: F) -> i32 { f() }
@@ -41,6 +41,7 @@ fn main() {
4141
assert_eq!(indirect3(h), 210);
4242
assert_eq!(indirect_mut3(h), 210);
4343
assert_eq!(indirect_once3(h), 210);
44-
assert!(return_fn_ptr() == f);
45-
assert!(return_fn_ptr() as unsafe fn() -> i32 == f as fn() -> i32 as unsafe fn() -> i32);
44+
let g = f as fn() -> i32;
45+
assert!(return_fn_ptr(g) == g);
46+
assert!(return_fn_ptr(g) as unsafe fn() -> i32 == g as fn() -> i32 as unsafe fn() -> i32);
4647
}

tests/run-pass/mir_coercions.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ fn main() {
6060
let a = [0,1,2];
6161
let square_local : fn(u32) -> u32 = square;
6262
let (f,g) = fn_coercions(&square_local);
63-
assert_eq!(f as *const (), square as *const());
63+
// cannot use `square as *const ()` because we can't know whether the compiler duplicates
64+
// functions, so two function pointers are only equal if they result from the same function
65+
// to function pointer cast
66+
assert_eq!(f as *const (), square_local as *const());
6467
assert_eq!(g(4), 16);
6568
assert_eq!(identity_coercion(g)(5), 25);
6669

tests/run-pass/regions-mock-trans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//ignore-windows: Uses POSIX APIs
1212

13-
#![feature(libc)]
13+
#![feature(rustc_private)]
1414

1515
#![allow(dead_code)]
1616

tests/run-pass/thread-local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//ignore-windows: Uses POSIX APIs
22

3-
#![feature(libc)]
3+
#![feature(rustc_private)]
44
extern crate libc;
55

66
use std::mem;

tests/run-pass/vecdeque.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// FIXME: Validation disabled until https://github.com/rust-lang/rust/pull/56161 lands
2-
// compile-flags: -Zmiri-disable-validation
3-
41
use std::collections::VecDeque;
52

63
fn main() {

travis.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ else
1111
fi
1212

1313
echo "Build and install miri"
14-
cargo build --release --all-features --all-targets &&
14+
cargo build --release --all-features --all-targets
1515
cargo install --all-features --force --path .
1616
echo
1717

1818
echo "Get ourselves a MIR-full libstd for the host and a foreign architecture"
19-
cargo miri setup &&
19+
cargo miri setup
2020
cargo miri setup --target "$FOREIGN_TARGET"
2121
echo
2222

2323
echo "Test miri with full MIR, on the host and other architectures"
24-
MIRI_SYSROOT=$MIRI_SYSROOT_BASE/HOST cargo test --release --all-features &&
25-
MIRI_SYSROOT=$MIRI_SYSROOT_BASE MIRI_TARGET=$FOREIGN_TARGET cargo test --release --all-features
24+
MIRI_SYSROOT="$MIRI_SYSROOT_BASE"/HOST cargo test --release --all-features
25+
MIRI_SYSROOT="$MIRI_SYSROOT_BASE" MIRI_TARGET="$FOREIGN_TARGET" cargo test --release --all-features
2626
echo
2727

2828
echo "Test cargo integration"
29-
(cd test-cargo-miri && MIRI_SYSROOT=$MIRI_SYSROOT_BASE/HOST ./run-test.py)
29+
(cd test-cargo-miri && MIRI_SYSROOT="$MIRI_SYSROOT_BASE"/HOST ./run-test.py)
3030
echo

0 commit comments

Comments
 (0)