diff --git a/src/test/auxiliary/method_self_arg2.rs b/src/test/auxiliary/method_self_arg2.rs index e1e79b59e3e..eb4d62b01ad 100644 --- a/src/test/auxiliary/method_self_arg2.rs +++ b/src/test/auxiliary/method_self_arg2.rs @@ -32,7 +32,7 @@ impl Foo { } } -pub trait Bar { +pub trait Bar : Sized { fn foo1(&self); fn foo2(self); fn foo3(self: Box); diff --git a/src/test/compile-fail/dst-sized-trait-param.rs b/src/test/compile-fail/dst-sized-trait-param.rs index 750b475adb2..ea5becbf229 100644 --- a/src/test/compile-fail/dst-sized-trait-param.rs +++ b/src/test/compile-fail/dst-sized-trait-param.rs @@ -12,7 +12,7 @@ // parameter, the corresponding value must be sized. Also that the // self type must be sized if appropriate. -trait Foo { fn take(self, x: &T) { } } // Note: T is sized +trait Foo : Sized { fn take(self, x: &T) { } } // Note: T is sized impl Foo<[int]> for uint { } //~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `[int]` diff --git a/src/test/compile-fail/issue-5543.rs b/src/test/compile-fail/issue-5543.rs index bbd41b28f03..f970cdb1b83 100644 --- a/src/test/compile-fail/issue-5543.rs +++ b/src/test/compile-fail/issue-5543.rs @@ -15,5 +15,4 @@ fn main() { let r: Box = box 5; let _m: Box = r as Box; //~^ ERROR `core::kinds::Sized` is not implemented for the type `Foo` - //~| ERROR `Foo` is not implemented for the type `Foo` } diff --git a/src/test/compile-fail/regions-infer-bound-from-trait-self.rs b/src/test/compile-fail/regions-infer-bound-from-trait-self.rs index 25fd20b6ec5..aeb003ca5d0 100644 --- a/src/test/compile-fail/regions-infer-bound-from-trait-self.rs +++ b/src/test/compile-fail/regions-infer-bound-from-trait-self.rs @@ -23,12 +23,12 @@ fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } // In these case, `Self` inherits `'static`. -trait InheritsFromStatic : 'static { +trait InheritsFromStatic : Sized + 'static { fn foo1<'a>(self, x: Inv<'a>) { check_bound(x, self) } } -trait InheritsFromStaticIndirectly : Static { +trait InheritsFromStaticIndirectly : Sized + Static { fn foo1<'a>(self, x: Inv<'a>) { check_bound(x, self) } @@ -37,13 +37,13 @@ trait InheritsFromStaticIndirectly : Static { // In these case, `Self` inherits `'a`. -trait InheritsFromIs<'a> : 'a { +trait InheritsFromIs<'a> : Sized + 'a { fn foo(self, x: Inv<'a>) { check_bound(x, self) } } -trait InheritsFromIsIndirectly<'a> : Is<'a> { +trait InheritsFromIsIndirectly<'a> : Sized + Is<'a> { fn foo(self, x: Inv<'a>) { check_bound(x, self) } @@ -51,7 +51,7 @@ trait InheritsFromIsIndirectly<'a> : Is<'a> { // In this case, `Self` inherits nothing. -trait InheritsFromNothing<'a> { +trait InheritsFromNothing<'a> : Sized { fn foo(self, x: Inv<'a>) { check_bound(x, self) //~^ ERROR parameter type `Self` may not live long enough diff --git a/src/test/compile-fail/trait-matching-lifetimes.rs b/src/test/compile-fail/trait-matching-lifetimes.rs index f1b30166b5e..333730e0c4b 100644 --- a/src/test/compile-fail/trait-matching-lifetimes.rs +++ b/src/test/compile-fail/trait-matching-lifetimes.rs @@ -16,7 +16,7 @@ struct Foo<'a,'b> { y: &'b int, } -trait Tr { +trait Tr : Sized { fn foo(x: Self) {} } diff --git a/src/test/compile-fail/trait-safety-fn-body.rs b/src/test/compile-fail/trait-safety-fn-body.rs index d174092e4d0..f894e2ee28e 100644 --- a/src/test/compile-fail/trait-safety-fn-body.rs +++ b/src/test/compile-fail/trait-safety-fn-body.rs @@ -11,7 +11,7 @@ // Check that an unsafe impl does not imply that unsafe actions are // legal in the methods. -unsafe trait UnsafeTrait { +unsafe trait UnsafeTrait : Sized { fn foo(self) { } } diff --git a/src/test/compile-fail/type-params-in-different-spaces-2.rs b/src/test/compile-fail/type-params-in-different-spaces-2.rs index 9be64bf5346..3a4cc9e874e 100644 --- a/src/test/compile-fail/type-params-in-different-spaces-2.rs +++ b/src/test/compile-fail/type-params-in-different-spaces-2.rs @@ -11,7 +11,7 @@ // Test static calls to make sure that we align the Self and input // type parameters on a trait correctly. -trait Tr { +trait Tr : Sized { fn op(T) -> Self; } diff --git a/src/test/compile-fail/type-params-in-different-spaces-3.rs b/src/test/compile-fail/type-params-in-different-spaces-3.rs index a3d69d53ba9..c113e1b7815 100644 --- a/src/test/compile-fail/type-params-in-different-spaces-3.rs +++ b/src/test/compile-fail/type-params-in-different-spaces-3.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Tr { +trait Tr : Sized { fn test(u: X) -> Self { u //~ ERROR mismatched types } diff --git a/src/test/compile-fail/unsized4.rs b/src/test/compile-fail/unsized4.rs index 0537fc1f94a..f9ece8e6843 100644 --- a/src/test/compile-fail/unsized4.rs +++ b/src/test/compile-fail/unsized4.rs @@ -10,8 +10,7 @@ // Test that bounds are sized-compatible. -trait T {} - +trait T : Sized {} fn f() { //~^ERROR incompatible bounds on `Y`, bound `T` does not allow unsized type } diff --git a/src/test/debuginfo/issue7712.rs b/src/test/debuginfo/issue7712.rs index 948048ec272..94458a7fb4b 100644 --- a/src/test/debuginfo/issue7712.rs +++ b/src/test/debuginfo/issue7712.rs @@ -11,7 +11,7 @@ // compile-flags:--debuginfo=1 // min-lldb-version: 310 -pub trait TraitWithDefaultMethod { +pub trait TraitWithDefaultMethod : Sized { fn method(self) { () } diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs index f8ef5b3d2fc..87884d2f956 100644 --- a/src/test/debuginfo/self-in-default-method.rs +++ b/src/test/debuginfo/self-in-default-method.rs @@ -118,7 +118,7 @@ struct Struct { x: int } -trait Trait { +trait Trait : Sized { fn self_by_ref(&self, arg1: int, arg2: int) -> int { zzz(); // #break arg1 + arg2 diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs index c2594df7d35..62b5e6872ee 100644 --- a/src/test/debuginfo/self-in-generic-default-method.rs +++ b/src/test/debuginfo/self-in-generic-default-method.rs @@ -118,7 +118,7 @@ struct Struct { x: int } -trait Trait { +trait Trait : Sized { fn self_by_ref(&self, arg1: int, arg2: T) -> int { zzz(); // #break diff --git a/src/test/run-pass/associated-types-impl-redirect.rs b/src/test/run-pass/associated-types-impl-redirect.rs index a28cf346336..ce7f5dde2ad 100644 --- a/src/test/run-pass/associated-types-impl-redirect.rs +++ b/src/test/run-pass/associated-types-impl-redirect.rs @@ -19,6 +19,7 @@ #![feature(associated_types, lang_items, unboxed_closures)] #![no_implicit_prelude] +use std::kinds::Sized; use std::option::Option::{None, Some, mod}; trait Iterator { @@ -27,7 +28,7 @@ trait Iterator { fn next(&mut self) -> Option; } -trait IteratorExt: Iterator { +trait IteratorExt: Iterator + Sized { fn by_ref(&mut self) -> ByRef { ByRef(self) } diff --git a/src/test/run-pass/associated-types-projection-bound-in-supertraits.rs b/src/test/run-pass/associated-types-projection-bound-in-supertraits.rs index 83686d92a7c..92daee5225d 100644 --- a/src/test/run-pass/associated-types-projection-bound-in-supertraits.rs +++ b/src/test/run-pass/associated-types-projection-bound-in-supertraits.rs @@ -21,7 +21,7 @@ trait Not { fn not(self) -> Self::Result; } -trait Int: Not { +trait Int: Not + Sized { fn count_ones(self) -> uint; fn count_zeros(self) -> uint { // neither works diff --git a/src/test/run-pass/associated-types-where-clause-impl-ambiguity.rs b/src/test/run-pass/associated-types-where-clause-impl-ambiguity.rs index 062d37556ec..7afaf290424 100644 --- a/src/test/run-pass/associated-types-where-clause-impl-ambiguity.rs +++ b/src/test/run-pass/associated-types-where-clause-impl-ambiguity.rs @@ -19,6 +19,7 @@ #![feature(associated_types, lang_items, unboxed_closures)] #![no_implicit_prelude] +use std::kinds::Sized; use std::option::Option::{None, Some, mod}; trait Iterator { @@ -27,7 +28,7 @@ trait Iterator { fn next(&mut self) -> Option; } -trait IteratorExt: Iterator { +trait IteratorExt: Iterator + Sized { fn by_ref(&mut self) -> ByRef { ByRef(self) } diff --git a/src/test/run-pass/bug-7183-generics.rs b/src/test/run-pass/bug-7183-generics.rs index 8c4d10a2d59..bf8d303f341 100644 --- a/src/test/run-pass/bug-7183-generics.rs +++ b/src/test/run-pass/bug-7183-generics.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Speak { +trait Speak : Sized { fn say(&self, s:&str) -> String; fn hi(&self) -> String { hello(self) } } diff --git a/src/test/run-pass/builtin-superkinds-self-type.rs b/src/test/run-pass/builtin-superkinds-self-type.rs index 1c156f6551c..ab775132dde 100644 --- a/src/test/run-pass/builtin-superkinds-self-type.rs +++ b/src/test/run-pass/builtin-superkinds-self-type.rs @@ -11,7 +11,7 @@ // Tests the ability for the Self type in default methods to use // capabilities granted by builtin kinds as supertraits. -trait Foo : Send { +trait Foo : Send + Sized { fn foo(self, tx: Sender) { tx.send(self); } diff --git a/src/test/run-pass/default-method-supertrait-vtable.rs b/src/test/run-pass/default-method-supertrait-vtable.rs index 1b2b17f9917..727cada21fa 100644 --- a/src/test/run-pass/default-method-supertrait-vtable.rs +++ b/src/test/run-pass/default-method-supertrait-vtable.rs @@ -21,7 +21,7 @@ trait Y { } -trait Z: Y { +trait Z: Y + Sized { fn x(self) -> int { require_y(self) } diff --git a/src/test/run-pass/issue-7320.rs b/src/test/run-pass/issue-7320.rs index c7087f8e3a8..bd57a3956c7 100644 --- a/src/test/run-pass/issue-7320.rs +++ b/src/test/run-pass/issue-7320.rs @@ -9,7 +9,7 @@ // except according to those terms. -trait Foo { +trait Foo : Sized { fn foo(self: Box) { bar(self as Box); } } diff --git a/src/test/run-pass/issue-8171-default-method-self-inherit-builtin-trait.rs b/src/test/run-pass/issue-8171-default-method-self-inherit-builtin-trait.rs index aaf2ecb7129..3238c24163e 100644 --- a/src/test/run-pass/issue-8171-default-method-self-inherit-builtin-trait.rs +++ b/src/test/run-pass/issue-8171-default-method-self-inherit-builtin-trait.rs @@ -16,7 +16,7 @@ fn require_send(_: T){} -trait TragicallySelfIsNotSend: Send { +trait TragicallySelfIsNotSend: Send + Sized { fn x(self) { require_send(self); } diff --git a/src/test/run-pass/method-self-arg-trait.rs b/src/test/run-pass/method-self-arg-trait.rs index 36dfe83a9eb..29d100beb06 100644 --- a/src/test/run-pass/method-self-arg-trait.rs +++ b/src/test/run-pass/method-self-arg-trait.rs @@ -16,7 +16,7 @@ struct Foo; impl Copy for Foo {} -trait Bar { +trait Bar : Sized { fn foo1(&self); fn foo2(self); fn foo3(self: Box); diff --git a/src/test/run-pass/self-in-mut-slot-default-method.rs b/src/test/run-pass/self-in-mut-slot-default-method.rs index b4a46f34015..bced8012b68 100644 --- a/src/test/run-pass/self-in-mut-slot-default-method.rs +++ b/src/test/run-pass/self-in-mut-slot-default-method.rs @@ -13,7 +13,7 @@ struct X { a: int } -trait Changer { +trait Changer : Sized { fn change(mut self) -> Self { self.set_to(55); self