Skip to content

Commit e2b2a53

Browse files
committed
Fallout in tests: largely changes to error messages.
1 parent c92bdcb commit e2b2a53

15 files changed

+37
-51
lines changed

src/test/auxiliary/lang-item-public.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ pub trait Copy : PhantomFn<Self> {
3535

3636
#[lang="rem"]
3737
pub trait Rem<RHS=Self> {
38-
/// The resulting type after applying the `%` operator
39-
#[stable(feature = "rust1", since = "1.0.0")]
4038
type Output = Self;
41-
42-
/// The method for the `%` operator
43-
#[stable(feature = "rust1", since = "1.0.0")]
4439
fn rem(self, rhs: RHS) -> Self::Output;
4540
}
4641

47-
impl Rem for i32 {
48-
type Output = i32;
42+
impl Rem for isize {
43+
type Output = isize;
4944

5045
#[inline]
51-
fn rem(self, other: i32) -> i32 { self % other }
46+
fn rem(self, other: isize) -> isize {
47+
// if you use `self % other` here, as one would expect, you
48+
// get back an error because of potential failure/overflow,
49+
// which tries to invoke error fns that don't have the
50+
// appropriate signatures anymore. So...just return 0.
51+
0
52+
}
5253
}

src/test/compile-fail/assignment-operator-unimplemented.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ struct Foo;
1313
fn main() {
1414
let mut a = Foo;
1515
let ref b = Foo;
16-
a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo`
16+
a += *b; //~ Error: binary assignment operation `+=` cannot be applied to types `Foo` and `Foo`
1717
}

src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ trait Add<RHS=Self> {
3535
fn ice<A>(a: A) {
3636
let r = loop {};
3737
r = r + a;
38-
//~^ ERROR binary operation `+` cannot be applied to type `A`
38+
//~^ ERROR not implemented
39+
//~| ERROR not implemented
3940
}

src/test/compile-fail/binop-logic-float.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:`||` cannot be applied to type `f32`
12-
1311
fn main() { let x = 1.0_f32 || 2.0_f32; }
12+
//~^ ERROR mismatched types
13+
//~| ERROR mismatched types
14+

src/test/compile-fail/binop-logic-int.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:`&&` cannot be applied to type `_`
12-
1311
fn main() { let x = 1 && 2; }
12+
//~^ ERROR mismatched types
13+
//~| ERROR mismatched types

src/test/compile-fail/fn-compare-mismatch.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ fn main() {
1313
fn g() { }
1414
let x = f == g;
1515
//~^ ERROR binary operation `==` cannot be applied
16+
//~| ERROR mismatched types
1617
}

src/test/compile-fail/issue-11771.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,13 @@
1111
fn main() {
1212
let x = ();
1313
1 +
14-
x //~ ERROR mismatched types
15-
//~| expected `_`
16-
//~| found `()`
17-
//~| expected integral variable
18-
//~| found ()
14+
x //~^ ERROR E0277
15+
//~| ERROR E0277
1916
;
2017

2118
let x: () = ();
2219
1 +
23-
x //~ ERROR mismatched types
24-
//~| expected `_`
25-
//~| found `()`
26-
//~| expected integral variable
27-
//~| found ()
20+
x //~^ ERROR E0277
21+
//~| ERROR E0277
2822
;
2923
}

src/test/compile-fail/issue-2149.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ impl<A> vec_monad<A> for Vec<A> {
1616
fn bind<B, F>(&self, mut f: F) where F: FnMut(A) -> Vec<B> {
1717
let mut r = panic!();
1818
for elt in self { r = r + f(*elt); }
19-
//~^ ERROR binary operation `+` cannot be applied to type `collections::vec::Vec<B>`
19+
//~^ ERROR E0277
20+
//~| ERROR E0277
2021
}
2122
}
2223
fn main() {

src/test/compile-fail/issue-5239-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212

1313
fn main() {
1414
let x = |ref x: isize| -> isize { x += 1; };
15-
//~^ ERROR binary assignment operation `+=` cannot be applied to type `&isize`
15+
//~^ ERROR E0368
1616
}

src/test/compile-fail/shift-various-bad-types.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ struct Panolpy {
1717

1818
fn foo(p: &Panolpy) {
1919
22 >> p.char;
20-
//~^ ERROR right-hand-side of a shift operation must have integral type
20+
//~^ ERROR E0277
21+
//~| ERROR E0277
2122

2223
22 >> p.str;
23-
//~^ ERROR right-hand-side of a shift operation must have integral type
24+
//~^ ERROR E0277
25+
//~| ERROR E0277
2426

2527
22 >> p;
26-
//~^ ERROR right-hand-side of a shift operation must have integral type
28+
//~^ ERROR E0277
29+
//~| ERROR E0277
2730

28-
// We could be more accepting in the case of a type not yet inferred, but not
29-
// known to be an integer, but meh.
3031
let x;
31-
22 >> x;
32-
//~^ ERROR the type of this value must be known in this context
32+
22 >> x; // ambiguity error winds up being suppressed
3333

3434
22 >> 1;
3535
// Integer literal types are OK

src/test/compile-fail/simd-binop.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// ignore-tidy-linelength
1212

13+
#![feature(core)]
1314

1415
use std::simd::f32x4;
1516

src/test/pretty/issue-929.rs

-13
This file was deleted.

src/test/compile-fail/binop-fail-3.rs renamed to src/test/run-fail/binop-fail-3.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// error-pattern:quux
1112
fn foo() -> ! { panic!("quux"); }
1213
fn main() {
13-
foo() //~ ERROR the type of this value must be known in this context
14-
==
15-
foo();
14+
foo() == foo(); // these types wind up being defaulted to ()
1615
}

src/test/run-fail/bounds-check-no-overflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:index out of bounds: the len is 3 but the index is
11+
// error-pattern:assertion failed: index < self.len()
1212

1313
use std::usize;
1414
use std::mem::size_of;

src/test/run-pass/lang-item-public.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ extern {}
4646

4747
#[start]
4848
fn main(_: isize, _: *const *const u8) -> isize {
49-
1 % 1
49+
1_isize % 1_isize
5050
}

0 commit comments

Comments
 (0)