Fix fallout in tests.

This commit is contained in:
Niko Matsakis 2014-12-19 06:54:09 -05:00
parent 1b3734f8ae
commit 5b425c1b2f
22 changed files with 27 additions and 27 deletions

View File

@ -32,7 +32,7 @@ impl Foo {
}
}
pub trait Bar {
pub trait Bar : Sized {
fn foo1(&self);
fn foo2(self);
fn foo3(self: Box<Self>);

View File

@ -12,7 +12,7 @@
// parameter, the corresponding value must be sized. Also that the
// self type must be sized if appropriate.
trait Foo<T> { fn take(self, x: &T) { } } // Note: T is sized
trait Foo<T> : 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]`

View File

@ -15,5 +15,4 @@ fn main() {
let r: Box<Foo> = box 5;
let _m: Box<Foo> = r as Box<Foo>;
//~^ ERROR `core::kinds::Sized` is not implemented for the type `Foo`
//~| ERROR `Foo` is not implemented for the type `Foo`
}

View File

@ -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

View File

@ -16,7 +16,7 @@ struct Foo<'a,'b> {
y: &'b int,
}
trait Tr {
trait Tr : Sized {
fn foo(x: Self) {}
}

View File

@ -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) { }
}

View File

@ -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<T> {
trait Tr<T> : Sized {
fn op(T) -> Self;
}

View File

@ -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<X>(u: X) -> Self {
u //~ ERROR mismatched types
}

View File

@ -10,8 +10,7 @@
// Test that bounds are sized-compatible.
trait T {}
trait T : Sized {}
fn f<Sized? Y: T>() {
//~^ERROR incompatible bounds on `Y`, bound `T` does not allow unsized type
}

View File

@ -11,7 +11,7 @@
// compile-flags:--debuginfo=1
// min-lldb-version: 310
pub trait TraitWithDefaultMethod {
pub trait TraitWithDefaultMethod : Sized {
fn method(self) {
()
}

View File

@ -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

View File

@ -118,7 +118,7 @@ struct Struct {
x: int
}
trait Trait {
trait Trait : Sized {
fn self_by_ref<T>(&self, arg1: int, arg2: T) -> int {
zzz(); // #break

View File

@ -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<Self::Item>;
}
trait IteratorExt: Iterator {
trait IteratorExt: Iterator + Sized {
fn by_ref(&mut self) -> ByRef<Self> {
ByRef(self)
}

View File

@ -21,7 +21,7 @@ trait Not {
fn not(self) -> Self::Result;
}
trait Int: Not<Result=Self> {
trait Int: Not<Result=Self> + Sized {
fn count_ones(self) -> uint;
fn count_zeros(self) -> uint {
// neither works

View File

@ -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<Self::Item>;
}
trait IteratorExt: Iterator {
trait IteratorExt: Iterator + Sized {
fn by_ref(&mut self) -> ByRef<Self> {
ByRef(self)
}

View File

@ -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) }
}

View File

@ -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<Self>) {
tx.send(self);
}

View File

@ -21,7 +21,7 @@ trait Y {
}
trait Z: Y {
trait Z: Y + Sized {
fn x(self) -> int {
require_y(self)
}

View File

@ -9,7 +9,7 @@
// except according to those terms.
trait Foo {
trait Foo : Sized {
fn foo(self: Box<Self>) { bar(self as Box<Foo>); }
}

View File

@ -16,7 +16,7 @@
fn require_send<T: Send>(_: T){}
trait TragicallySelfIsNotSend: Send {
trait TragicallySelfIsNotSend: Send + Sized {
fn x(self) {
require_send(self);
}

View File

@ -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<Self>);

View File

@ -13,7 +13,7 @@ struct X {
a: int
}
trait Changer {
trait Changer : Sized {
fn change(mut self) -> Self {
self.set_to(55);
self