about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-12-05 00:21:59 +0000
committerbors <bors@rust-lang.org>2017-12-05 00:21:59 +0000
commita4fa23a5bbbffc15c7ef6df5781478ddc7a45640 (patch)
tree03581d3d67d316ccbbb98e189e626017dcbe0a79
parentcd8a35299572c7d246cd9ab13d0d5c962aba053c (diff)
parent2c175df013a701321e44bcdba3c7ba7772ed3b94 (diff)
downloadrust-a4fa23a5bbbffc15c7ef6df5781478ddc7a45640.tar.gz
rust-a4fa23a5bbbffc15c7ef6df5781478ddc7a45640.zip
Auto merge of #46305 - irinagpopa:backstory, r=alexcrichton,eddyb
Move rustc_back modules where they belong.
-rw-r--r--src/Cargo.lock6
-rw-r--r--src/librustc/lib.rs1
-rw-r--r--src/librustc/lint/context.rs4
-rw-r--r--src/librustc/middle/resolve_lifetime.rs4
-rw-r--r--src/librustc/mir/mod.rs14
-rw-r--r--src/librustc_back/lib.rs5
-rw-r--r--src/librustc_back/slice.rs19
-rw-r--r--src/librustc_back/tempdir.rs114
-rw-r--r--src/librustc_borrowck/Cargo.toml1
-rw-r--r--src/librustc_borrowck/borrowck/unused.rs6
-rw-r--r--src/librustc_borrowck/lib.rs2
-rw-r--r--src/librustc_const_eval/Cargo.toml1
-rw-r--r--src/librustc_const_eval/check_match.rs6
-rw-r--r--src/librustc_const_eval/lib.rs2
-rw-r--r--src/librustc_metadata/creader.rs2
-rw-r--r--src/librustc_metadata/dynamic_lib.rs (renamed from src/librustc_back/dynamic_lib.rs)0
-rw-r--r--src/librustc_metadata/lib.rs3
-rw-r--r--src/librustc_plugin/Cargo.toml1
-rw-r--r--src/librustc_plugin/lib.rs1
-rw-r--r--src/librustc_plugin/load.rs2
-rw-r--r--src/librustc_trans/Cargo.toml1
-rw-r--r--src/librustc_trans/back/link.rs2
-rw-r--r--src/librustc_trans/lib.rs1
-rw-r--r--src/librustc_typeck/Cargo.toml1
-rw-r--r--src/librustc_typeck/astconv.rs6
-rw-r--r--src/librustc_typeck/check/mod.rs9
-rw-r--r--src/librustc_typeck/lib.rs2
-rw-r--r--src/librustdoc/Cargo.toml1
-rw-r--r--src/librustdoc/lib.rs1
-rw-r--r--src/librustdoc/plugins.rs2
-rw-r--r--src/librustdoc/test.rs4
-rw-r--r--src/test/run-make/extern-fn-reachable/main.rs4
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs4
-rw-r--r--src/test/run-pass-fulldeps/create-dir-all-bare.rs4
-rw-r--r--src/test/run-pass-fulldeps/issue-15149.rs4
-rw-r--r--src/test/run-pass-fulldeps/rename-directory.rs4
-rw-r--r--src/test/run-pass-fulldeps/stdio-from.rs4
-rw-r--r--src/test/run-pass-fulldeps/switch-stdout.rs4
38 files changed, 57 insertions, 195 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock
index a8107bc47c6..dc15486fe7c 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -1687,7 +1687,6 @@ dependencies = [
  "graphviz 0.0.0",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc 0.0.0",
- "rustc_back 0.0.0",
  "rustc_errors 0.0.0",
  "rustc_mir 0.0.0",
  "syntax 0.0.0",
@@ -1701,7 +1700,6 @@ dependencies = [
  "arena 0.0.0",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc 0.0.0",
- "rustc_back 0.0.0",
  "rustc_const_math 0.0.0",
  "rustc_data_structures 0.0.0",
  "rustc_errors 0.0.0",
@@ -1891,7 +1889,6 @@ name = "rustc_plugin"
 version = "0.0.0"
 dependencies = [
  "rustc 0.0.0",
- "rustc_back 0.0.0",
  "rustc_errors 0.0.0",
  "rustc_metadata 0.0.0",
  "syntax 0.0.0",
@@ -1963,6 +1960,7 @@ dependencies = [
  "serialize 0.0.0",
  "syntax 0.0.0",
  "syntax_pos 0.0.0",
+ "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1999,7 +1997,6 @@ dependencies = [
  "fmt_macros 0.0.0",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc 0.0.0",
- "rustc_back 0.0.0",
  "rustc_const_math 0.0.0",
  "rustc_data_structures 0.0.0",
  "rustc_errors 0.0.0",
@@ -2017,6 +2014,7 @@ dependencies = [
  "html-diff 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index a8c80aaa030..06c9995663e 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -46,6 +46,7 @@
 #![feature(const_fn)]
 #![feature(core_intrinsics)]
 #![feature(drain_filter)]
+#![feature(from_ref)]
 #![feature(i128)]
 #![feature(i128_type)]
 #![feature(inclusive_range)]
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index 2b9d5f27c66..75cd230e1e5 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -26,7 +26,7 @@
 
 use self::TargetLint::*;
 
-use rustc_back::slice;
+use std::slice;
 use lint::{EarlyLintPassObject, LateLintPassObject};
 use lint::{Level, Lint, LintId, LintPass, LintBuffer};
 use lint::levels::{LintLevelSets, LintLevelsBuilder};
@@ -308,7 +308,7 @@ impl LintStore {
                     Some(ids) => CheckLintNameResult::Ok(&ids.0),
                 }
             }
-            Some(&Id(ref id)) => CheckLintNameResult::Ok(slice::ref_slice(id)),
+            Some(&Id(ref id)) => CheckLintNameResult::Ok(slice::from_ref(id)),
         }
     }
 }
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index 4856fa3fc45..3683425cee5 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -31,7 +31,7 @@ use syntax_pos::Span;
 use errors::DiagnosticBuilder;
 use util::common::ErrorReported;
 use util::nodemap::{NodeMap, NodeSet, FxHashSet, FxHashMap, DefIdMap};
-use rustc_back::slice;
+use std::slice;
 
 use hir;
 use hir::intravisit::{self, Visitor, NestedVisitorMap};
@@ -530,7 +530,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
 
     fn visit_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime) {
         if lifetime_ref.is_elided() {
-            self.resolve_elided_lifetimes(slice::ref_slice(lifetime_ref));
+            self.resolve_elided_lifetimes(slice::from_ref(lifetime_ref));
             return;
         }
         if lifetime_ref.is_static() {
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index cd4ed8081c3..5e5b9dc4d84 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -25,7 +25,7 @@ use ty::subst::{Subst, Substs};
 use ty::{self, AdtDef, ClosureSubsts, Region, Ty, TyCtxt, GeneratorInterior};
 use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
 use util::ppaux;
-use rustc_back::slice;
+use std::slice;
 use hir::{self, InlineAsm};
 use std::ascii;
 use std::borrow::{Cow};
@@ -754,28 +754,28 @@ impl<'tcx> TerminatorKind<'tcx> {
     pub fn successors(&self) -> Cow<[BasicBlock]> {
         use self::TerminatorKind::*;
         match *self {
-            Goto { target: ref b } => slice::ref_slice(b).into_cow(),
+            Goto { target: ref b } => slice::from_ref(b).into_cow(),
             SwitchInt { targets: ref b, .. } => b[..].into_cow(),
             Resume | GeneratorDrop => (&[]).into_cow(),
             Return => (&[]).into_cow(),
             Unreachable => (&[]).into_cow(),
             Call { destination: Some((_, t)), cleanup: Some(c), .. } => vec![t, c].into_cow(),
             Call { destination: Some((_, ref t)), cleanup: None, .. } =>
-                slice::ref_slice(t).into_cow(),
-            Call { destination: None, cleanup: Some(ref c), .. } => slice::ref_slice(c).into_cow(),
+                slice::from_ref(t).into_cow(),
+            Call { destination: None, cleanup: Some(ref c), .. } => slice::from_ref(c).into_cow(),
             Call { destination: None, cleanup: None, .. } => (&[]).into_cow(),
             Yield { resume: t, drop: Some(c), .. } => vec![t, c].into_cow(),
-            Yield { resume: ref t, drop: None, .. } => slice::ref_slice(t).into_cow(),
+            Yield { resume: ref t, drop: None, .. } => slice::from_ref(t).into_cow(),
             DropAndReplace { target, unwind: Some(unwind), .. } |
             Drop { target, unwind: Some(unwind), .. } => {
                 vec![target, unwind].into_cow()
             }
             DropAndReplace { ref target, unwind: None, .. } |
             Drop { ref target, unwind: None, .. } => {
-                slice::ref_slice(target).into_cow()
+                slice::from_ref(target).into_cow()
             }
             Assert { target, cleanup: Some(unwind), .. } => vec![target, unwind].into_cow(),
-            Assert { ref target, .. } => slice::ref_slice(target).into_cow(),
+            Assert { ref target, .. } => slice::from_ref(target).into_cow(),
             FalseEdges { ref real_target, ref imaginary_targets } => {
                 let mut s = vec![*real_target];
                 s.extend_from_slice(imaginary_targets);
diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs
index 824b5531047..ccf1db778d2 100644
--- a/src/librustc_back/lib.rs
+++ b/src/librustc_back/lib.rs
@@ -28,20 +28,15 @@
 
 #![feature(box_syntax)]
 #![feature(const_fn)]
-#![feature(libc)]
 
 extern crate syntax;
-extern crate libc;
 extern crate rand;
 extern crate serialize;
 #[macro_use] extern crate log;
 
 extern crate serialize as rustc_serialize; // used by deriving
 
-pub mod tempdir;
 pub mod target;
-pub mod slice;
-pub mod dynamic_lib;
 
 use std::str::FromStr;
 
diff --git a/src/librustc_back/slice.rs b/src/librustc_back/slice.rs
deleted file mode 100644
index 5d8fc3acefd..00000000000
--- a/src/librustc_back/slice.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2015 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.
-
-use std::mem;
-
-pub fn ref_slice<T>(ptr: &T) -> &[T; 1] {
-    unsafe { mem::transmute(ptr) }
-}
-
-pub fn mut_ref_slice<T>(ptr: &mut T) -> &mut [T; 1] {
-    unsafe { mem::transmute(ptr) }
-}
diff --git a/src/librustc_back/tempdir.rs b/src/librustc_back/tempdir.rs
deleted file mode 100644
index 1a251536622..00000000000
--- a/src/librustc_back/tempdir.rs
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2015 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.
-
-use std::env;
-use std::io::{self, Error, ErrorKind};
-use std::fs;
-use std::path::{self, PathBuf, Path};
-use rand::{thread_rng, Rng};
-
-/// A wrapper for a path to temporary directory implementing automatic
-/// scope-based deletion.
-pub struct TempDir {
-    path: Option<PathBuf>,
-}
-
-// How many times should we (re)try finding an unused random name? It should be
-// enough that an attacker will run out of luck before we run out of patience.
-const NUM_RETRIES: u32 = 1 << 31;
-// How many characters should we include in a random file name? It needs to
-// be enough to dissuade an attacker from trying to preemptively create names
-// of that length, but not so huge that we unnecessarily drain the random number
-// generator of entropy.
-const NUM_RAND_CHARS: usize = 12;
-
-impl TempDir {
-    /// Attempts to make a temporary directory inside of `tmpdir` whose name
-    /// will have the prefix `prefix`. The directory will be automatically
-    /// deleted once the returned wrapper is destroyed.
-    ///
-    /// If no directory can be created, `Err` is returned.
-    #[allow(deprecated)] // rand usage
-    pub fn new_in<P: AsRef<Path>>(tmpdir: P, prefix: &str)
-                                  -> io::Result<TempDir> {
-        Self::_new_in(tmpdir.as_ref(), prefix)
-    }
-
-    fn _new_in(tmpdir: &Path, prefix: &str) -> io::Result<TempDir> {
-        let storage;
-        let mut tmpdir = tmpdir;
-        if !tmpdir.is_absolute() {
-            let cur_dir = env::current_dir()?;
-            storage = cur_dir.join(tmpdir);
-            tmpdir = &storage;
-            // return TempDir::new_in(&cur_dir.join(tmpdir), prefix);
-        }
-
-        let mut rng = thread_rng();
-        for _ in 0..NUM_RETRIES {
-            let suffix: String = rng.gen_ascii_chars().take(NUM_RAND_CHARS).collect();
-            let leaf = if !prefix.is_empty() {
-                format!("{}.{}", prefix, suffix)
-            } else {
-                // If we're given an empty string for a prefix, then creating a
-                // directory starting with "." would lead to it being
-                // semi-invisible on some systems.
-                suffix
-            };
-            let path = tmpdir.join(&leaf);
-            match fs::create_dir(&path) {
-                Ok(_) => return Ok(TempDir { path: Some(path) }),
-                Err(ref e) if e.kind() == ErrorKind::AlreadyExists => {}
-                Err(e) => return Err(e)
-            }
-        }
-
-        Err(Error::new(ErrorKind::AlreadyExists,
-                       "too many temporary directories already exist"))
-    }
-
-    /// Attempts to make a temporary directory inside of `env::temp_dir()` whose
-    /// name will have the prefix `prefix`. The directory will be automatically
-    /// deleted once the returned wrapper is destroyed.
-    ///
-    /// If no directory can be created, `Err` is returned.
-    pub fn new(prefix: &str) -> io::Result<TempDir> {
-        TempDir::new_in(&env::temp_dir(), prefix)
-    }
-
-    /// Unwrap the wrapped `std::path::Path` from the `TempDir` wrapper.
-    /// This discards the wrapper so that the automatic deletion of the
-    /// temporary directory is prevented.
-    pub fn into_path(mut self) -> PathBuf {
-        self.path.take().unwrap()
-    }
-
-    /// Access the wrapped `std::path::Path` to the temporary directory.
-    pub fn path(&self) -> &path::Path {
-        self.path.as_ref().unwrap()
-    }
-
-    fn cleanup_dir(&mut self) -> io::Result<()> {
-        match self.path {
-            Some(ref p) => fs::remove_dir_all(p),
-            None => Ok(())
-        }
-    }
-}
-
-impl Drop for TempDir {
-    fn drop(&mut self) {
-        let _ = self.cleanup_dir();
-    }
-}
-
-// the tests for this module need to change the path using change_dir,
-// and this doesn't play nicely with other tests so these unit tests are located
-// in src/test/run-pass/tempfile.rs
diff --git a/src/librustc_borrowck/Cargo.toml b/src/librustc_borrowck/Cargo.toml
index 4c09a9e003d..25f02537490 100644
--- a/src/librustc_borrowck/Cargo.toml
+++ b/src/librustc_borrowck/Cargo.toml
@@ -15,6 +15,5 @@ syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
 graphviz = { path = "../libgraphviz" }
 rustc = { path = "../librustc" }
-rustc_back = { path = "../librustc_back" }
 rustc_mir = { path = "../librustc_mir" }
 rustc_errors = { path = "../librustc_errors" }
diff --git a/src/librustc_borrowck/borrowck/unused.rs b/src/librustc_borrowck/borrowck/unused.rs
index 228824b663d..ddee122d0a6 100644
--- a/src/librustc_borrowck/borrowck/unused.rs
+++ b/src/librustc_borrowck/borrowck/unused.rs
@@ -13,7 +13,7 @@ use rustc::hir::{self, HirId};
 use rustc::lint::builtin::UNUSED_MUT;
 use rustc::ty;
 use rustc::util::nodemap::{FxHashMap, FxHashSet};
-use rustc_back::slice;
+use std::slice;
 use syntax::ptr::P;
 
 use borrowck::BorrowckCtxt;
@@ -26,7 +26,7 @@ pub fn check<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, body: &'tcx hir::Body) {
     }.visit_expr(&body.value);
     let mut cx = UnusedMutCx { bccx, used_mut };
     for arg in body.arguments.iter() {
-        cx.check_unused_mut_pat(slice::ref_slice(&arg.pat));
+        cx.check_unused_mut_pat(slice::from_ref(&arg.pat));
     }
     cx.visit_expr(&body.value);
 }
@@ -101,7 +101,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnusedMutCx<'a, 'tcx> {
     }
 
     fn visit_local(&mut self, local: &hir::Local) {
-        self.check_unused_mut_pat(slice::ref_slice(&local.pat));
+        self.check_unused_mut_pat(slice::from_ref(&local.pat));
     }
 }
 
diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs
index c8b71be86f8..be173db23a5 100644
--- a/src/librustc_borrowck/lib.rs
+++ b/src/librustc_borrowck/lib.rs
@@ -15,6 +15,7 @@
 
 #![allow(non_camel_case_types)]
 
+#![feature(from_ref)]
 #![feature(match_default_bindings)]
 #![feature(quote)]
 
@@ -22,7 +23,6 @@
 extern crate syntax;
 extern crate syntax_pos;
 extern crate rustc_errors as errors;
-extern crate rustc_back;
 
 // for "clarity", rename the graphviz crate to dot; graphviz within `borrowck`
 // refers to the borrowck-specific graphviz adapter traits.
diff --git a/src/librustc_const_eval/Cargo.toml b/src/librustc_const_eval/Cargo.toml
index bbc61480824..e8d404af4de 100644
--- a/src/librustc_const_eval/Cargo.toml
+++ b/src/librustc_const_eval/Cargo.toml
@@ -12,7 +12,6 @@ crate-type = ["dylib"]
 arena = { path = "../libarena" }
 log = "0.3"
 rustc = { path = "../librustc" }
-rustc_back = { path = "../librustc_back" }
 rustc_const_math = { path = "../librustc_const_math" }
 rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_errors = { path = "../librustc_errors" }
diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs
index 762b9787c8d..e22f7f14164 100644
--- a/src/librustc_const_eval/check_match.rs
+++ b/src/librustc_const_eval/check_match.rs
@@ -31,7 +31,7 @@ use rustc::hir::def_id::DefId;
 use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
 use rustc::hir::{self, Pat, PatKind};
 
-use rustc_back::slice;
+use std::slice;
 
 use syntax::ast;
 use syntax::ptr::P;
@@ -114,7 +114,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MatchVisitor<'a, 'tcx> {
         });
 
         // Check legality of move bindings and `@` patterns.
-        self.check_patterns(false, slice::ref_slice(&loc.pat));
+        self.check_patterns(false, slice::from_ref(&loc.pat));
     }
 
     fn visit_body(&mut self, body: &'tcx hir::Body) {
@@ -122,7 +122,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MatchVisitor<'a, 'tcx> {
 
         for arg in &body.arguments {
             self.check_irrefutable(&arg.pat, "function argument");
-            self.check_patterns(false, slice::ref_slice(&arg.pat));
+            self.check_patterns(false, slice::from_ref(&arg.pat));
         }
     }
 }
diff --git a/src/librustc_const_eval/lib.rs b/src/librustc_const_eval/lib.rs
index 5e569e21de7..d4110f0091a 100644
--- a/src/librustc_const_eval/lib.rs
+++ b/src/librustc_const_eval/lib.rs
@@ -24,12 +24,12 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(i128_type)]
+#![feature(from_ref)]
 
 extern crate arena;
 #[macro_use] extern crate syntax;
 #[macro_use] extern crate log;
 #[macro_use] extern crate rustc;
