From 84ce55e5427d0d36dbf6e330537175ab4162b6f2 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 27 Dec 2012 15:49:26 -0800 Subject: [PATCH] librustc: Fix some unresolved imports in the test runner. rs=bustage --- src/librustc/back/rpath.rs | 11 ++++++++++- src/librustc/driver/driver.rs | 5 +++++ src/librustc/driver/session.rs | 1 + src/librustc/front/test.rs | 2 +- src/librustc/middle/astencode.rs | 7 ++++--- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index 04c653d4a13..adb0b659b14 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -114,7 +114,10 @@ fn get_rpaths_relative_to_output(os: session::os, fn get_rpath_relative_to_output(os: session::os, output: &Path, - lib: &Path) -> Path { + lib: &Path) + -> Path { + use core::os; + assert not_win32(os); // Mac doesn't appear to support $ORIGIN @@ -197,6 +200,12 @@ fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] { #[cfg(unix)] mod test { #[legacy_exports]; + + use driver::session; + + use core::os; + use core::str; + #[test] fn test_rpaths_to_flags() { let flags = rpaths_to_flags(~[Path("path1"), diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 12cf35d2633..db15a572082 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -828,6 +828,11 @@ fn list_metadata(sess: Session, path: &Path, out: io::Writer) { mod test { #[legacy_exports]; + use core::vec; + use std::getopts; + use syntax::attr; + use syntax::diagnostic; + // When the user supplies --test we should implicitly supply --cfg test #[test] fn test_switch_implies_cfg_test() { diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 58391bbbdd4..8ea5052afaf 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -332,6 +332,7 @@ fn sess_os_to_meta_os(os: os) -> metadata::loader::os { #[cfg(test)] mod test { #[legacy_exports]; + use syntax::ast; use syntax::ast_util; fn make_crate_type_attr(t: ~str) -> ast::attribute { diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index a699b91f444..834b45f4944 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -238,7 +238,7 @@ fn nospan(t: T) -> ast::spanned { } fn path_node(ids: ~[ast::ident]) -> @ast::path { - @{span: dummy_sp(), global: false, idents: ids, rp: None, types: ~[]} + @{span: dummy_sp(), global: true, idents: ids, rp: None, types: ~[]} } fn mk_tests(cx: test_ctxt) -> @ast::item { diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 815b91f6e7c..3a308011e75 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -23,12 +23,13 @@ use middle; use util::ppaux::ty_to_str; -use core::{dvec, option, vec}; +use core::{dvec, io, option, vec}; use std::ebml::reader::get_doc; use std::ebml::reader; use std::ebml::writer::Encoder; use std::ebml; use std::map::HashMap; +use std::prettyprint; use std::serialize; use std::serialize::{Encodable, EncoderHelpers, DecoderHelpers}; use std::serialize::Decodable; @@ -1071,10 +1072,10 @@ fn roundtrip(in_item: Option<@ast::item>) { let out_item = decode_item_ast(ebml_doc); let exp_str = do io::with_str_writer |w| { - in_item.encode(&std::prettyprint::Encoder(w)) + in_item.encode(&prettyprint::Serializer(w)) }; let out_str = do io::with_str_writer |w| { - out_item.encode(&std::prettyprint::Encoder(w)) + out_item.encode(&prettyprint::Serializer(w)) }; debug!("expected string: %s", exp_str);