From 8749cb59d8efd6634617cae0b586efcf03373c25 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 27 May 2013 18:02:15 -0500 Subject: [PATCH 1/2] Fix 'make check-stage1-std' by correcting dependencies --- mk/tests.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/tests.mk b/mk/tests.mk index 6e84aa49a88ed..8f7e6529a23ce 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -284,7 +284,7 @@ define TEST_RUNNER # If NO_REBUILD is set then break the dependencies on extra so we can # test crates without rebuilding std and extra first ifeq ($(NO_REBUILD),) -STDTESTDEP_$(1)_$(2)_$(3) = $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2)) +STDTESTDEP_$(1)_$(2)_$(3) = $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_EXTRALIB_$(2)) else STDTESTDEP_$(1)_$(2)_$(3) = endif From b04c40bb1c96202409f663480076977619a1da30 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 27 May 2013 18:04:00 -0500 Subject: [PATCH 2/2] Silence various warnings throughout test modules --- src/libextra/arc.rs | 1 - src/libextra/bitv.rs | 2 +- src/libextra/flatpipes.rs | 4 +- src/libextra/json.rs | 14 ++-- src/libextra/net_ip.rs | 1 - src/libextra/sha1.rs | 2 +- src/libextra/sort.rs | 2 - src/libextra/sync.rs | 1 - src/libextra/tempfile.rs | 1 - src/libextra/time.rs | 4 +- src/libextra/uv_global_loop.rs | 6 +- src/libfuzzer/fuzzer.rc | 4 +- src/librustc/back/rpath.rs | 22 ++++--- src/librustc/driver/driver.rs | 4 +- src/librustc/driver/session.rs | 4 +- src/librustc/lib/llvm.rs | 2 +- src/librustc/middle/trans/shape.rs | 2 +- src/librustc/middle/ty.rs | 1 - src/librustc/rustc.rc | 2 +- src/librustdoc/attr_parser.rs | 1 - src/librustdoc/desc_to_brief_pass.rs | 4 +- src/librustdoc/markdown_pass.rs | 8 +-- src/librustdoc/markdown_writer.rs | 4 +- src/librustdoc/page_pass.rs | 2 +- src/librustdoc/pass.rs | 4 +- src/librustdoc/sectionalize_pass.rs | 8 +-- src/librusti/rusti.rc | 12 ++-- src/librustpkg/tests.rs | 20 +++--- src/librustpkg/util.rs | 18 +++--- src/libstd/at_vec.rs | 2 +- src/libstd/hash.rs | 2 +- src/libstd/logging.rs | 6 +- src/libstd/num/int_macros.rs | 96 ++++++++++++++-------------- src/libstd/num/uint_macros.rs | 64 +++++++++---------- src/libstd/os.rs | 4 +- src/libstd/ptr.rs | 4 +- src/libstd/str.rs | 2 +- 37 files changed, 168 insertions(+), 172 deletions(-) diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index 319fb83d3f833..4baa1168b3b4c 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -510,7 +510,6 @@ mod tests { use core::prelude::*; use core::cell::Cell; use arc::*; - use arc; #[test] fn manually_share_arc() { diff --git a/src/libextra/bitv.rs b/src/libextra/bitv.rs index 8aac20d7a6356..1a6e42d2fbba9 100644 --- a/src/libextra/bitv.rs +++ b/src/libextra/bitv.rs @@ -1197,7 +1197,7 @@ mod tests { #[test] fn test_from_bytes() { let bitv = from_bytes([0b10110110, 0b00000000, 0b11111111]); - let str = ~"10110110" + ~"00000000" + ~"11111111"; + let str = ~"10110110" + "00000000" + "11111111"; assert_eq!(bitv.to_str(), str); } diff --git a/src/libextra/flatpipes.rs b/src/libextra/flatpipes.rs index ed9614285e9a3..8cb94abcd38c0 100644 --- a/src/libextra/flatpipes.rs +++ b/src/libextra/flatpipes.rs @@ -927,7 +927,7 @@ mod test { fn test_try_recv_none3(loader: PortLoader

) { static CONTINUE: [u8, ..4] = [0xAA, 0xBB, 0xCC, 0xDD]; // The control word is followed by garbage - let bytes = CONTINUE.to_vec() + ~[0]; + let bytes = CONTINUE.to_vec() + [0]; let port = loader(bytes); let res: Option = port.try_recv(); assert!(res.is_none()); @@ -951,7 +951,7 @@ mod test { 1, sys::size_of::()) |len_bytes| { len_bytes.to_vec() }; - let bytes = CONTINUE.to_vec() + len_bytes + ~[0, 0, 0, 0]; + let bytes = CONTINUE.to_vec() + len_bytes + [0, 0, 0, 0]; let port = loader(bytes); diff --git a/src/libextra/json.rs b/src/libextra/json.rs index adf2c4f35b51e..15823d6806249 100644 --- a/src/libextra/json.rs +++ b/src/libextra/json.rs @@ -1880,13 +1880,13 @@ mod tests { ])); assert_eq!(result::unwrap(from_str( ~"{" + - ~"\"a\": 1.0, " + - ~"\"b\": [" + - ~"true," + - ~"\"foo\\nbar\", " + - ~"{ \"c\": {\"d\": null} } " + - ~"]" + - ~"}")), + "\"a\": 1.0, " + + "\"b\": [" + + "true," + + "\"foo\\nbar\", " + + "{ \"c\": {\"d\": null} } " + + "]" + + "}")), mk_object([ (~"a", Number(1.0f)), (~"b", List(~[ diff --git a/src/libextra/net_ip.rs b/src/libextra/net_ip.rs index 70a8c3fb0cb8a..a9c8540a83cc9 100644 --- a/src/libextra/net_ip.rs +++ b/src/libextra/net_ip.rs @@ -375,7 +375,6 @@ mod test { use uv; use core::result; - use core::vec; #[test] fn test_ip_ipv4_parse_and_format_ip() { diff --git a/src/libextra/sha1.rs b/src/libextra/sha1.rs index 7b38c031774d1..e970d34ff9153 100644 --- a/src/libextra/sha1.rs +++ b/src/libextra/sha1.rs @@ -317,7 +317,7 @@ mod tests { Test { input: ~"abcdbcdecdefdefgefghfghighij" + - ~"hijkijkljklmklmnlmnomnopnopq", + "hijkijkljklmklmnlmnomnopnopq", output: ~[ 0x84u8, 0x98u8, 0x3Eu8, 0x44u8, 0x1Cu8, 0x3Bu8, 0xD2u8, 0x6Eu8, diff --git a/src/libextra/sort.rs b/src/libextra/sort.rs index c56a02e03800a..3039fa46f0623 100644 --- a/src/libextra/sort.rs +++ b/src/libextra/sort.rs @@ -746,8 +746,6 @@ fn shift_vec(dest: &mut [T], #[cfg(test)] mod test_qsort3 { - use core::prelude::*; - use sort::*; use core::vec; diff --git a/src/libextra/sync.rs b/src/libextra/sync.rs index 5768b015ab11f..48f34fdf46a70 100644 --- a/src/libextra/sync.rs +++ b/src/libextra/sync.rs @@ -720,7 +720,6 @@ mod tests { use core::cast; use core::cell::Cell; - use core::ptr; use core::result; use core::task; use core::vec; diff --git a/src/libextra/tempfile.rs b/src/libextra/tempfile.rs index be9b920c592bf..7f073d0decb0a 100644 --- a/src/libextra/tempfile.rs +++ b/src/libextra/tempfile.rs @@ -30,7 +30,6 @@ mod tests { use core::prelude::*; use tempfile::mkdtemp; - use tempfile; use core::os; #[test] diff --git a/src/libextra/time.rs b/src/libextra/time.rs index eb7955bfa8b62..d5a8cd78249bf 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -1205,8 +1205,8 @@ mod tests { // abbreviation. let rfc822 = local.rfc822(); let prefix = ~"Fri, 13 Feb 2009 15:31:30 "; - assert!(rfc822 == prefix + ~"PST" || - rfc822 == prefix + ~"Pacific Standard Time"); + assert!(rfc822 == prefix + "PST" || + rfc822 == prefix + "Pacific Standard Time"); assert_eq!(local.ctime(), ~"Fri Feb 13 15:31:30 2009"); assert_eq!(local.rfc822z(), ~"Fri, 13 Feb 2009 15:31:30 -0800"); diff --git a/src/libextra/uv_global_loop.rs b/src/libextra/uv_global_loop.rs index e067f22d63832..ae59f91cf83d2 100644 --- a/src/libextra/uv_global_loop.rs +++ b/src/libextra/uv_global_loop.rs @@ -126,9 +126,7 @@ mod test { use uv::ll; use uv_iotask::IoTask; - use core::old_iter; use core::libc; - use core::ptr; use core::task; use core::cast::transmute; use core::libc::c_void; @@ -228,7 +226,7 @@ mod test { for cycles.times { exit_po.recv(); }; - debug!(~"test_stress_gl_uv_global_loop_high_level_global_timer"+ - ~" exiting successfully!"); + debug!("test_stress_gl_uv_global_loop_high_level_global_timer \ + exiting successfully!"); } } diff --git a/src/libfuzzer/fuzzer.rc b/src/libfuzzer/fuzzer.rc index 90a93a9e57cc1..0107517ff3f3d 100644 --- a/src/libfuzzer/fuzzer.rc +++ b/src/libfuzzer/fuzzer.rc @@ -139,7 +139,7 @@ pub fn stash_expr_if(c: @fn(@ast::expr, test_mode)->bool, e: @ast::expr, tm: test_mode) { if c(e, tm) { - *es = *es + ~[e]; + *es = *es + [e]; } else { /* now my indices are wrong :( */ } @@ -425,7 +425,7 @@ pub fn check_running(exe_filename: &Path) -> happiness { let p = run::process_output( "/Users/jruderman/scripts/timed_run_rust_program.py", [exe_filename.to_str()]); - let comb = str::from_bytes(p.output) + ~"\n" + str::from_bytes(p.error); + let comb = str::from_bytes(p.output) + "\n" + str::from_bytes(p.error); if str::len(comb) > 1u { error!("comb comb comb: %?", comb); } diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index 24be917aedc9f..8695d0c79efc0 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -171,6 +171,7 @@ pub fn get_absolute_rpath(lib: &Path) -> Path { os::make_absolute(lib).dir_path() } +#[cfg(stage0)] pub fn get_install_prefix_rpath(target_triple: &str) -> Path { let install_prefix = env!("CFG_PREFIX"); @@ -182,6 +183,18 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> Path { os::make_absolute(&Path(install_prefix).push_rel(&tlib)) } +#[cfg(not(stage0))] +pub fn get_install_prefix_rpath(target_triple: &str) -> Path { + let install_prefix = env!("CFG_PREFIX"); + + if install_prefix == "" { + fail!("rustc compiled without CFG_PREFIX environment variable"); + } + + let tlib = filesearch::relative_target_lib_path(target_triple); + os::make_absolute(&Path(install_prefix).push_rel(&tlib)) +} + pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] { let mut set = HashSet::new(); let mut minimized = ~[]; @@ -193,20 +206,13 @@ pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] { minimized } -#[cfg(unix)] +#[cfg(unix, test)] mod test { use core::prelude::*; - // FIXME(#2119): the outer attribute should be #[cfg(unix, test)], then - // these redundant #[cfg(test)] blocks can be removed - #[cfg(test)] - #[cfg(test)] use back::rpath::{get_absolute_rpath, get_install_prefix_rpath}; - #[cfg(test)] use back::rpath::{get_relative_to, get_rpath_relative_to_output}; - #[cfg(test)] use back::rpath::{minimize_rpaths, rpaths_to_flags}; - #[cfg(test)] use driver::session; #[test] diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 75731cf4dc62d..64d3b0e373cfd 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -641,7 +641,7 @@ pub fn build_session_options(binary: @~str, ~"3" => Aggressive, _ => { early_error(demitter, ~"optimization level needs " + - ~"to be between 0-3") + "to be between 0-3") } } } else { No } @@ -934,7 +934,7 @@ mod test { #[test] fn test_switch_implies_cfg_test() { let matches = - &match getopts(~[~"--test"], optgroups()) { + &match getopts([~"--test"], optgroups()) { Ok(copy m) => m, Err(copy f) => fail!("test_switch_implies_cfg_test: %s", getopts::fail_str(f)) }; diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 788be3a3f2799..ae49446c5b354 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -384,8 +384,8 @@ mod test { fn make_crate(with_bin: bool, with_lib: bool) -> @ast::crate { let mut attrs = ~[]; - if with_bin { attrs += ~[make_crate_type_attr(~"bin")]; } - if with_lib { attrs += ~[make_crate_type_attr(~"lib")]; } + if with_bin { attrs += [make_crate_type_attr(~"bin")]; } + if with_lib { attrs += [make_crate_type_attr(~"lib")]; } @codemap::respan(codemap::dummy_sp(), ast::crate_ { module: ast::_mod { view_items: ~[], items: ~[] }, attrs: attrs, diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index ac675df3399e5..7a1a3cf77aa18 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -1980,7 +1980,7 @@ pub fn type_to_str_inner(names: @TypeNames, outer0: &[TypeRef], ty: TypeRef) let mut s = ~""; let mut first: bool = true; for tys.each |t| { - if first { first = false; } else { s += ~", "; } + if first { first = false; } else { s += ", "; } s += type_to_str_inner(names, outer, *t).to_owned(); } // [Note at-str] FIXME #2543: Could rewrite this without the copy, diff --git a/src/librustc/middle/trans/shape.rs b/src/librustc/middle/trans/shape.rs index ab40d41dfe939..6612122fd3e34 100644 --- a/src/librustc/middle/trans/shape.rs +++ b/src/librustc/middle/trans/shape.rs @@ -66,7 +66,7 @@ Although these two functions are never called, they are here for a VERY GOOD REASON. See #3670 */ pub fn add_u16(dest: &mut ~[u8], val: u16) { - *dest += ~[(val & 0xffu16) as u8, (val >> 8u16) as u8]; + *dest += [(val & 0xffu16) as u8, (val >> 8u16) as u8]; } pub fn add_substr(dest: &mut ~[u8], src: ~[u8]) { diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 8240155547263..e17fe63af764b 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -30,7 +30,6 @@ use util::enum_set::{EnumSet, CLike}; use core::ptr::to_unsafe_ptr; use core::to_bytes; use core::hashmap::{HashMap, HashSet}; -use extra::smallintmap::SmallIntMap; use syntax::ast::*; use syntax::ast_util::is_local; use syntax::ast_util; diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 056b4a9a49ef9..629310b12134e 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -157,7 +157,7 @@ pub fn version(argv0: &str) { pub fn usage(argv0: &str) { let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0); io::println(groups::usage(message, optgroups()) + - ~"Additional help: + "Additional help: -W help Print 'lint' options and default settings -Z help Print internal options for debugging rustc "); diff --git a/src/librustdoc/attr_parser.rs b/src/librustdoc/attr_parser.rs index 99bdf2284595f..717b49dfe26f7 100644 --- a/src/librustdoc/attr_parser.rs +++ b/src/librustdoc/attr_parser.rs @@ -78,7 +78,6 @@ mod test { fn parse_attributes(source: ~str) -> ~[ast::attribute] { use syntax::parse; use syntax::parse::attr::parser_attr; - use syntax::codemap; let parse_sess = syntax::parse::new_parse_sess(None); let parser = parse::new_parser_from_source_str( diff --git a/src/librustdoc/desc_to_brief_pass.rs b/src/librustdoc/desc_to_brief_pass.rs index 130cbb784ee37..972299d35f0a7 100644 --- a/src/librustdoc/desc_to_brief_pass.rs +++ b/src/librustdoc/desc_to_brief_pass.rs @@ -166,7 +166,7 @@ pub fn paragraphs(s: &str) -> ~[~str] { accum = if str::is_empty(accum) { copy *line } else { - accum + ~"\n" + *line + accum + "\n" + *line } } @@ -174,7 +174,7 @@ pub fn paragraphs(s: &str) -> ~[~str] { }; if !accum.is_empty() { - paras + ~[accum] + paras + [accum] } else { paras } diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index 97de4627d6b4c..ed882bc3434b7 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -171,7 +171,7 @@ pub fn header_kind(doc: doc::ItemTag) -> ~str { } pub fn header_name(doc: doc::ItemTag) -> ~str { - let fullpath = str::connect(doc.path() + ~[doc.name()], "::"); + let fullpath = str::connect(doc.path() + [doc.name()], "::"); match &doc { &doc::ModTag(_) if doc.id() != syntax::ast::crate_node_id => { fullpath @@ -190,9 +190,9 @@ pub fn header_name(doc: doc::ItemTag) -> ~str { let mut trait_part = ~""; for doc.trait_types.eachi |i, trait_type| { if i == 0 { - trait_part += ~" of "; + trait_part += " of "; } else { - trait_part += ~", "; + trait_part += ", "; } trait_part += *trait_type; } @@ -668,7 +668,7 @@ mod test { assert!(str::contains(markdown, "% Crate core")); } doc::ItemPage(_) => { - assert!(str::contains(markdown, ~"% Module a")); + assert!(str::contains(markdown, "% Module a")); } } } diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs index 8149dc61fb475..b537dfdbd0bc1 100644 --- a/src/librustdoc/markdown_writer.rs +++ b/src/librustdoc/markdown_writer.rs @@ -38,7 +38,7 @@ impl WriterUtils for Writer { } fn put_line(&self, str: ~str) { - self.put_str(str + ~"\n"); + self.put_str(str + "\n"); } fn put_done(&self) { @@ -159,7 +159,7 @@ pub fn make_filename( } } doc::ItemPage(doc) => { - str::connect(doc.path() + ~[doc.name()], "_") + str::connect(doc.path() + [doc.name()], "_") } } }; diff --git a/src/librustdoc/page_pass.rs b/src/librustdoc/page_pass.rs index f0d4c62960f86..581bc742eb903 100644 --- a/src/librustdoc/page_pass.rs +++ b/src/librustdoc/page_pass.rs @@ -69,7 +69,7 @@ fn make_doc_from_pages(page_port: &PagePort) -> doc::Doc { loop { let val = page_port.recv(); if val.is_some() { - pages += ~[val.unwrap()]; + pages += [val.unwrap()]; } else { break; } diff --git a/src/librustdoc/pass.rs b/src/librustdoc/pass.rs index 85eb5dc77aa27..95998ba135845 100644 --- a/src/librustdoc/pass.rs +++ b/src/librustdoc/pass.rs @@ -48,7 +48,7 @@ fn test_run_passes() { doc::CratePage(doc::CrateDoc{ topmod: doc::ModDoc{ item: doc::ItemDoc { - name: doc.cratemod().name() + ~"two", + name: doc.cratemod().name() + "two", .. copy doc.cratemod().item }, items: ~[], @@ -67,7 +67,7 @@ fn test_run_passes() { doc::CratePage(doc::CrateDoc{ topmod: doc::ModDoc{ item: doc::ItemDoc { - name: doc.cratemod().name() + ~"three", + name: doc.cratemod().name() + "three", .. copy doc.cratemod().item }, items: ~[], diff --git a/src/librustdoc/sectionalize_pass.rs b/src/librustdoc/sectionalize_pass.rs index 1ffdd396da9d5..89aa09b42d510 100644 --- a/src/librustdoc/sectionalize_pass.rs +++ b/src/librustdoc/sectionalize_pass.rs @@ -113,7 +113,7 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) { match parse_header(copy *line) { Some(header) => { if current_section.is_some() { - sections += ~[(¤t_section).get()]; + sections += [(¤t_section).get()]; } current_section = Some(doc::Section { header: header, @@ -124,14 +124,14 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) { match copy current_section { Some(section) => { current_section = Some(doc::Section { - body: section.body + ~"\n" + *line, + body: section.body + "\n" + *line, .. section }); } None => { new_desc = match copy new_desc { Some(desc) => { - Some(desc + ~"\n" + *line) + Some(desc + "\n" + *line) } None => { Some(copy *line) @@ -144,7 +144,7 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) { } if current_section.is_some() { - sections += ~[current_section.get()]; + sections += [current_section.get()]; } (new_desc, sections) diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc index 2097d0b690743..125737e587b6d 100644 --- a/src/librusti/rusti.rc +++ b/src/librusti/rusti.rc @@ -272,11 +272,11 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer, ~"help" => { io::println( ~":{\\n ..lines.. \\n:}\\n - execute multiline command\n" + - ~":load ... - \ + ":load ... - \ loads given crates as dynamic libraries\n" + - ~":clear - clear the bindings\n" + - ~":exit - exit from the repl\n" + - ~":help - show this message"); + ":clear - clear the bindings\n" + + ":exit - exit from the repl\n" + + ":help - show this message"); } ~"load" => { let mut loaded_crates: ~[~str] = ~[]; @@ -317,10 +317,10 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer, match get_line(use_rl, "rusti| ") { None => fail!("unterminated multiline command :{ .. :}"), Some(line) => { - if str::trim(line) == ~":}" { + if str::trim(line) == ":}" { end_multiline = true; } else { - multiline_cmd += line + ~"\n"; + multiline_cmd += line + "\n"; } } } diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index 1bd1a6bfd77ce..01ab2881eeeda 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -40,7 +40,7 @@ fn fake_pkg() -> PkgId { } fn remote_pkg() -> PkgId { - let remote = RemotePath(Path(~"github.com/catamorphism/test-pkg")); + let remote = RemotePath(Path("github.com/catamorphism/test-pkg")); PkgId { local_path: normalize(copy remote), remote_path: remote, @@ -52,23 +52,23 @@ fn remote_pkg() -> PkgId { fn writeFile(file_path: &Path, contents: ~str) { let out: @io::Writer = result::get(&io::file_writer(file_path, - ~[io::Create, io::Truncate])); + [io::Create, io::Truncate])); out.write_line(contents); } fn mk_temp_workspace(short_name: &LocalPath) -> Path { let workspace = mkdtemp(&os::tmpdir(), "test").expect("couldn't create temp dir"); // include version number in directory name - let package_dir = workspace.push(~"src").push(fmt!("%s-0.1", short_name.to_str())); + let package_dir = workspace.push("src").push(fmt!("%s-0.1", short_name.to_str())); assert!(os::mkdir_recursive(&package_dir, u_rwx)); // Create main, lib, test, and bench files - writeFile(&package_dir.push(~"main.rs"), + writeFile(&package_dir.push("main.rs"), ~"fn main() { let _x = (); }"); - writeFile(&package_dir.push(~"lib.rs"), + writeFile(&package_dir.push("lib.rs"), ~"pub fn f() { let _x = (); }"); - writeFile(&package_dir.push(~"test.rs"), + writeFile(&package_dir.push("test.rs"), ~"#[test] pub fn f() { (); }"); - writeFile(&package_dir.push(~"bench.rs"), + writeFile(&package_dir.push("bench.rs"), ~"#[bench] pub fn f() { (); }"); workspace } @@ -98,7 +98,7 @@ fn test_sysroot() -> Path { #[ignore(cfg(target_arch = "x86"))] fn test_make_dir_rwx() { let temp = &os::tmpdir(); - let dir = temp.push(~"quux"); + let dir = temp.push("quux"); assert!(!os::path_exists(&dir) || os::remove_dir_recursive(&dir)); debug!("Trying to make %s", dir.to_str()); @@ -176,10 +176,10 @@ fn test_install_url() { debug!("lib = %s", lib.to_str()); assert!(os::path_exists(&lib)); assert!(is_rwx(&lib)); - let built_test = built_test_in_workspace(&temp_pkg_id, &workspace).expect(~"test_install_url"); + let built_test = built_test_in_workspace(&temp_pkg_id, &workspace).expect("test_install_url"); assert!(os::path_exists(&built_test)); let built_bench = built_bench_in_workspace(&temp_pkg_id, - &workspace).expect(~"test_install_url"); + &workspace).expect("test_install_url"); assert!(os::path_exists(&built_bench)); // And that the test and bench executables aren't installed let test = target_test_in_workspace(&temp_pkg_id, &workspace); diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index 1425e68a85773..7794dd47b6903 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -536,15 +536,15 @@ mod test { #[test] fn test_is_cmd() { - assert!(is_cmd(~"build")); - assert!(is_cmd(~"clean")); - assert!(is_cmd(~"do")); - assert!(is_cmd(~"info")); - assert!(is_cmd(~"install")); - assert!(is_cmd(~"prefer")); - assert!(is_cmd(~"test")); - assert!(is_cmd(~"uninstall")); - assert!(is_cmd(~"unprefer")); + assert!(is_cmd("build")); + assert!(is_cmd("clean")); + assert!(is_cmd("do")); + assert!(is_cmd("info")); + assert!(is_cmd("install")); + assert!(is_cmd("prefer")); + assert!(is_cmd("test")); + assert!(is_cmd("uninstall")); + assert!(is_cmd("unprefer")); } } diff --git a/src/libstd/at_vec.rs b/src/libstd/at_vec.rs index 44c55563ac57f..7a41c278fa36c 100644 --- a/src/libstd/at_vec.rs +++ b/src/libstd/at_vec.rs @@ -300,7 +300,7 @@ mod test { #[test] fn append_test() { - assert_eq!(@[1,2,3] + @[4,5,6], @[1,2,3,4,5,6]); + assert_eq!(@[1,2,3] + [4,5,6], @[1,2,3,4,5,6]); } #[test] diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs index f46c8ab7ecc6e..7eb2054a35d4c 100644 --- a/src/libstd/hash.rs +++ b/src/libstd/hash.rs @@ -487,7 +487,7 @@ mod tests { assert!(f == i && f == v); - buf += ~[t as u8]; + buf += [t as u8]; stream_inc.input([t as u8]); t += 1; diff --git a/src/libstd/logging.rs b/src/libstd/logging.rs index be71714a048e3..693d786329773 100644 --- a/src/libstd/logging.rs +++ b/src/libstd/logging.rs @@ -12,10 +12,7 @@ use option::*; use either::*; -use rt; use rt::logging::{Logger, StdErrLogger}; -use cast; -use str; /// Turns on logging to stdout globally pub fn console_on() { @@ -40,10 +37,13 @@ pub fn console_off() { #[cfg(not(test))] #[lang="log_type"] pub fn log_type(level: u32, object: &T) { + use cast; use container::Container; use io; use libc; use repr; + use rt; + use str; use vec; let bytes = do io::with_bytes_writer |writer| { diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index 6fde30fdb50c5..27e872003ecbc 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -757,45 +757,45 @@ mod tests { #[test] fn test_from_str() { - assert_eq!(from_str(~"0"), Some(0 as $T)); - assert_eq!(from_str(~"3"), Some(3 as $T)); - assert_eq!(from_str(~"10"), Some(10 as $T)); - assert_eq!(i32::from_str(~"123456789"), Some(123456789 as i32)); - assert_eq!(from_str(~"00100"), Some(100 as $T)); + assert_eq!(from_str("0"), Some(0 as $T)); + assert_eq!(from_str("3"), Some(3 as $T)); + assert_eq!(from_str("10"), Some(10 as $T)); + assert_eq!(i32::from_str("123456789"), Some(123456789 as i32)); + assert_eq!(from_str("00100"), Some(100 as $T)); - assert_eq!(from_str(~"-1"), Some(-1 as $T)); - assert_eq!(from_str(~"-3"), Some(-3 as $T)); - assert_eq!(from_str(~"-10"), Some(-10 as $T)); - assert_eq!(i32::from_str(~"-123456789"), Some(-123456789 as i32)); - assert_eq!(from_str(~"-00100"), Some(-100 as $T)); + assert_eq!(from_str("-1"), Some(-1 as $T)); + assert_eq!(from_str("-3"), Some(-3 as $T)); + assert_eq!(from_str("-10"), Some(-10 as $T)); + assert_eq!(i32::from_str("-123456789"), Some(-123456789 as i32)); + assert_eq!(from_str("-00100"), Some(-100 as $T)); - assert!(from_str(~" ").is_none()); - assert!(from_str(~"x").is_none()); + assert!(from_str(" ").is_none()); + assert!(from_str("x").is_none()); } #[test] fn test_parse_bytes() { use str::to_bytes; - assert_eq!(parse_bytes(to_bytes(~"123"), 10u), Some(123 as $T)); - assert_eq!(parse_bytes(to_bytes(~"1001"), 2u), Some(9 as $T)); - assert_eq!(parse_bytes(to_bytes(~"123"), 8u), Some(83 as $T)); - assert_eq!(i32::parse_bytes(to_bytes(~"123"), 16u), Some(291 as i32)); - assert_eq!(i32::parse_bytes(to_bytes(~"ffff"), 16u), Some(65535 as i32)); - assert_eq!(i32::parse_bytes(to_bytes(~"FFFF"), 16u), Some(65535 as i32)); - assert_eq!(parse_bytes(to_bytes(~"z"), 36u), Some(35 as $T)); - assert_eq!(parse_bytes(to_bytes(~"Z"), 36u), Some(35 as $T)); - - assert_eq!(parse_bytes(to_bytes(~"-123"), 10u), Some(-123 as $T)); - assert_eq!(parse_bytes(to_bytes(~"-1001"), 2u), Some(-9 as $T)); - assert_eq!(parse_bytes(to_bytes(~"-123"), 8u), Some(-83 as $T)); - assert_eq!(i32::parse_bytes(to_bytes(~"-123"), 16u), Some(-291 as i32)); - assert_eq!(i32::parse_bytes(to_bytes(~"-ffff"), 16u), Some(-65535 as i32)); - assert_eq!(i32::parse_bytes(to_bytes(~"-FFFF"), 16u), Some(-65535 as i32)); - assert_eq!(parse_bytes(to_bytes(~"-z"), 36u), Some(-35 as $T)); - assert_eq!(parse_bytes(to_bytes(~"-Z"), 36u), Some(-35 as $T)); - - assert!(parse_bytes(to_bytes(~"Z"), 35u).is_none()); - assert!(parse_bytes(to_bytes(~"-9"), 2u).is_none()); + assert_eq!(parse_bytes(to_bytes("123"), 10u), Some(123 as $T)); + assert_eq!(parse_bytes(to_bytes("1001"), 2u), Some(9 as $T)); + assert_eq!(parse_bytes(to_bytes("123"), 8u), Some(83 as $T)); + assert_eq!(i32::parse_bytes(to_bytes("123"), 16u), Some(291 as i32)); + assert_eq!(i32::parse_bytes(to_bytes("ffff"), 16u), Some(65535 as i32)); + assert_eq!(i32::parse_bytes(to_bytes("FFFF"), 16u), Some(65535 as i32)); + assert_eq!(parse_bytes(to_bytes("z"), 36u), Some(35 as $T)); + assert_eq!(parse_bytes(to_bytes("Z"), 36u), Some(35 as $T)); + + assert_eq!(parse_bytes(to_bytes("-123"), 10u), Some(-123 as $T)); + assert_eq!(parse_bytes(to_bytes("-1001"), 2u), Some(-9 as $T)); + assert_eq!(parse_bytes(to_bytes("-123"), 8u), Some(-83 as $T)); + assert_eq!(i32::parse_bytes(to_bytes("-123"), 16u), Some(-291 as i32)); + assert_eq!(i32::parse_bytes(to_bytes("-ffff"), 16u), Some(-65535 as i32)); + assert_eq!(i32::parse_bytes(to_bytes("-FFFF"), 16u), Some(-65535 as i32)); + assert_eq!(parse_bytes(to_bytes("-z"), 36u), Some(-35 as $T)); + assert_eq!(parse_bytes(to_bytes("-Z"), 36u), Some(-35 as $T)); + + assert!(parse_bytes(to_bytes("Z"), 35u).is_none()); + assert!(parse_bytes(to_bytes("-9"), 2u).is_none()); } #[test] @@ -838,36 +838,36 @@ mod tests { #[test] fn test_int_from_str_overflow() { let mut i8_val: i8 = 127_i8; - assert_eq!(i8::from_str(~"127"), Some(i8_val)); - assert!(i8::from_str(~"128").is_none()); + assert_eq!(i8::from_str("127"), Some(i8_val)); + assert!(i8::from_str("128").is_none()); i8_val += 1 as i8; - assert_eq!(i8::from_str(~"-128"), Some(i8_val)); - assert!(i8::from_str(~"-129").is_none()); + assert_eq!(i8::from_str("-128"), Some(i8_val)); + assert!(i8::from_str("-129").is_none()); let mut i16_val: i16 = 32_767_i16; - assert_eq!(i16::from_str(~"32767"), Some(i16_val)); - assert!(i16::from_str(~"32768").is_none()); + assert_eq!(i16::from_str("32767"), Some(i16_val)); + assert!(i16::from_str("32768").is_none()); i16_val += 1 as i16; - assert_eq!(i16::from_str(~"-32768"), Some(i16_val)); - assert!(i16::from_str(~"-32769").is_none()); + assert_eq!(i16::from_str("-32768"), Some(i16_val)); + assert!(i16::from_str("-32769").is_none()); let mut i32_val: i32 = 2_147_483_647_i32; - assert_eq!(i32::from_str(~"2147483647"), Some(i32_val)); - assert!(i32::from_str(~"2147483648").is_none()); + assert_eq!(i32::from_str("2147483647"), Some(i32_val)); + assert!(i32::from_str("2147483648").is_none()); i32_val += 1 as i32; - assert_eq!(i32::from_str(~"-2147483648"), Some(i32_val)); - assert!(i32::from_str(~"-2147483649").is_none()); + assert_eq!(i32::from_str("-2147483648"), Some(i32_val)); + assert!(i32::from_str("-2147483649").is_none()); let mut i64_val: i64 = 9_223_372_036_854_775_807_i64; - assert_eq!(i64::from_str(~"9223372036854775807"), Some(i64_val)); - assert!(i64::from_str(~"9223372036854775808").is_none()); + assert_eq!(i64::from_str("9223372036854775807"), Some(i64_val)); + assert!(i64::from_str("9223372036854775808").is_none()); i64_val += 1 as i64; - assert_eq!(i64::from_str(~"-9223372036854775808"), Some(i64_val)); - assert!(i64::from_str(~"-9223372036854775809").is_none()); + assert_eq!(i64::from_str("-9223372036854775808"), Some(i64_val)); + assert!(i64::from_str("-9223372036854775809").is_none()); } #[test] diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index 3448314c43692..e6267bfe9e17e 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -496,29 +496,29 @@ mod tests { #[test] pub fn test_from_str() { - assert_eq!(from_str(~"0"), Some(0u as $T)); - assert_eq!(from_str(~"3"), Some(3u as $T)); - assert_eq!(from_str(~"10"), Some(10u as $T)); - assert_eq!(u32::from_str(~"123456789"), Some(123456789 as u32)); - assert_eq!(from_str(~"00100"), Some(100u as $T)); + assert_eq!(from_str("0"), Some(0u as $T)); + assert_eq!(from_str("3"), Some(3u as $T)); + assert_eq!(from_str("10"), Some(10u as $T)); + assert_eq!(u32::from_str("123456789"), Some(123456789 as u32)); + assert_eq!(from_str("00100"), Some(100u as $T)); - assert!(from_str(~"").is_none()); - assert!(from_str(~" ").is_none()); - assert!(from_str(~"x").is_none()); + assert!(from_str("").is_none()); + assert!(from_str(" ").is_none()); + assert!(from_str("x").is_none()); } #[test] pub fn test_parse_bytes() { use str::to_bytes; - assert_eq!(parse_bytes(to_bytes(~"123"), 10u), Some(123u as $T)); - assert_eq!(parse_bytes(to_bytes(~"1001"), 2u), Some(9u as $T)); - assert_eq!(parse_bytes(to_bytes(~"123"), 8u), Some(83u as $T)); - assert_eq!(u16::parse_bytes(to_bytes(~"123"), 16u), Some(291u as u16)); - assert_eq!(u16::parse_bytes(to_bytes(~"ffff"), 16u), Some(65535u as u16)); - assert_eq!(parse_bytes(to_bytes(~"z"), 36u), Some(35u as $T)); + assert_eq!(parse_bytes(to_bytes("123"), 10u), Some(123u as $T)); + assert_eq!(parse_bytes(to_bytes("1001"), 2u), Some(9u as $T)); + assert_eq!(parse_bytes(to_bytes("123"), 8u), Some(83u as $T)); + assert_eq!(u16::parse_bytes(to_bytes("123"), 16u), Some(291u as u16)); + assert_eq!(u16::parse_bytes(to_bytes("ffff"), 16u), Some(65535u as u16)); + assert_eq!(parse_bytes(to_bytes("z"), 36u), Some(35u as $T)); - assert!(parse_bytes(to_bytes(~"Z"), 10u).is_none()); - assert!(parse_bytes(to_bytes(~"_"), 2u).is_none()); + assert!(parse_bytes(to_bytes("Z"), 10u).is_none()); + assert!(parse_bytes(to_bytes("_"), 2u).is_none()); } #[test] @@ -551,36 +551,36 @@ mod tests { #[test] fn test_uint_from_str_overflow() { let mut u8_val: u8 = 255_u8; - assert_eq!(u8::from_str(~"255"), Some(u8_val)); - assert!(u8::from_str(~"256").is_none()); + assert_eq!(u8::from_str("255"), Some(u8_val)); + assert!(u8::from_str("256").is_none()); u8_val += 1 as u8; - assert_eq!(u8::from_str(~"0"), Some(u8_val)); - assert!(u8::from_str(~"-1").is_none()); + assert_eq!(u8::from_str("0"), Some(u8_val)); + assert!(u8::from_str("-1").is_none()); let mut u16_val: u16 = 65_535_u16; - assert_eq!(u16::from_str(~"65535"), Some(u16_val)); - assert!(u16::from_str(~"65536").is_none()); + assert_eq!(u16::from_str("65535"), Some(u16_val)); + assert!(u16::from_str("65536").is_none()); u16_val += 1 as u16; - assert_eq!(u16::from_str(~"0"), Some(u16_val)); - assert!(u16::from_str(~"-1").is_none()); + assert_eq!(u16::from_str("0"), Some(u16_val)); + assert!(u16::from_str("-1").is_none()); let mut u32_val: u32 = 4_294_967_295_u32; - assert_eq!(u32::from_str(~"4294967295"), Some(u32_val)); - assert!(u32::from_str(~"4294967296").is_none()); + assert_eq!(u32::from_str("4294967295"), Some(u32_val)); + assert!(u32::from_str("4294967296").is_none()); u32_val += 1 as u32; - assert_eq!(u32::from_str(~"0"), Some(u32_val)); - assert!(u32::from_str(~"-1").is_none()); + assert_eq!(u32::from_str("0"), Some(u32_val)); + assert!(u32::from_str("-1").is_none()); let mut u64_val: u64 = 18_446_744_073_709_551_615_u64; - assert_eq!(u64::from_str(~"18446744073709551615"), Some(u64_val)); - assert!(u64::from_str(~"18446744073709551616").is_none()); + assert_eq!(u64::from_str("18446744073709551615"), Some(u64_val)); + assert!(u64::from_str("18446744073709551616").is_none()); u64_val += 1 as u64; - assert_eq!(u64::from_str(~"0"), Some(u64_val)); - assert!(u64::from_str(~"-1").is_none()); + assert_eq!(u64::from_str("0"), Some(u64_val)); + assert!(u64::from_str("-1").is_none()); } #[test] diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 49e3c17be1b3e..15c68efc7cc2a 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -1481,7 +1481,7 @@ mod tests { fn test_getenv_big() { let mut s = ~""; let mut i = 0; - while i < 100 { s += ~"aaaaaaaaaa"; i += 1; } + while i < 100 { s += "aaaaaaaaaa"; i += 1; } let n = make_rand_name(); setenv(n, s); debug!(copy s); @@ -1658,7 +1658,7 @@ mod tests { }; assert!((ostream as uint != 0u)); let s = ~"hello"; - let mut buf = str::to_bytes(s) + ~[0 as u8]; + let mut buf = str::to_bytes(s) + [0 as u8]; do vec::as_mut_buf(buf) |b, _len| { assert!((libc::fwrite(b as *c_void, 1u as size_t, (str::len(s) + 1u) as size_t, ostream) diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index 309129b7f13e4..38d7095a3663d 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -11,8 +11,8 @@ //! Unsafe pointer utility functions use cast; -use libc; -use libc::{c_void, size_t}; +#[cfg(stage0)] use libc; +#[cfg(stage0)] use libc::{c_void, size_t}; use option::{Option, Some, None}; use sys; diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 449c7848f5636..349a848e2c7c3 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -3147,7 +3147,7 @@ mod tests { } t([~"you", ~"know", ~"I'm", ~"no", ~"good"], " ", "you know I'm no good"); - let v: &[~str] = ~[]; + let v: &[~str] = []; t(v, " ", ""); t([~"hi"], " ", "hi"); }