diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/rt/io/mod.rs index 6b405b0948a..70fcf442f3f 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/rt/io/mod.rs @@ -472,7 +472,7 @@ pub trait Writer { pub trait Stream: Reader + Writer { } -impl Stream for T; +impl Stream for T {} pub enum SeekStyle { /// Seek from the beginning of the stream diff --git a/src/libstd/rt/uv/file.rs b/src/libstd/rt/uv/file.rs index ada558036cf..54cb40c9873 100644 --- a/src/libstd/rt/uv/file.rs +++ b/src/libstd/rt/uv/file.rs @@ -22,7 +22,7 @@ use option::{None, Some, Option}; pub struct FsRequest(*uvll::uv_fs_t); -impl Request for FsRequest; +impl Request for FsRequest {} pub struct RequestData { complete_cb: Option diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index b056b39eb6e..c2c08ce9360 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -65,6 +65,7 @@ pub enum ObsoleteSyntax { ObsoletePrivVisibility, ObsoleteTraitFuncVisibility, ObsoleteConstPointer, + ObsoleteEmptyImpl, } impl to_bytes::IterBytes for ObsoleteSyntax { @@ -256,6 +257,10 @@ fn obsolete(&self, sp: Span, kind: ObsoleteSyntax) { "instead of `&const Foo` or `@const Foo`, write `&Foo` or \ `@Foo`" ), + ObsoleteEmptyImpl => ( + "empty implementation", + "instead of `impl A;`, write `impl A {}`" + ), }; self.report(sp, kind, kind_str, desc); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4aad5c24d0f..5a0ccac2cdb 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3852,7 +3852,9 @@ fn parse_item_impl(&self, visibility: ast::visibility) -> item_info { } let mut meths = ~[]; - if !self.eat(&token::SEMI) { + if self.eat(&token::SEMI) { + self.obsolete(*self.span, ObsoleteEmptyImpl); + } else { self.expect(&token::LBRACE); while !self.eat(&token::RBRACE) { meths.push(self.parse_method()); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 867e4fe416b..dee8d710a73 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -598,18 +598,12 @@ pub fn print_item(s: @ps, item: &ast::item) { print_type(s, ty); - if methods.len() == 0 { - word(s.s, ";"); - end(s); // end the head-ibox - end(s); // end the outer cbox - } else { - space(s.s); - bopen(s); - for meth in methods.iter() { - print_method(s, *meth); - } - bclose(s, item.span); + space(s.s); + bopen(s); + for meth in methods.iter() { + print_method(s, *meth); } + bclose(s, item.span); } ast::item_trait(ref generics, ref traits, ref methods) => { head(s, visibility_qualified(item.vis, "trait")); diff --git a/src/test/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/auxiliary/trait_inheritance_overloading_xc.rs index f938c9c56ed..8694871417a 100644 --- a/src/test/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/auxiliary/trait_inheritance_overloading_xc.rs @@ -35,6 +35,6 @@ fn eq(&self, other: &MyInt) -> bool { self.val == other.val } 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 } } diff --git a/src/test/compile-fail/missing-derivable-attr.rs b/src/test/compile-fail/missing-derivable-attr.rs index eb27d51061f..70c16e0baef 100644 --- a/src/test/compile-fail/missing-derivable-attr.rs +++ b/src/test/compile-fail/missing-derivable-attr.rs @@ -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() { } diff --git a/src/test/debug-info/generic-trait-generic-static-default-method.rs b/src/test/debug-info/generic-trait-generic-static-default-method.rs index 8523a947aac..4355b4b98fe 100644 --- a/src/test/debug-info/generic-trait-generic-static-default-method.rs +++ b/src/test/debug-info/generic-trait-generic-static-default-method.rs @@ -40,7 +40,7 @@ fn generic_static_default_method(arg1: int, arg2: &(T1, T2)) -> int { } } -impl Trait for Struct; +impl Trait for Struct {} fn main() { diff --git a/src/test/debug-info/self-in-default-method.rs b/src/test/debug-info/self-in-default-method.rs index 53b2e9ee21d..fde58f76acc 100644 --- a/src/test/debug-info/self-in-default-method.rs +++ b/src/test/debug-info/self-in-default-method.rs @@ -118,7 +118,7 @@ fn self_managed(@self, arg1: int, arg2: int) -> int { } } -impl Trait for Struct; +impl Trait for Struct {} fn main() { let stack = Struct { x: 100 }; diff --git a/src/test/debug-info/self-in-generic-default-method.rs b/src/test/debug-info/self-in-generic-default-method.rs index 47f58930760..3daf7afd4b1 100644 --- a/src/test/debug-info/self-in-generic-default-method.rs +++ b/src/test/debug-info/self-in-generic-default-method.rs @@ -119,7 +119,7 @@ fn self_managed(@self, arg1: int, arg2: T) -> int { } } -impl Trait for Struct; +impl Trait for Struct {} fn main() { let stack = Struct { x: 987 }; diff --git a/src/test/debug-info/trait-generic-static-default-method.rs b/src/test/debug-info/trait-generic-static-default-method.rs index 1f6e6992e27..05258d53586 100644 --- a/src/test/debug-info/trait-generic-static-default-method.rs +++ b/src/test/debug-info/trait-generic-static-default-method.rs @@ -40,7 +40,7 @@ fn generic_static_default_method(arg1: int, arg2: T) -> int { } } -impl Trait for Struct; +impl Trait for Struct {} fn main() { diff --git a/src/test/pretty/empty-impl.pp b/src/test/pretty/empty-impl.pp index af401bd25ca..685cdcdaead 100644 --- a/src/test/pretty/empty-impl.pp +++ b/src/test/pretty/empty-impl.pp @@ -1,5 +1,5 @@ trait X { } -impl X for uint; +impl X for uint { } trait Y { } -impl Y for uint; +impl Y for uint { } diff --git a/src/test/pretty/empty-impl.rs b/src/test/pretty/empty-impl.rs index af401bd25ca..685cdcdaead 100644 --- a/src/test/pretty/empty-impl.rs +++ b/src/test/pretty/empty-impl.rs @@ -1,5 +1,5 @@ trait X { } -impl X for uint; +impl X for uint { } trait Y { } -impl Y for uint; +impl Y for uint { } diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs index a62fbdeeb18..4a402132254 100644 --- a/src/test/pretty/path-type-bounds.rs +++ b/src/test/pretty/path-type-bounds.rs @@ -1,7 +1,7 @@ // pp-exact trait Tr { } -impl Tr for int; +impl Tr for int { } fn foo(x: ~Tr: Freeze) -> ~Tr: Freeze { x } diff --git a/src/test/run-pass/default-method-supertrait-vtable.rs b/src/test/run-pass/default-method-supertrait-vtable.rs index 90a2b914021..b5790269d90 100644 --- a/src/test/run-pass/default-method-supertrait-vtable.rs +++ b/src/test/run-pass/default-method-supertrait-vtable.rs @@ -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); diff --git a/src/test/run-pass/issue-3979-generics.rs b/src/test/run-pass/issue-3979-generics.rs index 867301121da..86cdd6135ec 100644 --- a/src/test/run-pass/issue-3979-generics.rs +++ b/src/test/run-pass/issue-3979-generics.rs @@ -31,7 +31,7 @@ fn X(&self) -> int { } } -impl Movable for Point; +impl Movable for Point {} pub fn main() { let mut p = Point{ x: 1, y: 2}; diff --git a/src/test/run-pass/issue-3979-xcrate.rs b/src/test/run-pass/issue-3979-xcrate.rs index caf6d202316..63d2562f541 100644 --- a/src/test/run-pass/issue-3979-xcrate.rs +++ b/src/test/run-pass/issue-3979-xcrate.rs @@ -24,7 +24,7 @@ fn X(&self) -> int { } } -impl Movable for Point; +impl Movable for Point {} pub fn main() { let mut p = Point{ x: 1, y: 2}; diff --git a/src/test/run-pass/issue-3979.rs b/src/test/run-pass/issue-3979.rs index 2e53fb5d3f9..4f69342830b 100644 --- a/src/test/run-pass/issue-3979.rs +++ b/src/test/run-pass/issue-3979.rs @@ -32,7 +32,7 @@ fn X(&self) -> int { } } -impl Movable for Point; +impl Movable for Point {} pub fn main() { let mut p = Point{ x: 1, y: 2}; diff --git a/src/test/run-pass/supertrait-default-generics.rs b/src/test/run-pass/supertrait-default-generics.rs index ae7e18d532b..2cfc22111a7 100644 --- a/src/test/run-pass/supertrait-default-generics.rs +++ b/src/test/run-pass/supertrait-default-generics.rs @@ -33,7 +33,7 @@ fn X(&self) -> S { } } -impl> Movable for Point; +impl> Movable for Point {} pub fn main() { let mut p = Point{ x: 1, y: 2}; diff --git a/src/test/run-pass/trait-inheritance-overloading-simple.rs b/src/test/run-pass/trait-inheritance-overloading-simple.rs index 041452176e0..3a0f2dd9464 100644 --- a/src/test/run-pass/trait-inheritance-overloading-simple.rs +++ b/src/test/run-pass/trait-inheritance-overloading-simple.rs @@ -19,7 +19,7 @@ fn eq(&self, other: &MyInt) -> bool { self.val == other.val } fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } } -impl MyNum for MyInt; +impl MyNum for MyInt {} fn f(x: T, y: T) -> bool { return x == y; diff --git a/src/test/run-pass/trait-inheritance-overloading.rs b/src/test/run-pass/trait-inheritance-overloading.rs index d5321ea5298..fb19bfa674f 100644 --- a/src/test/run-pass/trait-inheritance-overloading.rs +++ b/src/test/run-pass/trait-inheritance-overloading.rs @@ -31,7 +31,7 @@ fn eq(&self, other: &MyInt) -> bool { self.val == other.val } fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } } -impl MyNum for MyInt; +impl MyNum for MyInt {} fn f(x: T, y: T) -> (T, T, T) { return (x + y, x - y, x * y); diff --git a/src/test/run-pass/trait-inheritance-subst.rs b/src/test/run-pass/trait-inheritance-subst.rs index 479f293a396..cd57e6a7dd0 100644 --- a/src/test/run-pass/trait-inheritance-subst.rs +++ b/src/test/run-pass/trait-inheritance-subst.rs @@ -20,7 +20,7 @@ impl Add for MyInt { fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) } } -impl MyNum for MyInt; +impl MyNum for MyInt {} fn f(x: T, y: T) -> T { return x.add(&y); diff --git a/src/test/run-pass/trait-inheritance-subst2.rs b/src/test/run-pass/trait-inheritance-subst2.rs index 214505172a5..ebddfafc3b4 100644 --- a/src/test/run-pass/trait-inheritance-subst2.rs +++ b/src/test/run-pass/trait-inheritance-subst2.rs @@ -30,7 +30,7 @@ impl Add for MyInt { fn add(&self, other: &MyInt) -> MyInt { self.chomp(other) } } -impl MyNum for MyInt; +impl MyNum for MyInt {} fn f(x: T, y: T) -> T { return x.add(&y).chomp(&y); diff --git a/src/test/run-pass/trait-inheritance2.rs b/src/test/run-pass/trait-inheritance2.rs index 6046da41217..7fa895ddf98 100644 --- a/src/test/run-pass/trait-inheritance2.rs +++ b/src/test/run-pass/trait-inheritance2.rs @@ -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(a: &T) { assert_eq!(a.f(), 10);