Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence warnings when testing #6774

Merged
merged 2 commits into from
May 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ mod tests {
use core::prelude::*;
use core::cell::Cell;
use arc::*;
use arc;

#[test]
fn manually_share_arc() {
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/libextra/flatpipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ mod test {
fn test_try_recv_none3<P:BytePort>(loader: PortLoader<P>) {
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<int> = port.try_recv();
assert!(res.is_none());
Expand All @@ -951,7 +951,7 @@ mod test {
1, sys::size_of::<u64>()) |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);

Expand Down
14 changes: 7 additions & 7 deletions src/libextra/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(~[
Expand Down
1 change: 0 additions & 1 deletion src/libextra/net_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ mod test {
use uv;

use core::result;
use core::vec;

#[test]
fn test_ip_ipv4_parse_and_format_ip() {
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/sha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ mod tests {
Test {
input:
~"abcdbcdecdefdefgefghfghighij" +
~"hijkijkljklmklmnlmnomnopnopq",
"hijkijkljklmklmnlmnomnopnopq",
output: ~[
0x84u8, 0x98u8, 0x3Eu8, 0x44u8,
0x1Cu8, 0x3Bu8, 0xD2u8, 0x6Eu8,
Expand Down
2 changes: 0 additions & 2 deletions src/libextra/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,6 @@ fn shift_vec<T:Copy>(dest: &mut [T],

#[cfg(test)]
mod test_qsort3 {
use core::prelude::*;

use sort::*;

use core::vec;
Expand Down
1 change: 0 additions & 1 deletion src/libextra/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/libextra/tempfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ mod tests {
use core::prelude::*;

use tempfile::mkdtemp;
use tempfile;
use core::os;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 2 additions & 4 deletions src/libextra/uv_global_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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!");
}
}
4 changes: 2 additions & 2 deletions src/libfuzzer/fuzzer.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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 :( */
}
Expand Down Expand Up @@ -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);
}
Expand Down
22 changes: 14 additions & 8 deletions src/librustc/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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 = ~[];
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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))
};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/rustc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
");
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/attr_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/desc_to_brief_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ pub fn paragraphs(s: &str) -> ~[~str] {
accum = if str::is_empty(accum) {
copy *line
} else {
accum + ~"\n" + *line
accum + "\n" + *line
}
}

res
};

if !accum.is_empty() {
paras + ~[accum]
paras + [accum]
} else {
paras
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/markdown_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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"));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/markdown_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -159,7 +159,7 @@ pub fn make_filename(
}
}
doc::ItemPage(doc) => {
str::connect(doc.path() + ~[doc.name()], "_")
str::connect(doc.path() + [doc.name()], "_")
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/page_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: ~[],
Expand All @@ -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: ~[],
Expand Down
Loading