#[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
+ }
}
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`
}
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
}
+++ /dev/null
-// 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 <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 foo() -> ! { panic!("quux"); }
-fn main() {
- foo() //~ ERROR the type of this value must be known in this context
- ==
- foo();
-}
// 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
+
// 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
fn g() { }
let x = f == g;
//~^ ERROR binary operation `==` cannot be applied
+ //~| ERROR mismatched types
}
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
;
}
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() {
fn main() {
let x = |ref x: isize| -> isize { x += 1; };
- //~^ ERROR binary assignment operation `+=` cannot be applied to type `&isize`
+ //~^ ERROR E0368
}
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
// ignore-tidy-linelength
+#![feature(core)]
use std::simd::f32x4;
+++ /dev/null
-// 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() { }
--- /dev/null
+// 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 <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.
+
+// error-pattern:quux
+fn foo() -> ! { panic!("quux"); }
+fn main() {
+ foo() == foo(); // these types wind up being defaulted to ()
+}
// 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;
#[start]
fn main(_: isize, _: *const *const u8) -> isize {
- 1 % 1
+ 1_isize % 1_isize
}