diff --git a/src/libextra/crypto/sha1.rs b/src/libextra/crypto/sha1.rs index aa52902c27d11..8ee9006f6136c 100644 --- a/src/libextra/crypto/sha1.rs +++ b/src/libextra/crypto/sha1.rs @@ -159,7 +159,7 @@ impl Sha1 { } impl Digest for Sha1 { - pub fn reset(&mut self) { + fn reset(&mut self) { self.length_bits = 0; self.h[0] = 0x67452301u32; self.h[1] = 0xEFCDAB89u32; @@ -169,9 +169,9 @@ impl Digest for Sha1 { self.buffer.reset(); self.computed = false; } - pub fn input(&mut self, msg: &[u8]) { add_input(self, msg); } - pub fn result(&mut self, out: &mut [u8]) { return mk_result(self, out); } - pub fn output_bits(&self) -> uint { 160 } + fn input(&mut self, msg: &[u8]) { add_input(self, msg); } + fn result(&mut self, out: &mut [u8]) { return mk_result(self, out); } + fn output_bits(&self) -> uint { 160 } } #[cfg(test)] diff --git a/src/libextra/ebml.rs b/src/libextra/ebml.rs index f66677c21f7d1..286ebe0b8d036 100644 --- a/src/libextra/ebml.rs +++ b/src/libextra/ebml.rs @@ -305,7 +305,7 @@ pub mod reader { self.pos = r_doc.end; let str = r_doc.as_str_slice(); if lbl != str { - fail!("Expected label %s but found %s", lbl, str); + fail!("Expected label %s, found %s", lbl, str); } } } @@ -326,7 +326,7 @@ pub mod reader { r_doc.start, r_doc.end); if r_tag != (exp_tag as uint) { - fail!("expected EBML doc with tag %? but found tag %?", exp_tag, r_tag); + fail!("expected EBML doc with tag %?, found tag %?", exp_tag, r_tag); } if r_doc.end > self.parent.end { fail!("invalid EBML, child extends to 0x%x, parent to 0x%x", diff --git a/src/libextra/enum_set.rs b/src/libextra/enum_set.rs index 25501faa02e12..28ff16c43e8af 100644 --- a/src/libextra/enum_set.rs +++ b/src/libextra/enum_set.rs @@ -21,9 +21,9 @@ pub struct EnumSet { /// An iterface for casting C-like enum to uint and back. pub trait CLike { /// Converts C-like enum to uint. - pub fn to_uint(&self) -> uint; + fn to_uint(&self) -> uint; /// Converts uint to C-like enum. - pub fn from_uint(uint) -> Self; + fn from_uint(uint) -> Self; } fn bit(e: E) -> uint { @@ -142,11 +142,11 @@ mod test { } impl CLike for Foo { - pub fn to_uint(&self) -> uint { + fn to_uint(&self) -> uint { *self as uint } - pub fn from_uint(v: uint) -> Foo { + fn from_uint(v: uint) -> Foo { unsafe { cast::transmute(v) } } } diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index 27dfc090f8888..354696ef42060 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -537,7 +537,7 @@ impl ToStrRadix for BigUint { impl FromStrRadix for BigUint { /// Creates and initializes an BigUint. - pub fn from_str_radix(s: &str, radix: uint) + fn from_str_radix(s: &str, radix: uint) -> Option { BigUint::parse_bytes(s.as_bytes(), radix) } diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index 0d2badff4929b..f07263a6459fd 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -178,7 +178,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { // Check magic number let magic = file.read_le_u16(); if (magic != 0x011A) { - return Err(fmt!("invalid magic number: expected %x but found %x", 0x011A, magic as uint)); + return Err(fmt!("invalid magic number: expected %x, found %x", 0x011A, magic as uint)); } let names_bytes = file.read_le_i16() as int; @@ -196,19 +196,19 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { debug!("string_table_bytes = %?", string_table_bytes); if (bools_bytes as uint) > boolnames.len() { - error!("expected bools_bytes to be less than %? but found %?", boolnames.len(), + error!("expected bools_bytes to be less than %?, found %?", boolnames.len(), bools_bytes); return Err(~"incompatible file: more booleans than expected"); } if (numbers_count as uint) > numnames.len() { - error!("expected numbers_count to be less than %? but found %?", numnames.len(), + error!("expected numbers_count to be less than %?, found %?", numnames.len(), numbers_count); return Err(~"incompatible file: more numbers than expected"); } if (string_offsets_count as uint) > stringnames.len() { - error!("expected string_offsets_count to be less than %? but found %?", stringnames.len(), + error!("expected string_offsets_count to be less than %?, found %?", stringnames.len(), string_offsets_count); return Err(~"incompatible file: more string offsets than expected"); } diff --git a/src/libextra/test.rs b/src/libextra/test.rs index 8b7332ff545a4..a9c3bf98cb659 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -104,7 +104,7 @@ pub struct Metric { pub struct MetricMap(TreeMap<~str,Metric>); impl Clone for MetricMap { - pub fn clone(&self) -> MetricMap { + fn clone(&self) -> MetricMap { MetricMap((**self).clone()) } } diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs index 424492a3cfea4..f7d56f25437d1 100644 --- a/src/libextra/treemap.rs +++ b/src/libextra/treemap.rs @@ -895,7 +895,7 @@ impl> Extendable<(K, V), T> for TreeMap> FromIterator for TreeSet { - pub fn from_iterator(iter: &mut Iter) -> TreeSet { + fn from_iterator(iter: &mut Iter) -> TreeSet { let mut set = TreeSet::new(); set.extend(iter); set diff --git a/src/libextra/url.rs b/src/libextra/url.rs index 581bdf2a294db..3f23cbd02abab 100644 --- a/src/libextra/url.rs +++ b/src/libextra/url.rs @@ -701,7 +701,7 @@ pub fn to_str(url: &Url) -> ~str { } impl ToStr for Url { - pub fn to_str(&self) -> ~str { + fn to_str(&self) -> ~str { to_str(self) } } diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 5801e43a54cd2..8a157ebc988f5 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -2082,6 +2082,9 @@ pub mod llvm { Elements: ValueRef, RunTimeLang: c_uint) -> ValueRef; + + #[fast_ffi] + pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool); } } @@ -2101,6 +2104,12 @@ pub fn SetLinkage(Global: ValueRef, Link: Linkage) { } } +pub fn SetUnnamedAddr(Global: ValueRef, Unnamed: bool) { + unsafe { + llvm::LLVMSetUnnamedAddr(Global, Unnamed as Bool); + } +} + pub fn ConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef { unsafe { llvm::LLVMConstICmp(Pred as c_ushort, V1, V2) diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 89b30e46ac06d..a922db55a3156 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -542,12 +542,12 @@ pub fn parse_def_id(buf: &[u8]) -> ast::def_id { let crate_num = match uint::parse_bytes(crate_part, 10u) { Some(cn) => cn as int, - None => fail!("internal error: parse_def_id: crate number expected, but found %?", + None => fail!("internal error: parse_def_id: crate number expected, found %?", crate_part) }; let def_num = match uint::parse_bytes(def_part, 10u) { Some(dn) => dn as int, - None => fail!("internal error: parse_def_id: id expected, but found %?", + None => fail!("internal error: parse_def_id: id expected, found %?", def_part) }; ast::def_id { crate: crate_num, node: def_num } diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index a4b88870b9739..4ad43b8cb8df3 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -351,6 +351,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt, // Do not check privacy inside items with the resolve_unexported // attribute. This is used for the test runner. if !attr::contains_name(item.attrs, "!resolve_unexported") { + check_sane_privacy(tcx, item); oldvisit::visit_item(item, (method_map, visitor)); } }, @@ -540,3 +541,81 @@ pub fn check_crate<'mm>(tcx: ty::ctxt, }); oldvisit::visit_crate(crate, (method_map, visitor)); } + +/// Validates all of the visibility qualifers placed on the item given. This +/// ensures that there are no extraneous qualifiers that don't actually do +/// anything. In theory these qualifiers wouldn't parse, but that may happen +/// later on down the road... +fn check_sane_privacy(tcx: ty::ctxt, item: @ast::item) { + match item.node { + // implementations of traits don't need visibility qualifiers because + // that's controlled by having the trait in scope. + ast::item_impl(_, Some(*), _, ref methods) => { + for m in methods.iter() { + match m.vis { + ast::private | ast::public => { + tcx.sess.span_err(m.span, "unnecessary visibility") + } + ast::inherited => {} + } + } + } + + ast::item_enum(ref def, _) => { + for v in def.variants.iter() { + match v.node.vis { + ast::public => { + if item.vis == ast::public { + tcx.sess.span_err(v.span, "unnecessary `pub` \ + visibility"); + } + } + ast::private => { + if item.vis != ast::public { + tcx.sess.span_err(v.span, "unnecessary `priv` \ + visibility"); + } + } + ast::inherited => {} + } + } + } + + ast::item_struct(ref def, _) => { + for f in def.fields.iter() { + match f.node.kind { + ast::named_field(_, ast::public) => { + tcx.sess.span_err(f.span, "unnecessary `pub` \ + visibility"); + } + ast::named_field(_, ast::private) => { + // Fields should really be private by default... + } + ast::named_field(*) | ast::unnamed_field => {} + } + } + } + + ast::item_trait(_, _, ref methods) => { + for m in methods.iter() { + match *m { + ast::provided(ref m) => { + match m.vis { + ast::private | ast::public => { + tcx.sess.span_err(m.span, "unnecessary \ + visibility"); + } + ast::inherited => {} + } + } + // this is warned about in the parser + ast::required(*) => {} + } + } + } + + ast::item_impl(*) | ast::item_static(*) | ast::item_foreign_mod(*) | + ast::item_fn(*) | ast::item_mod(*) | ast::item_ty(*) | + ast::item_mac(*) => {} + } +} diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index c98d859337c3e..d9b1b97ef9ed6 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -463,7 +463,7 @@ fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::pat) { if !pat_is_binding_or_wild(bcx.tcx().def_map, p) { bcx.sess().span_bug( p.span, - fmt!("Expected an identifier pattern but found p: %s", + fmt!("Expected an identifier pattern, found p: %s", p.repr(bcx.tcx()))); } } diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 762f6953bb222..8bbcd2a556ab4 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -165,7 +165,7 @@ impl<'self> StatRecorder<'self> { #[unsafe_destructor] impl<'self> Drop for StatRecorder<'self> { - pub fn drop(&self) { + fn drop(&self) { if self.ccx.sess.trans_stats() { let end = time::precise_time_ns(); let elapsed = ((end - self.start) / 1_000_000) as uint; @@ -2180,19 +2180,18 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) { } ast::item_static(_, m, expr) => { consts::trans_const(ccx, m, item.id); - // Do static_assert checking. It can't really be done much earlier because we need to get - // the value of the bool out of LLVM - for attr in item.attrs.iter() { - if "static_assert" == attr.name() { - if m == ast::m_mutbl { - ccx.sess.span_fatal(expr.span, - "cannot have static_assert on a mutable static"); - } - let v = ccx.const_values.get_copy(&item.id); - unsafe { - if !(llvm::LLVMConstIntGetZExtValue(v) as bool) { - ccx.sess.span_fatal(expr.span, "static assertion failed"); - } + // Do static_assert checking. It can't really be done much earlier + // because we need to get the value of the bool out of LLVM + if attr::contains_name(item.attrs, "static_assert") { + if m == ast::m_mutbl { + ccx.sess.span_fatal(expr.span, + "cannot have static_assert on a mutable \ + static"); + } + let v = ccx.const_values.get_copy(&item.id); + unsafe { + if !(llvm::LLVMConstIntGetZExtValue(v) as bool) { + ccx.sess.span_fatal(expr.span, "static assertion failed"); } } } @@ -2452,6 +2451,15 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { llvm::LLVMAddGlobal(ccx.llmod, llty, buf) }; + // Apply the `unnamed_addr` attribute if + // requested + if attr::contains_name(i.attrs, + "address_insignificant"){ + lib::llvm::SetUnnamedAddr(g, true); + lib::llvm::SetLinkage(g, + lib::llvm::InternalLinkage); + } + ccx.item_symbols.insert(i.id, sym); g } @@ -2740,6 +2748,60 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> { ifn!("llvm.bswap.i32",[Type::i32()], Type::i32()); ifn!("llvm.bswap.i64",[Type::i64()], Type::i64()); + ifn!("llvm.sadd.with.overflow.i8", + [Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false)); + ifn!("llvm.sadd.with.overflow.i16", + [Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false)); + ifn!("llvm.sadd.with.overflow.i32", + [Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false)); + ifn!("llvm.sadd.with.overflow.i64", + [Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false)); + + ifn!("llvm.uadd.with.overflow.i8", + [Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false)); + ifn!("llvm.uadd.with.overflow.i16", + [Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false)); + ifn!("llvm.uadd.with.overflow.i32", + [Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false)); + ifn!("llvm.uadd.with.overflow.i64", + [Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false)); + + ifn!("llvm.ssub.with.overflow.i8", + [Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false)); + ifn!("llvm.ssub.with.overflow.i16", + [Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false)); + ifn!("llvm.ssub.with.overflow.i32", + [Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false)); + ifn!("llvm.ssub.with.overflow.i64", + [Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false)); + + ifn!("llvm.usub.with.overflow.i8", + [Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false)); + ifn!("llvm.usub.with.overflow.i16", + [Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false)); + ifn!("llvm.usub.with.overflow.i32", + [Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false)); + ifn!("llvm.usub.with.overflow.i64", + [Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false)); + + ifn!("llvm.smul.with.overflow.i8", + [Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false)); + ifn!("llvm.smul.with.overflow.i16", + [Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false)); + ifn!("llvm.smul.with.overflow.i32", + [Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false)); + ifn!("llvm.smul.with.overflow.i64", + [Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false)); + + ifn!("llvm.umul.with.overflow.i8", + [Type::i8(), Type::i8()], Type::struct_([Type::i8(), Type::i1()], false)); + ifn!("llvm.umul.with.overflow.i16", + [Type::i16(), Type::i16()], Type::struct_([Type::i16(), Type::i1()], false)); + ifn!("llvm.umul.with.overflow.i32", + [Type::i32(), Type::i32()], Type::struct_([Type::i32(), Type::i1()], false)); + ifn!("llvm.umul.with.overflow.i64", + [Type::i64(), Type::i64()], Type::struct_([Type::i64(), Type::i1()], false)); + return intrinsics; } diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index c8e2a17c3b5f1..dab970569212e 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -714,9 +714,11 @@ pub fn ExtractValue(cx: @mut Block, AggVal: ValueRef, Index: uint) -> ValueRef { } } -pub fn InsertValue(cx: @mut Block, AggVal: ValueRef, EltVal: ValueRef, Index: uint) { - if cx.unreachable { return; } - B(cx).insert_value(AggVal, EltVal, Index) +pub fn InsertValue(cx: @mut Block, AggVal: ValueRef, EltVal: ValueRef, Index: uint) -> ValueRef { + unsafe { + if cx.unreachable { return llvm::LLVMGetUndef(Type::nil().to_ref()); } + B(cx).insert_value(AggVal, EltVal, Index) + } } pub fn IsNull(cx: @mut Block, Val: ValueRef) -> ValueRef { diff --git a/src/librustc/middle/trans/builder.rs b/src/librustc/middle/trans/builder.rs index 8f48c00b8d6b4..5c216b2e14346 100644 --- a/src/librustc/middle/trans/builder.rs +++ b/src/librustc/middle/trans/builder.rs @@ -861,11 +861,11 @@ impl Builder { } pub fn insert_value(&self, agg_val: ValueRef, elt: ValueRef, - idx: uint) { + idx: uint) -> ValueRef { self.count_insn("insertvalue"); unsafe { llvm::LLVMBuildInsertValue(self.llbuilder, agg_val, elt, idx as c_uint, - noname()); + noname()) } } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 40a83eb977078..96616cbe533ba 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -238,7 +238,7 @@ impl FunctionContext { } pub fn out_arg_pos(&self) -> uint { - assert!(self.has_immediate_return_value); + assert!(!self.has_immediate_return_value); 0u } diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index b1e600b9d7376..2bf483ee3a019 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -550,6 +550,24 @@ pub fn trans_intrinsic(ccx: @mut CrateContext, Ret(bcx, Call(bcx, llfn, args.slice(0, num_args))); } + fn with_overflow_instrinsic(bcx: @mut Block, name: &'static str) { + let first_real_arg = bcx.fcx.arg_pos(0u); + let a = get_param(bcx.fcx.llfn, first_real_arg); + let b = get_param(bcx.fcx.llfn, first_real_arg + 1); + let llfn = bcx.ccx().intrinsics.get_copy(&name); + + // convert `i1` to a `bool`, and write to the out parameter + let val = Call(bcx, llfn, [a, b]); + let result = ExtractValue(bcx, val, 0); + let overflow = ZExt(bcx, ExtractValue(bcx, val, 1), Type::bool()); + let retptr = get_param(bcx.fcx.llfn, bcx.fcx.out_arg_pos()); + let ret = Load(bcx, retptr); + let ret = InsertValue(bcx, ret, result, 0); + let ret = InsertValue(bcx, ret, overflow, 1); + Store(bcx, ret, retptr); + RetVoid(bcx) + } + fn memcpy_intrinsic(bcx: @mut Block, name: &'static str, tp_ty: ty::t, sizebits: u8) { let ccx = bcx.ccx(); let lltp_ty = type_of::type_of(ccx, tp_ty); @@ -944,6 +962,37 @@ pub fn trans_intrinsic(ccx: @mut CrateContext, "bswap16" => simple_llvm_intrinsic(bcx, "llvm.bswap.i16", 1), "bswap32" => simple_llvm_intrinsic(bcx, "llvm.bswap.i32", 1), "bswap64" => simple_llvm_intrinsic(bcx, "llvm.bswap.i64", 1), + + "i8_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.sadd.with.overflow.i8"), + "i16_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.sadd.with.overflow.i16"), + "i32_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.sadd.with.overflow.i32"), + "i64_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.sadd.with.overflow.i64"), + + "u8_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.uadd.with.overflow.i8"), + "u16_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.uadd.with.overflow.i16"), + "u32_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.uadd.with.overflow.i32"), + "u64_add_with_overflow" => with_overflow_instrinsic(bcx, "llvm.uadd.with.overflow.i64"), + + "i8_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.ssub.with.overflow.i8"), + "i16_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.ssub.with.overflow.i16"), + "i32_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.ssub.with.overflow.i32"), + "i64_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.ssub.with.overflow.i64"), + + "u8_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.usub.with.overflow.i8"), + "u16_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.usub.with.overflow.i16"), + "u32_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.usub.with.overflow.i32"), + "u64_sub_with_overflow" => with_overflow_instrinsic(bcx, "llvm.usub.with.overflow.i64"), + + "i8_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.smul.with.overflow.i8"), + "i16_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.smul.with.overflow.i16"), + "i32_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.smul.with.overflow.i32"), + "i64_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.smul.with.overflow.i64"), + + "u8_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.umul.with.overflow.i8"), + "u16_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.umul.with.overflow.i16"), + "u32_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.umul.with.overflow.i32"), + "u64_mul_with_overflow" => with_overflow_instrinsic(bcx, "llvm.umul.with.overflow.i64"), + _ => { // Could we make this an enum rather than a string? does it get // checked earlier? diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs index f25bf011f5d06..74661098348e6 100644 --- a/src/librustc/middle/trans/type_use.rs +++ b/src/librustc/middle/trans/type_use.rs @@ -168,6 +168,22 @@ pub fn type_uses_for(ccx: @mut CrateContext, fn_id: def_id, n_tps: uint) "bswap16" | "bswap32" | "bswap64" => 0, + + "i8_add_with_overflow" | "u8_add_with_overflow" | + "i16_add_with_overflow" | "u16_add_with_overflow" | + "i32_add_with_overflow" | "u32_add_with_overflow" | + "i64_add_with_overflow" | "u64_add_with_overflow" => 0, + + "i8_sub_with_overflow" | "u8_sub_with_overflow" | + "i16_sub_with_overflow" | "u16_sub_with_overflow" | + "i32_sub_with_overflow" | "u32_sub_with_overflow" | + "i64_sub_with_overflow" | "u64_sub_with_overflow" => 0, + + "i8_mul_with_overflow" | "u8_mul_with_overflow" | + "i16_mul_with_overflow" | "u16_mul_with_overflow" | + "i32_mul_with_overflow" | "u32_mul_with_overflow" | + "i64_mul_with_overflow" | "u64_mul_with_overflow" => 0, + // would be cool to make these an enum instead of // strings! _ => fail!("unknown intrinsic in type_use") diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index bba5d85083b70..493d43a8127f8 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -706,10 +706,10 @@ pub fn AllBuiltinBounds() -> BuiltinBounds { } impl CLike for BuiltinBound { - pub fn to_uint(&self) -> uint { + fn to_uint(&self) -> uint { *self as uint } - pub fn from_uint(v: uint) -> BuiltinBound { + fn from_uint(v: uint) -> BuiltinBound { unsafe { cast::transmute(v) } } } @@ -3397,15 +3397,15 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str { match *err { terr_mismatch => ~"types differ", terr_purity_mismatch(values) => { - fmt!("expected %s fn but found %s fn", + fmt!("expected %s fn, found %s fn", values.expected.to_str(), values.found.to_str()) } terr_abi_mismatch(values) => { - fmt!("expected %s fn but found %s fn", + fmt!("expected %s fn, found %s fn", values.expected.to_str(), values.found.to_str()) } terr_onceness_mismatch(values) => { - fmt!("expected %s fn but found %s fn", + fmt!("expected %s fn, found %s fn", values.expected.to_str(), values.found.to_str()) } terr_sigil_mismatch(values) => { @@ -3419,25 +3419,25 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str { terr_ptr_mutability => ~"pointers differ in mutability", terr_ref_mutability => ~"references differ in mutability", terr_ty_param_size(values) => { - fmt!("expected a type with %? type params \ - but found one with %? type params", + fmt!("expected a type with %? type params, \ + found one with %? type params", values.expected, values.found) } terr_tuple_size(values) => { - fmt!("expected a tuple with %? elements \ - but found one with %? elements", + fmt!("expected a tuple with %? elements, \ + found one with %? elements", values.expected, values.found) } terr_record_size(values) => { - fmt!("expected a record with %? fields \ - but found one with %? fields", + fmt!("expected a record with %? fields, \ + found one with %? fields", values.expected, values.found) } terr_record_mutability => { ~"record elements differ in mutability" } terr_record_fields(values) => { - fmt!("expected a record with field `%s` but found one with field \ + fmt!("expected a record with field `%s`, found one with field \ `%s`", cx.sess.str_of(values.expected), cx.sess.str_of(values.found)) @@ -3454,22 +3454,22 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str { } terr_regions_insufficiently_polymorphic(br, _) => { fmt!("expected bound lifetime parameter %s, \ - but found concrete lifetime", + found concrete lifetime", bound_region_ptr_to_str(cx, br)) } terr_regions_overly_polymorphic(br, _) => { fmt!("expected concrete lifetime, \ - but found bound lifetime parameter %s", + found bound lifetime parameter %s", bound_region_ptr_to_str(cx, br)) } terr_vstores_differ(k, ref values) => { - fmt!("%s storage differs: expected %s but found %s", + fmt!("%s storage differs: expected %s, found %s", terr_vstore_kind_to_str(k), vstore_to_str(cx, (*values).expected), vstore_to_str(cx, (*values).found)) } terr_trait_stores_differ(_, ref values) => { - fmt!("trait storage differs: expected %s but found %s", + fmt!("trait storage differs: expected %s, found %s", trait_store_to_str(cx, (*values).expected), trait_store_to_str(cx, (*values).found)) } @@ -3478,38 +3478,38 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str { type_err_to_str(cx, err)) } terr_sorts(values) => { - fmt!("expected %s but found %s", + fmt!("expected %s, found %s", ty_sort_str(cx, values.expected), ty_sort_str(cx, values.found)) } terr_traits(values) => { - fmt!("expected trait %s but found trait %s", + fmt!("expected trait %s, found trait %s", item_path_str(cx, values.expected), item_path_str(cx, values.found)) } terr_builtin_bounds(values) => { if values.expected.is_empty() { - fmt!("expected no bounds but found `%s`", + fmt!("expected no bounds, found `%s`", values.found.user_string(cx)) } else if values.found.is_empty() { - fmt!("expected bounds `%s` but found no bounds", + fmt!("expected bounds `%s`, found no bounds", values.expected.user_string(cx)) } else { - fmt!("expected bounds `%s` but found bounds `%s`", + fmt!("expected bounds `%s`, found bounds `%s`", values.expected.user_string(cx), values.found.user_string(cx)) } } terr_integer_as_char => { - fmt!("expected an integral type but found char") + fmt!("expected an integral type, found char") } terr_int_mismatch(ref values) => { - fmt!("expected %s but found %s", + fmt!("expected %s, found %s", values.expected.to_str(), values.found.to_str()) } terr_float_mismatch(ref values) => { - fmt!("expected %s but found %s", + fmt!("expected %s, found %s", values.expected.to_str(), values.found.to_str()) } @@ -4315,16 +4315,16 @@ pub fn normalize_ty(cx: ctxt, t: t) -> t { } pub trait ExprTyProvider { - pub fn expr_ty(&self, ex: &ast::expr) -> t; - pub fn ty_ctxt(&self) -> ctxt; + fn expr_ty(&self, ex: &ast::expr) -> t; + fn ty_ctxt(&self) -> ctxt; } impl ExprTyProvider for ctxt { - pub fn expr_ty(&self, ex: &ast::expr) -> t { + fn expr_ty(&self, ex: &ast::expr) -> t { expr_ty(*self, ex) } - pub fn ty_ctxt(&self) -> ctxt { + fn ty_ctxt(&self) -> ctxt { *self } } @@ -4336,7 +4336,7 @@ pub fn eval_repeat_count(tcx: &T, count_expr: &ast::expr) -> const_eval::const_int(count) => if count < 0 { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found negative integer"); + repeat count, found negative integer"); return 0; } else { return count as uint @@ -4345,26 +4345,26 @@ pub fn eval_repeat_count(tcx: &T, count_expr: &ast::expr) -> const_eval::const_float(count) => { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found float"); + repeat count, found float"); return count as uint; } const_eval::const_str(_) => { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found string"); + repeat count, found string"); return 0; } const_eval::const_bool(_) => { tcx.ty_ctxt().sess.span_err(count_expr.span, "expected positive integer for \ - repeat count but found boolean"); + repeat count, found boolean"); return 0; } }, Err(*) => { tcx.ty_ctxt().sess.span_err(count_expr.span, - "expected constant integer for repeat count \ - but found variable"); + "expected constant integer for repeat count, \ + found variable"); return 0; } } diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index c666e98c9c15f..ad17d5cf0dfe3 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -177,7 +177,7 @@ fn ast_path_substs( if !vec::same_length(*decl_generics.type_param_defs, path.types) { this.tcx().sess.span_fatal( path.span, - fmt!("wrong number of type arguments: expected %u but found %u", + fmt!("wrong number of type arguments: expected %u, found %u", decl_generics.type_param_defs.len(), path.types.len())); } let tps = path.types.map(|a_t| ast_ty_to_ty(this, rscope, a_t)); diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index d8a9350e695d7..8341bc04a92f1 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -159,7 +159,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: &ast::Path, fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + fmt!("mismatched types: expected `%s`, found %s", e, actual)})}, Some(expected), ~"a structure pattern", None); @@ -202,7 +202,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: &ast::Path, fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + fmt!("mismatched types: expected `%s`, found %s", e, actual)})}, Some(expected), ~"an enum or structure pattern", None); @@ -341,7 +341,7 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: span, Some(&ast::def_struct(*)) | Some(&ast::def_variant(*)) => { let name = pprust::path_to_str(path, tcx.sess.intr()); tcx.sess.span_err(span, - fmt!("mismatched types: expected `%s` but found `%s`", + fmt!("mismatched types: expected `%s`, found `%s`", fcx.infcx().ty_to_str(expected), name)); } @@ -500,7 +500,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) { } _ => { tcx.sess.span_err(pat.span, - fmt!("mismatched types: expected `%s` but found struct", + fmt!("mismatched types: expected `%s`, found struct", fcx.infcx().ty_to_str(expected))); error_happened = true; } @@ -536,7 +536,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) { }; fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + fmt!("mismatched types: expected `%s`, found %s", e, actual)})}, Some(expected), ~"tuple", Some(&type_error)); fcx.write_error(pat.id); } @@ -585,7 +585,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) { pat.span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + fmt!("mismatched types: expected `%s`, found %s", e, actual)})}, Some(expected), ~"a vector pattern", @@ -643,7 +643,7 @@ pub fn check_pointer_pat(pcx: &pat_ctxt, span, |expected, actual| { expected.map_move_default(~"", |e| { - fmt!("mismatched types: expected `%s` but found %s", + fmt!("mismatched types: expected `%s`, found %s", e, actual)})}, Some(expected), fmt!("%s pattern", match pointer_kind { diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 8bc3241256875..6380c8b960b91 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -287,11 +287,11 @@ pub fn blank_fn_ctxt(ccx: @mut CrateCtxt, } impl ExprTyProvider for FnCtxt { - pub fn expr_ty(&self, ex: &ast::expr) -> ty::t { + fn expr_ty(&self, ex: &ast::expr) -> ty::t { self.expr_ty(ex) } - pub fn ty_ctxt(&self) -> ty::ctxt { + fn ty_ctxt(&self) -> ty::ctxt { self.ccx.tcx } } @@ -1310,7 +1310,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, ty::ty_bool => {} _ => fcx.type_error_message(call_expr.span, |actual| { fmt!("expected `for` closure to return `bool`, \ - but found `%s`", actual) }, + found `%s`", actual) }, output, None) } ty::mk_nil() @@ -1358,7 +1358,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, ty::ty_closure(ty::ClosureTy {sig: ref sig, _}) => sig, _ => { fcx.type_error_message(call_expr.span, |actual| { - fmt!("expected function but \ + fmt!("expected function, \ found `%s`", actual) }, fn_ty, None); &error_fn_sig } @@ -2750,7 +2750,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, pub fn require_integral(fcx: @mut FnCtxt, sp: span, t: ty::t) { if !type_is_integral(fcx, sp, t) { fcx.type_error_message(sp, |actual| { - fmt!("mismatched types: expected integral type but found `%s`", + fmt!("mismatched types: expected integral type, found `%s`", actual) }, t, None); } @@ -3130,28 +3130,28 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt, ast::def_ty(_) | ast::def_prim_ty(_) | ast::def_ty_param(*)=> { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type"); } ast::def_mod(*) | ast::def_foreign_mod(*) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found module"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found module"); } ast::def_use(*) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found use"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found use"); } ast::def_region(*) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found region"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found region"); } ast::def_typaram_binder(*) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found type parameter"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type parameter"); } ast::def_label(*) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found label"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found label"); } ast::def_self_ty(*) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found self ty"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found self ty"); } ast::def_method(*) => { - fcx.ccx.tcx.sess.span_bug(sp, "expected value but found method"); + fcx.ccx.tcx.sess.span_bug(sp, "expected value, found method"); } } } @@ -3647,6 +3647,39 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) { "bswap16" => (0, ~[ ty::mk_i16() ], ty::mk_i16()), "bswap32" => (0, ~[ ty::mk_i32() ], ty::mk_i32()), "bswap64" => (0, ~[ ty::mk_i64() ], ty::mk_i64()), + + "i8_add_with_overflow" | "i8_sub_with_overflow" | "i8_mul_with_overflow" => + (0, ~[ty::mk_i8(), ty::mk_i8()], + ty::mk_tup(tcx, ~[ty::mk_i8(), ty::mk_bool()])), + + "i16_add_with_overflow" | "i16_sub_with_overflow" | "i16_mul_with_overflow" => + (0, ~[ty::mk_i16(), ty::mk_i16()], + ty::mk_tup(tcx, ~[ty::mk_i16(), ty::mk_bool()])), + + "i32_add_with_overflow" | "i32_sub_with_overflow" | "i32_mul_with_overflow" => + (0, ~[ty::mk_i32(), ty::mk_i32()], + ty::mk_tup(tcx, ~[ty::mk_i32(), ty::mk_bool()])), + + "i64_add_with_overflow" | "i64_sub_with_overflow" | "i64_mul_with_overflow" => + (0, ~[ty::mk_i64(), ty::mk_i64()], + ty::mk_tup(tcx, ~[ty::mk_i64(), ty::mk_bool()])), + + "u8_add_with_overflow" | "u8_sub_with_overflow" | "u8_mul_with_overflow" => + (0, ~[ty::mk_u8(), ty::mk_u8()], + ty::mk_tup(tcx, ~[ty::mk_u8(), ty::mk_bool()])), + + "u16_add_with_overflow" | "u16_sub_with_overflow" | "u16_mul_with_overflow" => + (0, ~[ty::mk_u16(), ty::mk_u16()], + ty::mk_tup(tcx, ~[ty::mk_u16(), ty::mk_bool()])), + + "u32_add_with_overflow" | "u32_sub_with_overflow" | "u32_mul_with_overflow"=> + (0, ~[ty::mk_u32(), ty::mk_u32()], + ty::mk_tup(tcx, ~[ty::mk_u32(), ty::mk_bool()])), + + "u64_add_with_overflow" | "u64_sub_with_overflow" | "u64_mul_with_overflow" => + (0, ~[ty::mk_u64(), ty::mk_u64()], + ty::mk_tup(tcx, ~[ty::mk_u64(), ty::mk_bool()])), + ref other => { tcx.sess.span_err(it.span, fmt!("unrecognized intrinsic function: `%s`", diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 37f4a6ba49737..6d22f10f5b8ad 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -207,7 +207,7 @@ fn relate_trait_refs(vcx: &VtableContext, let tcx = vcx.tcx(); tcx.sess.span_err( location_info.span, - fmt!("expected %s, but found %s (%s)", + fmt!("expected %s, found %s (%s)", ppaux::trait_ref_to_str(tcx, &r_exp_trait_ref), ppaux::trait_ref_to_str(tcx, &r_act_trait_ref), ty::type_err_to_str(tcx, err))); diff --git a/src/librustc/middle/typeck/infer/doc.rs b/src/librustc/middle/typeck/infer/doc.rs index 11bfbc637169e..539418dbcb228 100644 --- a/src/librustc/middle/typeck/infer/doc.rs +++ b/src/librustc/middle/typeck/infer/doc.rs @@ -240,4 +240,4 @@ We make use of a trait-like impementation strategy to consolidate duplicated code between subtypes, GLB, and LUB computations. See the section on "Type Combining" below for details. -*/ \ No newline at end of file +*/ diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index 1b325dd8a4b99..d604540cd1641 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -76,12 +76,12 @@ use util::ppaux::UserString; use util::ppaux::note_and_explain_region; pub trait ErrorReporting { - pub fn report_region_errors(@mut self, - errors: &OptVec); + fn report_region_errors(@mut self, + errors: &OptVec); - pub fn report_and_explain_type_error(@mut self, - trace: TypeTrace, - terr: &ty::type_err); + fn report_and_explain_type_error(@mut self, + trace: TypeTrace, + terr: &ty::type_err); fn values_str(@mut self, values: &ValuePairs) -> Option<~str>; @@ -112,8 +112,8 @@ pub trait ErrorReporting { impl ErrorReporting for InferCtxt { - pub fn report_region_errors(@mut self, - errors: &OptVec) { + fn report_region_errors(@mut self, + errors: &OptVec) { for error in errors.iter() { match *error { ConcreteFailure(origin, sub, sup) => { @@ -139,7 +139,7 @@ impl ErrorReporting for InferCtxt { } } - pub fn report_and_explain_type_error(@mut self, + fn report_and_explain_type_error(@mut self, trace: TypeTrace, terr: &ty::type_err) { let tcx = self.tcx; @@ -173,7 +173,7 @@ impl ErrorReporting for InferCtxt { fn values_str(@mut self, values: &ValuePairs) -> Option<~str> { /*! - * Returns a string of the form "expected `%s` but found `%s`", + * Returns a string of the form "expected `%s`, found `%s`", * or None if this is a derived error. */ match *values { @@ -201,7 +201,7 @@ impl ErrorReporting for InferCtxt { return None; } - Some(fmt!("expected `%s` but found `%s`", + Some(fmt!("expected `%s`, found `%s`", expected.user_string(self.tcx), found.user_string(self.tcx))) } diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 7fa7daf614901..d0993674d35d1 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -765,7 +765,7 @@ impl InferCtxt { _ => { // if I leave out : ~str, it infers &str and complains |actual: ~str| { - fmt!("mismatched types: expected `%s` but found `%s`", + fmt!("mismatched types: expected `%s`, found `%s`", self.ty_to_str(resolved_expected), actual) } } diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index b1356ffb2d5e9..07ef7fadc658b 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -294,11 +294,11 @@ trait get_and_find_region { } impl get_and_find_region for isr_alist { - pub fn get(&self, br: ty::bound_region) -> ty::Region { + fn get(&self, br: ty::bound_region) -> ty::Region { self.find(br).unwrap() } - pub fn find(&self, br: ty::bound_region) -> Option { + fn find(&self, br: ty::bound_region) -> Option { let mut ret = None; do list::each(*self) |isr| { let (isr_br, isr_r) = *isr; diff --git a/src/librustc/rustc.rs b/src/librustc/rustc.rs index 4cb6d7de0d3dd..ec80d1a44ead9 100644 --- a/src/librustc/rustc.rs +++ b/src/librustc/rustc.rs @@ -319,7 +319,13 @@ pub fn monitor(f: ~fn(diagnostic::Emitter)) { let ch_capture = ch.clone(); let mut task_builder = task::task(); task_builder.supervised(); - task_builder.opts.stack_size = Some(STACK_SIZE); + + // XXX: Hacks on hacks. If the env is trying to override the stack size + // then *don't* set it explicitly. + if os::getenv("RUST_MIN_STACK").is_none() { + task_builder.opts.stack_size = Some(STACK_SIZE); + } + match do task_builder.try { let ch = ch_capture.clone(); let ch_capture = ch.clone(); diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 877338902cc07..dd43e22fc0c57 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -22,18 +22,18 @@ use extra::getopts; #[deriving(Clone, Eq)] pub enum OutputFormat { /// Markdown - pub Markdown, + Markdown, /// HTML, via markdown and pandoc - pub PandocHtml + PandocHtml } /// How to organize the output #[deriving(Clone, Eq)] pub enum OutputStyle { /// All in a single document - pub DocPerCrate, + DocPerCrate, /// Each module in its own document - pub DocPerMod + DocPerMod } /// The configuration for a rustdoc session diff --git a/src/librustpkg/testsuite/pass/src/fancy-lib/foo.rs b/src/librustpkg/testsuite/pass/src/fancy-lib/foo.rs index 542a6af402d05..3b233c9f6a88a 100644 --- a/src/librustpkg/testsuite/pass/src/fancy-lib/foo.rs +++ b/src/librustpkg/testsuite/pass/src/fancy-lib/foo.rs @@ -9,4 +9,4 @@ // except according to those terms. pub fn do_nothing() { -} \ No newline at end of file +} diff --git a/src/librustpkg/testsuite/pass/src/install-paths/bench.rs b/src/librustpkg/testsuite/pass/src/install-paths/bench.rs index e1641ccf07493..3d22ddc57faa3 100644 --- a/src/librustpkg/testsuite/pass/src/install-paths/bench.rs +++ b/src/librustpkg/testsuite/pass/src/install-paths/bench.rs @@ -14,4 +14,4 @@ fn g() { while(x < 1000) { x += 1; } -} \ No newline at end of file +} diff --git a/src/librustpkg/testsuite/pass/src/simple-lib/src/foo.rs b/src/librustpkg/testsuite/pass/src/simple-lib/src/foo.rs index 542a6af402d05..3b233c9f6a88a 100644 --- a/src/librustpkg/testsuite/pass/src/simple-lib/src/foo.rs +++ b/src/librustpkg/testsuite/pass/src/simple-lib/src/foo.rs @@ -9,4 +9,4 @@ // except according to those terms. pub fn do_nothing() { -} \ No newline at end of file +} diff --git a/src/libstd/nil.rs b/src/libstd/nil.rs index 3507dc9d2b233..d2e9cf9ae7e96 100644 --- a/src/libstd/nil.rs +++ b/src/libstd/nil.rs @@ -49,7 +49,9 @@ impl TotalEq for () { #[cfg(not(test))] impl Zero for () { + #[inline] fn zero() -> () { () } + #[inline] fn is_zero(&self) -> bool { true } } diff --git a/src/libstd/num/num.rs b/src/libstd/num/num.rs index bbadf1caca241..04e9a862bd4bb 100644 --- a/src/libstd/num/num.rs +++ b/src/libstd/num/num.rs @@ -18,7 +18,9 @@ use cmp::{Eq, ApproxEq, Ord}; use ops::{Add, Sub, Mul, Div, Rem, Neg}; use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr}; -use option::Option; +use option::{Option, Some, None}; +#[cfg(not(stage0))] +use unstable::intrinsics; pub mod strconv; @@ -413,11 +415,11 @@ impl_num_cast!(f64, to_f64) impl_num_cast!(float, to_float) pub trait ToStrRadix { - pub fn to_str_radix(&self, radix: uint) -> ~str; + fn to_str_radix(&self, radix: uint) -> ~str; } pub trait FromStrRadix { - pub fn from_str_radix(str: &str, radix: uint) -> Option; + fn from_str_radix(str: &str, radix: uint) -> Option; } /// Calculates a power to a given radix, optimized for uint `pow` and `radix`. @@ -516,6 +518,414 @@ impl Saturating for u16 {} impl Saturating for u32 {} impl Saturating for u64 {} +pub trait CheckedAdd: Add { + fn checked_add(&self, v: &Self) -> Option; +} + +#[cfg(not(stage0))] +impl CheckedAdd for i8 { + #[inline] + fn checked_add(&self, v: &i8) -> Option { + unsafe { + let (x, y) = intrinsics::i8_add_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedAdd for i16 { + #[inline] + fn checked_add(&self, v: &i16) -> Option { + unsafe { + let (x, y) = intrinsics::i16_add_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedAdd for i32 { + #[inline] + fn checked_add(&self, v: &i32) -> Option { + unsafe { + let (x, y) = intrinsics::i32_add_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedAdd for i64 { + #[inline] + fn checked_add(&self, v: &i64) -> Option { + unsafe { + let (x, y) = intrinsics::i64_add_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0), target_word_size = "32")] +impl CheckedAdd for int { + #[inline] + fn checked_add(&self, v: &int) -> Option { + unsafe { + let (x, y) = intrinsics::i32_add_with_overflow(*self as i32, *v as i32); + if y { None } else { Some(x as int) } + } + } +} + +#[cfg(not(stage0), target_word_size = "64")] +impl CheckedAdd for int { + #[inline] + fn checked_add(&self, v: &int) -> Option { + unsafe { + let (x, y) = intrinsics::i64_add_with_overflow(*self as i64, *v as i64); + if y { None } else { Some(x as int) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedAdd for u8 { + #[inline] + fn checked_add(&self, v: &u8) -> Option { + unsafe { + let (x, y) = intrinsics::u8_add_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedAdd for u16 { + #[inline] + fn checked_add(&self, v: &u16) -> Option { + unsafe { + let (x, y) = intrinsics::u16_add_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedAdd for u32 { + #[inline] + fn checked_add(&self, v: &u32) -> Option { + unsafe { + let (x, y) = intrinsics::u32_add_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedAdd for u64 { + #[inline] + fn checked_add(&self, v: &u64) -> Option { + unsafe { + let (x, y) = intrinsics::u64_add_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0), target_word_size = "32")] +impl CheckedAdd for uint { + #[inline] + fn checked_add(&self, v: &uint) -> Option { + unsafe { + let (x, y) = intrinsics::u32_add_with_overflow(*self as u32, *v as u32); + if y { None } else { Some(x as uint) } + } + } +} + +#[cfg(not(stage0), target_word_size = "64")] +impl CheckedAdd for uint { + #[inline] + fn checked_add(&self, v: &uint) -> Option { + unsafe { + let (x, y) = intrinsics::u64_add_with_overflow(*self as u64, *v as u64); + if y { None } else { Some(x as uint) } + } + } +} + +pub trait CheckedSub: Sub { + fn checked_sub(&self, v: &Self) -> Option; +} + +#[cfg(not(stage0))] +impl CheckedSub for i8 { + #[inline] + fn checked_sub(&self, v: &i8) -> Option { + unsafe { + let (x, y) = intrinsics::i8_sub_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedSub for i16 { + #[inline] + fn checked_sub(&self, v: &i16) -> Option { + unsafe { + let (x, y) = intrinsics::i16_sub_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedSub for i32 { + #[inline] + fn checked_sub(&self, v: &i32) -> Option { + unsafe { + let (x, y) = intrinsics::i32_sub_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedSub for i64 { + #[inline] + fn checked_sub(&self, v: &i64) -> Option { + unsafe { + let (x, y) = intrinsics::i64_sub_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0), target_word_size = "32")] +impl CheckedSub for int { + #[inline] + fn checked_sub(&self, v: &int) -> Option { + unsafe { + let (x, y) = intrinsics::i32_sub_with_overflow(*self as i32, *v as i32); + if y { None } else { Some(x as int) } + } + } +} + +#[cfg(not(stage0), target_word_size = "64")] +impl CheckedSub for int { + #[inline] + fn checked_sub(&self, v: &int) -> Option { + unsafe { + let (x, y) = intrinsics::i64_sub_with_overflow(*self as i64, *v as i64); + if y { None } else { Some(x as int) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedSub for u8 { + #[inline] + fn checked_sub(&self, v: &u8) -> Option { + unsafe { + let (x, y) = intrinsics::u8_sub_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedSub for u16 { + #[inline] + fn checked_sub(&self, v: &u16) -> Option { + unsafe { + let (x, y) = intrinsics::u16_sub_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedSub for u32 { + #[inline] + fn checked_sub(&self, v: &u32) -> Option { + unsafe { + let (x, y) = intrinsics::u32_sub_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedSub for u64 { + #[inline] + fn checked_sub(&self, v: &u64) -> Option { + unsafe { + let (x, y) = intrinsics::u64_sub_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0), target_word_size = "32")] +impl CheckedSub for uint { + #[inline] + fn checked_sub(&self, v: &uint) -> Option { + unsafe { + let (x, y) = intrinsics::u32_sub_with_overflow(*self as u32, *v as u32); + if y { None } else { Some(x as uint) } + } + } +} + +#[cfg(not(stage0), target_word_size = "64")] +impl CheckedSub for uint { + #[inline] + fn checked_sub(&self, v: &uint) -> Option { + unsafe { + let (x, y) = intrinsics::u64_sub_with_overflow(*self as u64, *v as u64); + if y { None } else { Some(x as uint) } + } + } +} + +pub trait CheckedMul: Mul { + fn checked_mul(&self, v: &Self) -> Option; +} + +#[cfg(not(stage0))] +impl CheckedMul for i8 { + #[inline] + fn checked_mul(&self, v: &i8) -> Option { + unsafe { + let (x, y) = intrinsics::i8_mul_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedMul for i16 { + #[inline] + fn checked_mul(&self, v: &i16) -> Option { + unsafe { + let (x, y) = intrinsics::i16_mul_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedMul for i32 { + #[inline] + fn checked_mul(&self, v: &i32) -> Option { + unsafe { + let (x, y) = intrinsics::i32_mul_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedMul for i64 { + #[inline] + fn checked_mul(&self, v: &i64) -> Option { + unsafe { + let (x, y) = intrinsics::i64_mul_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0), target_word_size = "32")] +impl CheckedMul for int { + #[inline] + fn checked_mul(&self, v: &int) -> Option { + unsafe { + let (x, y) = intrinsics::i32_mul_with_overflow(*self as i32, *v as i32); + if y { None } else { Some(x as int) } + } + } +} + +#[cfg(not(stage0), target_word_size = "64")] +impl CheckedMul for int { + #[inline] + fn checked_mul(&self, v: &int) -> Option { + unsafe { + let (x, y) = intrinsics::i64_mul_with_overflow(*self as i64, *v as i64); + if y { None } else { Some(x as int) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedMul for u8 { + #[inline] + fn checked_mul(&self, v: &u8) -> Option { + unsafe { + let (x, y) = intrinsics::u8_mul_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedMul for u16 { + #[inline] + fn checked_mul(&self, v: &u16) -> Option { + unsafe { + let (x, y) = intrinsics::u16_mul_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedMul for u32 { + #[inline] + fn checked_mul(&self, v: &u32) -> Option { + unsafe { + let (x, y) = intrinsics::u32_mul_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0))] +impl CheckedMul for u64 { + #[inline] + fn checked_mul(&self, v: &u64) -> Option { + unsafe { + let (x, y) = intrinsics::u64_mul_with_overflow(*self, *v); + if y { None } else { Some(x) } + } + } +} + +#[cfg(not(stage0), target_word_size = "32")] +impl CheckedMul for uint { + #[inline] + fn checked_mul(&self, v: &uint) -> Option { + unsafe { + let (x, y) = intrinsics::u32_mul_with_overflow(*self as u32, *v as u32); + if y { None } else { Some(x as uint) } + } + } +} + +#[cfg(not(stage0), target_word_size = "64")] +impl CheckedMul for uint { + #[inline] + fn checked_mul(&self, v: &uint) -> Option { + unsafe { + let (x, y) = intrinsics::u64_mul_with_overflow(*self as u64, *v as u64); + if y { None } else { Some(x as uint) } + } + } +} + /// Helper function for testing numeric operations #[cfg(test)] pub fn test_num(ten: T, two: T) { @@ -534,6 +944,8 @@ pub fn test_num(ten: T, two: T) { #[cfg(test)] mod tests { + use prelude::*; + use uint; use super::*; macro_rules! test_cast_20( @@ -639,4 +1051,39 @@ mod tests { assert_eq!(max_value.saturating_sub(-max_value), max_value); assert_eq!((max_value-2).saturating_sub(-1), max_value-1); } + + #[test] + fn test_checked_add() { + let five_less = uint::max_value - 5; + assert_eq!(five_less.checked_add(&0), Some(uint::max_value - 5)); + assert_eq!(five_less.checked_add(&1), Some(uint::max_value - 4)); + assert_eq!(five_less.checked_add(&2), Some(uint::max_value - 3)); + assert_eq!(five_less.checked_add(&3), Some(uint::max_value - 2)); + assert_eq!(five_less.checked_add(&4), Some(uint::max_value - 1)); + assert_eq!(five_less.checked_add(&5), Some(uint::max_value)); + assert_eq!(five_less.checked_add(&6), None); + assert_eq!(five_less.checked_add(&7), None); + } + + #[test] + fn test_checked_sub() { + assert_eq!(5u.checked_sub(&0), Some(5)); + assert_eq!(5u.checked_sub(&1), Some(4)); + assert_eq!(5u.checked_sub(&2), Some(3)); + assert_eq!(5u.checked_sub(&3), Some(2)); + assert_eq!(5u.checked_sub(&4), Some(1)); + assert_eq!(5u.checked_sub(&5), Some(0)); + assert_eq!(5u.checked_sub(&6), None); + assert_eq!(5u.checked_sub(&7), None); + } + + #[test] + fn test_checked_mul() { + let third = uint::max_value / 3; + assert_eq!(third.checked_mul(&0), Some(0)); + assert_eq!(third.checked_mul(&1), Some(third)); + assert_eq!(third.checked_mul(&2), Some(third * 2)); + assert_eq!(third.checked_mul(&3), Some(third * 3)); + assert_eq!(third.checked_mul(&4), None); + } } diff --git a/src/libstd/ops.rs b/src/libstd/ops.rs index 756b4a10d3c90..e41109ecf675b 100644 --- a/src/libstd/ops.rs +++ b/src/libstd/ops.rs @@ -105,4 +105,4 @@ mod bench { HasDtor { x : 10 }; } } -} \ No newline at end of file +} diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 9a8737f4dee3f..93e14be582b60 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -53,7 +53,7 @@ pub use iter::Times; pub use iterator::Extendable; pub use iterator::{Iterator, DoubleEndedIterator}; pub use iterator::{ClonableIterator, OrdIterator}; -pub use num::{Num, NumCast}; +pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul}; pub use num::{Orderable, Signed, Unsigned, Round}; pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic}; pub use num::{Integer, Fractional, Real, RealExt}; diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index 26653a51d6618..eccbcd228b725 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -416,7 +416,7 @@ impl Add for *T { /// Add an integer value to a pointer to get an offset pointer. /// Is calculated according to the size of the type pointed to. #[inline] - pub fn add(&self, rhs: &I) -> *T { + fn add(&self, rhs: &I) -> *T { self.offset(rhs.to_int() as int) } } @@ -426,7 +426,7 @@ impl Sub for *T { /// Subtract an integer value from a pointer to get an offset pointer. /// Is calculated according to the size of the type pointed to. #[inline] - pub fn sub(&self, rhs: &I) -> *T { + fn sub(&self, rhs: &I) -> *T { self.offset(-rhs.to_int() as int) } } @@ -436,7 +436,7 @@ impl Add for *mut T { /// Add an integer value to a pointer to get an offset pointer. /// Is calculated according to the size of the type pointed to. #[inline] - pub fn add(&self, rhs: &I) -> *mut T { + fn add(&self, rhs: &I) -> *mut T { self.offset(rhs.to_int() as int) } } @@ -446,7 +446,7 @@ impl Sub for *mut T { /// Subtract an integer value from a pointer to get an offset pointer. /// Is calculated according to the size of the type pointed to. #[inline] - pub fn sub(&self, rhs: &I) -> *mut T { + fn sub(&self, rhs: &I) -> *mut T { self.offset(-rhs.to_int() as int) } } diff --git a/src/libstd/rand.rs b/src/libstd/rand.rs index 5f8fa9fddbcf7..500278fddb0b1 100644 --- a/src/libstd/rand.rs +++ b/src/libstd/rand.rs @@ -260,7 +260,7 @@ pub mod rustrt { /// A random number generator pub trait Rng { /// Return the next random integer - pub fn next(&mut self) -> u32; + fn next(&mut self) -> u32; } /// A value with a particular weight compared to other values @@ -825,7 +825,7 @@ pub struct XorShiftRng { impl Rng for XorShiftRng { #[inline] - pub fn next(&mut self) -> u32 { + fn next(&mut self) -> u32 { let x = self.x; let t = x ^ (x << 11); self.x = self.y; diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 793e244bec7b9..b5296968d07db 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -714,6 +714,7 @@ mod test { use rt::test::*; use cell::Cell; use iter::Times; + use rt::util; #[test] fn oneshot_single_thread_close_port_first() { @@ -862,6 +863,7 @@ mod test { #[test] fn oneshot_multi_thread_close_stress() { + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } do stress_factor().times { do run_in_newsched_task { let (port, chan) = oneshot::(); @@ -877,6 +879,7 @@ mod test { #[test] fn oneshot_multi_thread_send_close_stress() { + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } do stress_factor().times { do run_in_newsched_task { let (port, chan) = oneshot::(); @@ -897,6 +900,7 @@ mod test { #[test] fn oneshot_multi_thread_recv_close_stress() { + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } do stress_factor().times { do run_in_newsched_task { let (port, chan) = oneshot::(); @@ -923,6 +927,7 @@ mod test { #[test] fn oneshot_multi_thread_send_recv_stress() { + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } do stress_factor().times { do run_in_newsched_task { let (port, chan) = oneshot::<~int>(); @@ -942,6 +947,7 @@ mod test { #[test] fn stream_send_recv_stress() { + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } do stress_factor().times { do run_in_mt_newsched_task { let (port, chan) = stream::<~int>(); @@ -986,6 +992,7 @@ mod test { #[test] fn shared_chan_stress() { + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } do run_in_mt_newsched_task { let (port, chan) = stream(); let chan = SharedChan::new(chan); @@ -1005,6 +1012,7 @@ mod test { #[test] fn shared_port_stress() { + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } do run_in_mt_newsched_task { // XXX: Removing these type annotations causes an ICE let (end_port, end_chan) = stream::<()>(); @@ -1085,6 +1093,8 @@ mod test { use rand; use rand::RngUtil; + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } + do run_in_mt_newsched_task { let (end_port, end_chan) = stream::<()>(); let end_chan = SharedChan::new(end_chan); diff --git a/src/libstd/rt/io/comm_adapters.rs b/src/libstd/rt/io/comm_adapters.rs index 6a3e44b2a4d70..06424fee8bc12 100644 --- a/src/libstd/rt/io/comm_adapters.rs +++ b/src/libstd/rt/io/comm_adapters.rs @@ -31,9 +31,9 @@ impl> ChanWriter { } impl> Writer for ChanWriter { - pub fn write(&mut self, _buf: &[u8]) { fail!() } + fn write(&mut self, _buf: &[u8]) { fail!() } - pub fn flush(&mut self) { fail!() } + fn flush(&mut self) { fail!() } } struct ReaderPort; diff --git a/src/libstd/rt/io/mock.rs b/src/libstd/rt/io/mock.rs index b580b752bd985..c46e1372c6414 100644 --- a/src/libstd/rt/io/mock.rs +++ b/src/libstd/rt/io/mock.rs @@ -47,4 +47,4 @@ impl MockWriter { impl Writer for MockWriter { fn write(&mut self, buf: &[u8]) { (self.write)(buf) } fn flush(&mut self) { (self.flush)() } -} \ No newline at end of file +} diff --git a/src/libstd/rt/io/timer.rs b/src/libstd/rt/io/timer.rs index c7820ebf6238b..78ce52fca20ec 100644 --- a/src/libstd/rt/io/timer.rs +++ b/src/libstd/rt/io/timer.rs @@ -61,4 +61,4 @@ mod test { } } } -} \ No newline at end of file +} diff --git a/src/libstd/rt/metrics.rs b/src/libstd/rt/metrics.rs index b0c0fa5d70862..8912420645750 100644 --- a/src/libstd/rt/metrics.rs +++ b/src/libstd/rt/metrics.rs @@ -95,4 +95,4 @@ impl ToStr for SchedMetrics { self.release_no_tombstone ) } -} \ No newline at end of file +} diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index ce4e64c47d2ef..e65a45f0e0749 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -819,6 +819,7 @@ mod test { use cell::Cell; use rt::thread::Thread; use rt::task::{Task, Sched}; + use rt::util; use option::{Some}; #[test] @@ -1040,6 +1041,7 @@ mod test { #[test] fn test_stress_schedule_task_states() { + if util::limit_thread_creation_due_to_osx_and_valgrind() { return; } let n = stress_factor() * 120; for _ in range(0, n as int) { test_schedule_home_states(); diff --git a/src/libstd/rt/sleeper_list.rs b/src/libstd/rt/sleeper_list.rs index d327023de978a..48012199bbef5 100644 --- a/src/libstd/rt/sleeper_list.rs +++ b/src/libstd/rt/sleeper_list.rs @@ -56,4 +56,4 @@ impl Clone for SleeperList { stack: self.stack.clone() } } -} \ No newline at end of file +} diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs index ca94468e1adae..174c780afe01d 100644 --- a/src/libstd/rt/test.rs +++ b/src/libstd/rt/test.rs @@ -18,7 +18,7 @@ use iterator::{Iterator, range}; use super::io::net::ip::{SocketAddr, Ipv4Addr, Ipv6Addr}; use vec::{OwnedVector, MutableVector, ImmutableVector}; use rt::sched::Scheduler; -use unstable::run_in_bare_thread; +use unstable::{run_in_bare_thread}; use rt::thread::Thread; use rt::task::Task; use rt::uv::uvio::UvEventLoop; @@ -160,10 +160,14 @@ pub fn run_in_mt_newsched_task(f: ~fn()) { let nthreads = match os::getenv("RUST_RT_TEST_THREADS") { Some(nstr) => FromStr::from_str(nstr).unwrap(), None => { - // Using more threads than cores in test code - // to force the OS to preempt them frequently. - // Assuming that this help stress test concurrent types. - util::num_cpus() * 2 + if util::limit_thread_creation_due_to_osx_and_valgrind() { + 1 + } else { + // Using more threads than cores in test code + // to force the OS to preempt them frequently. + // Assuming that this help stress test concurrent types. + util::num_cpus() * 2 + } } }; diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 6280b64ecf51c..148c40c38b1cb 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -14,6 +14,7 @@ use libc; use option::{Some, None}; use os; use str::StrSlice; +use unstable::running_on_valgrind; /// Get the number of cores available pub fn num_cpus() -> uint { @@ -26,12 +27,35 @@ pub fn num_cpus() -> uint { } } +/// Valgrind has a fixed-sized array (size around 2000) of segment descriptors wired into it; this +/// is a hard limit and requires rebuilding valgrind if you want to go beyond it. Normally this is +/// not a problem, but in some tests, we produce a lot of threads casually. Making lots of threads +/// alone might not be a problem _either_, except on OSX, the segments produced for new threads +/// _take a while_ to get reclaimed by the OS. Combined with the fact that libuv schedulers fork off +/// a separate thread for polling fsevents on OSX, we get a perfect storm of creating "too many +/// mappings" for valgrind to handle when running certain stress tests in the runtime. +#[cfg(target_os="macos")] +pub fn limit_thread_creation_due_to_osx_and_valgrind() -> bool { + running_on_valgrind() +} + +#[cfg(not(target_os="macos"))] +pub fn limit_thread_creation_due_to_osx_and_valgrind() -> bool { + false +} + /// Get's the number of scheduler threads requested by the environment /// either `RUST_THREADS` or `num_cpus`. pub fn default_sched_threads() -> uint { match os::getenv("RUST_THREADS") { Some(nstr) => FromStr::from_str(nstr).unwrap(), - None => num_cpus() + None => { + if limit_thread_creation_due_to_osx_and_valgrind() { + 1 + } else { + num_cpus() + } + } } } diff --git a/src/libstd/rt/uv/mod.rs b/src/libstd/rt/uv/mod.rs index ae5e7dd27b5f3..6c5a28b31b1e4 100644 --- a/src/libstd/rt/uv/mod.rs +++ b/src/libstd/rt/uv/mod.rs @@ -90,8 +90,8 @@ pub trait Request { } /// A type that wraps a native handle pub trait NativeHandle { - pub fn from_native_handle(T) -> Self; - pub fn native_handle(&self) -> T; + fn from_native_handle(T) -> Self; + fn native_handle(&self) -> T; } impl Loop { @@ -155,7 +155,7 @@ pub trait WatcherInterop { impl> WatcherInterop for W { /// Get the uv event loop from a Watcher - pub fn event_loop(&self) -> Loop { + fn event_loop(&self) -> Loop { unsafe { let handle = self.native_handle(); let loop_ = uvll::get_loop_for_uv_handle(handle); @@ -163,7 +163,7 @@ impl> WatcherInterop for W { } } - pub fn install_watcher_data(&mut self) { + fn install_watcher_data(&mut self) { unsafe { let data = ~WatcherData { read_cb: None, @@ -182,7 +182,7 @@ impl> WatcherInterop for W { } } - pub fn get_watcher_data<'r>(&'r mut self) -> &'r mut WatcherData { + fn get_watcher_data<'r>(&'r mut self) -> &'r mut WatcherData { unsafe { let data = uvll::get_data_for_uv_handle(self.native_handle()); let data = transmute::<&*c_void, &mut ~WatcherData>(&data); @@ -190,7 +190,7 @@ impl> WatcherInterop for W { } } - pub fn drop_watcher_data(&mut self) { + fn drop_watcher_data(&mut self) { unsafe { let data = uvll::get_data_for_uv_handle(self.native_handle()); let _data = transmute::<*c_void, ~WatcherData>(data); diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 31e317604c77e..30c10e04c799a 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -941,6 +941,7 @@ mod tests { use path::Path; use run; use str; + use unstable::running_on_valgrind; #[test] #[cfg(windows)] @@ -1349,12 +1350,4 @@ mod tests { assert!(output.contains("RUN_TEST_NEW_ENV=123")); } - - fn running_on_valgrind() -> bool { - unsafe { rust_running_on_valgrind() != 0 } - } - - extern { - fn rust_running_on_valgrind() -> uintptr_t; - } } diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 26a00cca4c82b..85057a609f502 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -175,14 +175,14 @@ pub fn push_str(lhs: &mut ~str, rhs: &str) { #[allow(missing_doc)] pub trait StrVector { - pub fn concat(&self) -> ~str; - pub fn connect(&self, sep: &str) -> ~str; + fn concat(&self) -> ~str; + fn connect(&self, sep: &str) -> ~str; } impl<'self, S: Str> StrVector for &'self [S] { /// Concatenate a vector of strings. #[cfg(stage0)] - pub fn concat(&self) -> ~str { + fn concat(&self) -> ~str { if self.is_empty() { return ~""; } let len = self.iter().map(|s| s.as_slice().len()).sum(); @@ -207,7 +207,7 @@ impl<'self, S: Str> StrVector for &'self [S] { /// Concatenate a vector of strings. #[cfg(not(stage0))] - pub fn concat(&self) -> ~str { + fn concat(&self) -> ~str { if self.is_empty() { return ~""; } let len = self.iter().map(|s| s.as_slice().len()).sum(); @@ -231,7 +231,7 @@ impl<'self, S: Str> StrVector for &'self [S] { /// Concatenate a vector of strings, placing a given separator between each. #[cfg(stage0)] - pub fn connect(&self, sep: &str) -> ~str { + fn connect(&self, sep: &str) -> ~str { if self.is_empty() { return ~""; } // concat is faster @@ -272,7 +272,7 @@ impl<'self, S: Str> StrVector for &'self [S] { /// Concatenate a vector of strings, placing a given separator between each. #[cfg(not(stage0))] - pub fn connect(&self, sep: &str) -> ~str { + fn connect(&self, sep: &str) -> ~str { if self.is_empty() { return ~""; } // concat is faster @@ -807,6 +807,7 @@ pub fn from_utf16(v: &[u16]) -> ~str { /// Allocates a new string with the specified capacity. The string returned is /// the empty string, but has capacity for much more. +#[cfg(stage0)] #[inline] pub fn with_capacity(capacity: uint) -> ~str { let mut buf = ~""; @@ -814,6 +815,16 @@ pub fn with_capacity(capacity: uint) -> ~str { buf } +/// Allocates a new string with the specified capacity. The string returned is +/// the empty string, but has capacity for much more. +#[cfg(not(stage0))] +#[inline] +pub fn with_capacity(capacity: uint) -> ~str { + unsafe { + cast::transmute(vec::with_capacity::<~[u8]>(capacity)) + } +} + /// As char_len but for a slice of a string /// /// # Arguments @@ -948,6 +959,14 @@ pub mod raw { ::cast::transmute(v) } + #[lang="strdup_uniq"] + #[cfg(not(test))] + #[allow(missing_doc)] + #[inline] + pub unsafe fn strdup_uniq(ptr: *u8, len: uint) -> ~str { + from_buf_len(ptr, len) + } + /// Create a Rust string from a null-terminated C string pub unsafe fn from_c_str(buf: *libc::c_char) -> ~str { let mut curr = buf; @@ -1783,7 +1802,7 @@ impl<'self> StrSlice<'self> for &'self str { /// # Return value /// /// The original string with all occurances of `from` replaced with `to` - pub fn replace(&self, from: &str, to: &str) -> ~str { + fn replace(&self, from: &str, to: &str) -> ~str { let mut result = ~""; let mut last_end = 0; for (start, end) in self.matches_index_iter(from) { @@ -2380,7 +2399,7 @@ impl OwnedStr for ~str { /// * n - The number of bytes to reserve space for #[cfg(stage0)] #[inline] - pub fn reserve(&mut self, n: uint) { + fn reserve(&mut self, n: uint) { unsafe { let v: *mut ~[u8] = cast::transmute(self); (*v).reserve(n + 1); @@ -2403,7 +2422,7 @@ impl OwnedStr for ~str { /// * n - The number of bytes to reserve space for #[cfg(not(stage0))] #[inline] - pub fn reserve(&mut self, n: uint) { + fn reserve(&mut self, n: uint) { unsafe { let v: &mut ~[u8] = cast::transmute(self); (*v).reserve(n); @@ -3700,7 +3719,7 @@ mod tests { #[cfg(test)] mod bench { use extra::test::BenchHarness; - use str; + use super::*; #[bench] fn is_utf8_100_ascii(bh: &mut BenchHarness) { @@ -3710,7 +3729,7 @@ mod bench { assert_eq!(100, s.len()); do bh.iter { - str::is_utf8(s); + is_utf8(s); } } @@ -3719,7 +3738,7 @@ mod bench { let s = bytes!("𐌀𐌖𐌋𐌄𐌑𐌉ปรدولة الكويتทศไทย中华𐍅𐌿𐌻𐍆𐌹𐌻𐌰"); assert_eq!(100, s.len()); do bh.iter { - str::is_utf8(s); + is_utf8(s); } } @@ -3742,4 +3761,11 @@ mod bench { s.map_chars(|c| ((c as uint) + 1) as char); } } + + #[bench] + fn bench_with_capacity(bh: &mut BenchHarness) { + do bh.iter { + with_capacity(100); + } + } } diff --git a/src/libstd/unstable/intrinsics.rs b/src/libstd/unstable/intrinsics.rs index c60edad3dbd56..9f69ee47e9bd6 100644 --- a/src/libstd/unstable/intrinsics.rs +++ b/src/libstd/unstable/intrinsics.rs @@ -428,6 +428,60 @@ extern "rust-intrinsic" { pub fn bswap16(x: i16) -> i16; pub fn bswap32(x: i32) -> i32; pub fn bswap64(x: i64) -> i64; + + #[cfg(not(stage0))] + pub fn i8_add_with_overflow(x: i8, y: i8) -> (i8, bool); + #[cfg(not(stage0))] + pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool); + #[cfg(not(stage0))] + pub fn i32_add_with_overflow(x: i32, y: i32) -> (i32, bool); + #[cfg(not(stage0))] + pub fn i64_add_with_overflow(x: i64, y: i64) -> (i64, bool); + + #[cfg(not(stage0))] + pub fn u8_add_with_overflow(x: u8, y: u8) -> (u8, bool); + #[cfg(not(stage0))] + pub fn u16_add_with_overflow(x: u16, y: u16) -> (u16, bool); + #[cfg(not(stage0))] + pub fn u32_add_with_overflow(x: u32, y: u32) -> (u32, bool); + #[cfg(not(stage0))] + pub fn u64_add_with_overflow(x: u64, y: u64) -> (u64, bool); + + #[cfg(not(stage0))] + pub fn i8_sub_with_overflow(x: i8, y: i8) -> (i8, bool); + #[cfg(not(stage0))] + pub fn i16_sub_with_overflow(x: i16, y: i16) -> (i16, bool); + #[cfg(not(stage0))] + pub fn i32_sub_with_overflow(x: i32, y: i32) -> (i32, bool); + #[cfg(not(stage0))] + pub fn i64_sub_with_overflow(x: i64, y: i64) -> (i64, bool); + + #[cfg(not(stage0))] + pub fn u8_sub_with_overflow(x: u8, y: u8) -> (u8, bool); + #[cfg(not(stage0))] + pub fn u16_sub_with_overflow(x: u16, y: u16) -> (u16, bool); + #[cfg(not(stage0))] + pub fn u32_sub_with_overflow(x: u32, y: u32) -> (u32, bool); + #[cfg(not(stage0))] + pub fn u64_sub_with_overflow(x: u64, y: u64) -> (u64, bool); + + #[cfg(not(stage0))] + pub fn i8_mul_with_overflow(x: i8, y: i8) -> (i8, bool); + #[cfg(not(stage0))] + pub fn i16_mul_with_overflow(x: i16, y: i16) -> (i16, bool); + #[cfg(not(stage0))] + pub fn i32_mul_with_overflow(x: i32, y: i32) -> (i32, bool); + #[cfg(not(stage0))] + pub fn i64_mul_with_overflow(x: i64, y: i64) -> (i64, bool); + + #[cfg(not(stage0))] + pub fn u8_mul_with_overflow(x: u8, y: u8) -> (u8, bool); + #[cfg(not(stage0))] + pub fn u16_mul_with_overflow(x: u16, y: u16) -> (u16, bool); + #[cfg(not(stage0))] + pub fn u32_mul_with_overflow(x: u32, y: u32) -> (u32, bool); + #[cfg(not(stage0))] + pub fn u64_mul_with_overflow(x: u64, y: u64) -> (u64, bool); } #[cfg(target_endian = "little")] pub fn to_le16(x: i16) -> i16 { x } diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs index 9e7ac1fd7db13..d8df967a45ca2 100644 --- a/src/libstd/unstable/lang.rs +++ b/src/libstd/unstable/lang.rs @@ -12,8 +12,7 @@ use c_str::ToCStr; use cast::transmute; -use libc::{c_char, c_uchar, c_void, size_t, uintptr_t}; -use str; +use libc::{c_char, c_void, size_t, uintptr_t}; use sys; use rt::task::Task; use rt::local::Local; @@ -93,12 +92,6 @@ pub unsafe fn check_not_borrowed(a: *u8, borrowck::check_not_borrowed(a, file, line) } -#[lang="strdup_uniq"] -#[inline] -pub unsafe fn strdup_uniq(ptr: *c_uchar, len: uint) -> ~str { - str::raw::from_buf_len(ptr, len) -} - #[lang="annihilate"] pub unsafe fn annihilate() { ::cleanup::annihilate() diff --git a/src/libstd/unstable/mod.rs b/src/libstd/unstable/mod.rs index f721dd47a66a0..7a6f9bd6d2224 100644 --- a/src/libstd/unstable/mod.rs +++ b/src/libstd/unstable/mod.rs @@ -14,6 +14,7 @@ use comm::{GenericChan, GenericPort}; use comm; use prelude::*; use task; +use libc::uintptr_t; pub mod dynamic_lib; @@ -116,3 +117,16 @@ pub fn change_dir_locked(p: &Path, action: &fn()) -> bool { fn rust_drop_change_dir_lock(); } } + + +/// Dynamically inquire about whether we're running under V. +/// You should usually not use this unless your test definitely +/// can't run correctly un-altered. Valgrind is there to help +/// you notice weirdness in normal, un-doctored code paths! +pub fn running_on_valgrind() -> bool { + unsafe { rust_running_on_valgrind() != 0 } +} + +extern { + fn rust_running_on_valgrind() -> uintptr_t; +} diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index c831dd7091828..df7042d09839e 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -313,18 +313,18 @@ pub fn connect_slices(v: &[&[T]], sep: &T) -> ~[T] { v.connect_vec(sep) pub trait VectorVector { // FIXME #5898: calling these .concat and .connect conflicts with // StrVector::con{cat,nect}, since they have generic contents. - pub fn concat_vec(&self) -> ~[T]; - pub fn connect_vec(&self, sep: &T) -> ~[T]; + fn concat_vec(&self) -> ~[T]; + fn connect_vec(&self, sep: &T) -> ~[T]; } impl<'self, T:Clone> VectorVector for &'self [~[T]] { /// Flattens a vector of slices of T into a single vector of T. - pub fn concat_vec(&self) -> ~[T] { + fn concat_vec(&self) -> ~[T] { self.flat_map(|inner| (*inner).clone()) } /// Concatenate a vector of vectors, placing a given separator between each. - pub fn connect_vec(&self, sep: &T) -> ~[T] { + fn connect_vec(&self, sep: &T) -> ~[T] { let mut r = ~[]; let mut first = true; for inner in self.iter() { @@ -337,12 +337,12 @@ impl<'self, T:Clone> VectorVector for &'self [~[T]] { impl<'self,T:Clone> VectorVector for &'self [&'self [T]] { /// Flattens a vector of slices of T into a single vector of T. - pub fn concat_vec(&self) -> ~[T] { + fn concat_vec(&self) -> ~[T] { self.flat_map(|&inner| inner.to_owned()) } /// Concatenate a vector of slices, placing a given separator between each. - pub fn connect_vec(&self, sep: &T) -> ~[T] { + fn connect_vec(&self, sep: &T) -> ~[T] { let mut r = ~[]; let mut first = true; for &inner in self.iter() { @@ -561,7 +561,7 @@ impl<'self, T> RandomAccessIterator<&'self [T]> for ChunkIter<'self, T> { #[cfg(not(test))] pub mod traits { - use super::Vector; + use super::*; use clone::Clone; use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Equal, Equiv}; @@ -686,17 +686,17 @@ pub mod traits { impl<'self,T:Clone, V: Vector> Add for &'self [T] { #[inline] fn add(&self, rhs: &V) -> ~[T] { - let mut res = self.to_owned(); + let mut res = with_capacity(self.len() + rhs.as_slice().len()); + res.push_all(*self); res.push_all(rhs.as_slice()); res } } + impl> Add for ~[T] { #[inline] fn add(&self, rhs: &V) -> ~[T] { - let mut res = self.to_owned(); - res.push_all(rhs.as_slice()); - res + self.as_slice() + rhs.as_slice() } } } @@ -1651,7 +1651,7 @@ impl OwnedEqVector for ~[T] { * Remove consecutive repeated elements from a vector; if the vector is * sorted, this removes all duplicates. */ - pub fn dedup(&mut self) { + fn dedup(&mut self) { unsafe { // Although we have a mutable reference to `self`, we cannot make // *arbitrary* changes. There exists the possibility that this @@ -2081,7 +2081,7 @@ pub mod bytes { /// A trait for operations on mutable operations on `[u8]` pub trait MutableByteVector { /// Sets all bytes of the receiver to the given value. - pub fn set_memory(self, value: u8); + fn set_memory(self, value: u8); } impl<'self> MutableByteVector for &'self mut [u8] { @@ -3662,4 +3662,13 @@ mod bench { } } } + + #[bench] + fn add(b: &mut BenchHarness) { + let xs: &[int] = [5, ..10]; + let ys: &[int] = [5, ..10]; + do b.iter() { + xs + ys; + } + } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 0005180ef50ff..9bb37c2ca456a 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -672,7 +672,7 @@ pub fn walk_pat(pat: @pat, it: &fn(@pat) -> bool) -> bool { } pub trait EachViewItem { - pub fn each_view_item(&self, f: @fn(&ast::view_item) -> bool) -> bool; + fn each_view_item(&self, f: @fn(&ast::view_item) -> bool) -> bool; } struct EachViewItemData { diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index b0dda2b7dc89f..a5293a75fc20a 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -82,7 +82,7 @@ impl AttrMetaMethods for MetaItem { } } - pub fn name_str_pair(&self) -> Option<(@str, @str)> { + fn name_str_pair(&self) -> Option<(@str, @str)> { self.value_str().map_move(|s| (self.name(), s)) } } @@ -105,14 +105,14 @@ pub trait AttributeMethods { impl AttributeMethods for Attribute { /// Extract the MetaItem from inside this Attribute. - pub fn meta(&self) -> @MetaItem { + fn meta(&self) -> @MetaItem { self.node.value } /// Convert self to a normal #[doc="foo"] comment, if it is a /// comment like `///` or `/** */`. (Returns self unchanged for /// non-sugared doc attributes.) - pub fn desugar_doc(&self) -> Attribute { + fn desugar_doc(&self) -> Attribute { if self.node.is_sugared_doc { let comment = self.value_str().unwrap(); let meta = mk_name_value_item_str(@"doc", diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 8c70f128d9a09..d4337523cfb25 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -194,10 +194,10 @@ pub struct FileLines // represents the origin of a file: pub enum FileSubstr { // indicates that this is a normal standalone file: - pub FssNone, + FssNone, // indicates that this "file" is actually a substring // of another file that appears earlier in the codemap - pub FssInternal(span), + FssInternal(span), } /// Identifies an offset of a multi-byte character in a FileMap diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index a1abe47e0909d..6b028e25c0fff 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -542,7 +542,7 @@ impl<'self> MethodDef<'self> { id: cx.next_id(), span: span, self_id: cx.next_id(), - vis: ast::public + vis: ast::inherited, } } diff --git a/src/libsyntax/ext/ifmt.rs b/src/libsyntax/ext/ifmt.rs index a3adb42425ae2..65d2f798f31df 100644 --- a/src/libsyntax/ext/ifmt.rs +++ b/src/libsyntax/ext/ifmt.rs @@ -429,7 +429,12 @@ impl Context { let st = ast::item_static(ty, ast::m_imm, method); let static_name = self.ecx.ident_of(fmt!("__static_method_%u", self.method_statics.len())); - let item = self.ecx.item(sp, static_name, ~[], st); + // Flag these statics as `address_insignificant` so LLVM can + // merge duplicate globals as much as possible (which we're + // generating a whole lot of). + let unnamed = self.ecx.meta_word(self.fmtsp, @"address_insignificant"); + let unnamed = self.ecx.attribute(self.fmtsp, unnamed); + let item = self.ecx.item(sp, static_name, ~[unnamed], st); self.method_statics.push(item); self.ecx.expr_ident(sp, static_name) }; @@ -550,7 +555,10 @@ impl Context { let ty = self.ecx.ty(self.fmtsp, ty); let st = ast::item_static(ty, ast::m_imm, fmt); let static_name = self.ecx.ident_of("__static_fmtstr"); - let item = self.ecx.item(self.fmtsp, static_name, ~[], st); + // see above comment for `address_insignificant` and why we do it + let unnamed = self.ecx.meta_word(self.fmtsp, @"address_insignificant"); + let unnamed = self.ecx.attribute(self.fmtsp, unnamed); + let item = self.ecx.item(self.fmtsp, static_name, ~[unnamed], st); let decl = respan(self.fmtsp, ast::decl_item(item)); lets.push(@respan(self.fmtsp, ast::stmt_decl(@decl, self.ecx.next_id()))); @@ -613,6 +621,7 @@ impl Context { if ty == Unknown { ty = Known(@"?"); } + let argptr = self.ecx.expr_addr_of(sp, self.ecx.expr_ident(sp, ident)); match ty { Known(tyname) => { diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index d218be5e47637..9d82bb9c4f8ab 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -40,11 +40,11 @@ pub mod rt { pub use codemap::{BytePos, span, dummy_spanned}; pub trait ToTokens { - pub fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree]; + fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree]; } impl ToTokens for ~[token_tree] { - pub fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree] { + fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree] { (*self).clone() } } @@ -65,7 +65,7 @@ pub mod rt { pub trait ToSource { // Takes a thing and generates a string containing rust code for it. - pub fn to_source(&self) -> @str; + fn to_source(&self) -> @str; } impl ToSource for ast::ident { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 918949113ad0c..29963a7b46122 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -419,18 +419,18 @@ pub fn parse_nt(p: &Parser, name: &str) -> nonterminal { Some(i) => token::nt_item(i), None => p.fatal("expected an item keyword") }, - "block" => token::nt_block(p.parse_block()), + "block" => token::nt_block(~p.parse_block()), "stmt" => token::nt_stmt(p.parse_stmt(~[])), "pat" => token::nt_pat(p.parse_pat()), "expr" => token::nt_expr(p.parse_expr()), - "ty" => token::nt_ty(p.parse_ty(false /* no need to disambiguate*/)), + "ty" => token::nt_ty(~p.parse_ty(false /* no need to disambiguate*/)), // this could be handled like a token, since it is one "ident" => match *p.token { - token::IDENT(sn,b) => { p.bump(); token::nt_ident(sn,b) } + token::IDENT(sn,b) => { p.bump(); token::nt_ident(~sn,b) } _ => p.fatal(~"expected ident, found " + token::to_str(get_ident_interner(), p.token)) }, - "path" => token::nt_path(p.parse_path_with_tps(false)), + "path" => token::nt_path(~p.parse_path_with_tps(false)), "attr" => token::nt_attr(@p.parse_attribute(false)), "tt" => { *p.quote_depth += 1u; //but in theory, non-quoted tts might be useful diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 16019b2144833..9d3e916b500a7 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -279,7 +279,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { /* sidestep the interpolation tricks for ident because (a) idents can be in lots of places, so it'd be a pain (b) we actually can, since it's a token. */ - matched_nonterminal(nt_ident(sn,b)) => { + matched_nonterminal(nt_ident(~sn,b)) => { r.cur_span = sp; r.cur_tok = IDENT(sn,b); r.stack.idx += 1u; return ret_val; diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 3a10206b513f8..2d7801a22deda 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -124,7 +124,7 @@ impl OptVec { } impl Eq for OptVec { - pub fn eq(&self, other: &OptVec) -> bool { + fn eq(&self, other: &OptVec) -> bool { // Note: cannot use #[deriving(Eq)] here because // (Empty, Vec(~[])) ought to be equal. match (self, other) { @@ -135,7 +135,7 @@ impl Eq for OptVec { } } - pub fn ne(&self, other: &OptVec) -> bool { + fn ne(&self, other: &OptVec) -> bool { !self.eq(other) } } diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index dda5e990221ec..01c1af7464db6 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -65,6 +65,7 @@ pub enum ObsoleteSyntax { ObsoleteExternVisibility, ObsoleteUnsafeExternFn, ObsoletePrivVisibility, + ObsoleteTraitFuncVisibility, } impl to_bytes::IterBytes for ObsoleteSyntax { @@ -95,7 +96,7 @@ pub trait ParserObsoleteMethods { impl ParserObsoleteMethods for Parser { /// Reports an obsolete syntax non-fatal error. - pub fn obsolete(&self, sp: span, kind: ObsoleteSyntax) { + fn obsolete(&self, sp: span, kind: ObsoleteSyntax) { let (kind_str, desc) = match kind { ObsoleteLet => ( "`let` in field declaration", @@ -258,6 +259,10 @@ impl ParserObsoleteMethods for Parser { "`priv` not necessary", "an item without a visibility qualifier is private by default" ), + ObsoleteTraitFuncVisibility => ( + "visibility not necessary", + "trait functions inherit the visibility of the trait itself" + ), }; self.report(sp, kind, kind_str, desc); @@ -265,7 +270,7 @@ impl ParserObsoleteMethods for Parser { // Reports an obsolete syntax non-fatal error, and returns // a placeholder expression - pub fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr { + fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr { self.obsolete(sp, kind); self.mk_expr(sp.lo, sp.hi, expr_lit(@respan(sp, lit_nil))) } @@ -283,7 +288,7 @@ impl ParserObsoleteMethods for Parser { } } - pub fn token_is_obsolete_ident(&self, ident: &str, token: &Token) + fn token_is_obsolete_ident(&self, ident: &str, token: &Token) -> bool { match *token { token::IDENT(sid, _) => { @@ -293,11 +298,11 @@ impl ParserObsoleteMethods for Parser { } } - pub fn is_obsolete_ident(&self, ident: &str) -> bool { + fn is_obsolete_ident(&self, ident: &str) -> bool { self.token_is_obsolete_ident(ident, self.token) } - pub fn eat_obsolete_ident(&self, ident: &str) -> bool { + fn eat_obsolete_ident(&self, ident: &str) -> bool { if self.is_obsolete_ident(ident) { self.bump(); true @@ -306,7 +311,7 @@ impl ParserObsoleteMethods for Parser { } } - pub fn try_parse_obsolete_struct_ctor(&self) -> bool { + fn try_parse_obsolete_struct_ctor(&self) -> bool { if self.eat_obsolete_ident("new") { self.obsolete(*self.last_span, ObsoleteStructCtor); self.parse_fn_decl(); @@ -317,7 +322,7 @@ impl ParserObsoleteMethods for Parser { } } - pub fn try_parse_obsolete_with(&self) -> bool { + fn try_parse_obsolete_with(&self) -> bool { if *self.token == token::COMMA && self.look_ahead(1, |t| self.token_is_obsolete_ident("with", t)) { @@ -332,7 +337,7 @@ impl ParserObsoleteMethods for Parser { } } - pub fn try_parse_obsolete_priv_section(&self, attrs: &[Attribute]) + fn try_parse_obsolete_priv_section(&self, attrs: &[Attribute]) -> bool { if self.is_keyword(keywords::Priv) && self.look_ahead(1, |t| *t == token::LBRACE) { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 77c50a779c03f..5530c05bfbbf8 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -70,24 +70,7 @@ use parse::common::{SeqSep, seq_sep_none}; use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed}; use parse::lexer::reader; use parse::lexer::TokenAndSpan; -use parse::obsolete::{ObsoleteClassTraits}; -use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator}; -use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove, ObsoleteSwap}; -use parse::obsolete::ObsoleteSyntax; -use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax}; -use parse::obsolete::{ObsoleteMutOwnedPointer}; -use parse::obsolete::{ObsoleteMutVector, ObsoleteImplVisibility}; -use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern}; -use parse::obsolete::{ObsoletePostFnTySigil}; -use parse::obsolete::{ObsoleteBareFnType, ObsoleteNewtypeEnum}; -use parse::obsolete::ObsoleteMode; -use parse::obsolete::{ObsoleteLifetimeNotation, ObsoleteConstManagedPointer}; -use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod}; -use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType}; -use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl}; -use parse::obsolete::{ObsoleteMutWithMultipleBindings}; -use parse::obsolete::{ObsoleteExternVisibility, ObsoleteUnsafeExternFn}; -use parse::obsolete::{ParserObsoleteMethods, ObsoletePrivVisibility}; +use parse::obsolete::*; use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident}; use parse::token::{is_ident_or_path}; use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents}; @@ -146,7 +129,7 @@ macro_rules! maybe_whole_expr ( Some($p.mk_expr( ($p).span.lo, ($p).span.hi, - expr_path(/* bad */ (*pt).clone()))) + expr_path(/* bad */ (**pt).clone()))) } _ => None }; @@ -235,8 +218,8 @@ macro_rules! maybe_whole ( _ => None }; match __found__ { - Some(INTERPOLATED(token::$constructor(x))) => { - return (~[], x.clone()) + Some(INTERPOLATED(token::$constructor(ref x))) => { + return (~[], (**x).clone()) } _ => {} } @@ -368,7 +351,7 @@ impl Parser { } else { self.fatal( fmt!( - "expected `%s` but found `%s`", + "expected `%s`, found `%s`", self.token_to_str(t), self.this_token_to_str() ) @@ -840,6 +823,10 @@ impl Parser { debug!("parse_trait_methods(): parsing required method"); // NB: at the moment, visibility annotations on required // methods are ignored; this could change. + if vis != ast::inherited { + self.obsolete(*self.last_span, + ObsoleteTraitFuncVisibility); + } required(TypeMethod { ident: ident, attrs: attrs, @@ -874,7 +861,7 @@ impl Parser { _ => { p.fatal( fmt!( - "expected `;` or `}` but found `%s`", + "expected `;` or `}`, found `%s`", self.this_token_to_str() ) ); @@ -939,7 +926,7 @@ impl Parser { // Useless second parameter for compatibility with quasiquote macros. // Bleh! pub fn parse_ty(&self, _: bool) -> Ty { - maybe_whole!(self, nt_ty); + maybe_whole!(deref self, nt_ty); let lo = self.span.lo; @@ -1293,7 +1280,7 @@ impl Parser { // parse a path that doesn't have type parameters attached pub fn parse_path_without_tps(&self) -> ast::Path { - maybe_whole!(self, nt_path); + maybe_whole!(deref self, nt_path); let (ids,is_global,sp) = self.parse_path(); ast::Path { span: sp, global: is_global, @@ -1306,7 +1293,7 @@ impl Parser { before_tps: Option<&fn()>) -> ast::Path { debug!("parse_path_with_tps(colons=%b)", colons); - maybe_whole!(self, nt_path); + maybe_whole!(deref self, nt_path); let lo = self.span.lo; let path = self.parse_path_without_tps(); if colons && !self.eat(&token::MOD_SEP) { @@ -3100,7 +3087,7 @@ impl Parser { // parse a block. No inner attrs are allowed. pub fn parse_block(&self) -> Block { - maybe_whole!(self, nt_block); + maybe_whole!(deref self, nt_block); let lo = self.span.lo; if self.eat_keyword(keywords::Unsafe) { @@ -3194,7 +3181,7 @@ impl Parser { self.fatal( fmt!( "expected `;` or `}` after \ - expression but found `%s`", + expression, found `%s`", self.token_to_str(t) ) ); @@ -3393,7 +3380,7 @@ impl Parser { if !self.is_self_ident() { self.fatal( fmt!( - "expected `self` but found `%s`", + "expected `self`, found `%s`", self.this_token_to_str() ) ); @@ -3791,7 +3778,7 @@ impl Parser { self.fatal( fmt!( "expected `{`, `(`, or `;` after struct name \ - but found `%s`", + , found `%s`", self.this_token_to_str() ) ); @@ -3835,7 +3822,7 @@ impl Parser { token::RBRACE => {} _ => { self.span_fatal(*self.span, - fmt!("expected `,`, or '}' but found `%s`", + fmt!("expected `,`, or '}', found `%s`", self.this_token_to_str())); } } @@ -3931,7 +3918,7 @@ impl Parser { the module"); } _ => { - self.fatal(fmt!("expected item but found `%s`", + self.fatal(fmt!("expected item, found `%s`", self.this_token_to_str())); } } @@ -4179,7 +4166,7 @@ impl Parser { self.expect_keyword(keywords::Mod); } else if *self.token != token::LBRACE { self.span_fatal(*self.span, - fmt!("expected `{` or `mod` but found `%s`", + fmt!("expected `{` or `mod`, found `%s`", self.this_token_to_str())); } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index c554f111bf9a0..bdfd25ae644da 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -99,14 +99,14 @@ pub enum Token { /// For interpolation during macro expansion. pub enum nonterminal { nt_item(@ast::item), - nt_block(ast::Block), + nt_block(~ast::Block), nt_stmt(@ast::stmt), nt_pat( @ast::pat), nt_expr(@ast::expr), - nt_ty( ast::Ty), - nt_ident(ast::ident, bool), + nt_ty( ~ast::Ty), + nt_ident(~ast::ident, bool), nt_attr(@ast::Attribute), // #[foo] - nt_path( ast::Path), + nt_path(~ast::Path), nt_tt( @ast::token_tree), //needs @ed to break a circularity nt_matchers(~[ast::matcher]) } diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 04c062072d6cb..db353036336c2 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -833,3 +833,7 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateUnionType( unwrapDI(Elements), RunTimeLang)); } + +extern "C" void LLVMSetUnnamedAddr(LLVMValueRef Value, LLVMBool Unnamed) { + unwrap(Value)->setUnnamedAddr(Unnamed); +} diff --git a/src/rustllvm/rustllvm.def.in b/src/rustllvm/rustllvm.def.in index 260a16dab9845..a2af7a18b4f8a 100644 --- a/src/rustllvm/rustllvm.def.in +++ b/src/rustllvm/rustllvm.def.in @@ -613,3 +613,4 @@ LLVMDIBuilderInsertDeclareBefore LLVMDIBuilderCreateEnumerator LLVMDIBuilderCreateEnumerationType LLVMDIBuilderCreateUnionType +LLVMSetUnnamedAddr diff --git a/src/test/auxiliary/private_variant_xc.rs b/src/test/auxiliary/private_variant_xc.rs index a3a604d9e784c..e1ecbf8c5432e 100644 --- a/src/test/auxiliary/private_variant_xc.rs +++ b/src/test/auxiliary/private_variant_xc.rs @@ -1,4 +1,4 @@ pub enum Foo { - pub Bar, + Bar, priv Baz, } diff --git a/src/test/auxiliary/reexported_static_methods.rs b/src/test/auxiliary/reexported_static_methods.rs index 811bf082ae891..bb20b04762d5a 100644 --- a/src/test/auxiliary/reexported_static_methods.rs +++ b/src/test/auxiliary/reexported_static_methods.rs @@ -14,20 +14,20 @@ pub use sub_foo::Boz; pub use sub_foo::Bort; pub trait Bar { - pub fn bar() -> Self; + fn bar() -> Self; } impl Bar for int { - pub fn bar() -> int { 84 } + fn bar() -> int { 84 } } pub mod sub_foo { pub trait Foo { - pub fn foo() -> Self; + fn foo() -> Self; } impl Foo for int { - pub fn foo() -> int { 42 } + fn foo() -> int { 42 } } pub struct Boz { diff --git a/src/test/compile-fail/bad-bang-ann-3.rs b/src/test/compile-fail/bad-bang-ann-3.rs index 9e73bbe1406bd..f7524787c7b96 100644 --- a/src/test/compile-fail/bad-bang-ann-3.rs +++ b/src/test/compile-fail/bad-bang-ann-3.rs @@ -13,7 +13,7 @@ fn bad_bang(i: uint) -> ! { return 7u; - //~^ ERROR expected `!` but found `uint` + //~^ ERROR expected `!`, found `uint` } fn main() { bad_bang(5u); } diff --git a/src/test/compile-fail/bad-bang-ann.rs b/src/test/compile-fail/bad-bang-ann.rs index 2ffb5dd29066f..a52c6f3a849a0 100644 --- a/src/test/compile-fail/bad-bang-ann.rs +++ b/src/test/compile-fail/bad-bang-ann.rs @@ -13,7 +13,7 @@ fn bad_bang(i: uint) -> ! { if i < 0u { } else { fail!(); } - //~^ ERROR expected `!` but found `()` + //~^ ERROR expected `!`, found `()` } fn main() { bad_bang(5u); } diff --git a/src/test/compile-fail/bad-const-type.rs b/src/test/compile-fail/bad-const-type.rs index 5045c87c2f3a8..21047716f303e 100644 --- a/src/test/compile-fail/bad-const-type.rs +++ b/src/test/compile-fail/bad-const-type.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:expected `~str` but found `int` +// error-pattern:expected `~str`, found `int` static i: ~str = 10i; fn main() { info!(i); } diff --git a/src/test/compile-fail/bang-tailexpr.rs b/src/test/compile-fail/bang-tailexpr.rs index af78e19e8c2e2..ff95f05279eea 100644 --- a/src/test/compile-fail/bang-tailexpr.rs +++ b/src/test/compile-fail/bang-tailexpr.rs @@ -9,6 +9,6 @@ // except according to those terms. fn f() -> ! { - 3i //~ ERROR expected `!` but found `int` + 3i //~ ERROR expected `!`, found `int` } fn main() { } diff --git a/src/test/compile-fail/block-must-not-have-result-do.rs b/src/test/compile-fail/block-must-not-have-result-do.rs index abeefa4aac810..687171f8c1f9b 100644 --- a/src/test/compile-fail/block-must-not-have-result-do.rs +++ b/src/test/compile-fail/block-must-not-have-result-do.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `()` but found `bool` +// error-pattern:mismatched types: expected `()`, found `bool` fn main() { loop { diff --git a/src/test/compile-fail/block-must-not-have-result-res.rs b/src/test/compile-fail/block-must-not-have-result-res.rs index c9b627f55f803..a3bef505d0d4e 100644 --- a/src/test/compile-fail/block-must-not-have-result-res.rs +++ b/src/test/compile-fail/block-must-not-have-result-res.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `()` but found `bool` +// error-pattern:mismatched types: expected `()`, found `bool` struct r; diff --git a/src/test/compile-fail/block-must-not-have-result-while.rs b/src/test/compile-fail/block-must-not-have-result-while.rs index e4aceabf0c8fb..ed903f3fd6551 100644 --- a/src/test/compile-fail/block-must-not-have-result-while.rs +++ b/src/test/compile-fail/block-must-not-have-result-while.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `()` but found `bool` +// error-pattern:mismatched types: expected `()`, found `bool` fn main() { while true { diff --git a/src/test/compile-fail/borrowck-alias-mut-base-ptr.rs b/src/test/compile-fail/borrowck-alias-mut-base-ptr.rs index c51cf5b9538d9..1cde5cb94fd5e 100644 --- a/src/test/compile-fail/borrowck-alias-mut-base-ptr.rs +++ b/src/test/compile-fail/borrowck-alias-mut-base-ptr.rs @@ -12,4 +12,4 @@ fn foo(t0: &mut int) { } fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/borrowck-anon-fields-struct.rs b/src/test/compile-fail/borrowck-anon-fields-struct.rs index 45a26068d8285..bcaa3b9086cf3 100644 --- a/src/test/compile-fail/borrowck-anon-fields-struct.rs +++ b/src/test/compile-fail/borrowck-anon-fields-struct.rs @@ -34,4 +34,4 @@ fn same_variant() { } fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/borrowck-anon-fields-tuple.rs b/src/test/compile-fail/borrowck-anon-fields-tuple.rs index ae02245c97f52..de2a8d8326808 100644 --- a/src/test/compile-fail/borrowck-anon-fields-tuple.rs +++ b/src/test/compile-fail/borrowck-anon-fields-tuple.rs @@ -32,4 +32,4 @@ fn same_variant() { } fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/borrowck-anon-fields-variant.rs b/src/test/compile-fail/borrowck-anon-fields-variant.rs index 3d9738df059ca..da0a9323d2c81 100644 --- a/src/test/compile-fail/borrowck-anon-fields-variant.rs +++ b/src/test/compile-fail/borrowck-anon-fields-variant.rs @@ -40,4 +40,4 @@ fn same_variant() { } fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/borrowck-bad-nested-calls-free.rs b/src/test/compile-fail/borrowck-bad-nested-calls-free.rs index ff1ec38ad6406..c142876c5c2c5 100644 --- a/src/test/compile-fail/borrowck-bad-nested-calls-free.rs +++ b/src/test/compile-fail/borrowck-bad-nested-calls-free.rs @@ -40,4 +40,4 @@ fn explicit() { rewrite(&mut a)); //~ ERROR cannot borrow } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/borrowck-bad-nested-calls-move.rs b/src/test/compile-fail/borrowck-bad-nested-calls-move.rs index 0adf486b8b3ab..622d2e78ee794 100644 --- a/src/test/compile-fail/borrowck-bad-nested-calls-move.rs +++ b/src/test/compile-fail/borrowck-bad-nested-calls-move.rs @@ -40,4 +40,4 @@ fn explicit() { a); //~ ERROR cannot move } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs b/src/test/compile-fail/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs index 7e9c298ba4732..45238b36681b2 100644 --- a/src/test/compile-fail/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs +++ b/src/test/compile-fail/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs @@ -28,4 +28,4 @@ fn foo3(t0: &mut &mut int) { } fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs b/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs index c99a1ee60d7fd..628ccd1a5d782 100644 --- a/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs +++ b/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs @@ -13,4 +13,4 @@ fn let_pat() { //~^ ERROR cannot move out of dereference of & pointer } -pub fn main() {} \ No newline at end of file +pub fn main() {} diff --git a/src/test/compile-fail/borrowck-move-mut-base-ptr.rs b/src/test/compile-fail/borrowck-move-mut-base-ptr.rs index 6a3832d2304cf..565629b1c306d 100644 --- a/src/test/compile-fail/borrowck-move-mut-base-ptr.rs +++ b/src/test/compile-fail/borrowck-move-mut-base-ptr.rs @@ -12,4 +12,4 @@ fn foo(t0: &mut int) { } fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/borrowck-swap-mut-base-ptr.rs b/src/test/compile-fail/borrowck-swap-mut-base-ptr.rs index bea5f1f6ea765..ab6f70945be6c 100644 --- a/src/test/compile-fail/borrowck-swap-mut-base-ptr.rs +++ b/src/test/compile-fail/borrowck-swap-mut-base-ptr.rs @@ -13,4 +13,4 @@ fn foo<'a>(mut t0: &'a mut int, } fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/cast-immutable-mutable-trait.rs b/src/test/compile-fail/cast-immutable-mutable-trait.rs index 1047a99577143..0a94d6c456081 100644 --- a/src/test/compile-fail/cast-immutable-mutable-trait.rs +++ b/src/test/compile-fail/cast-immutable-mutable-trait.rs @@ -25,4 +25,4 @@ fn main() { let s = @S { unused: 0 }; let _s2 = s as @mut T; //~ error: types differ in mutability let _s3 = &s as &mut T; //~ error: types differ in mutability -} \ No newline at end of file +} diff --git a/src/test/compile-fail/cast-vector-to-unsafe-nonstatic.rs b/src/test/compile-fail/cast-vector-to-unsafe-nonstatic.rs index a083757a0eb9a..ce58b260f6186 100644 --- a/src/test/compile-fail/cast-vector-to-unsafe-nonstatic.rs +++ b/src/test/compile-fail/cast-vector-to-unsafe-nonstatic.rs @@ -11,4 +11,4 @@ fn main() { let foo = ['h' as u8, 'i' as u8, 0 as u8]; let bar = &foo as *u8; //~ ERROR mismatched types -} \ No newline at end of file +} diff --git a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs index b38cb89548807..2e7313b6afd54 100644 --- a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs +++ b/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs @@ -13,7 +13,7 @@ struct X { } fn foo(blk: @fn:()) -> X { - return X { field: blk }; //~ ERROR expected bounds `Send` but found no bounds + return X { field: blk }; //~ ERROR expected bounds `Send`, found no bounds } fn main() { diff --git a/src/test/compile-fail/closure-bounds-not-builtin.rs b/src/test/compile-fail/closure-bounds-not-builtin.rs index a3484cb33dcae..fbf1acb60665b 100644 --- a/src/test/compile-fail/closure-bounds-not-builtin.rs +++ b/src/test/compile-fail/closure-bounds-not-builtin.rs @@ -5,4 +5,4 @@ fn take(f: &fn:Foo()) { //~^ ERROR only the builtin traits can be used as closure or object bounds } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/closure-bounds-subtype.rs b/src/test/compile-fail/closure-bounds-subtype.rs index f04da0575b954..ba15d9a056544 100644 --- a/src/test/compile-fail/closure-bounds-subtype.rs +++ b/src/test/compile-fail/closure-bounds-subtype.rs @@ -11,7 +11,7 @@ fn give_any(f: &fn:()) { fn give_owned(f: &fn:Send()) { take_any(f); - take_const_owned(f); //~ ERROR expected bounds `Send+Freeze` but found bounds `Send` + take_const_owned(f); //~ ERROR expected bounds `Send+Freeze`, found bounds `Send` } fn main() {} diff --git a/src/test/compile-fail/coherence_inherent.rs b/src/test/compile-fail/coherence_inherent.rs index 590c12826e4fe..2c3fbc827aad6 100644 --- a/src/test/compile-fail/coherence_inherent.rs +++ b/src/test/compile-fail/coherence_inherent.rs @@ -42,4 +42,4 @@ mod NoImport { } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/coherence_inherent_cc.rs b/src/test/compile-fail/coherence_inherent_cc.rs index 72c6df57c4ff5..40d733f8bab5c 100644 --- a/src/test/compile-fail/coherence_inherent_cc.rs +++ b/src/test/compile-fail/coherence_inherent_cc.rs @@ -35,4 +35,4 @@ mod NoImport { } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/deprecated-auto-code.rs b/src/test/compile-fail/deprecated-auto-code.rs index 1f7cbfe980782..e4576e0f57c54 100644 --- a/src/test/compile-fail/deprecated-auto-code.rs +++ b/src/test/compile-fail/deprecated-auto-code.rs @@ -12,4 +12,4 @@ #[auto_decode] //~ ERROR: `#[auto_decode]` is deprecated struct A; -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/do-lambda-requires-braces.rs b/src/test/compile-fail/do-lambda-requires-braces.rs index a836556dff881..abe066182b924 100644 --- a/src/test/compile-fail/do-lambda-requires-braces.rs +++ b/src/test/compile-fail/do-lambda-requires-braces.rs @@ -10,6 +10,6 @@ fn main() { do something - |x| do somethingelse //~ ERROR: expected `{` but found `do` + |x| do somethingelse //~ ERROR: expected `{`, found `do` |y| say(x, y) } diff --git a/src/test/compile-fail/do1.rs b/src/test/compile-fail/do1.rs index d16fa4eadd566..2da57bda273e2 100644 --- a/src/test/compile-fail/do1.rs +++ b/src/test/compile-fail/do1.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x = do y; //~ ERROR: expected `{` but found + let x = do y; //~ ERROR: expected `{`, found } diff --git a/src/test/compile-fail/do2.rs b/src/test/compile-fail/do2.rs index 4466c07518fec..0d815363635f2 100644 --- a/src/test/compile-fail/do2.rs +++ b/src/test/compile-fail/do2.rs @@ -12,5 +12,5 @@ fn f(f: @fn(int) -> bool) -> bool { f(10i) } fn main() { assert!(do f() |i| { i == 10i } == 10i); - //~^ ERROR: expected `bool` but found `int` + //~^ ERROR: expected `bool`, found `int` } diff --git a/src/test/compile-fail/estr-subtyping.rs b/src/test/compile-fail/estr-subtyping.rs index d0d1b2013a95b..f8dcd9052b3ef 100644 --- a/src/test/compile-fail/estr-subtyping.rs +++ b/src/test/compile-fail/estr-subtyping.rs @@ -14,19 +14,19 @@ fn wants_slice(x: &str) { } fn has_box(x: @str) { wants_box(x); - wants_uniq(x); //~ ERROR str storage differs: expected ~ but found @ + wants_uniq(x); //~ ERROR str storage differs: expected ~, found @ wants_slice(x); } fn has_uniq(x: ~str) { - wants_box(x); //~ ERROR str storage differs: expected @ but found ~ + wants_box(x); //~ ERROR str storage differs: expected @, found ~ wants_uniq(x); wants_slice(x); } fn has_slice(x: &str) { - wants_box(x); //~ ERROR str storage differs: expected @ but found & - wants_uniq(x); //~ ERROR str storage differs: expected ~ but found & + wants_box(x); //~ ERROR str storage differs: expected @, found & + wants_uniq(x); //~ ERROR str storage differs: expected ~, found & wants_slice(x); } diff --git a/src/test/compile-fail/evec-subtyping.rs b/src/test/compile-fail/evec-subtyping.rs index f9c8ba01f1805..9301798bddb72 100644 --- a/src/test/compile-fail/evec-subtyping.rs +++ b/src/test/compile-fail/evec-subtyping.rs @@ -14,26 +14,26 @@ fn wants_three(x: [uint, ..3]) { } fn has_box(x: @[uint]) { wants_box(x); - wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found @ - wants_three(x); //~ ERROR [] storage differs: expected 3 but found @ + wants_uniq(x); //~ ERROR [] storage differs: expected ~, found @ + wants_three(x); //~ ERROR [] storage differs: expected 3, found @ } fn has_uniq(x: ~[uint]) { - wants_box(x); //~ ERROR [] storage differs: expected @ but found ~ + wants_box(x); //~ ERROR [] storage differs: expected @, found ~ wants_uniq(x); - wants_three(x); //~ ERROR [] storage differs: expected 3 but found ~ + wants_three(x); //~ ERROR [] storage differs: expected 3, found ~ } fn has_three(x: [uint, ..3]) { - wants_box(x); //~ ERROR [] storage differs: expected @ but found 3 - wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found 3 + wants_box(x); //~ ERROR [] storage differs: expected @, found 3 + wants_uniq(x); //~ ERROR [] storage differs: expected ~, found 3 wants_three(x); } fn has_four(x: [uint, ..4]) { - wants_box(x); //~ ERROR [] storage differs: expected @ but found 4 - wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found 4 - wants_three(x); //~ ERROR [] storage differs: expected 3 but found 4 + wants_box(x); //~ ERROR [] storage differs: expected @, found 4 + wants_uniq(x); //~ ERROR [] storage differs: expected ~, found 4 + wants_three(x); //~ ERROR [] storage differs: expected 3, found 4 } fn main() { diff --git a/src/test/compile-fail/extern-no-call.rs b/src/test/compile-fail/extern-no-call.rs index 58649f3209bb1..343965a5c4a8c 100644 --- a/src/test/compile-fail/extern-no-call.rs +++ b/src/test/compile-fail/extern-no-call.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:expected function but found `*u8` +// error-pattern:expected function, found `*u8` extern fn f() { } diff --git a/src/test/compile-fail/fully-qualified-type-name2.rs b/src/test/compile-fail/fully-qualified-type-name2.rs index 986d19669b91e..94af50dac0ea5 100644 --- a/src/test/compile-fail/fully-qualified-type-name2.rs +++ b/src/test/compile-fail/fully-qualified-type-name2.rs @@ -20,7 +20,7 @@ mod y { fn bar(x: x::foo) -> y::foo { return x; - //~^ ERROR mismatched types: expected `y::foo` but found `x::foo` + //~^ ERROR mismatched types: expected `y::foo`, found `x::foo` } fn main() { diff --git a/src/test/compile-fail/fully-qualified-type-name3.rs b/src/test/compile-fail/fully-qualified-type-name3.rs index 464f292b75899..a9fd68e4bf64a 100644 --- a/src/test/compile-fail/fully-qualified-type-name3.rs +++ b/src/test/compile-fail/fully-qualified-type-name3.rs @@ -16,7 +16,7 @@ type T2 = int; fn bar(x: T1) -> T2 { return x; - //~^ ERROR mismatched types: expected `T2` but found `T1` + //~^ ERROR mismatched types: expected `T2`, found `T1` } fn main() { diff --git a/src/test/compile-fail/if-branch-types.rs b/src/test/compile-fail/if-branch-types.rs index 1c6dd0ef9f657..4a8c72c3877c5 100644 --- a/src/test/compile-fail/if-branch-types.rs +++ b/src/test/compile-fail/if-branch-types.rs @@ -10,5 +10,5 @@ fn main() { let x = if true { 10i } else { 10u }; - //~^ ERROR if and else have incompatible types: expected `int` but found `uint` + //~^ ERROR if and else have incompatible types: expected `int`, found `uint` } diff --git a/src/test/compile-fail/if-without-else-result.rs b/src/test/compile-fail/if-without-else-result.rs index 8e3318f6945ac..d9307d9669ae7 100644 --- a/src/test/compile-fail/if-without-else-result.rs +++ b/src/test/compile-fail/if-without-else-result.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `()` but found `bool` +// error-pattern:mismatched types: expected `()`, found `bool` fn main() { let a = if true { true }; diff --git a/src/test/compile-fail/ifmt-bad-plural.rs b/src/test/compile-fail/ifmt-bad-plural.rs index 76a697b174f54..048916ef4234a 100644 --- a/src/test/compile-fail/ifmt-bad-plural.rs +++ b/src/test/compile-fail/ifmt-bad-plural.rs @@ -10,5 +10,5 @@ fn main() { ifmt!("{0, plural, other{}}", "a"); - //~^ ERROR: expected uint but found + //~^ ERROR: expected uint, found } diff --git a/src/test/compile-fail/ifmt-bad-select.rs b/src/test/compile-fail/ifmt-bad-select.rs index abe3b6ed65a6d..976b6713f9750 100644 --- a/src/test/compile-fail/ifmt-bad-select.rs +++ b/src/test/compile-fail/ifmt-bad-select.rs @@ -10,5 +10,5 @@ fn main() { ifmt!("{0, select, other{}}", 2); - //~^ ERROR: expected &str but found integral + //~^ ERROR: expected &str, found integral } diff --git a/src/test/compile-fail/integer-literal-suffix-inference.rs b/src/test/compile-fail/integer-literal-suffix-inference.rs index 2f77497acc4a8..1e42a9447f67a 100644 --- a/src/test/compile-fail/integer-literal-suffix-inference.rs +++ b/src/test/compile-fail/integer-literal-suffix-inference.rs @@ -39,62 +39,62 @@ fn main() { fn id_u64(n: u64) -> u64 { n } id_i8(a8); // ok - id_i8(a16); //~ ERROR mismatched types: expected `i8` but found `i16` - id_i8(a32); //~ ERROR mismatched types: expected `i8` but found `i32` - id_i8(a64); //~ ERROR mismatched types: expected `i8` but found `i64` + id_i8(a16); //~ ERROR mismatched types: expected `i8`, found `i16` + id_i8(a32); //~ ERROR mismatched types: expected `i8`, found `i32` + id_i8(a64); //~ ERROR mismatched types: expected `i8`, found `i64` - id_i16(a8); //~ ERROR mismatched types: expected `i16` but found `i8` + id_i16(a8); //~ ERROR mismatched types: expected `i16`, found `i8` id_i16(a16); // ok - id_i16(a32); //~ ERROR mismatched types: expected `i16` but found `i32` - id_i16(a64); //~ ERROR mismatched types: expected `i16` but found `i64` + id_i16(a32); //~ ERROR mismatched types: expected `i16`, found `i32` + id_i16(a64); //~ ERROR mismatched types: expected `i16`, found `i64` - id_i32(a8); //~ ERROR mismatched types: expected `i32` but found `i8` - id_i32(a16); //~ ERROR mismatched types: expected `i32` but found `i16` + id_i32(a8); //~ ERROR mismatched types: expected `i32`, found `i8` + id_i32(a16); //~ ERROR mismatched types: expected `i32`, found `i16` id_i32(a32); // ok - id_i32(a64); //~ ERROR mismatched types: expected `i32` but found `i64` + id_i32(a64); //~ ERROR mismatched types: expected `i32`, found `i64` - id_i64(a8); //~ ERROR mismatched types: expected `i64` but found `i8` - id_i64(a16); //~ ERROR mismatched types: expected `i64` but found `i16` - id_i64(a32); //~ ERROR mismatched types: expected `i64` but found `i32` + id_i64(a8); //~ ERROR mismatched types: expected `i64`, found `i8` + id_i64(a16); //~ ERROR mismatched types: expected `i64`, found `i16` + id_i64(a32); //~ ERROR mismatched types: expected `i64`, found `i32` id_i64(a64); // ok id_i8(c8); // ok - id_i8(c16); //~ ERROR mismatched types: expected `i8` but found `i16` - id_i8(c32); //~ ERROR mismatched types: expected `i8` but found `i32` - id_i8(c64); //~ ERROR mismatched types: expected `i8` but found `i64` + id_i8(c16); //~ ERROR mismatched types: expected `i8`, found `i16` + id_i8(c32); //~ ERROR mismatched types: expected `i8`, found `i32` + id_i8(c64); //~ ERROR mismatched types: expected `i8`, found `i64` - id_i16(c8); //~ ERROR mismatched types: expected `i16` but found `i8` + id_i16(c8); //~ ERROR mismatched types: expected `i16`, found `i8` id_i16(c16); // ok - id_i16(c32); //~ ERROR mismatched types: expected `i16` but found `i32` - id_i16(c64); //~ ERROR mismatched types: expected `i16` but found `i64` + id_i16(c32); //~ ERROR mismatched types: expected `i16`, found `i32` + id_i16(c64); //~ ERROR mismatched types: expected `i16`, found `i64` - id_i32(c8); //~ ERROR mismatched types: expected `i32` but found `i8` - id_i32(c16); //~ ERROR mismatched types: expected `i32` but found `i16` + id_i32(c8); //~ ERROR mismatched types: expected `i32`, found `i8` + id_i32(c16); //~ ERROR mismatched types: expected `i32`, found `i16` id_i32(c32); // ok - id_i32(c64); //~ ERROR mismatched types: expected `i32` but found `i64` + id_i32(c64); //~ ERROR mismatched types: expected `i32`, found `i64` - id_i64(a8); //~ ERROR mismatched types: expected `i64` but found `i8` - id_i64(a16); //~ ERROR mismatched types: expected `i64` but found `i16` - id_i64(a32); //~ ERROR mismatched types: expected `i64` but found `i32` + id_i64(a8); //~ ERROR mismatched types: expected `i64`, found `i8` + id_i64(a16); //~ ERROR mismatched types: expected `i64`, found `i16` + id_i64(a32); //~ ERROR mismatched types: expected `i64`, found `i32` id_i64(a64); // ok id_u8(b8); // ok - id_u8(b16); //~ ERROR mismatched types: expected `u8` but found `u16` - id_u8(b32); //~ ERROR mismatched types: expected `u8` but found `u32` - id_u8(b64); //~ ERROR mismatched types: expected `u8` but found `u64` + id_u8(b16); //~ ERROR mismatched types: expected `u8`, found `u16` + id_u8(b32); //~ ERROR mismatched types: expected `u8`, found `u32` + id_u8(b64); //~ ERROR mismatched types: expected `u8`, found `u64` - id_u16(b8); //~ ERROR mismatched types: expected `u16` but found `u8` + id_u16(b8); //~ ERROR mismatched types: expected `u16`, found `u8` id_u16(b16); // ok - id_u16(b32); //~ ERROR mismatched types: expected `u16` but found `u32` - id_u16(b64); //~ ERROR mismatched types: expected `u16` but found `u64` + id_u16(b32); //~ ERROR mismatched types: expected `u16`, found `u32` + id_u16(b64); //~ ERROR mismatched types: expected `u16`, found `u64` - id_u32(b8); //~ ERROR mismatched types: expected `u32` but found `u8` - id_u32(b16); //~ ERROR mismatched types: expected `u32` but found `u16` + id_u32(b8); //~ ERROR mismatched types: expected `u32`, found `u8` + id_u32(b16); //~ ERROR mismatched types: expected `u32`, found `u16` id_u32(b32); // ok - id_u32(b64); //~ ERROR mismatched types: expected `u32` but found `u64` + id_u32(b64); //~ ERROR mismatched types: expected `u32`, found `u64` - id_u64(b8); //~ ERROR mismatched types: expected `u64` but found `u8` - id_u64(b16); //~ ERROR mismatched types: expected `u64` but found `u16` - id_u64(b32); //~ ERROR mismatched types: expected `u64` but found `u32` + id_u64(b8); //~ ERROR mismatched types: expected `u64`, found `u8` + id_u64(b16); //~ ERROR mismatched types: expected `u64`, found `u16` + id_u64(b32); //~ ERROR mismatched types: expected `u64`, found `u32` id_u64(b64); // ok } diff --git a/src/test/compile-fail/issue-2995.rs b/src/test/compile-fail/issue-2995.rs index 3e771eef970f7..ea8ee8699e482 100644 --- a/src/test/compile-fail/issue-2995.rs +++ b/src/test/compile-fail/issue-2995.rs @@ -12,4 +12,4 @@ fn bad (p: *int) { let _q: &int = p as ∫ //~ ERROR non-scalar cast } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/issue-3036.rs b/src/test/compile-fail/issue-3036.rs index 45b4ab1871dc9..5f56f6b8b6b99 100644 --- a/src/test/compile-fail/issue-3036.rs +++ b/src/test/compile-fail/issue-3036.rs @@ -13,4 +13,4 @@ fn main() { let x = 3 -} //~ ERROR: expected `;` but found `}` +} //~ ERROR: expected `;`, found `}` diff --git a/src/test/compile-fail/issue-3477.rs b/src/test/compile-fail/issue-3477.rs index 23e680fd851c3..cb7809eef55b7 100644 --- a/src/test/compile-fail/issue-3477.rs +++ b/src/test/compile-fail/issue-3477.rs @@ -1,3 +1,3 @@ fn main() { - let _p: char = 100; //~ ERROR mismatched types: expected `char` but found + let _p: char = 100; //~ ERROR mismatched types: expected `char`, found } diff --git a/src/test/compile-fail/issue-3680.rs b/src/test/compile-fail/issue-3680.rs index b453384c0c890..7cb63d712664b 100644 --- a/src/test/compile-fail/issue-3680.rs +++ b/src/test/compile-fail/issue-3680.rs @@ -10,6 +10,6 @@ fn main() { match None { - Err(_) => () //~ ERROR mismatched types: expected `std::option::Option<>` but found `std::result::Result<,>` + Err(_) => () //~ ERROR mismatched types: expected `std::option::Option<>`, found `std::result::Result<,>` } } diff --git a/src/test/compile-fail/issue-4517.rs b/src/test/compile-fail/issue-4517.rs index 0fbc79b1bc7bd..02a245e0c97d0 100644 --- a/src/test/compile-fail/issue-4517.rs +++ b/src/test/compile-fail/issue-4517.rs @@ -2,5 +2,5 @@ fn bar(int_param: int) {} fn main() { let foo: [u8, ..4] = [1u8, ..4u8]; - bar(foo); //~ ERROR mismatched types: expected `int` but found `[u8, .. 4]` (expected int but found vector) + bar(foo); //~ ERROR mismatched types: expected `int`, found `[u8, .. 4]` (expected int, found vector) } diff --git a/src/test/compile-fail/issue-4736.rs b/src/test/compile-fail/issue-4736.rs index f7144b4c8fa91..6f410ea3c3739 100644 --- a/src/test/compile-fail/issue-4736.rs +++ b/src/test/compile-fail/issue-4736.rs @@ -12,4 +12,4 @@ struct NonCopyable(()); fn main() { let z = NonCopyable{ p: () }; //~ ERROR structure has no field named `p` -} \ No newline at end of file +} diff --git a/src/test/compile-fail/issue-4968.rs b/src/test/compile-fail/issue-4968.rs index 700d8a61c3a39..d94a8d69a8e95 100644 --- a/src/test/compile-fail/issue-4968.rs +++ b/src/test/compile-fail/issue-4968.rs @@ -12,5 +12,5 @@ static A: (int,int) = (4,2); fn main() { - match 42 { A => () } //~ ERROR mismatched types: expected `` but found `(int,int)` (expected integral variable but found tuple) + match 42 { A => () } //~ ERROR mismatched types: expected ``, found `(int,int)` (expected integral variable, found tuple) } diff --git a/src/test/compile-fail/issue-5100.rs b/src/test/compile-fail/issue-5100.rs index 1ef67f784e386..c6db366e79274 100644 --- a/src/test/compile-fail/issue-5100.rs +++ b/src/test/compile-fail/issue-5100.rs @@ -12,33 +12,33 @@ enum A { B, C } fn main() { match (true, false) { - B => (), //~ ERROR expected `(bool,bool)` but found an enum or structure pattern + B => (), //~ ERROR expected `(bool,bool)`, found an enum or structure pattern _ => () } match (true, false) { - (true, false, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found tuple (expected a tuple with 2 elements but found one with 3 elements) + (true, false, false) => () //~ ERROR mismatched types: expected `(bool,bool)`, found tuple (expected a tuple with 2 elements, found one with 3 elements) } match (true, false) { - @(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found an @-box pattern + @(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)`, found an @-box pattern } match (true, false) { - ~(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found a ~-box pattern + ~(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)`, found a ~-box pattern } match (true, false) { - &(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found an &-pointer pattern + &(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)`, found an &-pointer pattern } - let v = [('a', 'b') //~ ERROR expected function but found `(char,char)` + let v = [('a', 'b') //~ ERROR expected function, found `(char,char)` ('c', 'd'), ('e', 'f')]; for &(x,y) in v.iter() {} // should be OK // Make sure none of the errors above were fatal - let x: char = true; //~ ERROR expected `char` but found `bool` + let x: char = true; //~ ERROR expected `char`, found `bool` } diff --git a/src/test/compile-fail/issue-5358-1.rs b/src/test/compile-fail/issue-5358-1.rs index a3d25e7d2adca..85e34cd6db3ee 100644 --- a/src/test/compile-fail/issue-5358-1.rs +++ b/src/test/compile-fail/issue-5358-1.rs @@ -12,7 +12,7 @@ struct S(Either); fn main() { match S(Left(5)) { - Right(_) => {} //~ ERROR mismatched types: expected `S` but found `std::either::Either + Right(_) => {} //~ ERROR mismatched types: expected `S`, found `std::either::Either _ => {} } } diff --git a/src/test/compile-fail/issue-5358.rs b/src/test/compile-fail/issue-5358.rs index 8d4f463346693..b0a74fb37abe2 100644 --- a/src/test/compile-fail/issue-5358.rs +++ b/src/test/compile-fail/issue-5358.rs @@ -12,6 +12,6 @@ struct S(Either); fn main() { match *S(Left(5)) { - S(_) => {} //~ ERROR mismatched types: expected `std::either::Either` but found a structure pattern + S(_) => {} //~ ERROR mismatched types: expected `std::either::Either`, found a structure pattern } } diff --git a/src/test/compile-fail/issue-6762.rs b/src/test/compile-fail/issue-6762.rs index 391c1019a9468..14dcc4ea8a3a8 100644 --- a/src/test/compile-fail/issue-6762.rs +++ b/src/test/compile-fail/issue-6762.rs @@ -21,4 +21,4 @@ fn main() twice(x); invoke(sq); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs index 2350ca68b9747..75bc93c6d0b30 100644 --- a/src/test/compile-fail/lint-missing-doc.rs +++ b/src/test/compile-fail/lint-missing-doc.rs @@ -15,19 +15,17 @@ struct Foo { a: int, priv b: int, - pub c: int, // doesn't matter, Foo is private } pub struct PubFoo { //~ ERROR: missing documentation a: int, //~ ERROR: missing documentation priv b: int, - pub c: int, //~ ERROR: missing documentation } #[allow(missing_doc)] pub struct PubFoo2 { a: int, - pub c: int, + c: int, } /// dox @@ -44,9 +42,9 @@ pub trait C {} //~ ERROR: missing documentation trait Bar { /// dox - pub fn foo(); + fn foo(); fn foo2(); //~ ERROR: missing documentation - pub fn foo3(); //~ ERROR: missing documentation + fn foo3(); //~ ERROR: missing documentation } impl Foo { @@ -59,13 +57,13 @@ impl Foo { #[allow(missing_doc)] trait F { - pub fn a(); + fn a(); fn b(&self); } // should need to redefine documentation for implementations of traits impl F for Foo { - pub fn a() {} + fn a() {} fn b(&self) {} } diff --git a/src/test/compile-fail/loop-does-not-diverge.rs b/src/test/compile-fail/loop-does-not-diverge.rs index 0a9d9fb20ab0e..d0e5249305493 100644 --- a/src/test/compile-fail/loop-does-not-diverge.rs +++ b/src/test/compile-fail/loop-does-not-diverge.rs @@ -14,7 +14,7 @@ fn forever() -> ! { loop { break; } - return 42i; //~ ERROR expected `!` but found `int` + return 42i; //~ ERROR expected `!`, found `int` } fn main() { diff --git a/src/test/compile-fail/lub-if.rs b/src/test/compile-fail/lub-if.rs index 358c61921470f..6b5055cb1a2cd 100644 --- a/src/test/compile-fail/lub-if.rs +++ b/src/test/compile-fail/lub-if.rs @@ -49,4 +49,4 @@ pub fn opt_str3<'a>(maybestr: &'a Option<~str>) -> &'static str { } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/lub-match.rs b/src/test/compile-fail/lub-match.rs index 2a61b72997d1f..37b9cc55dc822 100644 --- a/src/test/compile-fail/lub-match.rs +++ b/src/test/compile-fail/lub-match.rs @@ -52,4 +52,4 @@ pub fn opt_str3<'a>(maybestr: &'a Option<~str>) -> &'static str { } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/main-wrong-location.rs b/src/test/compile-fail/main-wrong-location.rs index 90ef7843d4bf9..ef3f8140c68a0 100644 --- a/src/test/compile-fail/main-wrong-location.rs +++ b/src/test/compile-fail/main-wrong-location.rs @@ -12,4 +12,4 @@ mod m { // An inferred main entry point (that doesn't use #[main]) // must appear at the top of the crate fn main() { } //~ NOTE here is a function named 'main' -} \ No newline at end of file +} diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index f6fd8e29a4f4d..8b29d165b603c 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -17,5 +17,5 @@ fn main() { let x: @Map<~str, ~str> = @HashMap::new::<~str, ~str>() as @Map<~str, ~str>; let y: @Map = @x; - //~^ ERROR expected trait std::container::Map but found @-ptr + //~^ ERROR expected trait std::container::Map, found @-ptr } diff --git a/src/test/compile-fail/match-struct.rs b/src/test/compile-fail/match-struct.rs index 6e9bf603aef9e..2b75fc6410e86 100644 --- a/src/test/compile-fail/match-struct.rs +++ b/src/test/compile-fail/match-struct.rs @@ -4,7 +4,7 @@ enum E { C(int) } fn main() { match S { a: 1 } { - C(_) => (), //~ ERROR mismatched types: expected `S` but found `E` + C(_) => (), //~ ERROR mismatched types: expected `S`, found `E` _ => () } } diff --git a/src/test/compile-fail/match-vec-mismatch-2.rs b/src/test/compile-fail/match-vec-mismatch-2.rs index 6ea0300cf1e7d..f2c61898b385b 100644 --- a/src/test/compile-fail/match-vec-mismatch-2.rs +++ b/src/test/compile-fail/match-vec-mismatch-2.rs @@ -1,5 +1,5 @@ fn main() { match () { - [()] => { } //~ ERROR mismatched types: expected `()` but found a vector pattern + [()] => { } //~ ERROR mismatched types: expected `()`, found a vector pattern } } diff --git a/src/test/compile-fail/match-vec-mismatch.rs b/src/test/compile-fail/match-vec-mismatch.rs index 85ed8761ee935..ffc2e0b31ee48 100644 --- a/src/test/compile-fail/match-vec-mismatch.rs +++ b/src/test/compile-fail/match-vec-mismatch.rs @@ -1,6 +1,6 @@ fn main() { match ~"foo" { - ['f', 'o', .._] => { } //~ ERROR mismatched types: expected `~str` but found a vector pattern + ['f', 'o', .._] => { } //~ ERROR mismatched types: expected `~str`, found a vector pattern _ => { } } } diff --git a/src/test/compile-fail/multitrait.rs b/src/test/compile-fail/multitrait.rs index b49ee5aab47e6..2ad07dcbb069c 100644 --- a/src/test/compile-fail/multitrait.rs +++ b/src/test/compile-fail/multitrait.rs @@ -12,7 +12,7 @@ struct S { y: int } -impl Cmp, ToStr for S { //~ ERROR: expected `{` but found `,` +impl Cmp, ToStr for S { //~ ERROR: expected `{`, found `,` fn eq(&&other: S) { false } fn to_str(&self) -> ~str { ~"hi" } } diff --git a/src/test/compile-fail/noexporttypeexe.rs b/src/test/compile-fail/noexporttypeexe.rs index 3add0134d002a..e622122306f82 100644 --- a/src/test/compile-fail/noexporttypeexe.rs +++ b/src/test/compile-fail/noexporttypeexe.rs @@ -18,5 +18,5 @@ fn main() { // because the def_id associated with the type was // not convertible to a path. let x: int = noexporttypelib::foo(); - //~^ ERROR expected `int` but found `std::option::Option` + //~^ ERROR expected `int`, found `std::option::Option` } diff --git a/src/test/compile-fail/non-constant-expr-for-vec-repeat.rs b/src/test/compile-fail/non-constant-expr-for-vec-repeat.rs index 2727db9d0422e..25d2bd2982fb3 100644 --- a/src/test/compile-fail/non-constant-expr-for-vec-repeat.rs +++ b/src/test/compile-fail/non-constant-expr-for-vec-repeat.rs @@ -12,6 +12,6 @@ fn main() { fn bar(n: int) { - let _x = [0, ..n]; //~ ERROR expected constant integer for repeat count but found variable + let _x = [0, ..n]; //~ ERROR expected constant integer for repeat count, found variable } } diff --git a/src/test/compile-fail/omitted-arg-in-item-fn.rs b/src/test/compile-fail/omitted-arg-in-item-fn.rs index fcbfb115af756..c5ff885997b72 100644 --- a/src/test/compile-fail/omitted-arg-in-item-fn.rs +++ b/src/test/compile-fail/omitted-arg-in-item-fn.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(x) { //~ ERROR expected `:` but found `)` +fn foo(x) { //~ ERROR expected `:`, found `)` } diff --git a/src/test/compile-fail/omitted-arg-wrong-types.rs b/src/test/compile-fail/omitted-arg-wrong-types.rs index a44c113269b98..92052aaff5781 100644 --- a/src/test/compile-fail/omitted-arg-wrong-types.rs +++ b/src/test/compile-fail/omitted-arg-wrong-types.rs @@ -13,8 +13,8 @@ fn let_in(x: T, f: &fn(T)) {} fn main() { let_in(3u, |i| { assert!(i == 3); }); - //~^ ERROR expected `uint` but found `int` + //~^ ERROR expected `uint`, found `int` let_in(3, |i| { assert!(i == 3u); }); - //~^ ERROR expected `int` but found `uint` + //~^ ERROR expected `int`, found `uint` } diff --git a/src/test/compile-fail/pattern-error-continue.rs b/src/test/compile-fail/pattern-error-continue.rs index 14d8b04ade4eb..79fcc8468166e 100644 --- a/src/test/compile-fail/pattern-error-continue.rs +++ b/src/test/compile-fail/pattern-error-continue.rs @@ -29,8 +29,8 @@ fn main() { _ => () } match 'c' { - S { _ } => (), //~ ERROR mismatched types: expected `char` but found struct + S { _ } => (), //~ ERROR mismatched types: expected `char`, found struct _ => () } - f(true); //~ ERROR mismatched types: expected `char` but found `bool` -} \ No newline at end of file + f(true); //~ ERROR mismatched types: expected `char`, found `bool` +} diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/compile-fail/regions-bounds.rs index ab2ac6cc0e5b9..ebc19c6eaf772 100644 --- a/src/test/compile-fail/regions-bounds.rs +++ b/src/test/compile-fail/regions-bounds.rs @@ -16,12 +16,12 @@ struct an_enum<'self>(&'self int); struct a_class<'self> { x:&'self int } fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { - return e; //~ ERROR mismatched types: expected `an_enum<'b>` but found `an_enum<'a>` + return e; //~ ERROR mismatched types: expected `an_enum<'b>`, found `an_enum<'a>` //~^ ERROR cannot infer an appropriate lifetime } fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { - return e; //~ ERROR mismatched types: expected `a_class<'b>` but found `a_class<'a>` + return e; //~ ERROR mismatched types: expected `a_class<'b>`, found `a_class<'a>` //~^ ERROR cannot infer an appropriate lifetime } diff --git a/src/test/compile-fail/regions-free-region-ordering-callee.rs b/src/test/compile-fail/regions-free-region-ordering-callee.rs index e5399fc7fa3b9..66ab4b7705433 100644 --- a/src/test/compile-fail/regions-free-region-ordering-callee.rs +++ b/src/test/compile-fail/regions-free-region-ordering-callee.rs @@ -34,4 +34,4 @@ fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: &fn(&'a &'b uint)) { let z: Option<&'a &'b uint> = None; } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/regions-free-region-ordering-caller.rs b/src/test/compile-fail/regions-free-region-ordering-caller.rs index d06dcd8aa86b8..c9859899ea4f1 100644 --- a/src/test/compile-fail/regions-free-region-ordering-caller.rs +++ b/src/test/compile-fail/regions-free-region-ordering-caller.rs @@ -37,4 +37,4 @@ fn call4<'a, 'b>(a: &'a uint, b: &'b uint) { } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/compile-fail/regions-infer-paramd-indirect.rs index 0b4aa44010bdc..97f551ca0c2ae 100644 --- a/src/test/compile-fail/regions-infer-paramd-indirect.rs +++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs @@ -29,7 +29,7 @@ impl<'self> set_f<'self> for c<'self> { } fn set_f_bad(&self, b: @b) { - self.f = b; //~ ERROR mismatched types: expected `@@&'self int` but found `@@&int` + self.f = b; //~ ERROR mismatched types: expected `@@&'self int`, found `@@&int` //~^ ERROR cannot infer an appropriate lifetime } } diff --git a/src/test/compile-fail/regions-infer-paramd-method.rs b/src/test/compile-fail/regions-infer-paramd-method.rs index 8c3195f020a97..68bd2304b2ad0 100644 --- a/src/test/compile-fail/regions-infer-paramd-method.rs +++ b/src/test/compile-fail/regions-infer-paramd-method.rs @@ -30,7 +30,7 @@ trait set_foo_foo { impl<'self> set_foo_foo for with_foo<'self> { fn set_foo(&mut self, f: @foo) { - self.f = f; //~ ERROR mismatched types: expected `@foo/&self` but found `@foo/&` + self.f = f; //~ ERROR mismatched types: expected `@foo/&self`, found `@foo/&` } } diff --git a/src/test/compile-fail/regions-ref-in-fn-arg.rs b/src/test/compile-fail/regions-ref-in-fn-arg.rs index f90fe924587df..4848262750720 100644 --- a/src/test/compile-fail/regions-ref-in-fn-arg.rs +++ b/src/test/compile-fail/regions-ref-in-fn-arg.rs @@ -8,4 +8,4 @@ fn arg_closure() -> &'static int { with(|~ref x| x) //~ ERROR borrowed value does not live long enough } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/regions-trait-3.rs b/src/test/compile-fail/regions-trait-3.rs index 072b0e83fdf58..a3f2a28d643f7 100644 --- a/src/test/compile-fail/regions-trait-3.rs +++ b/src/test/compile-fail/regions-trait-3.rs @@ -16,7 +16,7 @@ trait get_ctxt<'self> { } fn make_gc1(gc: @get_ctxt<'a>) -> @get_ctxt<'b> { - return gc; //~ ERROR mismatched types: expected `@get_ctxt/&b` but found `@get_ctxt/&a` + return gc; //~ ERROR mismatched types: expected `@get_ctxt/&b`, found `@get_ctxt/&a` } struct Foo { diff --git a/src/test/compile-fail/repeat_count.rs b/src/test/compile-fail/repeat_count.rs index 579575e2008f8..dd0fd7e221dc8 100644 --- a/src/test/compile-fail/repeat_count.rs +++ b/src/test/compile-fail/repeat_count.rs @@ -12,5 +12,5 @@ fn main() { let n = 1; - let a = ~[0, ..n]; //~ ERROR expected constant integer for repeat count but found variable + let a = ~[0, ..n]; //~ ERROR expected constant integer for repeat count, found variable } diff --git a/src/test/compile-fail/struct-base-wrong-type.rs b/src/test/compile-fail/struct-base-wrong-type.rs index adda356298d9f..af6fc64535149 100644 --- a/src/test/compile-fail/struct-base-wrong-type.rs +++ b/src/test/compile-fail/struct-base-wrong-type.rs @@ -12,11 +12,11 @@ struct Foo { a: int, b: int } struct Bar { x: int } static bar: Bar = Bar { x: 5 }; -static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types: expected `Foo` but found `Bar` +static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types: expected `Foo`, found `Bar` static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types: expected `Foo` fn main() { let b = Bar { x: 5 }; - let f = Foo { a: 2, ..b }; //~ ERROR mismatched types: expected `Foo` but found `Bar` + let f = Foo { a: 2, ..b }; //~ ERROR mismatched types: expected `Foo`, found `Bar` let f_i = Foo { a: 2, ..4 }; //~ ERROR mismatched types: expected `Foo` } diff --git a/src/test/compile-fail/suppressed-error.rs b/src/test/compile-fail/suppressed-error.rs index b4a72548cfc0d..f13aabe52594a 100644 --- a/src/test/compile-fail/suppressed-error.rs +++ b/src/test/compile-fail/suppressed-error.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - let (x, y) = (); //~ ERROR expected `()` but found tuple (types differ) + let (x, y) = (); //~ ERROR expected `()`, found tuple (types differ) return x; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs index ebd3320d90126..478b4a4081ff6 100644 --- a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs +++ b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:mismatched types: expected `char` but found +// error-pattern:mismatched types: expected `char`, found // Issue #876 #[no_std]; diff --git a/src/test/compile-fail/tag-variant-disr-dup.rs b/src/test/compile-fail/tag-variant-disr-dup.rs index 216779fac7c46..a5f85a685e695 100644 --- a/src/test/compile-fail/tag-variant-disr-dup.rs +++ b/src/test/compile-fail/tag-variant-disr-dup.rs @@ -20,4 +20,4 @@ enum color { white = 0x000000, } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/terr-in-field.rs b/src/test/compile-fail/terr-in-field.rs index 6474a58c1cdb9..88da7bc854201 100644 --- a/src/test/compile-fail/terr-in-field.rs +++ b/src/test/compile-fail/terr-in-field.rs @@ -20,7 +20,7 @@ struct bar { fn want_foo(f: foo) {} fn have_bar(b: bar) { - want_foo(b); //~ ERROR (expected struct foo but found struct bar) + want_foo(b); //~ ERROR (expected struct foo, found struct bar) } fn main() {} diff --git a/src/test/compile-fail/terr-sorts.rs b/src/test/compile-fail/terr-sorts.rs index ad14688f08c62..462bb0a3962c7 100644 --- a/src/test/compile-fail/terr-sorts.rs +++ b/src/test/compile-fail/terr-sorts.rs @@ -17,7 +17,7 @@ type bar = @foo; fn want_foo(f: foo) {} fn have_bar(b: bar) { - want_foo(b); //~ ERROR (expected struct foo but found @-ptr) + want_foo(b); //~ ERROR (expected struct foo, found @-ptr) } fn main() {} diff --git a/src/test/compile-fail/trait-impl-method-mismatch.rs b/src/test/compile-fail/trait-impl-method-mismatch.rs index 54fa62f797766..e23c74880379c 100644 --- a/src/test/compile-fail/trait-impl-method-mismatch.rs +++ b/src/test/compile-fail/trait-impl-method-mismatch.rs @@ -15,7 +15,7 @@ trait Mumbo { impl Mumbo for uint { // Cannot have a larger effect than the trait: unsafe fn jumbo(&self, x: @uint) { *self + *x; } - //~^ ERROR expected impure fn but found unsafe fn + //~^ ERROR expected impure fn, found unsafe fn } fn main() {} diff --git a/src/test/compile-fail/tuple-arity-mismatch.rs b/src/test/compile-fail/tuple-arity-mismatch.rs index 517b3cb59232e..2ca8f3bcce261 100644 --- a/src/test/compile-fail/tuple-arity-mismatch.rs +++ b/src/test/compile-fail/tuple-arity-mismatch.rs @@ -13,5 +13,5 @@ fn first((value, _): (int, float)) -> int { value } fn main() { - let y = first ((1,2,3)); //~ ERROR expected a tuple with 2 elements but found one with 3 elements + let y = first ((1,2,3)); //~ ERROR expected a tuple with 2 elements, found one with 3 elements } diff --git a/src/test/compile-fail/tutorial-suffix-inference-test.rs b/src/test/compile-fail/tutorial-suffix-inference-test.rs index d92aa8d640ab5..c1be54b3f75e1 100644 --- a/src/test/compile-fail/tutorial-suffix-inference-test.rs +++ b/src/test/compile-fail/tutorial-suffix-inference-test.rs @@ -17,9 +17,9 @@ fn main() { identity_u8(x); // after this, `x` is assumed to have type `u8` identity_u16(x); - //~^ ERROR mismatched types: expected `u16` but found `u8` + //~^ ERROR mismatched types: expected `u16`, found `u8` identity_u16(y); - //~^ ERROR mismatched types: expected `u16` but found `i32` + //~^ ERROR mismatched types: expected `u16`, found `i32` let a = 3i; @@ -27,6 +27,6 @@ fn main() { identity_i(a); // ok identity_u16(a); - //~^ ERROR mismatched types: expected `u16` but found `int` + //~^ ERROR mismatched types: expected `u16`, found `int` } diff --git a/src/test/compile-fail/type-parameter-names.rs b/src/test/compile-fail/type-parameter-names.rs index 6af3166a2ff4e..c076e6b5c813f 100644 --- a/src/test/compile-fail/type-parameter-names.rs +++ b/src/test/compile-fail/type-parameter-names.rs @@ -1,6 +1,6 @@ // Test that we print out the names of type parameters correctly in // our error messages. -fn foo(x: Foo) -> Bar { x } //~ ERROR expected `Bar` but found `Foo` +fn foo(x: Foo) -> Bar { x } //~ ERROR expected `Bar`, found `Foo` -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/useless-priv.rs b/src/test/compile-fail/useless-priv.rs new file mode 100644 index 0000000000000..3d6841c919a4d --- /dev/null +++ b/src/test/compile-fail/useless-priv.rs @@ -0,0 +1,25 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct A { pub i: int } //~ ERROR: unnecessary `pub` +struct B { priv i: int } // don't warn b/c B can still be returned +pub enum C { pub Variant } //~ ERROR: unnecessary `pub` +enum D { priv Variant2 } //~ ERROR: unnecessary `priv` + +pub trait E { + pub fn foo() {} //~ ERROR: unnecessary visibility +} +trait F { pub fn foo() {} } //~ ERROR: unnecessary visibility + +impl E for A { + pub fn foo() {} //~ ERROR: unnecessary visibility +} + +fn main() {} diff --git a/src/test/compile-fail/useless-priv2.rs b/src/test/compile-fail/useless-priv2.rs new file mode 100644 index 0000000000000..0d94300329c2d --- /dev/null +++ b/src/test/compile-fail/useless-priv2.rs @@ -0,0 +1,19 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait E { + pub fn foo(); //~ ERROR: obsolete syntax +} +trait F { pub fn foo(); } //~ ERROR: obsolete syntax + +struct B; +impl E for B { + priv fn foo() {} //~ ERROR: obsolete syntax +} diff --git a/src/test/debug-info/borrowed-basic.rs b/src/test/debug-info/borrowed-basic.rs index 7610301f6f035..2ddf309b16916 100644 --- a/src/test/debug-info/borrowed-basic.rs +++ b/src/test/debug-info/borrowed-basic.rs @@ -110,4 +110,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/borrowed-c-style-enum.rs b/src/test/debug-info/borrowed-c-style-enum.rs index 70c85258c7921..14771396bd1ae 100644 --- a/src/test/debug-info/borrowed-c-style-enum.rs +++ b/src/test/debug-info/borrowed-c-style-enum.rs @@ -39,4 +39,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/borrowed-enum.rs b/src/test/debug-info/borrowed-enum.rs index 38aa9c3881000..7c8a6814dcb44 100644 --- a/src/test/debug-info/borrowed-enum.rs +++ b/src/test/debug-info/borrowed-enum.rs @@ -59,4 +59,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/borrowed-managed-basic.rs b/src/test/debug-info/borrowed-managed-basic.rs index 9087bb36fa5d6..7403ead3fcedd 100644 --- a/src/test/debug-info/borrowed-managed-basic.rs +++ b/src/test/debug-info/borrowed-managed-basic.rs @@ -111,4 +111,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/borrowed-struct.rs b/src/test/debug-info/borrowed-struct.rs index 8b6eca3e37f79..571333a8a3bc7 100644 --- a/src/test/debug-info/borrowed-struct.rs +++ b/src/test/debug-info/borrowed-struct.rs @@ -72,4 +72,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/borrowed-tuple.rs b/src/test/debug-info/borrowed-tuple.rs index da199941c8419..dbbf7d537aa54 100644 --- a/src/test/debug-info/borrowed-tuple.rs +++ b/src/test/debug-info/borrowed-tuple.rs @@ -41,4 +41,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/borrowed-unique-basic.rs b/src/test/debug-info/borrowed-unique-basic.rs index 52f5a2cba1ebe..893be617ac235 100644 --- a/src/test/debug-info/borrowed-unique-basic.rs +++ b/src/test/debug-info/borrowed-unique-basic.rs @@ -111,4 +111,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/boxed-struct.rs b/src/test/debug-info/boxed-struct.rs index 86162f0fa04cd..08f56154b62b8 100644 --- a/src/test/debug-info/boxed-struct.rs +++ b/src/test/debug-info/boxed-struct.rs @@ -56,4 +56,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/boxed-vec.rs b/src/test/debug-info/boxed-vec.rs index 8abead6519697..b6c6ce49ddaf4 100644 --- a/src/test/debug-info/boxed-vec.rs +++ b/src/test/debug-info/boxed-vec.rs @@ -33,4 +33,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/c-style-enum-in-composite.rs b/src/test/debug-info/c-style-enum-in-composite.rs index 47e433ea814ab..5a78666423a04 100644 --- a/src/test/debug-info/c-style-enum-in-composite.rs +++ b/src/test/debug-info/c-style-enum-in-composite.rs @@ -116,4 +116,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/c-style-enum.rs b/src/test/debug-info/c-style-enum.rs index d7cce4e6f3fb5..56c042f9e05fb 100644 --- a/src/test/debug-info/c-style-enum.rs +++ b/src/test/debug-info/c-style-enum.rs @@ -67,4 +67,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/destructured-fn-argument.rs b/src/test/debug-info/destructured-fn-argument.rs index 05718ab48909f..a3d53fb9efea2 100644 --- a/src/test/debug-info/destructured-fn-argument.rs +++ b/src/test/debug-info/destructured-fn-argument.rs @@ -315,4 +315,4 @@ fn main() { } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/destructured-local.rs b/src/test/debug-info/destructured-local.rs index f8db7981c941b..10d08ad66ba94 100644 --- a/src/test/debug-info/destructured-local.rs +++ b/src/test/debug-info/destructured-local.rs @@ -206,4 +206,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/evec-in-struct.rs b/src/test/debug-info/evec-in-struct.rs index 7e42690548e70..b23f3174705a9 100644 --- a/src/test/debug-info/evec-in-struct.rs +++ b/src/test/debug-info/evec-in-struct.rs @@ -85,4 +85,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/function-arguments.rs b/src/test/debug-info/function-arguments.rs index 1fe79b8e2a9e9..fba0a9b2dd2d1 100644 --- a/src/test/debug-info/function-arguments.rs +++ b/src/test/debug-info/function-arguments.rs @@ -45,4 +45,4 @@ fn fun(x: int, y: bool) -> (int, bool) { (x, y) } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/managed-enum.rs b/src/test/debug-info/managed-enum.rs index 1a3600a7d8cb3..ab77d7180bae1 100644 --- a/src/test/debug-info/managed-enum.rs +++ b/src/test/debug-info/managed-enum.rs @@ -60,4 +60,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/managed-pointer-within-unique-vec.rs b/src/test/debug-info/managed-pointer-within-unique-vec.rs index e42631599a9b9..facde86a305cc 100644 --- a/src/test/debug-info/managed-pointer-within-unique-vec.rs +++ b/src/test/debug-info/managed-pointer-within-unique-vec.rs @@ -34,4 +34,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/managed-pointer-within-unique.rs b/src/test/debug-info/managed-pointer-within-unique.rs index 3eb1c2ef01e55..9ea7b86f71141 100644 --- a/src/test/debug-info/managed-pointer-within-unique.rs +++ b/src/test/debug-info/managed-pointer-within-unique.rs @@ -44,4 +44,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/nil-enum.rs b/src/test/debug-info/nil-enum.rs index d3afd4b11f9cd..55ed84cd8f2ef 100644 --- a/src/test/debug-info/nil-enum.rs +++ b/src/test/debug-info/nil-enum.rs @@ -37,4 +37,4 @@ fn main() { } } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/option-like-enum.rs b/src/test/debug-info/option-like-enum.rs index 3bf3507faba77..3957d0b2a9873 100644 --- a/src/test/debug-info/option-like-enum.rs +++ b/src/test/debug-info/option-like-enum.rs @@ -69,4 +69,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/packed-struct-with-destructor.rs b/src/test/debug-info/packed-struct-with-destructor.rs index 9ff91aa00d1c9..cd2f9af26ca27 100644 --- a/src/test/debug-info/packed-struct-with-destructor.rs +++ b/src/test/debug-info/packed-struct-with-destructor.rs @@ -216,4 +216,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/packed-struct.rs b/src/test/debug-info/packed-struct.rs index 859166cb023a3..ef4d07fdb4322 100644 --- a/src/test/debug-info/packed-struct.rs +++ b/src/test/debug-info/packed-struct.rs @@ -101,4 +101,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/simple-struct.rs b/src/test/debug-info/simple-struct.rs index 49e7bc255c10f..7346c86fadb6e 100644 --- a/src/test/debug-info/simple-struct.rs +++ b/src/test/debug-info/simple-struct.rs @@ -81,4 +81,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/simple-tuple.rs b/src/test/debug-info/simple-tuple.rs index f45294221af16..f86959b7ca1eb 100644 --- a/src/test/debug-info/simple-tuple.rs +++ b/src/test/debug-info/simple-tuple.rs @@ -48,4 +48,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/struct-in-struct.rs b/src/test/debug-info/struct-in-struct.rs index 04c5eec610b73..60ac4bcea6087 100644 --- a/src/test/debug-info/struct-in-struct.rs +++ b/src/test/debug-info/struct-in-struct.rs @@ -142,4 +142,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/struct-style-enum.rs b/src/test/debug-info/struct-style-enum.rs index 61bbd2e215ff6..77d7746e2df86 100644 --- a/src/test/debug-info/struct-style-enum.rs +++ b/src/test/debug-info/struct-style-enum.rs @@ -70,4 +70,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/tuple-in-struct.rs b/src/test/debug-info/tuple-in-struct.rs index 369c9fd28ccdf..863cb57bd235a 100644 --- a/src/test/debug-info/tuple-in-struct.rs +++ b/src/test/debug-info/tuple-in-struct.rs @@ -148,4 +148,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/tuple-in-tuple.rs b/src/test/debug-info/tuple-in-tuple.rs index 9c6805dae67d3..ae77d4723f1ad 100644 --- a/src/test/debug-info/tuple-in-tuple.rs +++ b/src/test/debug-info/tuple-in-tuple.rs @@ -47,4 +47,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/tuple-style-enum.rs b/src/test/debug-info/tuple-style-enum.rs index ba1d02bb62a3c..dd52ee22766d4 100644 --- a/src/test/debug-info/tuple-style-enum.rs +++ b/src/test/debug-info/tuple-style-enum.rs @@ -70,4 +70,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/debug-info/unique-enum.rs b/src/test/debug-info/unique-enum.rs index 443f641a85859..101b51632d9b6 100644 --- a/src/test/debug-info/unique-enum.rs +++ b/src/test/debug-info/unique-enum.rs @@ -60,4 +60,4 @@ fn main() { zzz(); } -fn zzz() {()} \ No newline at end of file +fn zzz() {()} diff --git a/src/test/run-pass/borrowck-scope-of-deref-issue-4666.rs b/src/test/run-pass/borrowck-scope-of-deref-issue-4666.rs index 59e82a038bc79..0e7572220a8b4 100644 --- a/src/test/run-pass/borrowck-scope-of-deref-issue-4666.rs +++ b/src/test/run-pass/borrowck-scope-of-deref-issue-4666.rs @@ -47,4 +47,4 @@ fn fun2() { pub fn main() { fun1(); fun2(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/bug-7295.rs b/src/test/run-pass/bug-7295.rs index 2a1a0e35c56ed..ea711d78dd28e 100644 --- a/src/test/run-pass/bug-7295.rs +++ b/src/test/run-pass/bug-7295.rs @@ -9,9 +9,9 @@ // except according to those terms. pub trait Foo { - pub fn func1(&self, t: U); + fn func1(&self, t: U); - pub fn func2(&self, t: U) { + fn func2(&self, t: U) { self.func1(t); } } diff --git a/src/test/run-pass/cast-mutable-trait.rs b/src/test/run-pass/cast-mutable-trait.rs index 633188b9a623b..84827a7a82042 100644 --- a/src/test/run-pass/cast-mutable-trait.rs +++ b/src/test/run-pass/cast-mutable-trait.rs @@ -31,4 +31,4 @@ fn main() { s2.foo(); bar(s2); bar(s as @mut T); -} \ No newline at end of file +} diff --git a/src/test/run-pass/conditional-debug-macro-off.rs b/src/test/run-pass/conditional-debug-macro-off.rs index f40c8112e0bba..decd310c9a7e1 100644 --- a/src/test/run-pass/conditional-debug-macro-off.rs +++ b/src/test/run-pass/conditional-debug-macro-off.rs @@ -14,4 +14,4 @@ fn main() { // only fails if debug! evaluates its argument. debug!({ if true { fail!() } }); -} \ No newline at end of file +} diff --git a/src/test/run-pass/conditional-debug-macro-on.rs b/src/test/run-pass/conditional-debug-macro-on.rs index 65b751a58264d..a0da137369c1b 100644 --- a/src/test/run-pass/conditional-debug-macro-on.rs +++ b/src/test/run-pass/conditional-debug-macro-on.rs @@ -18,4 +18,4 @@ fn main() { debug!({ if true { return; } }); fail!(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs index 6f6e8d79d8b92..3d53ec97491a1 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs @@ -49,4 +49,4 @@ pub fn main() { assert_eq!(es1.cmp(es2), ord); } } -} \ No newline at end of file +} diff --git a/src/test/run-pass/deriving-via-extension-struct-empty.rs b/src/test/run-pass/deriving-via-extension-struct-empty.rs index 8f6a319798626..74698b9db28bc 100644 --- a/src/test/run-pass/deriving-via-extension-struct-empty.rs +++ b/src/test/run-pass/deriving-via-extension-struct-empty.rs @@ -14,4 +14,4 @@ struct Foo; pub fn main() { assert_eq!(Foo, Foo); assert!(!(Foo != Foo)); -} \ No newline at end of file +} diff --git a/src/test/run-pass/enum-vec-initializer.rs b/src/test/run-pass/enum-vec-initializer.rs index ae590ad7d1f71..11893bbf657ec 100644 --- a/src/test/run-pass/enum-vec-initializer.rs +++ b/src/test/run-pass/enum-vec-initializer.rs @@ -21,4 +21,4 @@ fn main() { let v = [0, .. BAR2]; static BAR3:uint = BAR2; let v = [0, .. BAR3]; -} \ No newline at end of file +} diff --git a/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs b/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs index 17c5bb5c0e253..cb438aa0b2085 100644 --- a/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs +++ b/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs @@ -38,4 +38,4 @@ fn main() { assert_eq!(x, 6); assert_eq!(y, 60); -} \ No newline at end of file +} diff --git a/src/test/run-pass/foreach-external-iterators-hashmap.rs b/src/test/run-pass/foreach-external-iterators-hashmap.rs index 908adc0d7620d..9a5c2fa86fadb 100644 --- a/src/test/run-pass/foreach-external-iterators-hashmap.rs +++ b/src/test/run-pass/foreach-external-iterators-hashmap.rs @@ -24,4 +24,4 @@ fn main() { } assert_eq!(x, 6); assert_eq!(y, 60); -} \ No newline at end of file +} diff --git a/src/test/run-pass/foreach-external-iterators.rs b/src/test/run-pass/foreach-external-iterators.rs index c6f903821dd0e..0933ac09243c9 100644 --- a/src/test/run-pass/foreach-external-iterators.rs +++ b/src/test/run-pass/foreach-external-iterators.rs @@ -15,4 +15,4 @@ fn main() { y += *i } assert!(y == 100); -} \ No newline at end of file +} diff --git a/src/test/run-pass/func-arg-incomplete-pattern.rs b/src/test/run-pass/func-arg-incomplete-pattern.rs index b08d3beae1bfa..6144e46593677 100644 --- a/src/test/run-pass/func-arg-incomplete-pattern.rs +++ b/src/test/run-pass/func-arg-incomplete-pattern.rs @@ -17,4 +17,4 @@ fn main() { let f = Foo {x: obj, y: ~2}; let xptr = foo(f); assert_eq!(objptr, xptr); -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index aa9be2203c6b2..a2fc6392b75fd 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -47,7 +47,7 @@ fn add_interface(store: int, managed_ip: ~str, data: extra::json::Json) -> (~str (label, bool_value(false)) } _ => { - error!("Expected dict for %s interfaces but found %?", managed_ip, data); + error!("Expected dict for %s interfaces, found %?", managed_ip, data); (~"gnos:missing-interface", bool_value(true)) } } @@ -65,7 +65,7 @@ fn add_interfaces(store: int, managed_ip: ~str, device: HashMap<~str, extra::jso } _ => { - error!("Expected list for %s interfaces but found %?", managed_ip, + error!("Expected list for %s interfaces, found %?", managed_ip, device.get(&~"interfaces")); ~[] } diff --git a/src/test/run-pass/issue-4252.rs b/src/test/run-pass/issue-4252.rs index de1f630a245b8..ebbdf6cc230ac 100644 --- a/src/test/run-pass/issue-4252.rs +++ b/src/test/run-pass/issue-4252.rs @@ -34,4 +34,4 @@ impl Drop for Z { fn main() { let y = Y; let _z = Z{x: y}; -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-6141-leaking-owned-fn.rs b/src/test/run-pass/issue-6141-leaking-owned-fn.rs index fe11bb0a972ad..cd48eba0f2322 100644 --- a/src/test/run-pass/issue-6141-leaking-owned-fn.rs +++ b/src/test/run-pass/issue-6141-leaking-owned-fn.rs @@ -5,4 +5,4 @@ fn run(f: &fn()) { fn main() { let f: ~fn() = || (); run(f); -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-6341.rs b/src/test/run-pass/issue-6341.rs index 29fc074430584..dfead893392be 100644 --- a/src/test/run-pass/issue-6341.rs +++ b/src/test/run-pass/issue-6341.rs @@ -15,4 +15,4 @@ impl Drop for A { fn drop(&self) {} } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/run-pass/issue-7712.rs b/src/test/run-pass/issue-7712.rs index 41c4af86bac95..1ea8312ddd927 100644 --- a/src/test/run-pass/issue-7712.rs +++ b/src/test/run-pass/issue-7712.rs @@ -11,7 +11,7 @@ // compile-flags:-Z debug-info pub trait TraitWithDefaultMethod { - pub fn method(self) { + fn method(self) { () } } diff --git a/src/test/run-pass/move-out-of-field.rs b/src/test/run-pass/move-out-of-field.rs index a3c2872803adc..04375052c3d6b 100644 --- a/src/test/run-pass/move-out-of-field.rs +++ b/src/test/run-pass/move-out-of-field.rs @@ -20,4 +20,4 @@ fn main() { sb.append("World!"); let str = to_str(sb); assert_eq!(str, ~"Hello, World!"); -} \ No newline at end of file +} diff --git a/src/test/run-pass/rt-start-main-thread.rs b/src/test/run-pass/rt-start-main-thread.rs index 8328e7416c579..2edf99e19430e 100644 --- a/src/test/run-pass/rt-start-main-thread.rs +++ b/src/test/run-pass/rt-start-main-thread.rs @@ -18,4 +18,4 @@ fn start(argc: int, argv: **u8, crate_map: *u8) -> int { info!("running on another thread"); } } -} \ No newline at end of file +} diff --git a/src/test/run-pass/static-methods-in-traits.rs b/src/test/run-pass/static-methods-in-traits.rs index 8cd7b78312bf2..180cd115c96e8 100644 --- a/src/test/run-pass/static-methods-in-traits.rs +++ b/src/test/run-pass/static-methods-in-traits.rs @@ -10,17 +10,17 @@ mod a { pub trait Foo { - pub fn foo() -> Self; + fn foo() -> Self; } impl Foo for int { - pub fn foo() -> int { + fn foo() -> int { 3 } } impl Foo for uint { - pub fn foo() -> uint { + fn foo() -> uint { 5u } } diff --git a/src/test/run-pass/unique-object-move.rs b/src/test/run-pass/unique-object-move.rs index 540de1652138b..e067fd49b1d13 100644 --- a/src/test/run-pass/unique-object-move.rs +++ b/src/test/run-pass/unique-object-move.rs @@ -21,4 +21,4 @@ impl EventLoop for UvEventLoop { } pub fn main() { let loop_: ~EventLoop = ~UvEventLoop { uvio: 0 } as ~EventLoop; let loop2_ = loop_; -} \ No newline at end of file +}