mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Update tests to use ?Sized
This commit is contained in:
parent
e656081b70
commit
4688aadfde
@ -23,7 +23,7 @@ impl Trait for A {
|
||||
}
|
||||
}
|
||||
|
||||
struct Foo<Sized? T> {
|
||||
struct Foo<T: ?Sized> {
|
||||
f: T
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// As dst-struct.rs, but the unsized field is the only field in the struct.
|
||||
|
||||
struct Fat<Sized? T> {
|
||||
struct Fat<T: ?Sized> {
|
||||
ptr: T
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct Fat<Sized? T> {
|
||||
struct Fat<T: ?Sized> {
|
||||
f1: int,
|
||||
f2: &'static str,
|
||||
ptr: T
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct Fat<Sized? T> {
|
||||
struct Fat<T: ?Sized> {
|
||||
f1: int,
|
||||
f2: &'static str,
|
||||
ptr: T
|
||||
|
@ -22,7 +22,7 @@ struct IndirectBlah { x: Box<IndirectTraitWithSend> }
|
||||
impl TraitWithSend for IndirectBlah {}
|
||||
impl IndirectTraitWithSend for IndirectBlah {}
|
||||
|
||||
fn test_trait<Sized? T: Send>() { println!("got here!") }
|
||||
fn test_trait<T: Send + ?Sized>() { println!("got here!") }
|
||||
|
||||
fn main() {
|
||||
test_trait::<TraitWithSend>();
|
||||
|
@ -11,6 +11,6 @@
|
||||
// Test that astconv doesn't forget about mutability of &mut str
|
||||
|
||||
fn main() {
|
||||
fn foo<Sized? T>(_: &mut T) {}
|
||||
fn foo<T: ?Sized>(_: &mut T) {}
|
||||
let _f: fn(&mut str) = foo;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
use std::kinds::Sized;
|
||||
|
||||
// Note: this must be generic for the problem to show up
|
||||
trait Foo<A> for Sized? {
|
||||
trait Foo<A> for ?Sized {
|
||||
fn foo(&self);
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,22 @@
|
||||
//
|
||||
// ignore-lexer-test FIXME #15879
|
||||
|
||||
// Test syntax checks for `Sized?` syntax.
|
||||
// Test syntax checks for `?Sized` syntax.
|
||||
|
||||
trait T1 for Sized? {}
|
||||
pub trait T2 for Sized? {}
|
||||
trait T3<X: T1> for Sized?: T2 {}
|
||||
trait T4<Sized? X> {}
|
||||
trait T5<Sized? X, Y> {}
|
||||
trait T6<Y, Sized? X> {}
|
||||
trait T7<Sized? X, Sized? Y> {}
|
||||
trait T8<Sized? X: T2> {}
|
||||
struct S1<Sized? X>;
|
||||
enum E<Sized? X> {}
|
||||
impl <Sized? X> T1 for S1<X> {}
|
||||
fn f<Sized? X>() {}
|
||||
type TT<Sized? T> = T;
|
||||
trait T1 for ?Sized {}
|
||||
pub trait T2 for ?Sized {}
|
||||
trait T3<X: T1> for ?Sized: T2 {}
|
||||
trait T4<X: ?Sized> {}
|
||||
trait T5<X: ?Sized, Y> {}
|
||||
trait T6<Y, X: ?Sized> {}
|
||||
trait T7<X: ?Sized, Y: ?Sized> {}
|
||||
trait T8<X: ?Sized+T2> {}
|
||||
trait T9<X: T2 + ?Sized> {}
|
||||
struct S1<X: ?Sized>;
|
||||
enum E<X: ?Sized> {}
|
||||
impl <X: ?Sized> T1 for S1<X> {}
|
||||
fn f<X: ?Sized>() {}
|
||||
type TT<T: ?Sized> = T;
|
||||
|
||||
pub fn main() {
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
// Test sized-ness checking in substitution.
|
||||
|
||||
// Unbounded.
|
||||
fn f1<Sized? X>(x: &X) {
|
||||
fn f1<X: ?Sized>(x: &X) {
|
||||
f1::<X>(x);
|
||||
}
|
||||
fn f2<X>(x: &X) {
|
||||
@ -22,8 +22,8 @@ fn f2<X>(x: &X) {
|
||||
}
|
||||
|
||||
// Bounded.
|
||||
trait T for Sized? {}
|
||||
fn f3<Sized? X: T>(x: &X) {
|
||||
trait T for ?Sized {}
|
||||
fn f3<X: T+?Sized>(x: &X) {
|
||||
f3::<X>(x);
|
||||
}
|
||||
fn f4<X: T>(x: &X) {
|
||||
@ -32,7 +32,7 @@ fn f4<X: T>(x: &X) {
|
||||
}
|
||||
|
||||
// Self type.
|
||||
trait T2 for Sized? {
|
||||
trait T2 for ?Sized {
|
||||
fn f() -> Box<Self>;
|
||||
}
|
||||
struct S;
|
||||
@ -41,14 +41,14 @@ impl T2 for S {
|
||||
box S
|
||||
}
|
||||
}
|
||||
fn f5<Sized? X: T2>(x: &X) {
|
||||
fn f5<X: ?Sized+T2>(x: &X) {
|
||||
let _: Box<X> = T2::f();
|
||||
}
|
||||
fn f6<X: T2>(x: &X) {
|
||||
let _: Box<X> = T2::f();
|
||||
}
|
||||
|
||||
trait T3 for Sized? {
|
||||
trait T3 for ?Sized {
|
||||
fn f() -> Box<Self>;
|
||||
}
|
||||
impl T3 for S {
|
||||
@ -56,7 +56,7 @@ impl T3 for S {
|
||||
box S
|
||||
}
|
||||
}
|
||||
fn f7<Sized? X: T3>(x: &X) {
|
||||
fn f7<X: ?Sized+T3>(x: &X) {
|
||||
// This is valid, but the unsized bound on X is irrelevant because any type
|
||||
// which implements T3 must have statically known size.
|
||||
let _: Box<X> = T3::f();
|
||||
@ -66,7 +66,7 @@ trait T4<X> {
|
||||
fn m1(x: &T4<X>);
|
||||
fn m2(x: &T5<X>);
|
||||
}
|
||||
trait T5<Sized? X> {
|
||||
trait T5<X: ?Sized> {
|
||||
// not an error (for now)
|
||||
fn m1(x: &T4<X>);
|
||||
fn m2(x: &T5<X>);
|
||||
@ -76,21 +76,21 @@ trait T6<X: T> {
|
||||
fn m1(x: &T4<X>);
|
||||
fn m2(x: &T5<X>);
|
||||
}
|
||||
trait T7<Sized? X: T> {
|
||||
trait T7<X: ?Sized+T> {
|
||||
// not an error (for now)
|
||||
fn m1(x: &T4<X>);
|
||||
fn m2(x: &T5<X>);
|
||||
}
|
||||
|
||||
// The last field in a struct or variant may be unsized
|
||||
struct S2<Sized? X> {
|
||||
struct S2<X: ?Sized> {
|
||||
f: X,
|
||||
}
|
||||
struct S3<Sized? X> {
|
||||
struct S3<X: ?Sized> {
|
||||
f1: int,
|
||||
f2: X,
|
||||
}
|
||||
enum E<Sized? X> {
|
||||
enum E<X: ?Sized> {
|
||||
V1(X),
|
||||
V2{x: X},
|
||||
V3(int, X),
|
||||
|
Loading…
Reference in New Issue
Block a user