From 4688aadfde7fa84d5a6cffbcfb309a653ae24441 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Wed, 24 Dec 2014 20:05:30 +1300 Subject: [PATCH] Update tests to use `?Sized` --- src/test/run-pass/dst-raw.rs | 2 +- src/test/run-pass/dst-struct-sole.rs | 2 +- src/test/run-pass/dst-struct.rs | 2 +- src/test/run-pass/dst-trait.rs | 2 +- src/test/run-pass/issue-15155.rs | 2 +- src/test/run-pass/issue-17361.rs | 2 +- .../run-pass/method-recursive-blanket-impl.rs | 2 +- src/test/run-pass/unsized.rs | 29 ++++++++++--------- src/test/run-pass/unsized2.rs | 24 +++++++-------- 9 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/test/run-pass/dst-raw.rs b/src/test/run-pass/dst-raw.rs index 19af9fd7ea7..d3d2e3581aa 100644 --- a/src/test/run-pass/dst-raw.rs +++ b/src/test/run-pass/dst-raw.rs @@ -23,7 +23,7 @@ fn foo(&self) -> int { } } -struct Foo { +struct Foo { f: T } diff --git a/src/test/run-pass/dst-struct-sole.rs b/src/test/run-pass/dst-struct-sole.rs index 26cb27cc653..47547bb7e5a 100644 --- a/src/test/run-pass/dst-struct-sole.rs +++ b/src/test/run-pass/dst-struct-sole.rs @@ -10,7 +10,7 @@ // As dst-struct.rs, but the unsized field is the only field in the struct. -struct Fat { +struct Fat { ptr: T } diff --git a/src/test/run-pass/dst-struct.rs b/src/test/run-pass/dst-struct.rs index 3644ca81d56..fb536904ac8 100644 --- a/src/test/run-pass/dst-struct.rs +++ b/src/test/run-pass/dst-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Fat { +struct Fat { f1: int, f2: &'static str, ptr: T diff --git a/src/test/run-pass/dst-trait.rs b/src/test/run-pass/dst-trait.rs index 907c7810736..abe55d78ac6 100644 --- a/src/test/run-pass/dst-trait.rs +++ b/src/test/run-pass/dst-trait.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Fat { +struct Fat { f1: int, f2: &'static str, ptr: T diff --git a/src/test/run-pass/issue-15155.rs b/src/test/run-pass/issue-15155.rs index 053a4916e22..3a63e63355c 100644 --- a/src/test/run-pass/issue-15155.rs +++ b/src/test/run-pass/issue-15155.rs @@ -22,7 +22,7 @@ struct IndirectBlah { x: Box } impl TraitWithSend for IndirectBlah {} impl IndirectTraitWithSend for IndirectBlah {} -fn test_trait() { println!("got here!") } +fn test_trait() { println!("got here!") } fn main() { test_trait::(); diff --git a/src/test/run-pass/issue-17361.rs b/src/test/run-pass/issue-17361.rs index fa38dcc1986..092bcf661a7 100644 --- a/src/test/run-pass/issue-17361.rs +++ b/src/test/run-pass/issue-17361.rs @@ -11,6 +11,6 @@ // Test that astconv doesn't forget about mutability of &mut str fn main() { - fn foo(_: &mut T) {} + fn foo(_: &mut T) {} let _f: fn(&mut str) = foo; } diff --git a/src/test/run-pass/method-recursive-blanket-impl.rs b/src/test/run-pass/method-recursive-blanket-impl.rs index b45faca2de6..4e4fb75b428 100644 --- a/src/test/run-pass/method-recursive-blanket-impl.rs +++ b/src/test/run-pass/method-recursive-blanket-impl.rs @@ -16,7 +16,7 @@ use std::kinds::Sized; // Note: this must be generic for the problem to show up -trait Foo for Sized? { +trait Foo for ?Sized { fn foo(&self); } diff --git a/src/test/run-pass/unsized.rs b/src/test/run-pass/unsized.rs index 141d6c88dd9..07b9fac6655 100644 --- a/src/test/run-pass/unsized.rs +++ b/src/test/run-pass/unsized.rs @@ -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 for Sized?: T2 {} -trait T4 {} -trait T5 {} -trait T6 {} -trait T7 {} -trait T8 {} -struct S1; -enum E {} -impl T1 for S1 {} -fn f() {} -type TT = T; +trait T1 for ?Sized {} +pub trait T2 for ?Sized {} +trait T3 for ?Sized: T2 {} +trait T4 {} +trait T5 {} +trait T6 {} +trait T7 {} +trait T8 {} +trait T9 {} +struct S1; +enum E {} +impl T1 for S1 {} +fn f() {} +type TT = T; pub fn main() { } diff --git a/src/test/run-pass/unsized2.rs b/src/test/run-pass/unsized2.rs index d28d47c0cfb..8d2c99d4414 100644 --- a/src/test/run-pass/unsized2.rs +++ b/src/test/run-pass/unsized2.rs @@ -13,7 +13,7 @@ // Test sized-ness checking in substitution. // Unbounded. -fn f1(x: &X) { +fn f1(x: &X) { f1::(x); } fn f2(x: &X) { @@ -22,8 +22,8 @@ fn f2(x: &X) { } // Bounded. -trait T for Sized? {} -fn f3(x: &X) { +trait T for ?Sized {} +fn f3(x: &X) { f3::(x); } fn f4(x: &X) { @@ -32,7 +32,7 @@ fn f4(x: &X) { } // Self type. -trait T2 for Sized? { +trait T2 for ?Sized { fn f() -> Box; } struct S; @@ -41,14 +41,14 @@ fn f() -> Box { box S } } -fn f5(x: &X) { +fn f5(x: &X) { let _: Box = T2::f(); } fn f6(x: &X) { let _: Box = T2::f(); } -trait T3 for Sized? { +trait T3 for ?Sized { fn f() -> Box; } impl T3 for S { @@ -56,7 +56,7 @@ fn f() -> Box { box S } } -fn f7(x: &X) { +fn f7(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 = T3::f(); @@ -66,7 +66,7 @@ trait T4 { fn m1(x: &T4); fn m2(x: &T5); } -trait T5 { +trait T5 { // not an error (for now) fn m1(x: &T4); fn m2(x: &T5); @@ -76,21 +76,21 @@ trait T6 { fn m1(x: &T4); fn m2(x: &T5); } -trait T7 { +trait T7 { // not an error (for now) fn m1(x: &T4); fn m2(x: &T5); } // The last field in a struct or variant may be unsized -struct S2 { +struct S2 { f: X, } -struct S3 { +struct S3 { f1: int, f2: X, } -enum E { +enum E { V1(X), V2{x: X}, V3(int, X), -- 2.44.0