Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Adjust the error messages to match the pattern "expected foo, found bar" #8413

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
88b89f8
Allow disabling optimizations in tests only
alexcrichton Aug 11, 2013
dcecc66
Cleanup librustpkg a little bit.
mstewartgallus Jul 18, 2013
ee5cfb0
Don't use unkillable in UnsafeArc dtor when there's no unwrapper. Clo…
bblum Aug 8, 2013
c8c09d4
Reorganise Select traits to not expose internal runtime types. Close …
bblum Aug 8, 2013
31f9b51
Make cell with_ref/with_mut_ref use finally. Close #7975.
bblum Aug 8, 2013
ce48e71
Fix select() in light of the deschedule...and then race. Close #8347.
bblum Aug 9, 2013
5ac8c57
Clean up transitionary glue in task/spawn.rs. Don't hold kill-little-…
bblum Aug 12, 2013
d376a01
make error messages conform to style guide
Aug 9, 2013
8b502d6
register snapshots
thestinger Aug 12, 2013
0cb0ef2
fix build with the new snapshot compiler
thestinger Aug 12, 2013
d9492d7
auto merge of #8450 : alexcrichton/rust/nopt-changes, r=graydon
bors Aug 13, 2013
44675ac
auto merge of #8476 : thestinger/rust/snapshot, r=brson
bors Aug 13, 2013
930885d
Forbid pub/priv where it has no effect
alexcrichton Aug 9, 2013
4601ea6
auto merge of #8487 : brson/rust/local-opts, r=brson
bors Aug 13, 2013
c99b2b9
auto merge of #7866 : sstewartgallus/rust/clean, r=cmr
bors Aug 13, 2013
f02cc6b
auto merge of #8411 : bblum/rust/assorted-fixes, r=brson
bors Aug 13, 2013
0d817ee
auto merge of #8423 : alexcrichton/rust/less-priv-again, r=bstrie
bors Aug 13, 2013
f6cb455
rebase
Aug 13, 2013
410cfad
Merge branch 'expect_found' of github.com:kud1ing/rust into expect_found
Aug 13, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ opt docs 1 "build documentation"
opt optimize 1 "build optimized rust code"
opt optimize-cxx 1 "build optimized C++ code"
opt optimize-llvm 1 "build optimized LLVM"
opt optimize-tests 1 "build tests with optimizations"
opt llvm-assertions 1 "build LLVM with assertions"
opt debug 0 "build with extra debug fun"
opt ratchet-bench 0 "ratchet benchmarks"
Expand Down
10 changes: 9 additions & 1 deletion mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,15 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \

# The tests select when to use debug configuration on their own;
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
CTEST_RUSTC_FLAGS = $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
CTEST_RUSTC_FLAGS := $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))

# The tests can not be optimized while the rest of the compiler is optimized, so
# filter out the optimization (if any) from rustc and then figure out if we need
# to be optimized
CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
ifndef CFG_DISABLE_OPTIMIZE_TESTS
CTEST_RUSTC_FLAGS += -O
endif

CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
Expand Down
8 changes: 4 additions & 4 deletions src/libextra/crypto/sha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/ebml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand All @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/libextra/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ pub struct EnumSet<E> {
/// 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:CLike>(e: E) -> uint {
Expand Down Expand Up @@ -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) }
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/num/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
BigUint::parse_bytes(s.as_bytes(), radix)
}
Expand Down
97 changes: 0 additions & 97 deletions src/libextra/terminfo/parm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,103 +475,6 @@ impl FormatOp {
}
}

