Skip to content

Commit

Permalink
Auto merge of #1299 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
rustup for import changes
  • Loading branch information
bors committed Apr 2, 2020
2 parents 4955ce3 + 9f3383d commit 147ea8f
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 52 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
127a11a344eb59b5aea1464e98257c262dcba967
537ccdf3ac44c8c7a8d36cbdbe6fb224afabb7ae
2 changes: 1 addition & 1 deletion src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::convert::TryFrom;
use rand::rngs::StdRng;
use rand::SeedableRng;

use rustc_middle::ty::layout::LayoutOf;
use rustc_target::abi::LayoutOf;
use rustc_middle::ty::{self, TyCtxt};
use rustc_hir::def_id::DefId;

Expand Down
17 changes: 7 additions & 10 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ use std::mem;
use log::trace;

use rustc_middle::mir;
use rustc_middle::ty::{
self,
layout::{self, LayoutOf, Size, TyAndLayout},
List, TyCtxt,
};
use rustc_middle::ty::{self, List, TyCtxt, layout::TyAndLayout};
use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX};
use rustc_target::abi::{LayoutOf, Size, FieldsShape, Variants};

use rand::RngCore;

Expand Down Expand Up @@ -298,7 +295,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// walking this value, we have to make sure it is not a
// `Variants::Multiple`.
match v.layout.variants {
layout::Variants::Multiple { .. } => {
Variants::Multiple { .. } => {
// A multi-variant enum, or generator, or so.
// Treat this like a union: without reading from memory,
// we cannot determine the variant we are in. Reading from
Expand All @@ -308,7 +305,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// `UnsafeCell` action.
(self.unsafe_cell_action)(v)
}
layout::Variants::Single { .. } => {
Variants::Single { .. } => {
// Proceed further, try to find where exactly that `UnsafeCell`
// is hiding.
self.walk_value(v)
Expand All @@ -324,19 +321,19 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
fields: impl Iterator<Item = InterpResult<'tcx, MPlaceTy<'tcx, Tag>>>,
) -> InterpResult<'tcx> {
match place.layout.fields {
layout::FieldsShape::Array { .. } => {
FieldsShape::Array { .. } => {
// For the array layout, we know the iterator will yield sorted elements so
// we can avoid the allocation.
self.walk_aggregate(place, fields)
}
layout::FieldsShape::Arbitrary { .. } => {
FieldsShape::Arbitrary { .. } => {
// Gather the subplaces and sort them before visiting.
let mut places =
fields.collect::<InterpResult<'tcx, Vec<MPlaceTy<'tcx, Tag>>>>()?;
places.sort_by_key(|place| place.ptr.assert_ptr().offset);
self.walk_aggregate(place, places.into_iter().map(Ok))
}
layout::FieldsShape::Union { .. } => {
FieldsShape::Union { .. } => {
// Uh, what?
bug!("a union is not an aggregate we should ever visit")
}
Expand Down
3 changes: 1 addition & 2 deletions src/intptrcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ use log::trace;
use rand::Rng;

use rustc_data_structures::fx::FxHashMap;
use rustc_middle::ty::layout::HasDataLayout;
use rustc_mir::interpret::{AllocCheck, AllocId, InterpResult, Memory, Machine, Pointer, PointerArithmetic};
use rustc_target::abi::Size;
use rustc_target::abi::{Size, HasDataLayout};

use crate::{Evaluator, Tag, STACK_ADDR};

Expand Down
10 changes: 3 additions & 7 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ use log::trace;
use rand::rngs::StdRng;

use rustc_data_structures::fx::FxHashMap;
use rustc_middle::mir;
use rustc_middle::ty::{
self,
layout::{LayoutOf, Size},
Ty,
};
use rustc_middle::{mir, ty};
use rustc_target::abi::{LayoutOf, Size};
use rustc_ast::attr;
use rustc_span::symbol::{sym, Symbol};

Expand Down Expand Up @@ -303,7 +299,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
bin_op: mir::BinOp,
left: ImmTy<'tcx, Tag>,
right: ImmTy<'tcx, Tag>,
) -> InterpResult<'tcx, (Scalar<Tag>, bool, Ty<'tcx>)> {
) -> InterpResult<'tcx, (Scalar<Tag>, bool, ty::Ty<'tcx>)> {
ecx.binary_ptr_op(bin_op, left, right)
}

Expand Down
7 changes: 2 additions & 5 deletions src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ use std::convert::TryFrom;

use log::trace;

use rustc_middle::mir;
use rustc_middle::ty::{
layout::{LayoutOf, Size},
Ty,
};
use rustc_middle::{mir, ty::Ty};
use rustc_target::abi::{LayoutOf, Size};

use crate::*;

Expand Down
2 changes: 1 addition & 1 deletion src/range_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use std::ops;

use rustc_middle::ty::layout::Size;
use rustc_target::abi::Size;

#[derive(Clone, Debug)]
struct Elem<T> {
Expand Down
8 changes: 3 additions & 5 deletions src/shims/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ use std::ffi::{OsString, OsStr};
use std::env;
use std::convert::TryFrom;

use crate::stacked_borrows::Tag;
use crate::rustc_target::abi::LayoutOf;
use crate::*;

use rustc_target::abi::{Size, LayoutOf};
use rustc_data_structures::fx::FxHashMap;
use rustc_middle::ty::layout::Size;
use rustc_mir::interpret::Pointer;

use crate::*;

/// Check whether an operation that writes to a target buffer was successful.
/// Accordingly select return value.
/// Local helper function to be used in Windows shims.
Expand Down
5 changes: 2 additions & 3 deletions src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ mod posix;
use std::{convert::{TryInto, TryFrom}, iter};

use rustc_hir::def_id::DefId;
use rustc_middle::mir;
use rustc_middle::ty;
use rustc_middle::ty::layout::{Align, Size};
use rustc_middle::{mir, ty};
use rustc_target::abi::{Align, Size};
use rustc_apfloat::Float;
use rustc_span::symbol::sym;
use rustc_ast::attr;
Expand Down
2 changes: 1 addition & 1 deletion src/shims/foreign_items/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use log::trace;

use crate::*;
use rustc_middle::mir;
use rustc_middle::ty::layout::{Align, LayoutOf, Size};
use rustc_target::abi::{Align, LayoutOf, Size};

impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
Expand Down
8 changes: 5 additions & 3 deletions src/shims/foreign_items/windows.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use crate::*;
use rustc_middle::mir;
use rustc_middle::ty::layout::Size;
use std::iter;

use rustc_middle::mir;
use rustc_target::abi::Size;

use crate::*;

impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
fn emulate_foreign_item_by_name(
Expand Down
2 changes: 1 addition & 1 deletion src/shims/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::Path;
use std::time::SystemTime;

use rustc_data_structures::fx::FxHashMap;
use rustc_middle::ty::layout::{Align, LayoutOf, Size};
use rustc_target::abi::{Align, LayoutOf, Size};

use crate::stacked_borrows::Tag;
use crate::*;
Expand Down
5 changes: 2 additions & 3 deletions src/shims/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use std::iter;
use std::convert::TryFrom;

use rustc_middle::mir;
use rustc_middle::ty;
use rustc_middle::ty::layout::{Align, LayoutOf};
use rustc_middle::{mir, ty};
use rustc_apfloat::Float;
use rustc_target::abi::{Align, LayoutOf};

use crate::*;

Expand Down
2 changes: 1 addition & 1 deletion src/shims/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::os::unix::ffi::{OsStrExt, OsStringExt};
#[cfg(windows)]
use std::os::windows::ffi::{OsStrExt, OsStringExt};

use rustc_middle::ty::layout::LayoutOf;
use rustc_target::abi::LayoutOf;

use crate::*;

Expand Down
5 changes: 2 additions & 3 deletions src/shims/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@

use log::trace;

use rustc_middle::mir;
use rustc_middle::ty::{self, layout::LayoutOf};
use rustc_target::spec::PanicStrategy;
use rustc_middle::{mir, ty};
use rustc_target::{spec::PanicStrategy, abi::LayoutOf};

use crate::*;

Expand Down
4 changes: 2 additions & 2 deletions src/shims/time.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::time::{Duration, SystemTime, Instant};
use std::convert::TryFrom;

use rustc_target::abi::LayoutOf;

use crate::stacked_borrows::Tag;
use crate::*;
use helpers::{immty_from_int_checked, immty_from_uint_checked};

use rustc_middle::ty::layout::LayoutOf;

/// Returns the time elapsed between the provided time and the unix epoch as a `Duration`.
pub fn system_time_to_duration<'tcx>(time: &SystemTime) -> InterpResult<'tcx, Duration> {
time.duration_since(SystemTime::UNIX_EPOCH)
Expand Down
4 changes: 2 additions & 2 deletions src/shims/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::collections::BTreeMap;

use log::trace;

use rustc_middle::{ty, ty::layout::{Size, HasDataLayout}};
use rustc_target::abi::LayoutOf;
use rustc_middle::ty;
use rustc_target::abi::{LayoutOf, Size, HasDataLayout};

use crate::{HelpersEvalContextExt, InterpResult, MPlaceTy, Scalar, StackPopCleanup, Tag};

Expand Down
3 changes: 2 additions & 1 deletion src/stacked_borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use log::trace;

use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_middle::mir::RetagKind;
use rustc_middle::ty::{self, layout::Size};
use rustc_middle::ty;
use rustc_target::abi::Size;
use rustc_hir::Mutability;

use crate::*;
Expand Down

0 comments on commit 147ea8f

Please sign in to comment.