From 90e9d8ee6258079e25d49480fcafb41945aa6fbe Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Sat, 22 Mar 2014 00:44:26 +0100 Subject: [PATCH] test: Remove Freeze / NoFreeze from tests --- .../auxiliary/trait_superkinds_in_metadata.rs | 4 +- .../borrowck-borrow-of-mut-base-ptr.rs | 25 -------- .../builtin-superkinds-in-metadata.rs | 6 +- .../compile-fail/builtin-superkinds-simple.rs | 7 +-- .../compile-fail/closure-bounds-subtype.rs | 4 +- src/test/compile-fail/kindck-freeze.rs | 57 ------------------- .../compile-fail/mutable-enum-indirect.rs | 6 +- src/test/compile-fail/proc-bounds.rs | 2 +- .../compile-fail/trait-bounds-cant-coerce.rs | 2 +- src/test/compile-fail/trait-bounds-sugar.rs | 4 +- src/test/pretty/path-type-bounds.rs | 6 +- .../builtin-superkinds-capabilities-xc.rs | 8 +-- .../builtin-superkinds-in-metadata.rs | 6 +- src/test/run-pass/proc-bounds.rs | 8 +-- src/test/run-pass/trait-bounds-basic.rs | 2 +- src/test/run-pass/trait-bounds-in-arc.rs | 2 +- 16 files changed, 32 insertions(+), 117 deletions(-) delete mode 100644 src/test/compile-fail/borrowck-borrow-of-mut-base-ptr.rs delete mode 100644 src/test/compile-fail/kindck-freeze.rs diff --git a/src/test/auxiliary/trait_superkinds_in_metadata.rs b/src/test/auxiliary/trait_superkinds_in_metadata.rs index 2345724e8c25..e49ed1f9cf71 100644 --- a/src/test/auxiliary/trait_superkinds_in_metadata.rs +++ b/src/test/auxiliary/trait_superkinds_in_metadata.rs @@ -13,6 +13,6 @@ #[crate_type="lib"]; -pub trait RequiresFreeze : Freeze { } -pub trait RequiresRequiresFreezeAndSend : RequiresFreeze + Send { } +pub trait RequiresShare : Share { } +pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } pub trait RequiresPod : Pod { } diff --git a/src/test/compile-fail/borrowck-borrow-of-mut-base-ptr.rs b/src/test/compile-fail/borrowck-borrow-of-mut-base-ptr.rs deleted file mode 100644 index 954ec82e40fa..000000000000 --- a/src/test/compile-fail/borrowck-borrow-of-mut-base-ptr.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that attempt to freeze an `&mut` pointer while referent is -// claimed yields an error. -// -// Example from src/middle/borrowck/doc.rs - -fn foo<'a>(mut t0: &'a mut int, - mut t1: &'a mut int) { - let p: &mut int = &mut *t0; // Claims `*t0` - let mut t2 = &t0; //~ ERROR cannot borrow `t0` - let q: &int = &**t2; // Freezes `*t0` but not through `*p` - *p += 1; // violates type of `*q` -} - -fn main() { -} diff --git a/src/test/compile-fail/builtin-superkinds-in-metadata.rs b/src/test/compile-fail/builtin-superkinds-in-metadata.rs index bd85141171eb..e085b35cbb11 100644 --- a/src/test/compile-fail/builtin-superkinds-in-metadata.rs +++ b/src/test/compile-fail/builtin-superkinds-in-metadata.rs @@ -16,12 +16,12 @@ // Mostly tests correctness of metadata. extern crate trait_superkinds_in_metadata; -use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze}; +use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; struct X(T); -impl RequiresFreeze for X { } +impl RequiresShare for X { } -impl RequiresRequiresFreezeAndSend for X { } //~ ERROR cannot implement this trait +impl RequiresRequiresShareAndSend for X { } //~ ERROR cannot implement this trait fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-simple.rs b/src/test/compile-fail/builtin-superkinds-simple.rs index 962bf67f009d..caf968612922 100644 --- a/src/test/compile-fail/builtin-superkinds-simple.rs +++ b/src/test/compile-fail/builtin-superkinds-simple.rs @@ -13,10 +13,7 @@ trait Foo : Send { } -impl <'a> Foo for &'a mut () { } //~ ERROR cannot implement this trait - -trait Bar : Freeze { } - -impl <'a> Bar for &'a mut () { } //~ ERROR cannot implement this trait +impl <'a> Foo for &'a mut () { } +//~^ ERROR which does not fulfill `Send`, cannot implement this trait fn main() { } diff --git a/src/test/compile-fail/closure-bounds-subtype.rs b/src/test/compile-fail/closure-bounds-subtype.rs index 9747a44cef07..5ffaebe405e1 100644 --- a/src/test/compile-fail/closure-bounds-subtype.rs +++ b/src/test/compile-fail/closure-bounds-subtype.rs @@ -12,7 +12,7 @@ fn take_any(_: ||:) { } -fn take_const_owned(_: ||:Freeze+Send) { +fn take_const_owned(_: ||:Share+Send) { } fn give_any(f: ||:) { @@ -21,7 +21,7 @@ fn give_any(f: ||:) { fn give_owned(f: ||:Send) { take_any(f); - take_const_owned(f); //~ ERROR expected bounds `Send+Freeze` but found bounds `Send` + take_const_owned(f); //~ ERROR expected bounds `Send+Share` but found bounds `Send` } fn main() {} diff --git a/src/test/compile-fail/kindck-freeze.rs b/src/test/compile-fail/kindck-freeze.rs deleted file mode 100644 index 4da124781949..000000000000 --- a/src/test/compile-fail/kindck-freeze.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test which of the builtin types are considered freezeable. - - -fn assert_freeze() { } -trait Dummy { } - -fn test<'a,T,U:Freeze>(_: &'a int) { - // lifetime pointers are ok... - assert_freeze::<&'static int>(); - assert_freeze::<&'a int>(); - assert_freeze::<&'a str>(); - assert_freeze::<&'a [int]>(); - - // ...unless they are mutable - assert_freeze::<&'static mut int>(); //~ ERROR does not fulfill `Freeze` - assert_freeze::<&'a mut int>(); //~ ERROR does not fulfill `Freeze` - - // ~ pointers are ok - assert_freeze::<~int>(); - assert_freeze::<~str>(); - assert_freeze:: >(); - - // but not if they own a bad thing - assert_freeze::<~&'a mut int>(); //~ ERROR does not fulfill `Freeze` - - // careful with object types, who knows what they close over... - assert_freeze::<&'a Dummy>(); //~ ERROR does not fulfill `Freeze` - assert_freeze::<~Dummy>(); //~ ERROR does not fulfill `Freeze` - - // ...unless they are properly bounded - assert_freeze::<&'a Dummy:Freeze>(); - assert_freeze::<&'static Dummy:Freeze>(); - assert_freeze::<~Dummy:Freeze>(); - - // ...but even then the pointer overrides - assert_freeze::<&'a mut Dummy:Freeze>(); //~ ERROR does not fulfill `Freeze` - - // closures are like an `&mut` object - assert_freeze::<||>(); //~ ERROR does not fulfill `Freeze` - - // unsafe ptrs are ok unless they point at unfreezeable things - assert_freeze::<*int>(); - assert_freeze::<*&'a mut int>(); //~ ERROR does not fulfill `Freeze` -} - -fn main() { -} diff --git a/src/test/compile-fail/mutable-enum-indirect.rs b/src/test/compile-fail/mutable-enum-indirect.rs index 501b17b202cf..e480ebfd3781 100644 --- a/src/test/compile-fail/mutable-enum-indirect.rs +++ b/src/test/compile-fail/mutable-enum-indirect.rs @@ -13,11 +13,11 @@ use std::kinds::marker; -enum Foo { A(marker::NoFreeze) } +enum Foo { A(marker::NoShare) } -fn bar(_: T) {} +fn bar(_: T) {} fn main() { - let x = A(marker::NoFreeze); + let x = A(marker::NoShare); bar(&x); //~ ERROR type parameter with an incompatible type } diff --git a/src/test/compile-fail/proc-bounds.rs b/src/test/compile-fail/proc-bounds.rs index c714bdb5b1b6..e4d2c801070b 100644 --- a/src/test/compile-fail/proc-bounds.rs +++ b/src/test/compile-fail/proc-bounds.rs @@ -9,7 +9,7 @@ // except according to those terms. fn is_send() {} -fn is_freeze() {} +fn is_freeze() {} fn is_static() {} fn main() { diff --git a/src/test/compile-fail/trait-bounds-cant-coerce.rs b/src/test/compile-fail/trait-bounds-cant-coerce.rs index 7f8a26716cd8..958a97412bce 100644 --- a/src/test/compile-fail/trait-bounds-cant-coerce.rs +++ b/src/test/compile-fail/trait-bounds-cant-coerce.rs @@ -14,7 +14,7 @@ trait Foo { fn a(_x: ~Foo:Send) { } -fn c(x: ~Foo:Freeze+Send) { +fn c(x: ~Foo:Share+Send) { a(x); } diff --git a/src/test/compile-fail/trait-bounds-sugar.rs b/src/test/compile-fail/trait-bounds-sugar.rs index b9fb94e09ed5..988057bc7b13 100644 --- a/src/test/compile-fail/trait-bounds-sugar.rs +++ b/src/test/compile-fail/trait-bounds-sugar.rs @@ -18,11 +18,11 @@ fn a(_x: ~Foo) { // should be same as ~Foo:Send fn b(_x: &'static Foo) { // should be same as &'static Foo:'static } -fn c(x: ~Foo:Freeze) { +fn c(x: ~Foo:Share) { a(x); //~ ERROR expected bounds `Send` } -fn d(x: &'static Foo:Freeze) { +fn d(x: &'static Foo:Share) { b(x); //~ ERROR expected bounds `'static` } diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs index c5f24160db51..7b09c5893209 100644 --- a/src/test/pretty/path-type-bounds.rs +++ b/src/test/pretty/path-type-bounds.rs @@ -13,11 +13,11 @@ trait Tr { } impl Tr for int { } -fn foo(x: ~Tr: Freeze) -> ~Tr: Freeze { x } +fn foo(x: ~Tr: Share) -> ~Tr: Share { x } fn main() { - let x: ~Tr: Freeze; + let x: ~Tr: Share; - ~1 as ~Tr: Freeze; + ~1 as ~Tr: Share; } diff --git a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs index dc7a0ce4eba7..8c41e4f57c4b 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs @@ -16,15 +16,15 @@ // even when using them cross-crate. extern crate trait_superkinds_in_metadata; -use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze}; +use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; #[deriving(Eq)] struct X(T); -impl RequiresFreeze for X { } -impl RequiresRequiresFreezeAndSend for X { } +impl RequiresShare for X { } +impl RequiresRequiresShareAndSend for X { } -fn foo(val: T, chan: Sender) { +fn foo(val: T, chan: Sender) { chan.send(val); } diff --git a/src/test/run-pass/builtin-superkinds-in-metadata.rs b/src/test/run-pass/builtin-superkinds-in-metadata.rs index 8cecd5019a39..7b2977d031c1 100644 --- a/src/test/run-pass/builtin-superkinds-in-metadata.rs +++ b/src/test/run-pass/builtin-superkinds-in-metadata.rs @@ -15,14 +15,14 @@ // Tests (correct) usage of trait super-builtin-kinds cross-crate. extern crate trait_superkinds_in_metadata; -use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze}; +use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; use trait_superkinds_in_metadata::{RequiresPod}; struct X(T); -impl RequiresFreeze for X { } +impl RequiresShare for X { } -impl RequiresRequiresFreezeAndSend for X { } +impl RequiresRequiresShareAndSend for X { } impl RequiresPod for X { } diff --git a/src/test/run-pass/proc-bounds.rs b/src/test/run-pass/proc-bounds.rs index 4a3e94704aab..900e266584bd 100644 --- a/src/test/run-pass/proc-bounds.rs +++ b/src/test/run-pass/proc-bounds.rs @@ -12,18 +12,18 @@ fn foo() {} fn bar(_: T) {} fn is_send() {} -fn is_freeze() {} +fn is_freeze() {} fn is_static() {} pub fn main() { foo::(); foo::(); foo::(); - foo::(); - foo::(); + foo::(); + foo::(); is_send::(); - is_freeze::(); + is_freeze::(); is_static::(); diff --git a/src/test/run-pass/trait-bounds-basic.rs b/src/test/run-pass/trait-bounds-basic.rs index 9fef70a4dda8..acc3ca508b2f 100644 --- a/src/test/run-pass/trait-bounds-basic.rs +++ b/src/test/run-pass/trait-bounds-basic.rs @@ -17,7 +17,7 @@ fn a(_x: ~Foo:) { fn b(_x: ~Foo:Send) { } -fn c(x: ~Foo:Freeze+Send) { +fn c(x: ~Foo:Share+Send) { a(x); } diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index 338e06ba25a9..7ba36cbc0dfd 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -11,7 +11,7 @@ // except according to those terms. // Tests that a heterogeneous list of existential types can be put inside an Arc -// and shared between tasks as long as all types fulfill Freeze+Send. +// and shared between tasks as long as all types fulfill Send. // ignore-fast