Skip to content

Commit 965160d

Browse files
authored
Merge pull request #769 from RalfJung/rustup
Rustup
2 parents b597eab + ad0c941 commit 965160d

10 files changed

+69
-55
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ Install Miri via `rustup`:
5555
rustup component add miri
5656
```
5757

58-
If `rustup` says the `miri` component is unavailable, that's because not all nightly releases come with all tools. Check out [this website](https://rust-lang.github.io/rustup-components-history) to determine a nightly version that comes with Miri and install that, e.g. using `rustup install nightly-2019-03-28`.
58+
If `rustup` says the `miri` component is unavailable, that's because not all
59+
nightly releases come with all tools. Check out
60+
[this website](https://rust-lang.github.io/rustup-components-history) to
61+
determine a nightly version that comes with Miri and install that, e.g. using
62+
`rustup install nightly-2019-03-28`.
5963

6064
Now you can run your project in Miri:
6165

@@ -131,7 +135,17 @@ able to just `cargo build` Miri.
131135
In case this fails, your nightly might be incompatible with Miri master. The
132136
`rust-version` file contains the commit hash of rustc that Miri is currently
133137
tested against; you can use that to find a nightly that works or you might have
134-
to wait for the next nightly to get released.
138+
to wait for the next nightly to get released. You can also use
139+
[`rustup-toolchain-install-master`](https://github.com/kennytm/rustup-toolchain-install-master)
140+
to install that exact version of rustc as a toolchain:
141+
```
142+
rustup-toolchain-install-master $(cat rust-version) -c rust-src
143+
```
144+
145+
Another common problem is outdated dependencies: Miri does not come with a
146+
lockfile (it cannot, due to how it gets embedded into the rustc build). So you
147+
have to run `cargo update` every now and then yourself to make sure you are
148+
using the latest versions of everything (which is what gets tested on CI).
135149

136150
### Testing the Miri driver
137151
[testing-miri]: #testing-the-miri-driver

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8e948df707ea8a3c88c65bf2ffdcb2f1cf5491be
1+
d8f50ab0ea6c529c24e575279acc72093caeb679

src/bin/miri-rustc-tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
4343
compiler.session().abort_if_errors();
4444
compiler.global_ctxt().unwrap().peek_mut().enter(|tcx| {
4545
if std::env::args().any(|arg| arg == "--test") {
46-
struct Visitor<'a, 'tcx: 'a>(TyCtxt<'a, 'tcx, 'tcx>);
47-
impl<'a, 'tcx: 'a, 'hir> itemlikevisit::ItemLikeVisitor<'hir> for Visitor<'a, 'tcx> {
46+
struct Visitor<'tcx>(TyCtxt<'tcx, 'tcx>);
47+
impl<'tcx, 'hir> itemlikevisit::ItemLikeVisitor<'hir> for Visitor<'tcx> {
4848
fn visit_item(&mut self, i: &'hir hir::Item) {
4949
if let hir::ItemKind::Fn(.., body_id) = i.node {
5050
if i.attrs.iter().any(|attr| attr.check_name(syntax::symbol::sym::test)) {

src/fn_call.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use rand::RngCore;
99

1010
use crate::*;
1111

12-
impl<'a, 'mir, 'tcx> EvalContextExt<'a, 'mir, 'tcx> for crate::MiriEvalContext<'a, 'mir, 'tcx> {}
13-
pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'a, 'mir, 'tcx> {
12+
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
13+
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
1414
fn find_fn(
1515
&mut self,
1616
instance: ty::Instance<'tcx>,
@@ -930,8 +930,8 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
930930
}
931931
}
932932

933-
fn gen_random<'a, 'mir, 'tcx>(
934-
this: &mut MiriEvalContext<'a, 'mir, 'tcx>,
933+
fn gen_random<'mir, 'tcx>(
934+
this: &mut MiriEvalContext<'mir, 'tcx>,
935935
len: usize,
936936
dest: Scalar<Tag>,
937937
) -> InterpResult<'tcx> {

src/helpers.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX};
55

66
use crate::*;
77

8-
impl<'a, 'mir, 'tcx> EvalContextExt<'a, 'mir, 'tcx> for crate::MiriEvalContext<'a, 'mir, 'tcx> {}
8+
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
99

10-
pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'a, 'mir, 'tcx> {
10+
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
1111
/// Gets an instance for a path.
1212
fn resolve_path(&self, path: &[&str]) -> InterpResult<'tcx, ty::Instance<'tcx>> {
1313
let this = self.eval_context_ref();
@@ -119,24 +119,24 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
119119

120120
/// Visiting the memory covered by a `MemPlace`, being aware of
121121
/// whether we are inside an `UnsafeCell` or not.
122-
struct UnsafeCellVisitor<'ecx, 'a, 'mir, 'tcx, F>
122+
struct UnsafeCellVisitor<'ecx, 'mir, 'tcx, F>
123123
where F: FnMut(MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>
124124
{
125-
ecx: &'ecx MiriEvalContext<'a, 'mir, 'tcx>,
125+
ecx: &'ecx MiriEvalContext<'mir, 'tcx>,
126126
unsafe_cell_action: F,
127127
}
128128

129-
impl<'ecx, 'a, 'mir, 'tcx, F>
130-
ValueVisitor<'a, 'mir, 'tcx, Evaluator<'tcx>>
129+
impl<'ecx, 'mir, 'tcx, F>
130+
ValueVisitor<'mir, 'tcx, Evaluator<'tcx>>
131131
for
132-
UnsafeCellVisitor<'ecx, 'a, 'mir, 'tcx, F>
132+
UnsafeCellVisitor<'ecx, 'mir, 'tcx, F>
133133
where
134134
F: FnMut(MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>
135135
{
136136
type V = MPlaceTy<'tcx, Tag>;
137137

138138
#[inline(always)]
139-
fn ecx(&self) -> &MiriEvalContext<'a, 'mir, 'tcx> {
139+
fn ecx(&self) -> &MiriEvalContext<'mir, 'tcx> {
140140
&self.ecx
141141
}
142142

src/intrinsic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::{
99
OperatorEvalContextExt
1010
};
1111

12-
impl<'a, 'mir, 'tcx> EvalContextExt<'a, 'mir, 'tcx> for crate::MiriEvalContext<'a, 'mir, 'tcx> {}
13-
pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a, 'mir, 'tcx> {
12+
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
13+
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
1414
fn call_intrinsic(
1515
&mut self,
1616
instance: ty::Instance<'tcx>,

src/lib.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ pub struct MiriConfig {
7171
}
7272

7373
// Used by priroda.
74-
pub fn create_ecx<'a, 'mir: 'a, 'tcx: 'mir>(
75-
tcx: TyCtxt<'a, 'tcx, 'tcx>,
74+
pub fn create_ecx<'mir, 'tcx: 'mir>(
75+
tcx: TyCtxt<'tcx, 'tcx>,
7676
main_id: DefId,
7777
config: MiriConfig,
78-
) -> InterpResult<'tcx, InterpretCx<'a, 'mir, 'tcx, Evaluator<'tcx>>> {
78+
) -> InterpResult<'tcx, InterpretCx<'mir, 'tcx, Evaluator<'tcx>>> {
7979
let mut ecx = InterpretCx::new(
8080
tcx.at(syntax::source_map::DUMMY_SP),
8181
ty::ParamEnv::reveal_all(),
@@ -211,8 +211,8 @@ pub fn create_ecx<'a, 'mir: 'a, 'tcx: 'mir>(
211211
Ok(ecx)
212212
}
213213

214-
pub fn eval_main<'a, 'tcx: 'a>(
215-
tcx: TyCtxt<'a, 'tcx, 'tcx>,
214+
pub fn eval_main<'tcx>(
215+
tcx: TyCtxt<'tcx, 'tcx>,
216216
main_id: DefId,
217217
config: MiriConfig,
218218
) {
@@ -364,25 +364,25 @@ impl<'tcx> Evaluator<'tcx> {
364364

365365
// FIXME: rustc issue <https://github.com/rust-lang/rust/issues/47131>.
366366
#[allow(dead_code)]
367-
type MiriEvalContext<'a, 'mir, 'tcx> = InterpretCx<'a, 'mir, 'tcx, Evaluator<'tcx>>;
367+
type MiriEvalContext<'mir, 'tcx> = InterpretCx<'mir, 'tcx, Evaluator<'tcx>>;
368368

369369
// A little trait that's useful to be inherited by extension traits.
370-
pub trait MiriEvalContextExt<'a, 'mir, 'tcx> {
371-
fn eval_context_ref(&self) -> &MiriEvalContext<'a, 'mir, 'tcx>;
372-
fn eval_context_mut(&mut self) -> &mut MiriEvalContext<'a, 'mir, 'tcx>;
370+
pub trait MiriEvalContextExt<'mir, 'tcx> {
371+
fn eval_context_ref(&self) -> &MiriEvalContext<'mir, 'tcx>;
372+
fn eval_context_mut(&mut self) -> &mut MiriEvalContext<'mir, 'tcx>;
373373
}
374-
impl<'a, 'mir, 'tcx> MiriEvalContextExt<'a, 'mir, 'tcx> for MiriEvalContext<'a, 'mir, 'tcx> {
374+
impl<'mir, 'tcx> MiriEvalContextExt<'mir, 'tcx> for MiriEvalContext<'mir, 'tcx> {
375375
#[inline(always)]
376-
fn eval_context_ref(&self) -> &MiriEvalContext<'a, 'mir, 'tcx> {
376+
fn eval_context_ref(&self) -> &MiriEvalContext<'mir, 'tcx> {
377377
self
378378
}
379379
#[inline(always)]
380-
fn eval_context_mut(&mut self) -> &mut MiriEvalContext<'a, 'mir, 'tcx> {
380+
fn eval_context_mut(&mut self) -> &mut MiriEvalContext<'mir, 'tcx> {
381381
self
382382
}
383383
}
384384

385-
impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
385+
impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
386386
type MemoryKinds = MiriMemoryKind;
387387

388388
type FrameExtra = stacked_borrows::CallId;
@@ -395,14 +395,14 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
395395
const STATIC_KIND: Option<MiriMemoryKind> = Some(MiriMemoryKind::Static);
396396

397397
#[inline(always)]
398-
fn enforce_validity(ecx: &InterpretCx<'a, 'mir, 'tcx, Self>) -> bool {
398+
fn enforce_validity(ecx: &InterpretCx<'mir, 'tcx, Self>) -> bool {
399399
ecx.machine.validate
400400
}
401401

402402
/// Returns `Ok()` when the function was handled; fail otherwise.
403403
#[inline(always)]
404404
fn find_fn(
405-
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
405+
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
406406
instance: ty::Instance<'tcx>,
407407
args: &[OpTy<'tcx, Tag>],
408408
dest: Option<PlaceTy<'tcx, Tag>>,
@@ -413,7 +413,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
413413

414414
#[inline(always)]
415415
fn call_intrinsic(
416-
ecx: &mut rustc_mir::interpret::InterpretCx<'a, 'mir, 'tcx, Self>,
416+
ecx: &mut rustc_mir::interpret::InterpretCx<'mir, 'tcx, Self>,
417417
instance: ty::Instance<'tcx>,
418418
args: &[OpTy<'tcx, Tag>],
419419
dest: PlaceTy<'tcx, Tag>,
@@ -423,7 +423,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
423423

424424
#[inline(always)]
425425
fn ptr_op(
426-
ecx: &rustc_mir::interpret::InterpretCx<'a, 'mir, 'tcx, Self>,
426+
ecx: &rustc_mir::interpret::InterpretCx<'mir, 'tcx, Self>,
427427
bin_op: mir::BinOp,
428428
left: ImmTy<'tcx, Tag>,
429429
right: ImmTy<'tcx, Tag>,
@@ -432,7 +432,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
432432
}
433433

434434
fn box_alloc(
435-
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
435+
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
436436
dest: PlaceTy<'tcx, Tag>,
437437
) -> InterpResult<'tcx> {
438438
trace!("box_alloc for {:?}", dest.layout.ty);
@@ -475,7 +475,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
475475

476476
fn find_foreign_static(
477477
def_id: DefId,
478-
tcx: TyCtxtAt<'a, 'tcx, 'tcx>,
478+
tcx: TyCtxtAt<'tcx, 'tcx>,
479479
) -> InterpResult<'tcx, Cow<'tcx, Allocation>> {
480480
let attrs = tcx.get_attrs(def_id);
481481
let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) {
@@ -498,7 +498,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
498498
}
499499

500500
#[inline(always)]
501-
fn before_terminator(_ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> InterpResult<'tcx>
501+
fn before_terminator(_ecx: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx>
502502
{
503503
// We are not interested in detecting loops.
504504
Ok(())
@@ -550,7 +550,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
550550

551551
#[inline(always)]
552552
fn retag(
553-
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
553+
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
554554
kind: mir::RetagKind,
555555
place: PlaceTy<'tcx, Tag>,
556556
) -> InterpResult<'tcx> {
@@ -568,14 +568,14 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
568568

569569
#[inline(always)]
570570
fn stack_push(
571-
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
571+
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
572572
) -> InterpResult<'tcx, stacked_borrows::CallId> {
573573
Ok(ecx.memory().extra.borrow_mut().new_call())
574574
}
575575

576576
#[inline(always)]
577577
fn stack_pop(
578-
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
578+
ecx: &mut InterpretCx<'mir, 'tcx, Self>,
579579
extra: stacked_borrows::CallId,
580580
) -> InterpResult<'tcx> {
581581
Ok(ecx.memory().extra.borrow_mut().end_call(extra))

src/operator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub trait EvalContextExt<'tcx> {
3333
) -> InterpResult<'tcx, Scalar<Tag>>;
3434
}
3535

36-
impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, 'tcx> {
36+
impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'mir, 'tcx> {
3737
fn ptr_op(
3838
&self,
3939
bin_op: mir::BinOp,

src/stacked_borrows.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ impl AllocationExtra<Tag> for Stacks {
519519

520520
/// Retagging/reborrowing. There is some policy in here, such as which permissions
521521
/// to grant for which references, and when to add protectors.
522-
impl<'a, 'mir, 'tcx> EvalContextPrivExt<'a, 'mir, 'tcx> for crate::MiriEvalContext<'a, 'mir, 'tcx> {}
523-
trait EvalContextPrivExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a, 'mir, 'tcx> {
522+
impl<'mir, 'tcx> EvalContextPrivExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
523+
trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
524524
fn reborrow(
525525
&mut self,
526526
place: MPlaceTy<'tcx, Tag>,
@@ -599,8 +599,8 @@ trait EvalContextPrivExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
599599
}
600600
}
601601

602-
impl<'a, 'mir, 'tcx> EvalContextExt<'a, 'mir, 'tcx> for crate::MiriEvalContext<'a, 'mir, 'tcx> {}
603-
pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a, 'mir, 'tcx> {
602+
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
603+
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
604604
fn retag(
605605
&mut self,
606606
kind: RetagKind,
@@ -643,19 +643,19 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
643643
visitor.visit_value(place)?;
644644

645645
// The actual visitor.
646-
struct RetagVisitor<'ecx, 'a, 'mir, 'tcx> {
647-
ecx: &'ecx mut MiriEvalContext<'a, 'mir, 'tcx>,
646+
struct RetagVisitor<'ecx, 'mir, 'tcx> {
647+
ecx: &'ecx mut MiriEvalContext<'mir, 'tcx>,
648648
kind: RetagKind,
649649
}
650-
impl<'ecx, 'a, 'mir, 'tcx>
651-
MutValueVisitor<'a, 'mir, 'tcx, Evaluator<'tcx>>
650+
impl<'ecx, 'mir, 'tcx>
651+
MutValueVisitor<'mir, 'tcx, Evaluator<'tcx>>
652652
for
653-
RetagVisitor<'ecx, 'a, 'mir, 'tcx>
653+
RetagVisitor<'ecx, 'mir, 'tcx>
654654
{
655655
type V = MPlaceTy<'tcx, Tag>;
656656

657657
#[inline(always)]
658-
fn ecx(&mut self) -> &mut MiriEvalContext<'a, 'mir, 'tcx> {
658+
fn ecx(&mut self) -> &mut MiriEvalContext<'mir, 'tcx> {
659659
&mut self.ecx
660660
}
661661

src/tls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ impl<'tcx> TlsData<'tcx> {
129129
}
130130
}
131131

132-
impl<'a, 'mir, 'tcx> EvalContextExt<'a, 'mir, 'tcx> for crate::MiriEvalContext<'a, 'mir, 'tcx> {}
133-
pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a, 'mir, 'tcx> {
132+
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
133+
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
134134
fn run_tls_dtors(&mut self) -> InterpResult<'tcx> {
135135
let this = self.eval_context_mut();
136136
let mut dtor = this.machine.tls.fetch_tls_dtor(None, &*this.tcx);

0 commit comments

Comments
 (0)