Stop accepting 'impl ...;', require {} instead

Progress on #7981
This commit is contained in:
Alex Crichton 2013-09-19 12:09:52 -07:00
parent 4dacd73651
commit 4b266f1c0d
24 changed files with 36 additions and 35 deletions

View file

@ -35,6 +35,6 @@ impl Eq for MyInt {
fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
}
impl MyNum for MyInt;
impl MyNum for MyInt {}
fn mi(v: int) -> MyInt { MyInt { val: v } }

View file

@ -20,7 +20,7 @@ impl MyEq for int {
fn eq(&self, other: &int) -> bool { *self == *other }
}
impl MyEq for A; //~ ERROR missing method
impl MyEq for A {} //~ ERROR missing method
fn main() {
}

View file

@ -40,7 +40,7 @@ trait Trait<T1> {
}
}
impl<T> Trait<T> for Struct;
impl<T> Trait<T> for Struct {}
fn main() {

View file

@ -118,7 +118,7 @@ trait Trait {
}
}
impl Trait for Struct;
impl Trait for Struct {}
fn main() {
let stack = Struct { x: 100 };

View file

@ -119,7 +119,7 @@ trait Trait {
}
}
impl Trait for Struct;
impl Trait for Struct {}
fn main() {
let stack = Struct { x: 987 };

View file

@ -40,7 +40,7 @@ trait Trait {
}
}
impl Trait for Struct;
impl Trait for Struct {}
fn main() {

View file

@ -1,5 +1,5 @@
trait X { }
impl X for uint;
impl X for uint { }
trait Y { }
impl Y for uint;
impl Y for uint { }

View file

@ -1,5 +1,5 @@
trait X { }
impl X for uint;
impl X for uint { }
trait Y { }
impl Y for uint;
impl Y for uint { }

View file

@ -1,7 +1,7 @@
// pp-exact
trait Tr { }
impl Tr for int;
impl Tr for int { }
fn foo(x: ~Tr: Freeze) -> ~Tr: Freeze { x }

View file

@ -29,7 +29,7 @@ impl Y for int {
fn y(self) -> int { self }
}
impl Z for int;
impl Z for int {}
fn main() {
assert_eq!(12.x(), 12);

View file

@ -31,7 +31,7 @@ impl Positioned<int> for Point {
}
}
impl Movable<int> for Point;
impl Movable<int> for Point {}
pub fn main() {
let mut p = Point{ x: 1, y: 2};

View file

@ -24,7 +24,7 @@ impl Positioned for Point {
}
}
impl Movable for Point;
impl Movable for Point {}
pub fn main() {
let mut p = Point{ x: 1, y: 2};

View file

@ -32,7 +32,7 @@ impl Positioned for Point {
}
}
impl Movable for Point;
impl Movable for Point {}
pub fn main() {
let mut p = Point{ x: 1, y: 2};

View file

@ -33,7 +33,7 @@ impl<S: Clone> Positioned<S> for Point<S> {
}
}
impl<S: Clone + Add<S, S>> Movable<S> for Point<S>;
impl<S: Clone + Add<S, S>> Movable<S> for Point<S> {}
pub fn main() {
let mut p = Point{ x: 1, y: 2};

View file

@ -19,7 +19,7 @@ impl Eq for MyInt {
fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
}
impl MyNum for MyInt;
impl MyNum for MyInt {}
fn f<T:MyNum>(x: T, y: T) -> bool {
return x == y;

View file

@ -31,7 +31,7 @@ impl Eq for MyInt {
fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
}
impl MyNum for MyInt;
impl MyNum for MyInt {}
fn f<T:MyNum>(x: T, y: T) -> (T, T, T) {
return (x + y, x - y, x * y);

View file

@ -20,7 +20,7 @@ impl Add<MyInt, MyInt> for MyInt {
fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) }
}
impl MyNum for MyInt;
impl MyNum for MyInt {}
fn f<T:MyNum>(x: T, y: T) -> T {
return x.add(&y);

View file

@ -30,7 +30,7 @@ impl Add<MyInt, MyInt> for MyInt {
fn add(&self, other: &MyInt) -> MyInt { self.chomp(other) }
}
impl MyNum for MyInt;
impl MyNum for MyInt {}
fn f<T:MyNum>(x: T, y: T) -> T {
return x.add(&y).chomp(&y);

View file

@ -19,7 +19,7 @@ struct A { x: int }
impl Foo for A { fn f(&self) -> int { 10 } }
impl Bar for A { fn g(&self) -> int { 20 } }
impl Baz for A { fn h(&self) -> int { 30 } }
impl Quux for A;
impl Quux for A {}
fn f<T:Quux + Foo + Bar + Baz>(a: &T) {
assert_eq!(a.f(), 10);