From e2b2a53d704899e5e59c943ab39fa692125233be Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 30 Mar 2015 04:56:24 -0400 Subject: [PATCH] Fallout in tests: largely changes to error messages. --- src/test/auxiliary/lang-item-public.rs | 17 +++++++++-------- .../assignment-operator-unimplemented.rs | 2 +- ...ated-types-ICE-when-projecting-out-of-err.rs | 3 ++- src/test/compile-fail/binop-logic-float.rs | 5 +++-- src/test/compile-fail/binop-logic-int.rs | 4 ++-- src/test/compile-fail/fn-compare-mismatch.rs | 1 + src/test/compile-fail/issue-11771.rs | 14 ++++---------- src/test/compile-fail/issue-2149.rs | 3 ++- src/test/compile-fail/issue-5239-1.rs | 2 +- .../compile-fail/shift-various-bad-types.rs | 14 +++++++------- src/test/compile-fail/simd-binop.rs | 1 + src/test/pretty/issue-929.rs | 13 ------------- .../{compile-fail => run-fail}/binop-fail-3.rs | 5 ++--- src/test/run-fail/bounds-check-no-overflow.rs | 2 +- src/test/run-pass/lang-item-public.rs | 2 +- 15 files changed, 37 insertions(+), 51 deletions(-) delete mode 100644 src/test/pretty/issue-929.rs rename src/test/{compile-fail => run-fail}/binop-fail-3.rs (84%) diff --git a/src/test/auxiliary/lang-item-public.rs b/src/test/auxiliary/lang-item-public.rs index 3c416dc2ef8d..72dfc75f41b9 100644 --- a/src/test/auxiliary/lang-item-public.rs +++ b/src/test/auxiliary/lang-item-public.rs @@ -35,18 +35,19 @@ pub trait Copy : PhantomFn { #[lang="rem"] pub trait Rem { - /// The resulting type after applying the `%` operator - #[stable(feature = "rust1", since = "1.0.0")] type Output = Self; - - /// The method for the `%` operator - #[stable(feature = "rust1", since = "1.0.0")] fn rem(self, rhs: RHS) -> Self::Output; } -impl Rem for i32 { - type Output = i32; +impl Rem for isize { + type Output = isize; #[inline] - fn rem(self, other: i32) -> i32 { self % other } + fn rem(self, other: isize) -> isize { + // if you use `self % other` here, as one would expect, you + // get back an error because of potential failure/overflow, + // which tries to invoke error fns that don't have the + // appropriate signatures anymore. So...just return 0. + 0 + } } diff --git a/src/test/compile-fail/assignment-operator-unimplemented.rs b/src/test/compile-fail/assignment-operator-unimplemented.rs index 5b24c6bd79f9..fef27af59571 100644 --- a/src/test/compile-fail/assignment-operator-unimplemented.rs +++ b/src/test/compile-fail/assignment-operator-unimplemented.rs @@ -13,5 +13,5 @@ struct Foo; fn main() { let mut a = Foo; let ref b = Foo; - a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo` + a += *b; //~ Error: binary assignment operation `+=` cannot be applied to types `Foo` and `Foo` } diff --git a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs index edd1b8255ccd..04170779ed2f 100644 --- a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs +++ b/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs @@ -35,5 +35,6 @@ trait Add { fn ice(a: A) { let r = loop {}; r = r + a; - //~^ ERROR binary operation `+` cannot be applied to type `A` + //~^ ERROR not implemented + //~| ERROR not implemented } diff --git a/src/test/compile-fail/binop-logic-float.rs b/src/test/compile-fail/binop-logic-float.rs index 923d611cebee..f3fb5a08c854 100644 --- a/src/test/compile-fail/binop-logic-float.rs +++ b/src/test/compile-fail/binop-logic-float.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:`||` cannot be applied to type `f32` - fn main() { let x = 1.0_f32 || 2.0_f32; } +//~^ ERROR mismatched types +//~| ERROR mismatched types + diff --git a/src/test/compile-fail/binop-logic-int.rs b/src/test/compile-fail/binop-logic-int.rs index d5dd9e00902f..f5e53f84c16e 100644 --- a/src/test/compile-fail/binop-logic-int.rs +++ b/src/test/compile-fail/binop-logic-int.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:`&&` cannot be applied to type `_` - fn main() { let x = 1 && 2; } +//~^ ERROR mismatched types +//~| ERROR mismatched types diff --git a/src/test/compile-fail/fn-compare-mismatch.rs b/src/test/compile-fail/fn-compare-mismatch.rs index 6178d37a5bd6..27be1ada4455 100644 --- a/src/test/compile-fail/fn-compare-mismatch.rs +++ b/src/test/compile-fail/fn-compare-mismatch.rs @@ -13,4 +13,5 @@ fn main() { fn g() { } let x = f == g; //~^ ERROR binary operation `==` cannot be applied + //~| ERROR mismatched types } diff --git a/src/test/compile-fail/issue-11771.rs b/src/test/compile-fail/issue-11771.rs index 2de86e527ef5..40fc6b1ed6aa 100644 --- a/src/test/compile-fail/issue-11771.rs +++ b/src/test/compile-fail/issue-11771.rs @@ -11,19 +11,13 @@ fn main() { let x = (); 1 + - x //~ ERROR mismatched types - //~| expected `_` - //~| found `()` - //~| expected integral variable - //~| found () + x //~^ ERROR E0277 + //~| ERROR E0277 ; let x: () = (); 1 + - x //~ ERROR mismatched types - //~| expected `_` - //~| found `()` - //~| expected integral variable - //~| found () + x //~^ ERROR E0277 + //~| ERROR E0277 ; } diff --git a/src/test/compile-fail/issue-2149.rs b/src/test/compile-fail/issue-2149.rs index 37dbcaf39bd1..ea305c96af4a 100644 --- a/src/test/compile-fail/issue-2149.rs +++ b/src/test/compile-fail/issue-2149.rs @@ -16,7 +16,8 @@ impl vec_monad for Vec { fn bind(&self, mut f: F) where F: FnMut(A) -> Vec { let mut r = panic!(); for elt in self { r = r + f(*elt); } - //~^ ERROR binary operation `+` cannot be applied to type `collections::vec::Vec` + //~^ ERROR E0277 + //~| ERROR E0277 } } fn main() { diff --git a/src/test/compile-fail/issue-5239-1.rs b/src/test/compile-fail/issue-5239-1.rs index 49a43ee37adc..1ebef06008ff 100644 --- a/src/test/compile-fail/issue-5239-1.rs +++ b/src/test/compile-fail/issue-5239-1.rs @@ -12,5 +12,5 @@ fn main() { let x = |ref x: isize| -> isize { x += 1; }; - //~^ ERROR binary assignment operation `+=` cannot be applied to type `&isize` + //~^ ERROR E0368 } diff --git a/src/test/compile-fail/shift-various-bad-types.rs b/src/test/compile-fail/shift-various-bad-types.rs index 901ae1d5e2ab..24b66213b39b 100644 --- a/src/test/compile-fail/shift-various-bad-types.rs +++ b/src/test/compile-fail/shift-various-bad-types.rs @@ -17,19 +17,19 @@ struct Panolpy { fn foo(p: &Panolpy) { 22 >> p.char; - //~^ ERROR right-hand-side of a shift operation must have integral type + //~^ ERROR E0277 + //~| ERROR E0277 22 >> p.str; - //~^ ERROR right-hand-side of a shift operation must have integral type + //~^ ERROR E0277 + //~| ERROR E0277 22 >> p; - //~^ ERROR right-hand-side of a shift operation must have integral type + //~^ ERROR E0277 + //~| ERROR E0277 - // We could be more accepting in the case of a type not yet inferred, but not - // known to be an integer, but meh. let x; - 22 >> x; - //~^ ERROR the type of this value must be known in this context + 22 >> x; // ambiguity error winds up being suppressed 22 >> 1; // Integer literal types are OK diff --git a/src/test/compile-fail/simd-binop.rs b/src/test/compile-fail/simd-binop.rs index f028c9af4623..feffe5c0b06c 100644 --- a/src/test/compile-fail/simd-binop.rs +++ b/src/test/compile-fail/simd-binop.rs @@ -10,6 +10,7 @@ // ignore-tidy-linelength +#![feature(core)] use std::simd::f32x4; diff --git a/src/test/pretty/issue-929.rs b/src/test/pretty/issue-929.rs deleted file mode 100644 index 75a6b919342b..000000000000 --- a/src/test/pretty/issue-929.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 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. - -fn f() { if (1 == panic!()) { } else { } } - -fn main() { } diff --git a/src/test/compile-fail/binop-fail-3.rs b/src/test/run-fail/binop-fail-3.rs similarity index 84% rename from src/test/compile-fail/binop-fail-3.rs rename to src/test/run-fail/binop-fail-3.rs index 097a52b89417..8cabd3b32629 100644 --- a/src/test/compile-fail/binop-fail-3.rs +++ b/src/test/run-fail/binop-fail-3.rs @@ -8,9 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// error-pattern:quux fn foo() -> ! { panic!("quux"); } fn main() { - foo() //~ ERROR the type of this value must be known in this context - == - foo(); + foo() == foo(); // these types wind up being defaulted to () } diff --git a/src/test/run-fail/bounds-check-no-overflow.rs b/src/test/run-fail/bounds-check-no-overflow.rs index c15c4b83828a..4d502cb2106b 100644 --- a/src/test/run-fail/bounds-check-no-overflow.rs +++ b/src/test/run-fail/bounds-check-no-overflow.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:index out of bounds: the len is 3 but the index is +// error-pattern:assertion failed: index < self.len() use std::usize; use std::mem::size_of; diff --git a/src/test/run-pass/lang-item-public.rs b/src/test/run-pass/lang-item-public.rs index 780bb52b3e8b..f5b9bd4fbaa6 100644 --- a/src/test/run-pass/lang-item-public.rs +++ b/src/test/run-pass/lang-item-public.rs @@ -46,5 +46,5 @@ extern {} #[start] fn main(_: isize, _: *const *const u8) -> isize { - 1 % 1 + 1_isize % 1_isize }