-extern crate rustc_back;
 extern crate rustc_const_math;
 extern crate rustc_data_structures;
 extern crate rustc_errors;
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index 155097cdbe2..e1c5cde42ec 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -556,7 +556,7 @@ impl<'a> CrateLoader<'a> {
         use std::{env, mem};
         use proc_macro::TokenStream;
         use proc_macro::__internal::Registry;
-        use rustc_back::dynamic_lib::DynamicLibrary;
+        use dynamic_lib::DynamicLibrary;
         use syntax_ext::deriving::custom::ProcMacroDerive;
         use syntax_ext::proc_macro_impl::{AttrProcMacro, BangProcMacro};
 
diff --git a/src/librustc_back/dynamic_lib.rs b/src/librustc_metadata/dynamic_lib.rs
index 1b42fa03a4f..1b42fa03a4f 100644
--- a/src/librustc_back/dynamic_lib.rs
+++ b/src/librustc_metadata/dynamic_lib.rs
diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs
index 20bdfaea0d0..6c1ca362323 100644
--- a/src/librustc_metadata/lib.rs
+++ b/src/librustc_metadata/lib.rs
@@ -16,12 +16,14 @@
 #![feature(box_patterns)]
 #![feature(conservative_impl_trait)]
 #![feature(i128_type)]
+#![feature(libc)]
 #![feature(proc_macro_internals)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(specialization)]
 #![feature(rustc_private)]
 
+extern crate libc;
 #[macro_use]
 extern crate log;
 #[macro_use]
@@ -54,6 +56,7 @@ mod link_args;
 
 pub mod creader;
 pub mod cstore;
+pub mod dynamic_lib;
 pub mod locator;
 
 __build_diagnostic_array! { librustc_metadata, DIAGNOSTICS }
diff --git a/src/librustc_plugin/Cargo.toml b/src/librustc_plugin/Cargo.toml
index 7f41d052761..d8fa1da1ce2 100644
--- a/src/librustc_plugin/Cargo.toml
+++ b/src/librustc_plugin/Cargo.toml
@@ -11,7 +11,6 @@ crate-type = ["dylib"]
 
 [dependencies]
 rustc = { path = "../librustc" }
-rustc_back = { path = "../librustc_back" }
 rustc_metadata = { path = "../librustc_metadata" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs
index a2a6d183e9c..3df56c4e728 100644
--- a/src/librustc_plugin/lib.rs
+++ b/src/librustc_plugin/lib.rs
@@ -71,7 +71,6 @@
 #[macro_use] extern crate syntax;
 
 extern crate rustc;
-extern crate rustc_back;
 extern crate rustc_metadata;
 extern crate syntax_pos;
 extern crate rustc_errors as errors;
diff --git a/src/librustc_plugin/load.rs b/src/librustc_plugin/load.rs
index aba56788928..8a4ec03b20e 100644
--- a/src/librustc_plugin/load.rs
+++ b/src/librustc_plugin/load.rs
@@ -115,7 +115,7 @@ impl<'a> PluginLoader<'a> {
                         span: Span,
                         path: PathBuf,
                         symbol: String) -> PluginRegistrarFun {
-        use rustc_back::dynamic_lib::DynamicLibrary;
+        use rustc_metadata::dynamic_lib::DynamicLibrary;
 
         // Make sure the path contains a / or the linker will search for it.
         let path = env::current_dir().unwrap().join(&path);
diff --git a/src/librustc_trans/Cargo.toml b/src/librustc_trans/Cargo.toml
index 96102cad3ef..d8318ea8082 100644
--- a/src/librustc_trans/Cargo.toml
+++ b/src/librustc_trans/Cargo.toml
@@ -32,6 +32,7 @@ rustc_trans_utils = { path = "../librustc_trans_utils" }
 serialize = { path = "../libserialize" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
+tempdir = "0.3"
 
 [target."cfg(windows)".dependencies]
 cc = "1.0.1"
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index e0eef1f5764..a182d7c6fbe 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -26,7 +26,7 @@ use {CrateTranslation, CrateInfo};
 use rustc::util::common::time;
 use rustc::util::fs::fix_windows_verbatim_for_gcc;
 use rustc::hir::def_id::CrateNum;
-use rustc_back::tempdir::TempDir;
+use tempdir::TempDir;
 use rustc_back::{PanicStrategy, RelroLevel, LinkerFlavor};
 use context::get_reloc_model;
 use llvm;
diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs
index 3d1bd81fe21..3c2e56bf2a1 100644
--- a/src/librustc_trans/lib.rs
+++ b/src/librustc_trans/lib.rs
@@ -63,6 +63,7 @@ extern crate rustc_errors as errors;
 extern crate serialize;
 #[cfg(windows)]
 extern crate cc; // Used to locate MSVC
+extern crate tempdir;
 
 pub use base::trans_crate;
 use back::bytecode::RLIB_BYTECODE_EXTENSION;
diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml
index 194d37dcb81..c3245842b42 100644
--- a/src/librustc_typeck/Cargo.toml
+++ b/src/librustc_typeck/Cargo.toml
@@ -15,7 +15,6 @@ syntax = { path = "../libsyntax" }
 arena = { path = "../libarena" }
 fmt_macros = { path = "../libfmt_macros" }
 rustc = { path = "../librustc" }
-rustc_back = { path = "../librustc_back" }
 rustc_const_math = { path = "../librustc_const_math" }
 rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" }
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 8b849a9e52f..e20706a0d5a 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -23,7 +23,7 @@ use rustc::ty::subst::{Kind, Subst, Substs};
 use rustc::traits;
 use rustc::ty::{self, RegionKind, Ty, TyCtxt, ToPredicate, TypeFoldable};
 use rustc::ty::wf::object_region_bounds;
-use rustc_back::slice;
+use std::slice;
 use require_c_abi_if_variadic;
 use util::common::ErrorReported;
 use util::nodemap::FxHashSet;
@@ -782,7 +782,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
 
         debug!("associated_path_def_to_ty: {:?}::{}", ty, assoc_name);
 
-        self.prohibit_type_params(slice::ref_slice(item_segment));
+        self.prohibit_type_params(slice::from_ref(item_segment));
 
         // Find the type of the associated item, and the trait where the associated
         // item is declared.
@@ -859,7 +859,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
         let tcx = self.tcx();
         let trait_def_id = tcx.parent_def_id(item_def_id).unwrap();
 
-        self.prohibit_type_params(slice::ref_slice(item_segment));
+        self.prohibit_type_params(slice::from_ref(item_segment));
 
         let self_ty = if let Some(ty) = opt_self_ty {
             ty
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 27a0e4f6dfe..efcf498b72c 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -87,7 +87,7 @@ use self::TupleArgumentsFlag::*;
 use astconv::AstConv;
 use hir::def::{Def, CtorKind};
 use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
-use rustc_back::slice::ref_slice;
+use std::slice;
 use namespace::Namespace;
 use rustc::infer::{self, InferCtxt, InferOk, RegionVariableOrigin};
 use rustc::infer::type_variable::{TypeVariableOrigin};
@@ -130,7 +130,6 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
 use rustc::hir::map::Node;
 use rustc::hir::{self, PatKind};
 use rustc::middle::lang_items;
-use rustc_back::slice;
 use rustc_const_math::ConstInt;
 
 mod autoderef;
@@ -4152,7 +4151,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         if let Some(cached_def) = self.tables.borrow().type_dependent_defs().get(hir_id) {
             // Return directly on cache hit. This is useful to avoid doubly reporting
             // errors with default match binding modes. See #44614.
-            return (*cached_def, Some(ty), slice::ref_slice(&**item_segment))
+            return (*cached_def, Some(ty), slice::from_ref(&**item_segment))
         }
         let item_name = item_segment.name;
         let def = match self.resolve_ufcs(span, item_name, ty, node_id) {
@@ -4171,7 +4170,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
 
         // Write back the new resolution.
         self.tables.borrow_mut().type_dependent_defs_mut().insert(hir_id, def);
-        (def, Some(ty), slice::ref_slice(&**item_segment))
+        (def, Some(ty), slice::from_ref(&**item_segment))
     }
 
     pub fn check_decl_initializer(&self,
@@ -4309,7 +4308,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             CoerceMany::new(coerce_to_ty)
         } else {
             let tail_expr: &[P<hir::Expr>] = match tail_expr {
-                Some(e) => ref_slice(e),
+                Some(e) => slice::from_ref(e),
                 None => &[],
             };
             CoerceMany::with_coercion_sites(coerce_to_ty, tail_expr)
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index 014b8b14edb..bf8f9d8b24a 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -77,6 +77,7 @@ This API is completely unstable and subject to change.
 #![feature(box_syntax)]
 #![feature(crate_visibility_modifier)]
 #![feature(conservative_impl_trait)]
+#![feature(from_ref)]
 #![feature(match_default_bindings)]
 #![feature(never_type)]
 #![feature(quote)]
@@ -90,7 +91,6 @@ extern crate syntax_pos;
 extern crate arena;
 #[macro_use] extern crate rustc;
 extern crate rustc_platform_intrinsics as intrinsics;
-extern crate rustc_back;
 extern crate rustc_const_math;
 extern crate rustc_data_structures;
 extern crate rustc_errors as errors;
diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml
index eca3ebe9130..fd8a6e0b593 100644
--- a/src/librustdoc/Cargo.toml
+++ b/src/librustdoc/Cargo.toml
@@ -14,6 +14,7 @@ doctest = false
 log = "0.3"
 pulldown-cmark = { version = "0.1.0", default-features = false }
 html-diff = "0.0.5"
+tempdir = "0.3"
 
 [build-dependencies]
 build_helper = { path = "../build_helper" }
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 967076779ad..f0bb87015f8 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -48,6 +48,7 @@ extern crate std_unicode;
 #[macro_use] extern crate log;
 extern crate rustc_errors as errors;
 extern crate pulldown_cmark;
+extern crate tempdir;
 
 extern crate serialize as rustc_serialize; // used by deriving
 
diff --git a/src/librustdoc/plugins.rs b/src/librustdoc/plugins.rs
index 4fc5159588d..1a1e60a6945 100644
--- a/src/librustdoc/plugins.rs
+++ b/src/librustdoc/plugins.rs
@@ -16,7 +16,7 @@ use std::mem;
 use std::string::String;
 use std::path::PathBuf;
 
-use rustc_back::dynamic_lib as dl;
+use rustc_metadata::dynamic_lib as dl;
 
 pub type PluginResult = clean::Crate;
 pub type PluginCallback = fn (clean::Crate) -> PluginResult;
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index ee0d9a7f3e2..74a16cb867d 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -27,8 +27,8 @@ use rustc::hir::intravisit;
 use rustc::session::{self, CompileIncomplete, config};
 use rustc::session::config::{OutputType, OutputTypes, Externs};
 use rustc::session::search_paths::{SearchPaths, PathKind};
-use rustc_back::dynamic_lib::DynamicLibrary;
-use rustc_back::tempdir::TempDir;
+use rustc_metadata::dynamic_lib::DynamicLibrary;
+use tempdir::TempDir;
 use rustc_driver::{self, driver, Compilation};
 use rustc_driver::driver::phase_2_configure_and_expand;
 use rustc_metadata::cstore::CStore;
diff --git a/src/test/run-make/extern-fn-reachable/main.rs b/src/test/run-make/extern-fn-reachable/main.rs
index a1bd1041d14..27387332c1c 100644
--- a/src/test/run-make/extern-fn-reachable/main.rs
+++ b/src/test/run-make/extern-fn-reachable/main.rs
@@ -10,9 +10,9 @@
 
 #![feature(rustc_private)]
 
-extern crate rustc_back;
+extern crate rustc_metadata;
 
-use rustc_back::dynamic_lib::DynamicLibrary;
+use rustc_metadata::dynamic_lib::DynamicLibrary;
 use std::path::Path;
 
 pub fn main() {
diff --git a/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs b/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs
index 09a2e8ecd87..7a15a4cb3a2 100644
--- a/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs
+++ b/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs
@@ -14,9 +14,9 @@
 // do the runtime check that these functions aren't exported.
 #![allow(private_no_mangle_fns)]
 
-extern crate rustc_back;
+extern crate rustc_metadata;
 
-use rustc_back::dynamic_lib::DynamicLibrary;
+use rustc_metadata::dynamic_lib::DynamicLibrary;
 
 #[no_mangle]
 pub fn foo() { bar(); }
diff --git a/src/test/run-pass-fulldeps/create-dir-all-bare.rs b/src/test/run-pass-fulldeps/create-dir-all-bare.rs
index e22736d7785..ba42cb870c9 100644
--- a/src/test/run-pass-fulldeps/create-dir-all-bare.rs
+++ b/src/test/run-pass-fulldeps/create-dir-all-bare.rs
@@ -12,11 +12,11 @@
 
 #![feature(rustc_private)]
 
-extern crate rustc_back;
+extern crate tempdir;
 
 use std::env;
 use std::fs;
-use rustc_back::tempdir::TempDir;
+use tempdir::TempDir;
 
 fn main() {
     let td = TempDir::new("create-dir-all-bare").unwrap();
diff --git a/src/test/run-pass-fulldeps/issue-15149.rs b/src/test/run-pass-fulldeps/issue-15149.rs
index c0ed7165afe..121fd4a9825 100644
--- a/src/test/run-pass-fulldeps/issue-15149.rs
+++ b/src/test/run-pass-fulldeps/issue-15149.rs
@@ -13,13 +13,13 @@
 
 #![feature(rustc_private)]
 
-extern crate rustc_back;
+extern crate tempdir;
 
 use std::env;
 use std::fs;
 use std::process;
 use std::str;
-use rustc_back::tempdir::TempDir;
+use tempdir::TempDir;
 
 fn main() {
     // If we're the child, make sure we were invoked correctly
diff --git a/src/test/run-pass-fulldeps/rename-directory.rs b/src/test/run-pass-fulldeps/rename-directory.rs
index f107e104281..7a2a4343522 100644
--- a/src/test/run-pass-fulldeps/rename-directory.rs
+++ b/src/test/run-pass-fulldeps/rename-directory.rs
@@ -15,11 +15,11 @@
 
 #![feature(rustc_private)]
 
-extern crate rustc_back;
+extern crate tempdir;
 
 use std::ffi::CString;
 use std::fs::{self, File};
-use rustc_back::tempdir::TempDir;
+use tempdir::TempDir;
 
 fn rename_directory() {
     let tmpdir = TempDir::new("rename_directory").ok().expect("rename_directory failed");
diff --git a/src/test/run-pass-fulldeps/stdio-from.rs b/src/test/run-pass-fulldeps/stdio-from.rs
index f64bbf9312c..535ab711f5b 100644
--- a/src/test/run-pass-fulldeps/stdio-from.rs
+++ b/src/test/run-pass-fulldeps/stdio-from.rs
@@ -12,7 +12,7 @@
 
 #![feature(rustc_private)]
 
-extern crate rustc_back;
+extern crate tempdir;
 
 use std::env;
 use std::fs::File;
@@ -20,7 +20,7 @@ use std::io;
 use std::io::{Read, Write};
 use std::process::{Command, Stdio};
 
-use rustc_back::tempdir::TempDir;
+use tempdir::TempDir;
 
 fn main() {
     if env::args().len() > 1 {
diff --git a/src/test/run-pass-fulldeps/switch-stdout.rs b/src/test/run-pass-fulldeps/switch-stdout.rs
index 4542e27545a..16f7e283285 100644
--- a/src/test/run-pass-fulldeps/switch-stdout.rs
+++ b/src/test/run-pass-fulldeps/switch-stdout.rs
@@ -10,12 +10,12 @@
 
 #![feature(rustc_private)]
 
-extern crate rustc_back;
+extern crate tempdir;
 
 use std::fs::File;
 use std::io::{Read, Write};
 
-use rustc_back::tempdir::TempDir;
+use tempdir::TempDir;
 
 #[cfg(unix)]
 fn switch_stdout_to(file: File) {