Skip to content

Commit 916221b

Browse files
authored
Merge branch 'master' into patch-1
2 parents 7d6c8ad + 2a03db9 commit 916221b

File tree

9 files changed

+51
-26
lines changed

9 files changed

+51
-26
lines changed

.appveyor.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,31 @@ environment:
33
PROJECT_NAME: miri
44
matrix:
55
- TARGET: x86_64-pc-windows-msvc
6-
MSYS2_BITS: 64
76
- TARGET: i686-pc-windows-msvc
8-
MSYS2_BITS: 32
97

108
# branches to build
119
branches:
1210
# whitelist
1311
only:
1412
- master
1513

14+
cache:
15+
- '%USERPROFILE%\.cargo'
16+
- '%USERPROFILE%\.rustup'
17+
1618
install:
17-
# Install Rust.
18-
- set PATH=C:\Program Files\Git\mingw64\bin;C:\msys64\mingw%MSYS2_BITS%\bin;%PATH%
19-
- set /p RUST_TOOLCHAIN=<rust-version
19+
# Install Rust
2020
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
21-
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_TOOLCHAIN%
21+
- rustup-init.exe -y --default-host %TARGET% --default-toolchain stable
2222
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
23+
# Install "master" toolchain
24+
- cargo install rustup-toolchain-install-master
25+
- set /p RUSTC_HASH=<rust-version
26+
- rustup-toolchain-install-master -f -n master %RUSTC_HASH% -c cargo -c rust-src
27+
- rustup default master
2328
- rustc --version
2429

25-
build: false
26-
27-
test_script:
30+
build_script:
2831
- set RUST_TEST_NOCAPTURE=1
2932
- set RUST_BACKTRACE=1
3033
# Build and install miri
@@ -33,11 +36,18 @@ test_script:
3336
# Get ourselves a MIR-full libstd, and use it henceforth
3437
- cargo miri setup
3538
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\miri\miri\cache\HOST
39+
40+
test_script:
3641
# Test miri
3742
- cargo test --release --all-features
3843
# Test cargo integration
3944
- cd test-cargo-miri
40-
- python3 run-test.py
45+
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
46+
47+
after_test:
48+
# Don't cache "master" toolchain, it's a waste
49+
- rustup default stable
50+
- rustup toolchain uninstall master
4151

4252
notifications:
4353
- provider: Email

.travis.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ cache:
44
# we cannot reuse anyway when the nightly changes (and it grows quite large
55
# over time).
66
directories:
7-
- /home/travis/.cargo
7+
- $HOME/.cargo
8+
- $HOME/.rustup
89

910
os:
1011
- linux
@@ -17,18 +18,27 @@ before_script:
1718
# Compute the rust version we use. We do not use "language: rust" to have more control here.
1819
- |
1920
if [[ "$TRAVIS_EVENT_TYPE" == cron ]]; then
20-
RUST_TOOLCHAIN=nightly
21+
RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}')
2122
else
22-
RUST_TOOLCHAIN=$(cat rust-version)
23+
RUSTC_HASH=$(cat rust-version)
2324
fi
24-
# install Rust
25-
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN"
25+
# Install Rust ("stable" toolchain for better caching, it is just used to build rustup-toolchain-install-master)
26+
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain stable
2627
- export PATH=$HOME/.cargo/bin:$PATH
28+
# Install "master" toolchain
29+
- cargo install rustup-toolchain-install-master || echo "rustup-toolchain-install-master already installed"
30+
- travis_retry rustup-toolchain-install-master -f -n master $RUSTC_HASH -c cargo -c rust-src
31+
- rustup default master
2732
- rustc --version
2833

2934
script:
3035
- ./travis.sh
3136

37+
before_cache:
38+
# Don't cache "master" toolchain, it's a waste
39+
- rustup default stable
40+
- rustup toolchain uninstall master
41+
3242
notifications:
3343
email:
3444
on_success: never

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,18 @@ other projects:
122122

123123
```sh
124124
rustup component remove miri # avoid having Miri installed twice
125-
cargo +nightly install --path "$DIR" --force # or the nightly in `rust-version`
125+
cargo +nightly install --path "$DIR" --force
126126
cargo +nightly miri setup
127127
```
128128

129129
(We are giving `+nightly` explicitly here all the time because it is important
130130
that all of these commands get executed with the same toolchain.)
131131

132+
In case this fails, your nightly might be incompatible with Miri master. The
133+
`rust-version` file contains the commit hash of rustc that Miri is currently
134+
tested against; you can use that to find a nightly that works or you might have
135+
to wait for the next nightly to get released.
136+
132137
If you want to use a different libstd (not the one that comes with the
133138
nightly), you can do that by running
134139

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2019-03-29
1+
f717b58dd70829f105960a071c7992b440720482

