mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-08 07:57:40 +00:00
adapt existing tests
This commit is contained in:
parent
f1695238ca
commit
d22f706150
@ -8,6 +8,8 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// ignore-test the unsized enum no longer compiles
|
||||||
|
|
||||||
enum A {
|
enum A {
|
||||||
B(char),
|
B(char),
|
||||||
C([Box<A>]),
|
C([Box<A>]),
|
||||||
|
@ -20,6 +20,4 @@ fn new_struct(r: A+'static)
|
|||||||
Struct { r: r }
|
Struct { r: r }
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Curve {}
|
|
||||||
enum E {X(Curve+'static)}
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -19,11 +19,4 @@ fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
|
|||||||
//
|
//
|
||||||
// Not OK: `T` is not sized.
|
// Not OK: `T` is not sized.
|
||||||
|
|
||||||
enum Bar<U: ?Sized> { BarSome(U), BarNone }
|
|
||||||
fn bar1<T: ?Sized>() { not_sized::<Bar<T>>() }
|
|
||||||
fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
|
|
||||||
//~^ ERROR `T: std::marker::Sized` is not satisfied
|
|
||||||
//
|
|
||||||
// Not OK: `Bar<T>` is not sized, but it should be.
|
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
@ -31,19 +31,8 @@ fn f3<X: ?Sized + T>(x: &X) {
|
|||||||
fn f4<X: T>(x: &X) {
|
fn f4<X: T>(x: &X) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test with unsized enum.
|
|
||||||
enum E<X: ?Sized> {
|
|
||||||
V(X),
|
|
||||||
}
|
|
||||||
|
|
||||||
fn f5<Y>(x: &Y) {}
|
fn f5<Y>(x: &Y) {}
|
||||||
fn f6<X: ?Sized>(x: &X) {}
|
fn f6<X: ?Sized>(x: &X) {}
|
||||||
fn f7<X: ?Sized>(x1: &E<X>, x2: &E<X>) {
|
|
||||||
f5(x1);
|
|
||||||
//~^ ERROR `X: std::marker::Sized` is not satisfied
|
|
||||||
f6(x2); // ok
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Test with unsized struct.
|
// Test with unsized struct.
|
||||||
struct S<X: ?Sized> {
|
struct S<X: ?Sized> {
|
||||||
@ -57,13 +46,13 @@ fn f8<X: ?Sized>(x1: &S<X>, x2: &S<X>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test some tuples.
|
// Test some tuples.
|
||||||
fn f9<X: ?Sized>(x1: Box<S<X>>, x2: Box<E<X>>) {
|
fn f9<X: ?Sized>(x1: Box<S<X>>) {
|
||||||
f5(&(*x1, 34));
|
f5(&(*x1, 34));
|
||||||
//~^ ERROR `X: std::marker::Sized` is not satisfied
|
//~^ ERROR `X: std::marker::Sized` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f10<X: ?Sized>(x1: Box<S<X>>, x2: Box<E<X>>) {
|
fn f10<X: ?Sized>(x1: Box<S<X>>) {
|
||||||
f5(&(32, *x2));
|
f5(&(32, *x1));
|
||||||
//~^ ERROR `X: std::marker::Sized` is not satisfied
|
//~^ ERROR `X: std::marker::Sized` is not satisfied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ trait T7<X: ?Sized+T> {
|
|||||||
fn m2(&self, x: &T5<X>);
|
fn m2(&self, x: &T5<X>);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The last field in a struct or variant may be unsized
|
// The last field in a struct may be unsized
|
||||||
struct S2<X: ?Sized> {
|
struct S2<X: ?Sized> {
|
||||||
f: X,
|
f: X,
|
||||||
}
|
}
|
||||||
@ -97,12 +97,6 @@ struct S3<X: ?Sized> {
|
|||||||
f1: isize,
|
f1: isize,
|
||||||
f2: X,
|
f2: X,
|
||||||
}
|
}
|
||||||
enum E<X: ?Sized> {
|
|
||||||
V1(X),
|
|
||||||
V2{x: X},
|
|
||||||
V3(isize, X),
|
|
||||||
V4{u: isize, x: X},
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user