Fallout in tests: largely changes to error messages.
This commit is contained in:
parent
c92bdcb232
commit
e2b2a53d70
15 changed files with 37 additions and 51 deletions
|
|
@ -35,18 +35,19 @@ pub trait Copy : PhantomFn<Self> {
|
|||
|
||||
#[lang="rem"]
|
||||
pub trait Rem<RHS=Self> {
|
||||
/// 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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,6 @@ trait Add<RHS=Self> {
|
|||
fn ice<A>(a: A) {
|
||||
let r = loop {};
|
||||
r = r + a;
|
||||
//~^ ERROR binary operation `+` cannot be applied to type `A`
|
||||
//~^ ERROR not implemented
|
||||
//~| ERROR not implemented
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -13,4 +13,5 @@ fn main() {
|
|||
fn g() { }
|
||||
let x = f == g;
|
||||
//~^ ERROR binary operation `==` cannot be applied
|
||||
//~| ERROR mismatched types
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ impl<A> vec_monad<A> for Vec<A> {
|
|||
fn bind<B, F>(&self, mut f: F) where F: FnMut(A) -> Vec<B> {
|
||||
let mut r = panic!();
|
||||
for elt in self { r = r + f(*elt); }
|
||||
//~^ ERROR binary operation `+` cannot be applied to type `collections::vec::Vec<B>`
|
||||
//~^ ERROR E0277
|
||||
//~| ERROR E0277
|
||||
}
|
||||
}
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![feature(core)]
|
||||
|
||||
use std::simd::f32x4;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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() { }
|
||||
|
|
@ -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 ()
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -46,5 +46,5 @@ extern {}
|
|||
|
||||
#[start]
|
||||
fn main(_: isize, _: *const *const u8) -> isize {
|
||||
1 % 1
|
||||
1_isize % 1_isize
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue