about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-04-18 18:20:04 +0000
committerbors <bors@rust-lang.org>2017-04-18 18:20:04 +0000
commit9f2abadca2d065bf81772cb84981d0a22d8e98b3 (patch)
treee3bbeeea63cf1b40768b68e020e0148f712fc3cd
parentc398efc53f09f6e1a8cba4ec2259ffb9d89f0542 (diff)
parent20718c81deb7d7151d852c9e7d77ac0ef834e4b3 (diff)
downloadrust-9f2abadca2d065bf81772cb84981d0a22d8e98b3.tar.gz
rust-9f2abadca2d065bf81772cb84981d0a22d8e98b3.zip
Auto merge of #41373 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #40290, #41353, #41356, #41360, #41361, #41364
- Failed merges:
-rw-r--r--src/bootstrap/bootstrap.py8
-rw-r--r--src/doc/unstable-book/src/SUMMARY.md1
-rw-r--r--src/doc/unstable-book/src/from_utf8_error_as_bytes.md7
-rw-r--r--src/libcollections/string.rs20
-rw-r--r--src/librustc/dep_graph/dep_node.rs40
-rw-r--r--src/librustc/middle/dead.rs2
-rw-r--r--src/librustc/middle/entry.rs3
-rw-r--r--src/librustc/middle/intrinsicck.rs3
-rw-r--r--src/librustc/middle/lang_items.rs2
-rw-r--r--src/librustc/middle/resolve_lifetime.rs2
-rw-r--r--src/librustc/middle/stability.rs6
-rw-r--r--src/librustc_const_eval/check_match.rs5
-rw-r--r--src/librustc_driver/derive_registrar.rs2
-rw-r--r--src/librustc_mir/build/expr/as_temp.rs7
-rw-r--r--src/librustc_mir/build/expr/into.rs60
-rw-r--r--src/librustc_mir/mir_map.rs2
-rw-r--r--src/librustc_mir/shim.rs16
-rw-r--r--src/librustc_passes/consts.rs18
-rw-r--r--src/librustc_plugin/build.rs2
-rw-r--r--src/librustc_trans/back/link.rs2
-rw-r--r--src/librustc_trans/base.rs4
-rw-r--r--src/librustc_trans/mir/block.rs10
-rw-r--r--src/librustc_typeck/check/mod.rs6
-rw-r--r--src/librustc_typeck/check_unused.rs3
-rw-r--r--src/librustc_typeck/coherence/mod.rs2
-rw-r--r--src/librustc_typeck/coherence/orphan.rs3
-rw-r--r--src/librustc_typeck/coherence/overlap.rs2
-rw-r--r--src/librustc_typeck/collect.rs53
-rw-r--r--src/librustc_typeck/impl_wf_check.rs3
-rw-r--r--src/librustc_typeck/lib.rs2
-rw-r--r--src/libstd/sys/redox/process.rs21
-rw-r--r--src/libstd/sys/redox/syscall/call.rs5
-rw-r--r--src/libstd/sys/redox/syscall/number.rs1
-rw-r--r--src/libstd/sys_common/backtrace.rs84
-rw-r--r--src/test/codegen/move-val-init.rs29
-rw-r--r--src/test/compile-fail/dep-graph-struct-signature.rs11
36 files changed, 151 insertions, 296 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 2e33b451194..3233a73b007 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -404,14 +404,6 @@ class RustBuild(object):
                 raise Exception(err)
             sys.exit(err)
 
-        # Darwin's `uname -s` lies and always returns i386. We have to use
-        # sysctl instead.
-        if ostype == 'Darwin' and cputype == 'i686':
-            args = ['sysctl', 'hw.optional.x86_64']
-            sysctl = subprocess.check_output(args).decode(default_encoding)
-            if ': 1' in sysctl:
-                cputype = 'x86_64'
-
         # The goal here is to come up with the same triple as LLVM would,
         # at least for the subset of platforms we're willing to target.
         if ostype == 'Linux':
diff --git a/src/doc/unstable-book/src/SUMMARY.md b/src/doc/unstable-book/src/SUMMARY.md
index d492903f03f..36999eb143f 100644
--- a/src/doc/unstable-book/src/SUMMARY.md
+++ b/src/doc/unstable-book/src/SUMMARY.md
@@ -79,6 +79,7 @@
 - [fmt_internals](fmt-internals.md)
 - [fn_traits](fn-traits.md)
 - [fnbox](fnbox.md)
+- [from_utf8_error_as_bytes](from_utf8_error_as_bytes.md)
 - [fundamental](fundamental.md)
 - [fused](fused.md)
 - [future_atomic_orderings](future-atomic-orderings.md)