#[cfg(stage0)]
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
let mut s = match val {
Number(d) => {
match op {
FormatString => {
return Err(~"non-number on stack with %s")
}
_ => {
let radix = match op {
FormatDigit => 10,
FormatOctal => 8,
FormatHex|FormatHEX => 16,
FormatString => util::unreachable()
};
let mut s = ~[];
match op {
FormatDigit => {
let sign = if flags.sign { SignAll } else { SignNeg };
do int_to_str_bytes_common(d, radix, sign) |c| {
s.push(c);
}
}
_ => {
do int_to_str_bytes_common(d as uint, radix, SignNone) |c| {
s.push(c);
}
}
};
if flags.precision > s.len() {
let mut s_ = vec::with_capacity(flags.precision);
let n = flags.precision - s.len();
s_.grow(n, &('0' as u8));
s_.push_all_move(s);
s = s_;
}
assert!(!s.is_empty(), "string conversion produced empty result");
match op {
FormatDigit => {
if flags.space && !(s[0] == '-' as u8 || s[0] == '+' as u8) {
s.unshift(' ' as u8);
}
}
FormatOctal => {
if flags.alternate && s[0] != '0' as u8 {
s.unshift('0' as u8);
}
}
FormatHex => {
if flags.alternate {
let s_ = util::replace(&mut s, ~['0' as u8, 'x' as u8]);
s.push_all_move(s_);
}
}
FormatHEX => {
s = s.into_ascii().to_upper().into_bytes();
if flags.alternate {
let s_ = util::replace(&mut s, ~['0' as u8, 'X' as u8]);
s.push_all_move(s_);
}
}
FormatString => util::unreachable()
}
s
}
}
}
String(s) => {
match op {
FormatString => {
let mut s = s.as_bytes().to_owned();
if flags.precision > 0 && flags.precision < s.len() {
s.truncate(flags.precision);
}
s
}
_ => {
return Err(fmt!("non-string on stack with %%%c", op.to_char()))
}
}
}
};
if flags.width > s.len() {
let n = flags.width - s.len();
if flags.left {
s.grow(n, &(' ' as u8));
} else {
let mut s_ = vec::with_capacity(flags.width);
s_.grow(n, &(' ' as u8));
s_.push_all_move(s);
s = s_;
}
}
Ok(s)
}

#[cfg(not(stage0))]
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
let mut s = match val {
Number(d) => {
Expand Down
8 changes: 4 additions & 4 deletions src/libextra/terminfo/parser/compiled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/treemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ impl<K: TotalOrd, V, T: Iterator<(K, V)>> Extendable<(K, V), T> for TreeMap<K, V
}

impl<T: TotalOrd, Iter: Iterator<T>> FromIterator<T, Iter> for TreeSet<T> {
pub fn from_iterator(iter: &mut Iter) -> TreeSet<T> {
fn from_iterator(iter: &mut Iter) -> TreeSet<T> {
let mut set = TreeSet::new();
set.extend(iter);
set
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
13 changes: 0 additions & 13 deletions src/librustc/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,6 @@ pub fn get_absolute_rpath(lib: &Path) -> Path {
os::make_absolute(lib).dir_path()
}

#[cfg(stage0)]
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
let install_prefix = env!("CFG_PREFIX");

if install_prefix == "" {
fail!("rustc compiled without CFG_PREFIX environment variable");
}

let tlib = filesearch::relative_target_lib_path(target_triple);
os::make_absolute(&Path(install_prefix).push_rel(&tlib))
}

#[cfg(not(stage0))]
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
let install_prefix = env!("CFG_PREFIX");

Expand Down
19 changes: 0 additions & 19 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,25 +578,6 @@ pub fn build_target_config(sopts: @session::options,
return target_cfg;
}

#[cfg(stage0)]
pub fn host_triple() -> ~str {
// Get the host triple out of the build environment. This ensures that our
// idea of the host triple is the same as for the set of libraries we've
// actually built. We can't just take LLVM's host triple because they
// normalize all ix86 architectures to i386.
//
// Instead of grabbing the host triple (for the current host), we grab (at
// compile time) the target triple that this rustc is built with and
// calling that (at runtime) the host triple.
let ht = env!("CFG_COMPILER_TRIPLE");
return if ht != "" {
ht.to_owned()
} else {
fail!("rustc built without CFG_COMPILER_TRIPLE")
};
}

#[cfg(not(stage0))]
pub fn host_triple() -> ~str {
// Get the host triple out of the build environment. This ensures that our
// idea of the host triple is the same as for the set of libraries we've
Expand Down
10 changes: 0 additions & 10 deletions src/librustc/metadata/filesearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,6 @@ fn push_if_exists(vec: &mut ~[Path], p: &Path) {

// The name of the directory rustc expects libraries to be located.
// On Unix should be "lib", on windows "bin"
#[cfg(stage0)]
pub fn libdir() -> ~str {
let libdir = env!("CFG_LIBDIR");
if libdir.is_empty() {
fail!("rustc compiled without CFG_LIBDIR environment variable");
}
libdir.to_owned()
}

#[cfg(not(stage0))]
pub fn libdir() -> ~str {
(env!("CFG_LIBDIR")).to_owned()
}
4 changes: 2 additions & 2 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Loading