about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-16 20:56:45 -0800
committerbors <bors@rust-lang.org>2014-01-16 20:56:45 -0800
commit5fdc81262a5d44f10e335384b5d69b938d6d729c (patch)
tree164cd2c9f73ba67261af1f3f172ab7b131758d08
parent58a15f3d5a2213d37bbf653e4562c36a130f14ee (diff)
parentb33d2fede8ecebf3771fbe6863ec2220f507613c (diff)
downloadrust-5fdc81262a5d44f10e335384b5d69b938d6d729c.tar.gz
rust-5fdc81262a5d44f10e335384b5d69b938d6d729c.zip
auto merge of #11553 : klutzy/rust/rustc-cleanups, r=alexcrichton
-rw-r--r--src/librustc/back/link.rs2
-rw-r--r--src/librustc/back/rpath.rs4
-rw-r--r--src/librustc/driver/driver.rs54
-rw-r--r--src/librustc/driver/session.rs19
-rw-r--r--src/librustc/lib.rs14
-rw-r--r--src/librustc/metadata/filesearch.rs203
-rw-r--r--src/librustc/metadata/loader.rs3
-rw-r--r--src/librustdoc/core.rs6
-rw-r--r--src/librustdoc/test.rs8
-rw-r--r--src/librustpkg/lib.rs6
-rw-r--r--src/librustpkg/util.rs6
-rw-r--r--src/libsyntax/ast.rs121
-rw-r--r--src/libsyntax/ast_util.rs36
-rw-r--r--src/libsyntax/parse/mod.rs2
14 files changed, 187 insertions, 297 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index ffb9cce033e..65195468ed3 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -1166,7 +1166,7 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
 fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
                             dylib: bool, tmpdir: &Path) {
     // Converts a library file-stem into a cc -l argument
-    fn unlib(config: @session::config, stem: &str) -> ~str {
+    fn unlib(config: @session::Config, stem: &str) -> ~str {
         if stem.starts_with("lib") &&
             config.os != abi::OsWin32 {
             stem.slice(3, stem.len()).to_owned()
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs
index ecf4dd95cec..43ecbccfd79 100644
--- a/src/librustc/back/rpath.rs
+++ b/src/librustc/back/rpath.rs
@@ -39,7 +39,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) -> ~[~str] {
 
     debug!("preparing the RPATH!");
 
-    let sysroot = sess.filesearch.sysroot();
+    let sysroot = sess.filesearch.sysroot;
     let output = out_filename;
     let libs = sess.cstore.get_used_crates(cstore::RequireDynamic);
     let libs = libs.move_iter().filter_map(|(_, l)| l.map(|p| p.clone())).collect();
@@ -55,7 +55,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) -> ~[~str] {
 
 fn get_sysroot_absolute_rt_lib(sess: session::Session) -> Path {
     let r = filesearch::relative_target_lib_path(sess.opts.target_triple);
-    let mut p = sess.filesearch.sysroot().join(&r);
+    let mut p = sess.filesearch.sysroot.join(&r);
     p.push(os::dll_filename("rustrt"));
     p
 }
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index ea75cdfea9a..b5dbf0e0c35 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -62,11 +62,11 @@ pub enum PpMode {
  */
 pub fn anon_src() -> @str { @"<anon>" }
 
-pub fn source_name(input: &input) -> @str {
+pub fn source_name(input: &Input) -> @str {
     match *input {
       // FIXME (#9639): This needs to handle non-utf8 paths
-      file_input(ref ifile) => ifile.as_str().unwrap().to_managed(),
-      str_input(_) => anon_src()
+      FileInput(ref ifile) => ifile.as_str().unwrap().to_managed(),
+      StrInput(_) => anon_src()
     }
 }
 
@@ -133,22 +133,22 @@ fn parse_cfgspecs(cfgspecs: ~[~str], demitter: @diagnostic::Emitter)
     }).collect::<ast::CrateConfig>()
 }
 
-pub enum input {
+pub enum Input {
     /// Load source from file
-    file_input(Path),
+    FileInput(Path),
     /// The string is the source
     // FIXME (#2319): Don't really want to box the source string
-    str_input(@str)
+    StrInput(@str)
 }
 
-pub fn phase_1_parse_input(sess: Session, cfg: ast::CrateConfig, input: &input)
+pub fn phase_1_parse_input(sess: Session, cfg: ast::CrateConfig, input: &Input)
     -> ast::Crate {
     time(sess.time_passes(), "parsing", (), |_| {
         match *input {
-            file_input(ref file) => {
+            FileInput(ref file) => {
                 parse::parse_crate_from_file(&(*file), cfg.clone(), sess.parse_sess)
             }
-            str_input(src) => {
+            StrInput(src) => {
                 parse::parse_crate_from_source_str(
                     anon_src(), src, cfg.clone(), sess.parse_sess)
             }
@@ -444,7 +444,7 @@ pub fn stop_after_phase_5(sess: Session) -> bool {
     return false;
 }
 
-fn write_out_deps(sess: Session, input: &input, outputs: &OutputFilenames, crate: &ast::Crate)
+fn write_out_deps(sess: Session, input: &Input, outputs: &OutputFilenames, crate: &ast::Crate)
 {
     let lm = link::build_link_meta(sess, crate.attrs, &outputs.obj_filename,
                                        &mut ::util::sha2::Sha256::new());
@@ -460,12 +460,12 @@ fn write_out_deps(sess: Session, input: &input, outputs: &OutputFilenames, crate
         (true, Some(ref filename)) => filename.clone(),
         // Use default filename: crate source filename with extension replaced by ".d"
         (true, None) => match *input {
-            file_input(ref input_path) => {
+            FileInput(ref input_path) => {
                 let filestem = input_path.filestem().expect("input file must have stem");
                 let filename = out_filenames[0].dir_path().join(filestem).with_extension("d");
                 filename
             },
-            str_input(..) => {
+            StrInput(..) => {
                 sess.warn("can not write --dep-info without a filename when compiling stdin.");
                 return;
             },
@@ -495,7 +495,7 @@ fn write_out_deps(sess: Session, input: &input, outputs: &OutputFilenames, crate
     }
 }
 
-pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
+pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &Input,
                      outdir: &Option<Path>, output: &Option<Path>) {
     // We need nested scopes here, because the intermediate results can keep
     // large chunks of memory alive and we want to free them as soon as
@@ -587,7 +587,7 @@ impl pprust::PpAnn for TypedAnnotation {
 
 pub fn pretty_print_input(sess: Session,
                           cfg: ast::CrateConfig,
-                          input: &input,
+                          input: &Input,
                           ppm: PpMode) {
     let crate = phase_1_parse_input(sess, cfg.clone(), input);
 
@@ -664,9 +664,9 @@ static architecture_abis : &'static [(&'static str, abi::Architecture)] = &'stat
 
     ("mips",   abi::Mips)];
 
-pub fn build_target_config(sopts: @session::options,
+pub fn build_target_config(sopts: @session::Options,
                            demitter: @diagnostic::Emitter)
-                           -> @session::config {
+                           -> @session::Config {
     let os = match get_os(sopts.target_triple) {
       Some(os) => os,
       None => early_error(demitter, "unknown operating system")
@@ -689,7 +689,7 @@ pub fn build_target_config(sopts: @session::options,
       abi::Arm => arm::get_target_strs(target_triple, os),
       abi::Mips => mips::get_target_strs(target_triple, os)
     };
-    let target_cfg = @session::config {
+    let target_cfg = @session::Config {
         os: os,
         arch: arch,
         target_strs: target_strs,
@@ -714,7 +714,7 @@ pub fn host_triple() -> ~str {
 pub fn build_session_options(binary: ~str,
                              matches: &getopts::Matches,
                              demitter: @diagnostic::Emitter)
-                             -> @session::options {
+                             -> @session::Options {
     let mut outputs = ~[];
     if matches.opt_present("rlib") {
         outputs.push(session::OutputRlib)
@@ -862,7 +862,7 @@ pub fn build_session_options(binary: ~str,
                        matches.opt_present("crate-name"),
                        matches.opt_present("crate-file-name"));
 
-    let sopts = @session::options {
+    let sopts = @session::Options {
         outputs: outputs,
         gc: gc,
         optimize: opt_level,
@@ -895,7 +895,7 @@ pub fn build_session_options(binary: ~str,
     return sopts;
 }
 
-pub fn build_session(sopts: @session::options, demitter: @diagnostic::Emitter)
+pub fn build_session(sopts: @session::Options, demitter: @diagnostic::Emitter)
                      -> Session {
     let codemap = @codemap::CodeMap::new();
     let diagnostic_handler =
@@ -905,7 +905,7 @@ pub fn build_session(sopts: @session::options, demitter: @diagnostic::Emitter)
     build_session_(sopts, codemap, demitter, span_diagnostic_handler)
 }
 
-pub fn build_session_(sopts: @session::options,
+pub fn build_session_(sopts: @session::Options,
                       cm: @codemap::CodeMap,
                       demitter: @diagnostic::Emitter,
                       span_diagnostic_handler: @diagnostic::SpanHandler)
@@ -914,7 +914,7 @@ pub fn build_session_(sopts: @session::options,
     let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler,
                                                     cm);
     let cstore = @CStore::new(token::get_ident_interner());
-    let filesearch = filesearch::mk_filesearch(
+    let filesearch = @filesearch::FileSearch::new(
         &sopts.maybe_sysroot,
         sopts.target_triple,
         sopts.addl_lib_search_paths);
@@ -1046,7 +1046,7 @@ pub struct OutputFilenames {
     obj_filename: Path
 }
 
-pub fn build_output_filenames(input: &input,
+pub fn build_output_filenames(input: &Input,
                               odir: &Option<Path>,
                               ofile: &Option<Path>,
                               attrs: &[ast::Attribute],
@@ -1074,15 +1074,15 @@ pub fn build_output_filenames(input: &input,
           let dirpath = match *odir {
               Some(ref d) => (*d).clone(),
               None => match *input {
-                  str_input(_) => os::getcwd(),
-                  file_input(ref ifile) => (*ifile).dir_path()
+                  StrInput(_) => os::getcwd(),
+                  FileInput(ref ifile) => (*ifile).dir_path()
               }
           };
 
           let mut stem = match *input {
               // FIXME (#9639): This needs to handle non-utf8 paths
-              file_input(ref ifile) => (*ifile).filestem_str().unwrap().to_managed(),
-              str_input(_) => @"rust_out"
+              FileInput(ref ifile) => (*ifile).filestem_str().unwrap().to_managed(),
+              StrInput(_) => @"rust_out"
           };
 
           // If a crateid is present, we use it as the link name
diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs
index abebfc614a8..ebd6c06e243 100644
--- a/src/librustc/driver/session.rs
+++ b/src/librustc/driver/session.rs
@@ -31,7 +31,7 @@ use syntax;
 use std::cell::{Cell, RefCell};
 use std::hashmap::{HashMap,HashSet};
 
-pub struct config {
+pub struct Config {
     os: abi::Os,
     arch: abi::Architecture,
     target_strs: target_strs::t,
@@ -134,7 +134,7 @@ pub enum OptLevel {
 }
 
 #[deriving(Clone)]
-pub struct options {
+pub struct Options {
     // The crate config requested for the session, which may be combined
     // with additional crate configurations during the compile process
     outputs: ~[OutputStyle],
@@ -176,11 +176,6 @@ pub struct options {
     print_metas: (bool, bool, bool),
 }
 
-pub struct crate_metadata {
-    name: ~str,
-    data: ~[u8]
-}
-
 // The type of entry function, so
 // users can have their own entry
 // functions that don't start a
@@ -201,8 +196,8 @@ pub enum OutputStyle {
 }
 
 pub struct Session_ {
-    targ_cfg: @config,
-    opts: @options,
+    targ_cfg: @Config,
+    opts: @Options,
     cstore: @metadata::cstore::CStore,
     parse_sess: @ParseSess,
     codemap: @codemap::CodeMap,
@@ -375,8 +370,8 @@ impl Session_ {
 }
 
 /// Some reasonable defaults
-pub fn basic_options() -> @options {
-    @options {
+pub fn basic_options() -> @Options {
+    @Options {
         outputs: ~[],
         gc: false,
         optimize: No,
@@ -413,7 +408,7 @@ pub fn expect<T:Clone>(sess: Session, opt: Option<T>, msg: || -> ~str) -> T {
     diagnostic::expect(sess.diagnostic(), opt, msg)
 }
 
-pub fn building_library(options: &options, crate: &ast::Crate) -> bool {
+pub fn building_library(options: &Options, crate: &ast::Crate) -> bool {
     if options.test { return false }
     for output in options.outputs.iter() {
         match *output {
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index dd1346e86e8..8e847238cff 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -255,9 +255,9 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
         let ifile = matches.free[0].as_slice();
         if "-" == ifile {
             let src = str::from_utf8_owned(io::stdin().read_to_end());
-            d::str_input(src.to_managed())
+            d::StrInput(src.to_managed())
         } else {
-            d::file_input(Path::new(ifile))
+            d::FileInput(Path::new(ifile))
         }
       }
       _ => d::early_error(demitter, "multiple input filenames provided")
@@ -281,12 +281,12 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
     let ls = matches.opt_present("ls");
     if ls {
         match input {
-          d::file_input(ref ifile) => {
+          d::FileInput(ref ifile) => {
             let mut stdout = io::stdout();
             d::list_metadata(sess, &(*ifile),
                                   &mut stdout as &mut io::Writer);
           }
-          d::str_input(_) => {
+          d::StrInput(_) => {
             d::early_error(demitter, "can not list metadata for stdin");
           }
         }
@@ -332,12 +332,12 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
 }
 
 fn parse_crate_attrs(sess: session::Session,
-                     input: &d::input) -> ~[ast::Attribute] {
+                     input: &d::Input) -> ~[ast::Attribute] {
     match *input {
-        d::file_input(ref ifile) => {
+        d::FileInput(ref ifile) => {
             parse::parse_crate_attrs_from_file(ifile, ~[], sess.parse_sess)
         }
-        d::str_input(src) => {
+        d::StrInput(src) => {
             parse::parse_crate_attrs_from_source_str(
                 d::anon_src(), src, ~[], sess.parse_sess)
         }
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index 93d8249336b..f8e7a28d277 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -25,132 +25,117 @@ pub enum FileMatch { FileMatches, FileDoesntMatch }
 /// a file found in that directory.
 pub type pick<'a> = 'a |path: &Path| -> FileMatch;
 
-pub fn pick_file(file: Path, path: &Path) -> Option<Path> {
-    if path.filename() == Some(file.as_vec()) {
-        Some(path.clone())
-    } else {
-        None
-    }
-}
-
-pub trait FileSearch {
-    fn sysroot(&self) -> @Path;
-    fn for_each_lib_search_path(&self, f: |&Path| -> FileMatch);
-    fn get_target_lib_path(&self) -> Path;
-    fn get_target_lib_file_path(&self, file: &Path) -> Path;
+pub struct FileSearch {
+    sysroot: @Path,
+    addl_lib_search_paths: @RefCell<HashSet<Path>>,
+    target_triple: ~str
 }
 
-pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
-                     target_triple: &str,
-                     addl_lib_search_paths: @RefCell<HashSet<Path>>)
-                  -> @FileSearch {
-    struct FileSearchImpl {
-        sysroot: @Path,
-        addl_lib_search_paths: @RefCell<HashSet<Path>>,
-        target_triple: ~str
-    }
-    impl FileSearch for FileSearchImpl {
-        fn sysroot(&self) -> @Path { self.sysroot }
-
-        fn for_each_lib_search_path(&self, f: |&Path| -> FileMatch) {
-            let mut visited_dirs = HashSet::new();
-            let mut found = false;
-
-            let addl_lib_search_paths = self.addl_lib_search_paths.borrow();
-            debug!("filesearch: searching additional lib search paths [{:?}]",
-                   addl_lib_search_paths.get().len());
-            for path in addl_lib_search_paths.get().iter() {
-                match f(path) {
-                    FileMatches => found = true,
-                    FileDoesntMatch => ()
-                }
-                visited_dirs.insert(path.as_vec().to_owned());
+impl FileSearch {
+    pub fn for_each_lib_search_path(&self, f: |&Path| -> FileMatch) {
+        let mut visited_dirs = HashSet::new();
+        let mut found = false;
+
+        let addl_lib_search_paths = self.addl_lib_search_paths.borrow();
+        debug!("filesearch: searching additional lib search paths [{:?}]",
+               addl_lib_search_paths.get().len());
+        for path in addl_lib_search_paths.get().iter() {
+            match f(path) {
+                FileMatches => found = true,
+                FileDoesntMatch => ()
             }
+            visited_dirs.insert(path.as_vec().to_owned());
+        }
 
-            debug!("filesearch: searching target lib path");
-            let tlib_path = make_target_lib_path(self.sysroot,
-                                        self.target_triple);
-            if !visited_dirs.contains_equiv(&tlib_path.as_vec()) {
-                match f(&tlib_path) {
-                    FileMatches => found = true,
-                    FileDoesntMatch => ()
-                }
+        debug!("filesearch: searching target lib path");
+        let tlib_path = make_target_lib_path(self.sysroot,
+                                    self.target_triple);
+        if !visited_dirs.contains_equiv(&tlib_path.as_vec()) {
+            match f(&tlib_path) {
+                FileMatches => found = true,
+                FileDoesntMatch => ()
             }
-            visited_dirs.insert(tlib_path.as_vec().to_owned());
-            // Try RUST_PATH
-            if !found {
-                let rustpath = rust_path();
-                for path in rustpath.iter() {
-                    let tlib_path = make_rustpkg_target_lib_path(path, self.target_triple);
-                    debug!("is {} in visited_dirs? {:?}", tlib_path.display(),
-                            visited_dirs.contains_equiv(&tlib_path.as_vec().to_owned()));
-
-                    if !visited_dirs.contains_equiv(&tlib_path.as_vec()) {
-                        visited_dirs.insert(tlib_path.as_vec().to_owned());
-                        // Don't keep searching the RUST_PATH if one match turns up --
-                        // if we did, we'd get a "multiple matching crates" error
-                        match f(&tlib_path) {
-                           FileMatches => {
-                               break;
-                           }
-                           FileDoesntMatch => ()
-                        }
+        }
+        visited_dirs.insert(tlib_path.as_vec().to_owned());
+        // Try RUST_PATH
+        if !found {
+            let rustpath = rust_path();
+            for path in rustpath.iter() {
+                let tlib_path = make_rustpkg_target_lib_path(path, self.target_triple);
+                debug!("is {} in visited_dirs? {:?}", tlib_path.display(),
+                        visited_dirs.contains_equiv(&tlib_path.as_vec().to_owned()));
+
+                if !visited_dirs.contains_equiv(&tlib_path.as_vec()) {
+                    visited_dirs.insert(tlib_path.as_vec().to_owned());
+                    // Don't keep searching the RUST_PATH if one match turns up --
+                    // if we did, we'd get a "multiple matching crates" error
+                    match f(&tlib_path) {
+                       FileMatches => {
+                           break;
+                       }
+                       FileDoesntMatch => ()
                     }
                 }
             }
         }
-        fn get_target_lib_path(&self) -> Path {
-            make_target_lib_path(self.sysroot, self.target_triple)
-        }
-        fn get_target_lib_file_path(&self, file: &Path) -> Path {
-            let mut p = self.get_target_lib_path();
-            p.push(file);
-            p
-        }
     }
 
-    let sysroot = get_sysroot(maybe_sysroot);
-    debug!("using sysroot = {}", sysroot.display());
-    @FileSearchImpl {
-        sysroot: sysroot,
-        addl_lib_search_paths: addl_lib_search_paths,
-        target_triple: target_triple.to_owned()
-    } as @FileSearch
-}
+    pub fn get_target_lib_path(&self) -> Path {
+        make_target_lib_path(self.sysroot, self.target_triple)
+    }
 
-pub fn search(filesearch: @FileSearch, pick: pick) {
-    filesearch.for_each_lib_search_path(|lib_search_path| {
-        debug!("searching {}", lib_search_path.display());
-        match io::result(|| fs::readdir(lib_search_path)) {
-            Ok(files) => {
-                let mut rslt = FileDoesntMatch;
-                let is_rlib = |p: & &Path| {
-                    p.extension_str() == Some("rlib")
-                };
-                // Reading metadata out of rlibs is faster, and if we find both
-                // an rlib and a dylib we only read one of the files of
-                // metadata, so in the name of speed, bring all rlib files to
-                // the front of the search list.
-                let files1 = files.iter().filter(|p| is_rlib(p));
-                let files2 = files.iter().filter(|p| !is_rlib(p));
-                for path in files1.chain(files2) {
-                    debug!("testing {}", path.display());
-                    let maybe_picked = pick(path);
-                    match maybe_picked {
-                        FileMatches => {
-                            debug!("picked {}", path.display());
-                            rslt = FileMatches;
-                        }
-                        FileDoesntMatch => {
-                            debug!("rejected {}", path.display());
+    pub fn get_target_lib_file_path(&self, file: &Path) -> Path {
+        let mut p = self.get_target_lib_path();
+        p.push(file);
+        p
+    }
+
+    pub fn search(&self, pick: pick) {
+        self.for_each_lib_search_path(|lib_search_path| {
+            debug!("searching {}", lib_search_path.display());
+            match io::result(|| fs::readdir(lib_search_path)) {
+                Ok(files) => {
+                    let mut rslt = FileDoesntMatch;
+                    let is_rlib = |p: & &Path| {
+                        p.extension_str() == Some("rlib")
+                    };
+                    // Reading metadata out of rlibs is faster, and if we find both
+                    // an rlib and a dylib we only read one of the files of
+                    // metadata, so in the name of speed, bring all rlib files to
+                    // the front of the search list.
+                    let files1 = files.iter().filter(|p| is_rlib(p));
+                    let files2 = files.iter().filter(|p| !is_rlib(p));
+                    for path in files1.chain(files2) {
+                        debug!("testing {}", path.display());
+                        let maybe_picked = pick(path);
+                        match maybe_picked {
+                            FileMatches => {
+                                debug!("picked {}", path.display());
+                                rslt = FileMatches;
+                            }
+                            FileDoesntMatch => {
+                                debug!("rejected {}", path.display());
+                            }
                         }
                     }
+                    rslt
                 }
-                rslt
+                Err(..) => FileDoesntMatch,
             }
-            Err(..) => FileDoesntMatch,
+        });
+    }
+
+    pub fn new(maybe_sysroot: &Option<@Path>,
+               target_triple: &str,
+               addl_lib_search_paths: @RefCell<HashSet<Path>>) -> FileSearch {
+        let sysroot = get_sysroot(maybe_sysroot);
+        debug!("using sysroot = {}", sysroot.display());
+        FileSearch{
+            sysroot: sysroot,
+            addl_lib_search_paths: addl_lib_search_paths,
+            target_triple: target_triple.to_owned()
         }
-    });
+    }
 }
 
 pub fn relative_target_lib_path(target_triple: &str) -> Path {
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index 12bfcb4b198..72f2e1baddd 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -17,7 +17,6 @@ use metadata::cstore::{MetadataBlob, MetadataVec, MetadataArchive};
 use metadata::decoder;
 use metadata::encoder;
 use metadata::filesearch::{FileMatches, FileDoesntMatch};
-use metadata::filesearch;
 use syntax::codemap::Span;
 use syntax::diagnostic::SpanHandler;
 use syntax::parse::token::IdentInterner;
@@ -89,7 +88,7 @@ impl Context {
         let rlib_prefix = format!("lib{}-", crate_name);
 
         let mut matches = ~[];
-        filesearch::search(filesearch, |path| {
+        filesearch.search(|path| {
             match path.filename_str() {
                 None => FileDoesntMatch,
                 Some(file) => {
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index e2205e12986..8501a01d34b 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -42,15 +42,15 @@ pub struct CrateAnalysis {
 fn get_ast_and_resolve(cpath: &Path,
                        libs: HashSet<Path>, cfgs: ~[~str]) -> (DocContext, CrateAnalysis) {
     use syntax::codemap::dummy_spanned;
-    use rustc::driver::driver::{file_input, build_configuration,
+    use rustc::driver::driver::{FileInput, build_configuration,
                                 phase_1_parse_input,
                                 phase_2_configure_and_expand,
                                 phase_3_run_analysis_passes};
 
     let parsesess = parse::new_parse_sess(None);
-    let input = file_input(cpath.clone());
+    let input = FileInput(cpath.clone());
 
-    let sessopts = @driver::session::options {
+    let sessopts = @driver::session::Options {
         binary: ~"rustdoc",
         maybe_sysroot: Some(@os::self_exe_path().unwrap().dir_path()),
         addl_lib_search_paths: @RefCell::new(libs),
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index ffc8388ee90..53a1e5697ef 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -34,11 +34,11 @@ use visit_ast::RustdocVisitor;
 
 pub fn run(input: &str, matches: &getopts::Matches) -> int {
     let parsesess = parse::new_parse_sess(None);
-    let input = driver::file_input(Path::new(input));
+    let input = driver::FileInput(Path::new(input));
     let libs = matches.opt_strs("L").map(|s| Path::new(s.as_slice()));
     let libs = @RefCell::new(libs.move_iter().collect());
 
-    let sessopts = @session::options {
+    let sessopts = @session::Options {
         binary: ~"rustdoc",
         maybe_sysroot: Some(@os::self_exe_path().unwrap().dir_path()),
         addl_lib_search_paths: libs,
@@ -97,9 +97,9 @@ pub fn run(input: &str, matches: &getopts::Matches) -> int {
 fn runtest(test: &str, cratename: &str, libs: HashSet<Path>) {
     let test = maketest(test, cratename);
     let parsesess = parse::new_parse_sess(None);
-    let input = driver::str_input(test);
+    let input = driver::StrInput(test);
 
-    let sessopts = @session::options {
+    let sessopts = @session::Options {
         binary: ~"rustdoctest",
         maybe_sysroot: Some(@os::self_exe_path().unwrap().dir_path()),
         addl_lib_search_paths: @RefCell::new(libs),
diff --git a/src/librustpkg/lib.rs b/src/librustpkg/lib.rs
index ab6f87c5a9d..ac94c477e78 100644
--- a/src/librustpkg/lib.rs
+++ b/src/librustpkg/lib.rs
@@ -107,13 +107,13 @@ impl<'a> PkgScript<'a> {
         // Build the rustc session data structures to pass
         // to the compiler
         debug!("pkgscript parse: {}", sysroot.display());
-        let options = @session::options {
+        let options = @session::Options {
             binary: binary,
             maybe_sysroot: Some(@sysroot),
             outputs: ~[session::OutputExecutable],
             .. (*session::basic_options()).clone()
         };
-        let input = driver::file_input(script.clone());
+        let input = driver::FileInput(script.clone());
         let sess = driver::build_session(options,
                                          @diagnostic::DefaultEmitter as
                                             @diagnostic::Emitter);
@@ -146,7 +146,7 @@ impl<'a> PkgScript<'a> {
         let (crate, ast_map) = self.crate_and_map.take_unwrap();
         let crate = util::ready_crate(sess, crate);
         debug!("Building output filenames with script name {}",
-               driver::source_name(&driver::file_input(self.input.clone())));
+               driver::source_name(&driver::FileInput(self.input.clone())));
         let exe = self.build_dir.join("pkg" + util::exe_suffix());
         util::compile_crate_from_input(&self.input,
                                        exec,
diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs
index e5308537250..4d8f5c668b7 100644
--- a/src/librustpkg/util.rs
+++ b/src/librustpkg/util.rs
@@ -171,7 +171,7 @@ pub fn compile_input(context: &BuildContext,
                      opt: session::OptLevel,
                      what: OutputType) -> Option<Path> {
     assert!(in_file.components().nth(1).is_some());
-    let input = driver::file_input(in_file.clone());
+    let input = driver::FileInput(in_file.clone());
     debug!("compile_input: {} / {:?}", in_file.display(), what);
     // tjc: by default, use the package ID name as the link name
     // not sure if we should support anything else
@@ -228,7 +228,7 @@ pub fn compile_input(context: &BuildContext,
 
     debug!("Output type = {:?}", output_type);
 
-    let options = @session::options {
+    let options = @session::Options {
         optimize: opt,
         test: what == Test || what == Bench,
         maybe_sysroot: Some(sysroot_to_use),
@@ -373,7 +373,7 @@ pub fn compile_crate_from_input(input: &Path,
 
     // bad copy
     debug!("out_dir = {}", out_dir.display());
-    let file_input = driver::file_input(input.clone());
+    let file_input = driver::FileInput(input.clone());
     let mut outputs = driver::build_output_filenames(&file_input,
                                                      &Some(out_dir.clone()), &None,
                                                      crate.attrs, sess);
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 889a67333a0..800172daf15 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1195,123 +1195,32 @@ pub enum InlinedItem {
 
 #[cfg(test)]
 mod test {
+    use extra;
+    use codemap::*;
     use super::*;
 
     fn is_freeze<T: Freeze>() {}
 
     // Assert that the AST remains Freeze (#10693).
-    #[test] fn ast_is_freeze() {
+    #[test]
+    fn ast_is_freeze() {
         is_freeze::<Item>();
     }
-}
-
-/* hold off on tests ... they appear in a later merge.
-#[cfg(test)]
-mod test {
-    use std::option::{None, Option, Some};
-    use std::uint;
-    use extra;
-    use codemap::*;
-    use super::*;
-
-
-    #[test] fn xorpush_test () {
-        let mut s = ~[];
-        xorPush(&mut s,14);
-        assert_eq!(s,~[14]);
-        xorPush(&mut s,14);
-        assert_eq!(s,~[]);
-        xorPush(&mut s,14);
-        assert_eq!(s,~[14]);
-        xorPush(&mut s,15);
-        assert_eq!(s,~[14,15]);
-        xorPush (&mut s,16);
-        assert_eq! (s,~[14,15,16]);
-        xorPush (&mut s,16);
-        assert_eq! (s,~[14,15]);
-        xorPush (&mut s,15);
-        assert_eq! (s,~[14]);
-    }
-
-    #[test] fn test_marksof () {
-        let stopname = uints_to_name(&~[12,14,78]);
-        assert_eq!(s,~[]);
-        xorPush(&mut s,14);
-        assert_eq!(s,~[14]);
-        xorPush(&mut s,15);
-        assert_eq!(s,~[14,15]);
-        xorPush (&mut s,16);
-        assert_eq! (s,~[14,15,16]);
-        xorPush (&mut s,16);
-        assert_eq! (s,~[14,15]);
-        xorPush (&mut s,15);
-        assert_eq! (s,~[14]);
-    }
-
-    #[test] fn test_marksof () {
-        let stopname = uints_to_name(&~[12,14,78]);
-        let name1 = uints_to_name(&~[4,9,7]);
-        assert_eq!(marksof (MT,stopname),~[]);
-        assert_eq! (marksof (Mark (4,@Mark(98,@MT)),stopname),~[4,98]);
-        // does xoring work?
-        assert_eq! (marksof (Mark (5, @Mark (5, @Mark (16,@MT))),stopname),
-                     ~[16]);
-        // does nested xoring work?
-        assert_eq! (marksof (Mark (5,
-                                    @Mark (10,
-                                           @Mark (10,
-                                                  @Mark (5,
-                                                         @Mark (16,@MT))))),
-                              stopname),
-                     ~[16]);
-        // stop has no effect on marks
-        assert_eq! (marksof (Mark (9, @Mark (14, @Mark (12, @MT))),stopname),
-                     ~[9,14,12]);
-        // rename where stop doesn't match:
-        assert_eq! (marksof (Mark (9, @Rename
-                                    (name1,
-                                     @Mark (4, @MT),
-                                     uints_to_name(&~[100,101,102]),
-                                     @Mark (14, @MT))),
-                              stopname),
-                     ~[9,14]);
-        // rename where stop does match
-        ;
-        assert_eq! (marksof (Mark(9, @Rename (name1,
-                                               @Mark (4, @MT),
-                                               stopname,
-                                               @Mark (14, @MT))),
-                              stopname),
-                     ~[9]);
-    }
 
     // are ASTs encodable?
-    #[test] fn check_asts_encodable() {
-        let bogus_span = span {lo:BytePos(10),
-                               hi:BytePos(20),
-                               expn_info:None};
-        let e : crate =
-            spanned{
-            node: crate_{
-                module: Mod {view_items: ~[], items: ~[]},
-                attrs: ~[],
-                config: ~[]
+    #[test]
+    fn check_asts_encodable() {
+        let e = Crate {
+            module: Mod {view_items: ~[], items: ~[]},
+            attrs: ~[],
+            config: ~[],
+            span: Span {
+                lo: BytePos(10),
+                hi: BytePos(20),
+                expn_info: None,
             },
-            span: bogus_span};
+        };
         // doesn't matter which encoder we use....
         let _f = (@e as @extra::serialize::Encodable<extra::json::Encoder>);
     }
-
-
 }
-
-*/
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 3e0caab65c2..89aa03a46ba 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -872,9 +872,11 @@ pub fn marksof(ctxt: SyntaxContext, stopname: Name, table: &SCTable) -> ~[Mrk] {
             table.get()[loopvar]
         };
         match table_entry {
-            EmptyCtxt => {return result;},
-            Mark(mark,tl) => {
-                xorPush(&mut result,mark);
+            EmptyCtxt => {
+                return result;
+            },
+            Mark(mark, tl) => {
+                xorPush(&mut result, mark);
                 loopvar = tl;
             },
             Rename(_,name,tl) => {
@@ -980,20 +982,20 @@ mod test {
 
     #[test] fn xorpush_test () {
         let mut s = ~[];
-        xorPush(&mut s,14);
-        assert_eq!(s.clone(),~[14]);
-        xorPush(&mut s,14);
-        assert_eq!(s.clone(),~[]);
-        xorPush(&mut s,14);
-        assert_eq!(s.clone(),~[14]);
-        xorPush(&mut s,15);
-        assert_eq!(s.clone(),~[14,15]);
-        xorPush (&mut s,16);
-        assert_eq!(s.clone(),~[14,15,16]);
-        xorPush (&mut s,16);
-        assert_eq!(s.clone(),~[14,15]);
-        xorPush (&mut s,15);
-        assert_eq!(s.clone(),~[14]);
+        xorPush(&mut s, 14);
+        assert_eq!(s.clone(), ~[14]);
+        xorPush(&mut s, 14);
+        assert_eq!(s.clone(), ~[]);
+        xorPush(&mut s, 14);
+        assert_eq!(s.clone(), ~[14]);
+        xorPush(&mut s, 15);
+        assert_eq!(s.clone(), ~[14, 15]);
+        xorPush(&mut s, 16);
+        assert_eq!(s.clone(), ~[14, 15, 16]);
+        xorPush(&mut s, 16);
+        assert_eq!(s.clone(), ~[14, 15]);
+        xorPush(&mut s, 15);
+        assert_eq!(s.clone(), ~[14]);
     }
 
     fn id(n: Name, s: SyntaxContext) -> Ident {
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index c278fb2fc51..78328efdd0b 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -418,7 +418,7 @@ mod test {
 
     #[test] fn string_to_tts_1 () {
         let tts = string_to_tts(@"fn a (b : int) { b; }");
-        assert_eq!(to_json_str(@tts),
+        assert_eq!(to_json_str(&tts),
         ~"[\
     {\
         \"variant\":\"TTTok\",\