diff --git a/src/doc/unstable-book/src/from_utf8_error_as_bytes.md b/src/doc/unstable-book/src/from_utf8_error_as_bytes.md
new file mode 100644
index 00000000000..570f779417f
--- /dev/null
+++ b/src/doc/unstable-book/src/from_utf8_error_as_bytes.md
@@ -0,0 +1,7 @@
+# `from_utf8_error_as_bytes`
+
+The tracking issue for this feature is: [#40895]
+
+[#40895]: https://github.com/rust-lang/rust/issues/40895
+
+------------------------
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 7d9d7276201..8d6cf305112 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -1403,6 +1403,26 @@ impl String {
 }
 
 impl FromUtf8Error {
+    /// Returns a slice of [`u8`]s bytes that were attempted to convert to a `String`.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// #![feature(from_utf8_error_as_bytes)]
+    /// // some invalid bytes, in a vector
+    /// let bytes = vec![0, 159];
+    ///
+    /// let value = String::from_utf8(bytes);
+    ///
+    /// assert_eq!(&[0, 159], value.unwrap_err().as_bytes());
+    /// ```
+    #[unstable(feature = "from_utf8_error_as_bytes", reason = "recently added", issue = "40895")]
+    pub fn as_bytes(&self) -> &[u8] {
+        &self.bytes[..]
+    }
+
     /// Returns the bytes that were attempted to convert to a `String`.
     ///
     /// This method is carefully constructed to avoid allocation. It will
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs
index 59d04ea8c77..fd9750dbfe3 100644
--- a/src/librustc/dep_graph/dep_node.rs
+++ b/src/librustc/dep_graph/dep_node.rs
@@ -56,30 +56,15 @@ pub enum DepNode<D: Clone + Debug> {
     WorkProduct(Arc<WorkProductId>),
 
     // Represents different phases in the compiler.
-    CollectLanguageItems,
-    ResolveLifetimes,
     RegionResolveCrate,
-    PluginRegistrar,
-    StabilityIndex,
-    CollectItem(D),
-    CollectItemSig(D),
     Coherence,
     Resolve,
-    EntryPoint,
-    CheckEntryFn,
     CoherenceCheckTrait(D),
     CoherenceCheckImpl(D),
     CoherenceOverlapCheck(D),
     CoherenceOverlapCheckSpecial(D),
-    CoherenceOrphanCheck(D),
     Variance,
-    WfCheck(D),
-    TypeckItemType(D),
-    UnusedTraitCheck,
-    CheckConst(D),
     PrivacyAccessLevels(CrateNum),
-    IntrinsicCheck(D),
-    MatchCheck(D),
 
     // Represents the MIR for a fn; also used as the task node for
     // things read/modify that MIR.
@@ -91,14 +76,10 @@ pub enum DepNode<D: Clone + Debug> {
     BorrowCheck(D),
     RvalueCheck(D),
     Reachability,
-    DeadCheck,
-    StabilityCheck(D),
     LateLintCheck,
-    TransCrate,
     TransCrateItem(D),
     TransInlinedItem(D),
     TransWriteMetadata,
-    LinkBinary,
 
     // Nodes representing bits of computed IR in the tcx. Each shared
     // table in the tcx (or elsewhere) maps to one of these
@@ -184,12 +165,10 @@ impl<D: Clone + Debug> DepNode<D> {
         }
 
         check! {
-            CollectItem,
             BorrowCheck,
             Hir,
             HirBody,
             TransCrateItem,
-            TypeckItemType,
             AssociatedItems,
             ItemSignature,
             AssociatedItemDefIds,
@@ -211,24 +190,14 @@ impl<D: Clone + Debug> DepNode<D> {
             BorrowCheckKrate => Some(BorrowCheckKrate),
             MirKrate => Some(MirKrate),
             TypeckBodiesKrate => Some(TypeckBodiesKrate),
-            CollectLanguageItems => Some(CollectLanguageItems),
-            ResolveLifetimes => Some(ResolveLifetimes),
             RegionResolveCrate => Some(RegionResolveCrate),
-            PluginRegistrar => Some(PluginRegistrar),
-            StabilityIndex => Some(StabilityIndex),
             Coherence => Some(Coherence),
             Resolve => Some(Resolve),
-            EntryPoint => Some(EntryPoint),
-            CheckEntryFn => Some(CheckEntryFn),
             Variance => Some(Variance),
-            UnusedTraitCheck => Some(UnusedTraitCheck),
             PrivacyAccessLevels(k) => Some(PrivacyAccessLevels(k)),
             Reachability => Some(Reachability),
-            DeadCheck => Some(DeadCheck),
             LateLintCheck => Some(LateLintCheck),
-            TransCrate => Some(TransCrate),
             TransWriteMetadata => Some(TransWriteMetadata),
-            LinkBinary => Some(LinkBinary),
 
             // work product names do not need to be mapped, because
             // they are always absolute.
@@ -237,18 +206,10 @@ impl<D: Clone + Debug> DepNode<D> {
             Hir(ref d) => op(d).map(Hir),
             HirBody(ref d) => op(d).map(HirBody),
             MetaData(ref d) => op(d).map(MetaData),
-            CollectItem(ref d) => op(d).map(CollectItem),
-            CollectItemSig(ref d) => op(d).map(CollectItemSig),
             CoherenceCheckTrait(ref d) => op(d).map(CoherenceCheckTrait),
             CoherenceCheckImpl(ref d) => op(d).map(CoherenceCheckImpl),
             CoherenceOverlapCheck(ref d) => op(d).map(CoherenceOverlapCheck),
             CoherenceOverlapCheckSpecial(ref d) => op(d).map(CoherenceOverlapCheckSpecial),
-            CoherenceOrphanCheck(ref d) => op(d).map(CoherenceOrphanCheck),
-            WfCheck(ref d) => op(d).map(WfCheck),
-            TypeckItemType(ref d) => op(d).map(TypeckItemType),
-            CheckConst(ref d) => op(d).map(CheckConst),
-            IntrinsicCheck(ref d) => op(d).map(IntrinsicCheck),
-            MatchCheck(ref d) => op(d).map(MatchCheck),
             Mir(ref d) => op(d).map(Mir),
             MirShim(ref def_ids) => {
                 let def_ids: Option<Vec<E>> = def_ids.iter().map(op).collect();
@@ -256,7 +217,6 @@ impl<D: Clone + Debug> DepNode<D> {
             }
             BorrowCheck(ref d) => op(d).map(BorrowCheck),
             RvalueCheck(ref d) => op(d).map(RvalueCheck),
-            StabilityCheck(ref d) => op(d).map(StabilityCheck),
             TransCrateItem(ref d) => op(d).map(TransCrateItem),
             TransInlinedItem(ref d) => op(d).map(TransInlinedItem),
             AssociatedItems(ref d) => op(d).map(AssociatedItems),
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index 342553593af..63d90d93bb5 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -12,7 +12,6 @@
 // closely. The idea is that all reachable symbols are live, codes called
 // from live codes are live, and everything else is dead.
 
-use dep_graph::DepNode;
 use hir::map as hir_map;
 use hir::{self, PatKind};
 use hir::intravisit::{self, Visitor, NestedVisitorMap};
@@ -594,7 +593,6 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
 }
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let _task = tcx.dep_graph.in_task(DepNode::DeadCheck);
     let access_levels = &ty::queries::privacy_access_levels::get(tcx, DUMMY_SP, LOCAL_CRATE);
     let krate = tcx.hir.krate();
     let live_symbols = find_live(tcx, access_levels, krate);
diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs
index ff7adfb327a..8da7560387f 100644
--- a/src/librustc/middle/entry.rs
+++ b/src/librustc/middle/entry.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 
-use dep_graph::DepNode;
 use hir::map as hir_map;
 use hir::def_id::{CRATE_DEF_INDEX};
 use session::{config, Session};
@@ -57,8 +56,6 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> {
 }
 
 pub fn find_entry_point(session: &Session, hir_map: &hir_map::Map) {
-    let _task = hir_map.dep_graph.in_task(DepNode::EntryPoint);
-
     let any_exe = session.crate_types.borrow().iter().any(|ty| {
         *ty == config::CrateTypeExecutable
     });
diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs
index 942f8475ece..ecc0bb9fe49 100644
--- a/src/librustc/middle/intrinsicck.rs
+++ b/src/librustc/middle/intrinsicck.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use dep_graph::DepNode;
 use hir::def::Def;
 use hir::def_id::DefId;
 use infer::InferCtxt;
@@ -25,7 +24,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let mut visitor = ItemVisitor {
         tcx: tcx
     };
-    tcx.visit_all_item_likes_in_krate(DepNode::IntrinsicCheck, &mut visitor.as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
 }
 
 struct ItemVisitor<'a, 'tcx: 'a> {
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index 81a415a2f53..5989fa9007c 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -21,7 +21,6 @@
 
 pub use self::LangItem::*;
 
-use dep_graph::DepNode;
 use hir::map as hir_map;
 use session::Session;
 use hir::def_id::DefId;
@@ -236,7 +235,6 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> {
 pub fn collect_language_items(session: &Session,
                               map: &hir_map::Map)
                               -> LanguageItems {
-    let _task = map.dep_graph.in_task(DepNode::CollectLanguageItems);
     let krate: &hir::Crate = map.krate();
     let mut collector = LanguageItemCollector::new(session, map);
     collector.collect(krate);
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index b9938a04047..a1aabc775a3 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -15,7 +15,6 @@
 //! used between functions, and they operate in a purely top-down
 //! way. Therefore we break lifetime name resolution into a separate pass.
 
-use dep_graph::DepNode;
 use hir::map::Map;
 use session::Session;
 use hir::def::Def;
@@ -259,7 +258,6 @@ const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
 pub fn krate(sess: &Session,
              hir_map: &Map)
              -> Result<NamedRegionMap, usize> {
-    let _task = hir_map.dep_graph.in_task(DepNode::ResolveLifetimes);
     let krate = hir_map.krate();
     let mut map = NamedRegionMap {
         defs: NodeMap(),
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index 2b5ea61d4e8..1e856f6716e 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -13,7 +13,6 @@
 
 pub use self::StabilityLevel::*;
 
-use dep_graph::DepNode;
 use hir::map as hir_map;
 use lint;
 use hir::def::Def;
@@ -383,7 +382,6 @@ impl<'a, 'tcx> Index<'tcx> {
         // Put the active features into a map for quick lookup
         self.active_features = active_lib_features.iter().map(|&(ref s, _)| s.clone()).collect();
 
-        let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
         let krate = tcx.hir.krate();
         let mut annotator = Annotator {
             tcx: tcx,
@@ -397,7 +395,6 @@ impl<'a, 'tcx> Index<'tcx> {
     }
 
     pub fn new(hir_map: &hir_map::Map) -> Index<'tcx> {
-        let _task = hir_map.dep_graph.in_task(DepNode::StabilityIndex);
         let krate = hir_map.krate();
 
         let mut is_staged_api = false;
@@ -424,7 +421,7 @@ impl<'a, 'tcx> Index<'tcx> {
 /// features and possibly prints errors.
 pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let mut checker = Checker { tcx: tcx };
-    tcx.visit_all_item_likes_in_krate(DepNode::StabilityCheck, &mut checker.as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut checker.as_deep_visitor());
 }
 
 struct Checker<'a, 'tcx: 'a> {
@@ -662,7 +659,6 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let access_levels = &ty::queries::privacy_access_levels::get(tcx, DUMMY_SP, LOCAL_CRATE);
 
     if tcx.stability.borrow().staged_api[&LOCAL_CRATE] && tcx.sess.features.borrow().staged_api {
-        let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
         let krate = tcx.hir.krate();
         let mut missing = MissingStabilityAnnotations {
             tcx: tcx,
diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs
index f1ab6a00aa2..2e0afe789c6 100644
--- a/src/librustc_const_eval/check_match.rs
+++ b/src/librustc_const_eval/check_match.rs
@@ -14,8 +14,6 @@ use _match::WitnessPreference::*;
 
 use pattern::{Pattern, PatternContext, PatternError, PatternKind};
 
-use rustc::dep_graph::DepNode;
-
 use rustc::middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor};
 use rustc::middle::expr_use_visitor::{LoanCause, MutateMode};
 use rustc::middle::expr_use_visitor as euv;
@@ -56,8 +54,7 @@ impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> {
 }
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    tcx.visit_all_item_likes_in_krate(DepNode::MatchCheck,
-                                      &mut OuterVisitor { tcx: tcx }.as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx: tcx }.as_deep_visitor());
     tcx.sess.abort_if_errors();
 }
 
diff --git a/src/librustc_driver/derive_registrar.rs b/src/librustc_driver/derive_registrar.rs
index 6a884bafce7..9983efce6af 100644
--- a/src/librustc_driver/derive_registrar.rs
+++ b/src/librustc_driver/derive_registrar.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use rustc::dep_graph::DepNode;
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
 use rustc::hir::map::Map;
 use rustc::hir;
@@ -16,7 +15,6 @@ use syntax::ast;
 use syntax::attr;
 
 pub fn find(hir_map: &Map) -> Option<ast::NodeId> {
-    let _task = hir_map.dep_graph.in_task(DepNode::PluginRegistrar);
     let krate = hir_map.krate();
 
     let mut finder = Finder { registrar: None };
diff --git a/src/librustc_mir/build/expr/as_temp.rs b/src/librustc_mir/build/expr/as_temp.rs
index e4598b41438..a334923546f 100644
--- a/src/librustc_mir/build/expr/as_temp.rs
+++ b/src/librustc_mir/build/expr/as_temp.rs
@@ -38,9 +38,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
         debug!("expr_as_temp(block={:?}, expr={:?})", block, expr);
         let this = self;
 
-        if let ExprKind::Scope { .. } = expr.kind {
-            span_bug!(expr.span, "unexpected scope expression in as_temp: {:?}",
-                      expr);
+        if let ExprKind::Scope { extent, value } = expr.kind {
+            return this.in_scope(extent, block, |this| {
+                this.as_temp(block, temp_lifetime, value)
+            });
         }
 
         let expr_ty = expr.ty.clone();
diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs
index a5a114c61bc..5982d3bdc81 100644
--- a/src/librustc_mir/build/expr/into.rs
+++ b/src/librustc_mir/build/expr/into.rs
@@ -16,6 +16,8 @@ use hair::*;
 use rustc::ty;
 use rustc::mir::*;
 
+use syntax::abi::Abi;
+
 impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
     /// Compile `expr`, storing the result into `destination`, which
     /// is assumed to be uninitialized.
@@ -206,25 +208,49 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
                     }
                     _ => false
                 };
+                let intrinsic = match ty.sty {
+                    ty::TyFnDef(def_id, _, ref f) if
+                        f.abi() == Abi::RustIntrinsic ||
+                        f.abi() == Abi::PlatformIntrinsic =>
+                    {
+                        Some(this.hir.tcx().item_name(def_id).as_str())
+                    }
+                    _ => None
+                };
+                let intrinsic = intrinsic.as_ref().map(|s| &s[..]);
                 let fun = unpack!(block = this.as_local_operand(block, fun));
-                let args: Vec<_> =
-                    args.into_iter()
-                        .map(|arg| unpack!(block = this.as_local_operand(block, arg)))
-                        .collect();
+                if intrinsic == Some("move_val_init") {
+                    // `move_val_init` has "magic" semantics - the second argument is
+                    // always evaluated "directly" into the first one.
 
-                let success = this.cfg.start_new_block();
-                let cleanup = this.diverge_cleanup();
-                this.cfg.terminate(block, source_info, TerminatorKind::Call {
-                    func: fun,
-                    args: args,
-                    cleanup: cleanup,
-                    destination: if diverges {
-                        None
-                    } else {
-                        Some ((destination.clone(), success))
-                    }
-                });
-                success.unit()
+                    let mut args = args.into_iter();
+                    let ptr = args.next().expect("0 arguments to `move_val_init`");
+                    let val = args.next().expect("1 argument to `move_val_init`");
+                    assert!(args.next().is_none(), ">2 arguments to `move_val_init`");
+
+                    let topmost_scope = this.topmost_scope();
+                    let ptr = unpack!(block = this.as_temp(block, Some(topmost_scope), ptr));
+                    this.into(&ptr.deref(), block, val)
+                } else {
+                    let args: Vec<_> =
+                        args.into_iter()
+                            .map(|arg| unpack!(block = this.as_local_operand(block, arg)))
+                            .collect();
+
+                    let success = this.cfg.start_new_block();
+                    let cleanup = this.diverge_cleanup();
+                    this.cfg.terminate(block, source_info, TerminatorKind::Call {
+                        func: fun,
+                        args: args,
+                        cleanup: cleanup,
+                        destination: if diverges {
+                            None
+                        } else {
+                            Some ((destination.clone(), success))
+                        }
+                    });
+                    success.unit()
+                }
             }
 
             // These cases don't actually need a destination
diff --git a/src/librustc_mir/mir_map.rs b/src/librustc_mir/mir_map.rs
index 8c138d779c1..9dfe1a34c9c 100644
--- a/src/librustc_mir/mir_map.rs
+++ b/src/librustc_mir/mir_map.rs
@@ -68,7 +68,7 @@ pub fn build_mir_for_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
                 NestedVisitorMap::None
             }
         }
-        tcx.visit_all_item_likes_in_krate(DepNode::Mir, &mut GatherCtors {
+        tcx.hir.krate().visit_all_item_likes(&mut GatherCtors {
             tcx: tcx
         }.as_deep_visitor());
     }
diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs
index 0cec84d16a8..4d70540a7c6 100644
--- a/src/librustc_mir/shim.rs
+++ b/src/librustc_mir/shim.rs
@@ -205,12 +205,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
                 patch: MirPatch::new(&mir),
                 tcx, param_env
             };
-            let dropee = Lvalue::Projection(
-                box Projection {
-                    base: Lvalue::Local(Local::new(1+0)),
-                    elem: ProjectionElem::Deref
-                }
-                );
+            let dropee = Lvalue::Local(Local::new(1+0)).deref();
             let resume_block = elaborator.patch.resume_block();
             elaborate_drops::elaborate_drop(
                 &mut elaborator,
@@ -310,9 +305,7 @@ fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
 
     let rcvr = match rcvr_adjustment {
         Adjustment::Identity => Operand::Consume(rcvr_l),
-        Adjustment::Deref => Operand::Consume(Lvalue::Projection(
-            box Projection { base: rcvr_l, elem: ProjectionElem::Deref }
-        )),
+        Adjustment::Deref => Operand::Consume(rcvr_l.deref()),
         Adjustment::RefMut => {
             // let rcvr = &mut rcvr;
             let re_erased = tcx.mk_region(ty::ReErased);
@@ -352,10 +345,7 @@ fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
     if let Some(untuple_args) = untuple_args {
         args.extend(untuple_args.iter().enumerate().map(|(i, ity)| {
             let arg_lv = Lvalue::Local(Local::new(1+1));
-            Operand::Consume(Lvalue::Projection(box Projection {
-                base: arg_lv,
-                elem: ProjectionElem::Field(Field::new(i), *ity)
-            }))
+            Operand::Consume(arg_lv.field(Field::new(i), *ity))
         }));
     } else {
         args.extend((1..sig.inputs().len()).map(|i| {
diff --git a/src/librustc_passes/consts.rs b/src/librustc_passes/consts.rs
index 44d3026d80c..2c4439f80a2 100644
--- a/src/librustc_passes/consts.rs
+++ b/src/librustc_passes/consts.rs
@@ -24,7 +24,6 @@
 // - It's not possible to take the address of a static item with unsafe interior. This is enforced
 // by borrowck::gather_loans
 
-use rustc::dep_graph::DepNode;
 use rustc::ty::cast::CastKind;
 use rustc_const_eval::ConstContext;
 use rustc::middle::const_val::ConstEvalErr;
@@ -459,15 +458,14 @@ fn check_adjustments<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Exp
 }
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    tcx.visit_all_item_likes_in_krate(DepNode::CheckConst,
-                                      &mut CheckCrateVisitor {
-                                          tcx: tcx,
-                                          tables: &ty::TypeckTables::empty(),
-                                          in_fn: false,
-                                          promotable: false,
-                                          mut_rvalue_borrows: NodeSet(),
-                                          param_env: tcx.empty_parameter_environment(),
-                                      }.as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut CheckCrateVisitor {
+        tcx: tcx,
+        tables: &ty::TypeckTables::empty(),
+        in_fn: false,
+        promotable: false,
+        mut_rvalue_borrows: NodeSet(),
+        param_env: tcx.empty_parameter_environment(),
+    }.as_deep_visitor());
     tcx.sess.abort_if_errors();
 }
 
diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs
index 34ebd12de9c..88af8b49b9e 100644
--- a/src/librustc_plugin/build.rs
+++ b/src/librustc_plugin/build.rs
@@ -14,7 +14,6 @@ use syntax::ast;
 use syntax::attr;
 use errors;
 use syntax_pos::Span;
-use rustc::dep_graph::DepNode;
 use rustc::hir::map::Map;
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
 use rustc::hir;
@@ -44,7 +43,6 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder {
 pub fn find_plugin_registrar(diagnostic: &errors::Handler,
                              hir_map: &Map)
                              -> Option<ast::NodeId> {
-    let _task = hir_map.dep_graph.in_task(DepNode::PluginRegistrar);
     let krate = hir_map.krate();
 
     let mut finder = RegistrarFinder { registrars: Vec::new() };
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 7468f4ace1b..7c0522a9c8c 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -192,8 +192,6 @@ pub fn link_binary(sess: &Session,
                    trans: &CrateTranslation,
                    outputs: &OutputFilenames,
                    crate_name: &str) -> Vec<PathBuf> {
-    let _task = sess.dep_graph.in_task(DepNode::LinkBinary);
-
     let mut out_filenames = Vec::new();
     for &crate_type in sess.crate_types.borrow().iter() {
         // Ignore executable crates if we have -Z no-trans, as they will error.
diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs
index c770bbdb90f..cb8022efedb 100644
--- a/src/librustc_trans/base.rs
+++ b/src/librustc_trans/base.rs
@@ -38,7 +38,7 @@ use rustc::hir::def_id::LOCAL_CRATE;
 use middle::lang_items::StartFnLangItem;
 use middle::cstore::EncodedMetadata;
 use rustc::ty::{self, Ty, TyCtxt};
-use rustc::dep_graph::{AssertDepGraphSafe, DepNode};
+use rustc::dep_graph::AssertDepGraphSafe;
 use rustc::middle::cstore::LinkMeta;
 use rustc::hir::map as hir_map;
 use rustc::util::common::time;
@@ -1057,8 +1057,6 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                              analysis: ty::CrateAnalysis,
                              incremental_hashes_map: &IncrementalHashesMap)
                              -> CrateTranslation {
-    let _task = tcx.dep_graph.in_task(DepNode::TransCrate);
-
     // Be careful with this krate: obviously it gives access to the
     // entire contents of the krate. So if you push any subtasks of
     // `TransCrate`, you need to be careful to register "reads" of the
diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs
index 0976859e27f..0f5a38ac7f6 100644
--- a/src/librustc_trans/mir/block.rs
+++ b/src/librustc_trans/mir/block.rs
@@ -418,16 +418,6 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> {
                 };
                 let intrinsic = intrinsic.as_ref().map(|s| &s[..]);
 
-                if intrinsic == Some("move_val_init") {
-                    let &(_, target) = destination.as_ref().unwrap();
-                    // The first argument is a thin destination pointer.
-                    let llptr = self.trans_operand(&bcx, &args[0]).immediate();
-                    let val = self.trans_operand(&bcx, &args[1]);
-                    self.store_operand(&bcx, llptr, None, val);
-                    funclet_br(self, bcx, target);
-                    return;
-                }
-
                 if intrinsic == Some("transmute") {
                     let &(ref dest, target) = destination.as_ref().unwrap();
                     self.trans_transmute(&bcx, &args[0], dest);
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index f894c0d32e0..32aeeeb1105 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -82,7 +82,6 @@ pub use self::compare_method::{compare_impl_method, compare_const_impl};
 use self::TupleArgumentsFlag::*;
 
 use astconv::AstConv;
-use dep_graph::DepNode;
 use fmt_macros::{Parser, Piece, Position};
 use hir::def::{Def, CtorKind};
 use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
@@ -577,14 +576,13 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> {
 pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult {
     tcx.sess.track_errors(|| {
         let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx);
-        tcx.visit_all_item_likes_in_krate(DepNode::WfCheck, &mut visit.as_deep_visitor());
+        tcx.hir.krate().visit_all_item_likes(&mut visit.as_deep_visitor());
     })
 }
 
 pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult {
     tcx.sess.track_errors(|| {
-        tcx.visit_all_item_likes_in_krate(DepNode::TypeckItemType,
-                                          &mut CheckItemTypesVisitor { tcx });
+        tcx.hir.krate().visit_all_item_likes(&mut CheckItemTypesVisitor { tcx });
     })
 }
 
diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs
index 3791079dc81..c9479c5cebc 100644
--- a/src/librustc_typeck/check_unused.rs
+++ b/src/librustc_typeck/check_unused.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 use lint;
-use rustc::dep_graph::DepNode;
 use rustc::ty::TyCtxt;
 
 use syntax::ast;
@@ -62,8 +61,6 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CheckVisitor<'a, 'tcx> {
 }
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let _task = tcx.dep_graph.in_task(DepNode::UnusedTraitCheck);
-
     let mut used_trait_imports = DefIdSet();
     for &body_id in tcx.hir.krate().bodies.keys() {
         let item_id = tcx.hir.body_owner(body_id);
diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs
index b3a7b612dd5..b385ddc49c1 100644
--- a/src/librustc_typeck/coherence/mod.rs
+++ b/src/librustc_typeck/coherence/mod.rs
@@ -18,7 +18,6 @@
 use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use rustc::ty::{self, TyCtxt, TypeFoldable};
 use rustc::ty::maps::Providers;
-use rustc::dep_graph::DepNode;
 
 use syntax::ast;
 use syntax_pos::DUMMY_SP;
@@ -132,7 +131,6 @@ fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 }
 
 pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let _task = tcx.dep_graph.in_task(DepNode::Coherence);
     for &trait_def_id in tcx.hir.krate().trait_impls.keys() {
         ty::queries::coherent_trait::get(tcx, DUMMY_SP, (LOCAL_CRATE, trait_def_id));
     }
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs
index ee361ab6073..8ded3003c78 100644
--- a/src/librustc_typeck/coherence/orphan.rs
+++ b/src/librustc_typeck/coherence/orphan.rs
@@ -13,13 +13,12 @@
 
 use rustc::traits;
 use rustc::ty::{self, TyCtxt};
-use rustc::dep_graph::DepNode;
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
 use rustc::hir;
 
 pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let mut orphan = OrphanChecker { tcx: tcx };
-    tcx.visit_all_item_likes_in_krate(DepNode::CoherenceOrphanCheck, &mut orphan);
+    tcx.hir.krate().visit_all_item_likes(&mut orphan);
 }
 
 struct OrphanChecker<'cx, 'tcx: 'cx> {
diff --git a/src/librustc_typeck/coherence/overlap.rs b/src/librustc_typeck/coherence/overlap.rs
index d334d0c4338..74edc7bff49 100644
--- a/src/librustc_typeck/coherence/overlap.rs
+++ b/src/librustc_typeck/coherence/overlap.rs
@@ -24,7 +24,7 @@ pub fn check_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
 
     // this secondary walk specifically checks for some other cases,
     // like defaulted traits, for which additional overlap rules exist
-    tcx.visit_all_item_likes_in_krate(DepNode::CoherenceOverlapCheckSpecial, &mut overlap);
+    tcx.hir.krate().visit_all_item_likes(&mut overlap);
 }
 
 pub fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeId) {
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 73e3de0cc76..af0ef279e4f 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -64,7 +64,6 @@ use rustc::ty::{ToPredicate, ReprOptions};
 use rustc::ty::{self, AdtKind, ToPolyTraitRef, Ty, TyCtxt};
 use rustc::ty::maps::Providers;
 use rustc::ty::util::IntTypeExt;
-use rustc::dep_graph::DepNode;
 use util::nodemap::{NodeMap, FxHashMap};
 
 use rustc_const_math::ConstInt;
@@ -87,7 +86,7 @@ use rustc::hir::def_id::DefId;
 
 pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     let mut visitor = CollectItemTypesVisitor { tcx: tcx };
-    tcx.visit_all_item_likes_in_krate(DepNode::CollectItem, &mut visitor.as_deep_visitor());
+    tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
 }
 
 pub fn provide(providers: &mut Providers) {
@@ -126,57 +125,13 @@ struct CollectItemTypesVisitor<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>
 }
 
-impl<'a, 'tcx> CollectItemTypesVisitor<'a, 'tcx> {
-    /// Collect item types is structured into two tasks. The outer
-    /// task, `CollectItem`, walks the entire content of an item-like
-    /// thing, including its body. It also spawns an inner task,
-    /// `CollectItemSig`, which walks only the signature. This inner
-    /// task is the one that writes the item-type into the various
-    /// maps.  This setup ensures that the item body is never
-    /// accessible to the task that computes its signature, so that
-    /// changes to the body don't affect the signature.
-    ///
-    /// Consider an example function `foo` that also has a closure in its body:
-    ///
-    /// ```
-    /// fn foo(<sig>) {
-    ///     ...
-    ///     let bar = || ...; // we'll label this closure as "bar" below
-    /// }
-    /// ```
-    ///
-    /// This results in a dep-graph like so. I've labeled the edges to
-    /// document where they arise.
-    ///
-    /// ```
-    /// [HirBody(foo)] -2--> [CollectItem(foo)] -4-> [ItemSignature(bar)]
-    ///                       ^           ^
-    ///                       1           3
-    /// [Hir(foo)] -----------+-6-> [CollectItemSig(foo)] -5-> [ItemSignature(foo)]
-    /// ```
-    ///
-    /// 1. This is added by the `visit_all_item_likes_in_krate`.
-    /// 2. This is added when we fetch the item body.
-    /// 3. This is added because `CollectItem` launches `CollectItemSig`.
-    ///    - it is arguably false; if we refactor the `with_task` system;
-    ///      we could get probably rid of it, but it is also harmless enough.
-    /// 4. This is added by the code in `visit_expr` when we write to `item_types`.
-    /// 5. This is added by the code in `convert_item` when we write to `item_types`;
-    ///    note that this write occurs inside the `CollectItemSig` task.
-    /// 6. Added by reads from within `op`.
-    fn with_collect_item_sig(&self, id: ast::NodeId, op: fn(TyCtxt<'a, 'tcx, 'tcx>, ast::NodeId)) {
-        let def_id = self.tcx.hir.local_def_id(id);
-        self.tcx.dep_graph.with_task(DepNode::CollectItemSig(def_id), self.tcx, id, op);
-    }
-}
-
 impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> {
     fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
         NestedVisitorMap::OnlyBodies(&self.tcx.hir)
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
-        self.with_collect_item_sig(item.id, convert_item);
+        convert_item(self.tcx, item.id);
         intravisit::walk_item(self, item);
     }
 
@@ -209,12 +164,12 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> {
     }
 
     fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
-        self.with_collect_item_sig(trait_item.id, convert_trait_item);
+        convert_trait_item(self.tcx, trait_item.id);
         intravisit::walk_trait_item(self, trait_item);
     }
 
     fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
-        self.with_collect_item_sig(impl_item.id, convert_impl_item);
+        convert_impl_item(self.tcx, impl_item.id);
         intravisit::walk_impl_item(self, impl_item);
     }
 }
diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs
index 3df25825a71..5751dc5ab8a 100644
--- a/src/librustc_typeck/impl_wf_check.rs
+++ b/src/librustc_typeck/impl_wf_check.rs
@@ -19,7 +19,6 @@
 //! fixed, but for the moment it's easier to do these checks early.
 
 use constrained_type_params as ctp;
-use rustc::dep_graph::DepNode;
 use rustc::hir;
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
 use rustc::hir::def_id::DefId;
@@ -63,7 +62,7 @@ pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     // We will tag this as part of the WF check -- logically, it is,
     // but it's one that we must perform earlier than the rest of
     // WfCheck.
-    tcx.visit_all_item_likes_in_krate(DepNode::WfCheck, &mut ImplWfCheck { tcx: tcx });
+    tcx.hir.krate().visit_all_item_likes(&mut ImplWfCheck { tcx: tcx });
 }
 
 struct ImplWfCheck<'a, 'tcx: 'a> {
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index e9d52c5eb98..e9a606dc0ab 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -104,7 +104,6 @@ pub use rustc::middle;
 pub use rustc::session;
 pub use rustc::util;
 
-use dep_graph::DepNode;
 use hir::map as hir_map;
 use rustc::infer::InferOk;
 use rustc::ty::subst::Substs;
@@ -273,7 +272,6 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 }
 
 fn check_for_entry_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    let _task = tcx.dep_graph.in_task(DepNode::CheckEntryFn);
     if let Some((id, sp)) = *tcx.sess.entry_fn.borrow() {
         match tcx.sess.entry_type.get() {
             Some(config::EntryMain) => check_main_fn_ty(tcx, id, sp),
diff --git a/src/libstd/sys/redox/process.rs b/src/libstd/sys/redox/process.rs
index 707b4cbc6ac..95e9438cd71 100644
--- a/src/libstd/sys/redox/process.rs
+++ b/src/libstd/sys/redox/process.rs
@@ -270,19 +270,22 @@ impl Command {
         }
 
         if let Some(fd) = stdio.stderr.fd() {
-            let _ = syscall::close(2);
-            t!(cvt(syscall::dup(fd, &[])));
-            let _ = syscall::close(fd);
+            t!(cvt(syscall::dup2(fd, 2, &[])));
+            let mut flags = t!(cvt(syscall::fcntl(2, syscall::F_GETFL, 0)));
+            flags &= ! syscall::O_CLOEXEC;
+            t!(cvt(syscall::fcntl(2, syscall::F_SETFL, flags)));
         }
         if let Some(fd) = stdio.stdout.fd() {
-            let _ = syscall::close(1);
-            t!(cvt(syscall::dup(fd, &[])));
-            let _ = syscall::close(fd);
+            t!(cvt(syscall::dup2(fd, 1, &[])));
+            let mut flags = t!(cvt(syscall::fcntl(1, syscall::F_GETFL, 0)));
+            flags &= ! syscall::O_CLOEXEC;
+            t!(cvt(syscall::fcntl(1, syscall::F_SETFL, flags)));
         }
         if let Some(fd) = stdio.stdin.fd() {
-            let _ = syscall::close(0);
-            t!(cvt(syscall::dup(fd, &[])));
-            let _ = syscall::close(fd);
+            t!(cvt(syscall::dup2(fd, 0, &[])));
+            let mut flags = t!(cvt(syscall::fcntl(0, syscall::F_GETFL, 0)));
+            flags &= ! syscall::O_CLOEXEC;
+            t!(cvt(syscall::fcntl(0, syscall::F_SETFL, flags)));
         }
 
         if let Some(g) = self.gid {
diff --git a/src/libstd/sys/redox/syscall/call.rs b/src/libstd/sys/redox/syscall/call.rs
index f58c240f31e..fadf7325d75 100644
--- a/src/libstd/sys/redox/syscall/call.rs
+++ b/src/libstd/sys/redox/syscall/call.rs
@@ -71,6 +71,11 @@ pub fn dup(fd: usize, buf: &[u8]) -> Result<usize> {
     unsafe { syscall3(SYS_DUP, fd, buf.as_ptr() as usize, buf.len()) }
 }
 
+/// Copy and transform a file descriptor
+pub fn dup2(fd: usize, newfd: usize, buf: &[u8]) -> Result<usize> {
+    unsafe { syscall4(SYS_DUP2, fd, newfd, buf.as_ptr() as usize, buf.len()) }
+}
+
 /// Replace the current process with a new executable
 pub fn execve(path: &str, args: &[[usize; 2]]) -> Result<usize> {
     unsafe { syscall4(SYS_EXECVE, path.as_ptr() as usize, path.len(),
diff --git a/src/libstd/sys/redox/syscall/number.rs b/src/libstd/sys/redox/syscall/number.rs
index 358746cd20a..98f8b73e4e1 100644
--- a/src/libstd/sys/redox/syscall/number.rs
+++ b/src/libstd/sys/redox/syscall/number.rs
@@ -28,6 +28,7 @@ pub const SYS_UNLINK: usize =   SYS_CLASS_PATH | 10;
 
 pub const SYS_CLOSE: usize =    SYS_CLASS_FILE | 6;
 pub const SYS_DUP: usize =      SYS_CLASS_FILE | SYS_RET_FILE | 41;
+pub const SYS_DUP2: usize =     SYS_CLASS_FILE | SYS_RET_FILE | 63;
 pub const SYS_READ: usize =     SYS_CLASS_FILE | SYS_ARG_MSLICE | 3;
 pub const SYS_WRITE: usize =    SYS_CLASS_FILE | SYS_ARG_SLICE | 4;
 pub const SYS_LSEEK: usize =    SYS_CLASS_FILE | 19;
diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs
index f5c188f7a75..04fe5f78b03 100644
--- a/src/libstd/sys_common/backtrace.rs
+++ b/src/libstd/sys_common/backtrace.rs
@@ -93,87 +93,11 @@ fn _print(w: &mut Write, format: PrintFormat) -> io::Result<()> {
     Ok(())
 }
 
-fn filter_frames(frames: &[Frame],
-                 format: PrintFormat,
-                 context: &BacktraceContext) -> (usize, usize)
+fn filter_frames(_frames: &[Frame],
+                 _format: PrintFormat,
+                 _context: &BacktraceContext) -> (usize, usize)
 {
-    if format == PrintFormat::Full {
-        return (0, 0);
-    }
-
-    // We want to filter out frames with some prefixes
-    // from both top and bottom of the call stack.
-    static BAD_PREFIXES_TOP: &'static [&'static str] = &[
-        "_ZN3std3sys3imp9backtrace",
-        "ZN3std3sys3imp9backtrace",
-        "std::sys::imp::backtrace",
-        "_ZN3std10sys_common9backtrace",
-        "ZN3std10sys_common9backtrace",
-        "std::sys_common::backtrace",
-        "_ZN3std9panicking",
-        "ZN3std9panicking",
-        "std::panicking",
-        "_ZN4core9panicking",
-        "ZN4core9panicking",
-        "core::panicking",
-        "_ZN4core6result13unwrap_failed",
-        "ZN4core6result13unwrap_failed",
-        "core::result::unwrap_failed",
-        "rust_begin_unwind",
-        "_ZN4drop",
-        "mingw_set_invalid_parameter_handler",
-    ];
-    static BAD_PREFIXES_BOTTOM: &'static [&'static str] = &[
-        "_ZN3std9panicking",
-        "ZN3std9panicking",
-        "std::panicking",
-        "_ZN3std5panic",
-        "ZN3std5panic",
-        "std::panic",
-        "_ZN4core9panicking",
-        "ZN4core9panicking",
-        "core::panicking",
-        "_ZN3std2rt10lang_start",
-        "ZN3std2rt10lang_start",
-        "std::rt::lang_start",
-        "panic_unwind::__rust_maybe_catch_panic",
-        "__rust_maybe_catch_panic",
-        "_rust_maybe_catch_panic",
-        "__libc_start_main",
-        "__rust_try",
-        "_start",
-        "main",
-        "BaseThreadInitThunk",
-        "RtlInitializeExceptionChain",
-        "__scrt_common_main_seh",
-        "_ZN4drop",
-        "mingw_set_invalid_parameter_handler",
-    ];
-
-    let is_good_frame = |frame: Frame, bad_prefixes: &[&str]| {
-        resolve_symname(frame, |symname| {
-            if let Some(mangled_symbol_name) = symname {
-                if !bad_prefixes.iter().any(|s| mangled_symbol_name.starts_with(s)) {
-                    return Ok(())
-                }
-            }
-            Err(io::Error::from(io::ErrorKind::Other))
-        }, context).is_ok()
-    };
-
-    let skipped_before = frames.iter().position(|frame| {
-        is_good_frame(*frame, BAD_PREFIXES_TOP)
-    }).unwrap_or(frames.len());
-    let skipped_after = frames[skipped_before..].iter().rev().position(|frame| {
-        is_good_frame(*frame, BAD_PREFIXES_BOTTOM)
-    }).unwrap_or(frames.len() - skipped_before);
-
-    if skipped_before + skipped_after == frames.len() {
-        // Avoid showing completely empty backtraces
-        return (0, 0);
-    }
-
-    (skipped_before, skipped_after)
+    (0, 0)
 }
 
 /// Controls how the backtrace should be formated.
diff --git a/src/test/codegen/move-val-init.rs b/src/test/codegen/move-val-init.rs
new file mode 100644
index 00000000000..98b7db60b68
--- /dev/null
+++ b/src/test/codegen/move-val-init.rs
@@ -0,0 +1,29 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C no-prepopulate-passes
+
+#![feature(core_intrinsics)]
+#![crate_type = "lib"]
+
+// test that `move_val_init` actually avoids big allocas
+
+use std::intrinsics::move_val_init;
+
+pub struct Big {
+    pub data: [u8; 65536]
+}
+
+// CHECK-LABEL: @test_mvi
+#[no_mangle]
+pub unsafe fn test_mvi(target: *mut Big, make_big: fn() -> Big) {
+    // CHECK: call void %1(%Big*{{[^%]*}} %0)
+    move_val_init(target, make_big());
+}
diff --git a/src/test/compile-fail/dep-graph-struct-signature.rs b/src/test/compile-fail/dep-graph-struct-signature.rs
index 36382e776ce..7ed8b95f88b 100644
--- a/src/test/compile-fail/dep-graph-struct-signature.rs
+++ b/src/test/compile-fail/dep-graph-struct-signature.rs
@@ -35,44 +35,36 @@ mod signatures {
     use WillChange;
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR no path
     trait Bar {
         #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
-        #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
         fn do_something(x: WillChange);
     }
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
     fn some_fn(x: WillChange) { }
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
     fn new_foo(x: u32, y: u32) -> WillChange {
         WillChange { x: x, y: y }
     }
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
     impl WillChange {
         fn new(x: u32, y: u32) -> WillChange { loop { } }
     }
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
     impl WillChange {
         fn method(&self, x: u32) { }
     }
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
     struct WillChanges {
         x: WillChange,
         y: WillChange
     }
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
     fn indirect(x: WillChanges) { }
 }
 
@@ -80,17 +72,14 @@ mod invalid_signatures {
     use WontChange;
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR no path
     trait A {
         fn do_something_else_twice(x: WontChange);
     }
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR no path
     fn b(x: WontChange) { }
 
     #[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path from `WillChange`
-    #[rustc_then_this_would_need(CollectItem)] //~ ERROR no path from `WillChange`
     fn c(x: u32) { }
 }