src/fn_call.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
270270
let mut args = this.frame().mir.args_iter();
271271

272272
let arg_local = args.next().ok_or_else(||
273-
EvalErrorKind::AbiViolation(
273+
InterpError::AbiViolation(
274274
"Argument to __rust_maybe_catch_panic does not take enough arguments."
275275
.to_owned(),
276276
),
@@ -529,7 +529,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
529529
// This is `libc::pthread_key_t`.
530530
let key_type = args[0].layout.ty
531531
.builtin_deref(true)
532-
.ok_or_else(|| EvalErrorKind::AbiViolation("wrong signature used for `pthread_key_create`: first argument must be a raw pointer.".to_owned()))?
532+
.ok_or_else(|| InterpError::AbiViolation("wrong signature used for `pthread_key_create`: first argument must be a raw pointer.".to_owned()))?
533533
.ty;
534534
let key_layout = this.layout_of(key_type)?;
535535

src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
3939
})
4040
.ok_or_else(|| {
4141
let path = path.iter().map(|&s| s.to_owned()).collect();
42-
EvalErrorKind::PathNotFound(path).into()
42+
InterpError::PathNotFound(path).into()
4343
})
4444
}
4545

src/operator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
325325
let pointee_size = self.layout_of(pointee_ty)?.size.bytes() as i64;
326326
let offset = offset
327327
.checked_mul(pointee_size)
328-
.ok_or_else(|| EvalErrorKind::Overflow(mir::BinOp::Mul))?;
328+
.ok_or_else(|| InterpError::Overflow(mir::BinOp::Mul))?;
329329
// Now let's see what kind of pointer this is.
330330
if let Scalar::Ptr(ptr) = ptr {
331331
// Both old and new pointer must be in-bounds of a *live* allocation.

src/stacked_borrows.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc::hir::{Mutability, MutMutable, MutImmutable};
77
use rustc::mir::RetagKind;
88

99
use crate::{
10-
EvalResult, EvalErrorKind, MiriEvalContext, HelpersEvalContextExt, Evaluator, MutValueVisitor,
10+
EvalResult, InterpError, MiriEvalContext, HelpersEvalContextExt, Evaluator, MutValueVisitor,
1111
MemoryKind, MiriMemoryKind, RangeMap, AllocId, Allocation, AllocationExtra,
1212
Pointer, Immediate, ImmTy, PlaceTy, MPlaceTy,
1313
};
@@ -380,7 +380,7 @@ impl<'tcx> Stacks {
380380
ptr.tag, kind, ptr, size.bytes());
381381
let stacks = self.stacks.borrow();
382382
for stack in stacks.iter(ptr.offset, size) {
383-
stack.deref(ptr.tag, kind).map_err(EvalErrorKind::MachineError)?;
383+
stack.deref(ptr.tag, kind).map_err(InterpError::MachineError)?;
384384
}
385385
Ok(())
386386
}
@@ -435,7 +435,7 @@ impl<'tcx> Stacks {
435435
let mut stacks = self.stacks.borrow_mut();
436436
for stack in stacks.iter_mut(ptr.offset, size) {
437437
// Access source `ptr`, create new ref.
438-
let ptr_idx = stack.deref(ptr.tag, new_kind).map_err(EvalErrorKind::MachineError)?;
438+
let ptr_idx = stack.deref(ptr.tag, new_kind).map_err(InterpError::MachineError)?;
439439
// If we can deref the new tag already, and if that tag lives higher on
440440
// the stack than the one we come from, just use that.
441441
// That is, we check if `new_bor` *already* is "derived from" `ptr.tag`.

src/tls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_target::abi::LayoutOf;
44
use rustc::{ty, ty::layout::HasDataLayout, mir};
55

66
use crate::{
7-
EvalResult, EvalErrorKind, StackPopCleanup,
7+
EvalResult, InterpError, StackPopCleanup,
88
MPlaceTy, Scalar, Borrow,
99
};
1010

@@ -149,7 +149,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
149149
StackPopCleanup::None { cleanup: true },
150150
)?;
151151
let arg_local = this.frame().mir.args_iter().next().ok_or_else(
152-
|| EvalErrorKind::AbiViolation("TLS dtor does not take enough arguments.".to_owned()),
152+
|| InterpError::AbiViolation("TLS dtor does not take enough arguments.".to_owned()),
153153
)?;
154154
let dest = this.eval_place(&mir::Place::Base(mir::PlaceBase::Local(arg_local)))?;
155155
this.write_scalar(ptr, dest)?;

0 commit comments

Comments
 (0)