diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2018-02-10 21:01:49 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2018-03-14 18:04:20 -0700 |
| commit | 6d8a1739805fa81b6baa8c86efc3e79920ecb306 (patch) | |
| tree | 8ca52590f0d3e738cc3d8ec277ab564653618e35 /src/test/compile-fail | |
| parent | 883e74645d350b6752cb94d48f46363f6f8789e9 (diff) | |
| download | rust-6d8a1739805fa81b6baa8c86efc3e79920ecb306.tar.gz rust-6d8a1739805fa81b6baa8c86efc3e79920ecb306.zip | |
Reword E0044 and message for `!Send` types
- Reword E0044 help. - Change error message for types that don't implement `Send`
Diffstat (limited to 'src/test/compile-fail')
18 files changed, 38 insertions, 31 deletions
diff --git a/src/test/compile-fail/builtin-superkinds-double-superkind.rs b/src/test/compile-fail/builtin-superkinds-double-superkind.rs index 8d5d8e8dc9b..261881d880b 100644 --- a/src/test/compile-fail/builtin-superkinds-double-superkind.rs +++ b/src/test/compile-fail/builtin-superkinds-double-superkind.rs @@ -13,9 +13,11 @@ trait Foo : Send+Sync { } -impl <T: Sync+'static> Foo for (T,) { } //~ ERROR `T: std::marker::Send` is not satisfied +impl <T: Sync+'static> Foo for (T,) { } +//~^ ERROR the trait bound `T: std::marker::Send` is not satisfied in `(T,)` [E0277] -impl <T: Send> Foo for (T,T) { } //~ ERROR `T: std::marker::Sync` is not satisfied +impl <T: Send> Foo for (T,T) { } +//~^ ERROR `T` cannot be shared between threads safely [E0277] impl <T: Send+Sync> Foo for (T,T,T) { } // (ok) diff --git a/src/test/compile-fail/closure-bounds-subtype.rs b/src/test/compile-fail/closure-bounds-subtype.rs index d3339c4845a..db26535b004 100644 --- a/src/test/compile-fail/closure-bounds-subtype.rs +++ b/src/test/compile-fail/closure-bounds-subtype.rs @@ -21,7 +21,7 @@ fn give_any<F>(f: F) where F: FnOnce() { fn give_owned<F>(f: F) where F: FnOnce() + Send { take_any(f); - take_const_owned(f); //~ ERROR `F: std::marker::Sync` is not satisfied + take_const_owned(f); //~ ERROR `F` cannot be shared between threads safely [E0277] } fn main() {} diff --git a/src/test/compile-fail/extern-types-not-sync-send.rs b/src/test/compile-fail/extern-types-not-sync-send.rs index 2f00cf812e4..6a7a515ba5f 100644 --- a/src/test/compile-fail/extern-types-not-sync-send.rs +++ b/src/test/compile-fail/extern-types-not-sync-send.rs @@ -21,7 +21,7 @@ fn assert_send<T: ?Sized + Send>() { } fn main() { assert_sync::<A>(); - //~^ ERROR the trait bound `A: std::marker::Sync` is not satisfied + //~^ ERROR `A` cannot be shared between threads safely [E0277] assert_send::<A>(); //~^ ERROR the trait bound `A: std::marker::Send` is not satisfied diff --git a/src/test/compile-fail/issue-16538.rs b/src/test/compile-fail/issue-16538.rs index 08c3f7a7c15..7df445c676c 100644 --- a/src/test/compile-fail/issue-16538.rs +++ b/src/test/compile-fail/issue-16538.rs @@ -21,7 +21,7 @@ mod Y { } static foo: *const Y::X = Y::foo(Y::x as *const Y::X); -//~^ ERROR `*const usize: std::marker::Sync` is not satisfied +//~^ ERROR `*const usize` cannot be shared between threads safely [E0277] //~| ERROR cannot refer to other statics by value, use the address-of operator or a constant instead //~| ERROR E0015 diff --git a/src/test/compile-fail/issue-17718-static-sync.rs b/src/test/compile-fail/issue-17718-static-sync.rs index 790329cd2e4..c5349d4e82b 100644 --- a/src/test/compile-fail/issue-17718-static-sync.rs +++ b/src/test/compile-fail/issue-17718-static-sync.rs @@ -17,6 +17,6 @@ impl !Sync for Foo {} static FOO: usize = 3; static BAR: Foo = Foo; -//~^ ERROR: `Foo: std::marker::Sync` is not satisfied +//~^ ERROR: `Foo` cannot be shared between threads safely [E0277] fn main() {} diff --git a/src/test/compile-fail/issue-43733-2.rs b/src/test/compile-fail/issue-43733-2.rs index 0fd31454596..a5ba9ef9bd3 100644 --- a/src/test/compile-fail/issue-43733-2.rs +++ b/src/test/compile-fail/issue-43733-2.rs @@ -33,7 +33,7 @@ impl<T> Key<T> { use std::thread::__FastLocalKeyInner as Key; static __KEY: Key<()> = Key::new(); -//~^ ERROR `std::cell::UnsafeCell<std::option::Option<()>>: std::marker::Sync` is not satisfied -//~| ERROR `std::cell::Cell<bool>: std::marker::Sync` is not satisfied +//~^ ERROR `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads +//~| ERROR `std::cell::Cell<bool>` cannot be shared between threads safely [E0277] fn main() {} diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs index 16138c992ff..801a1301ad7 100644 --- a/src/test/compile-fail/issue-7364.rs +++ b/src/test/compile-fail/issue-7364.rs @@ -15,6 +15,6 @@ use std::cell::RefCell; // Regression test for issue 7364 static boxed: Box<RefCell<isize>> = box RefCell::new(0); //~^ ERROR allocations are not allowed in statics -//~| ERROR `std::cell::RefCell<isize>: std::marker::Sync` is not satisfied +//~| ERROR `std::cell::RefCell<isize>` cannot be shared between threads safely [E0277] fn main() { } diff --git a/src/test/compile-fail/kindck-send-object.rs b/src/test/compile-fail/kindck-send-object.rs index bd0e5642b9c..a84eae0bfda 100644 --- a/src/test/compile-fail/kindck-send-object.rs +++ b/src/test/compile-fail/kindck-send-object.rs @@ -20,7 +20,7 @@ trait Message : Send { } fn object_ref_with_static_bound_not_ok() { assert_send::<&'static (Dummy+'static)>(); - //~^ ERROR : std::marker::Sync` is not satisfied + //~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277] } fn box_object_with_no_bound_not_ok<'a>() { diff --git a/src/test/compile-fail/kindck-send-object1.rs b/src/test/compile-fail/kindck-send-object1.rs index da56fccde2d..66865bbcc7e 100644 --- a/src/test/compile-fail/kindck-send-object1.rs +++ b/src/test/compile-fail/kindck-send-object1.rs @@ -18,7 +18,7 @@ trait Dummy { } // careful with object types, who knows what they close over... fn test51<'a>() { assert_send::<&'a Dummy>(); - //~^ ERROR : std::marker::Sync` is not satisfied + //~^ ERROR `Dummy + 'a` cannot be shared between threads safely [E0277] } fn test52<'a>() { assert_send::<&'a (Dummy+Sync)>(); diff --git a/src/test/compile-fail/kindck-send-object2.rs b/src/test/compile-fail/kindck-send-object2.rs index e52a6e12efc..51bc587d74f 100644 --- a/src/test/compile-fail/kindck-send-object2.rs +++ b/src/test/compile-fail/kindck-send-object2.rs @@ -14,7 +14,8 @@ fn assert_send<T:Send>() { } trait Dummy { } fn test50() { - assert_send::<&'static Dummy>(); //~ ERROR : std::marker::Sync` is not satisfied + assert_send::<&'static Dummy>(); + //~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277] } fn test53() { diff --git a/src/test/compile-fail/mutable-enum-indirect.rs b/src/test/compile-fail/mutable-enum-indirect.rs index cafcabe6279..9107745b0e9 100644 --- a/src/test/compile-fail/mutable-enum-indirect.rs +++ b/src/test/compile-fail/mutable-enum-indirect.rs @@ -24,5 +24,6 @@ fn bar<T: Sync>(_: T) {} fn main() { let x = Foo::A(NoSync); - bar(&x); //~ ERROR `NoSync: std::marker::Sync` is not satisfied + bar(&x); + //~^ ERROR `NoSync` cannot be shared between threads safely [E0277] } diff --git a/src/test/compile-fail/mutexguard-sync.rs b/src/test/compile-fail/mutexguard-sync.rs index 861714720c5..2d4b50eb7b2 100644 --- a/src/test/compile-fail/mutexguard-sync.rs +++ b/src/test/compile-fail/mutexguard-sync.rs @@ -18,5 +18,6 @@ fn main() { let m = Mutex::new(Cell::new(0i32)); let guard = m.lock().unwrap(); - test_sync(guard); //~ ERROR the trait bound + test_sync(guard); + //~^ ERROR `std::cell::Cell<i32>` cannot be shared between threads safely [E0277] } diff --git a/src/test/compile-fail/no_share-enum.rs b/src/test/compile-fail/no_share-enum.rs index ae9a25a95b4..77a7012b3b0 100644 --- a/src/test/compile-fail/no_share-enum.rs +++ b/src/test/compile-fail/no_share-enum.rs @@ -22,5 +22,5 @@ fn bar<T: Sync>(_: T) {} fn main() { let x = Foo::A(NoSync); bar(x); - //~^ ERROR `NoSync: std::marker::Sync` is not satisfied + //~^ ERROR `NoSync` cannot be shared between threads safely [E0277] } diff --git a/src/test/compile-fail/no_share-struct.rs b/src/test/compile-fail/no_share-struct.rs index d64d37a2f6c..34e43e9f2aa 100644 --- a/src/test/compile-fail/no_share-struct.rs +++ b/src/test/compile-fail/no_share-struct.rs @@ -20,5 +20,5 @@ fn bar<T: Sync>(_: T) {} fn main() { let x = Foo { a: 5 }; bar(x); - //~^ ERROR `Foo: std::marker::Sync` is not satisfied + //~^ ERROR `Foo` cannot be shared between threads safely [E0277] } diff --git a/src/test/compile-fail/not-sync.rs b/src/test/compile-fail/not-sync.rs index 12c29279178..a383244f415 100644 --- a/src/test/compile-fail/not-sync.rs +++ b/src/test/compile-fail/not-sync.rs @@ -16,17 +16,17 @@ fn test<T: Sync>() {} fn main() { test::<Cell<i32>>(); - //~^ ERROR `std::cell::Cell<i32>: std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::Cell<i32>` cannot be shared between threads safely [E0277] test::<RefCell<i32>>(); - //~^ ERROR `std::cell::RefCell<i32>: std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::RefCell<i32>` cannot be shared between threads safely [E0277] test::<Rc<i32>>(); - //~^ ERROR `std::rc::Rc<i32>: std::marker::Sync` is not satisfied + //~^ ERROR `std::rc::Rc<i32>` cannot be shared between threads safely [E0277] test::<Weak<i32>>(); - //~^ ERROR `std::rc::Weak<i32>: std::marker::Sync` is not satisfied + //~^ ERROR `std::rc::Weak<i32>` cannot be shared between threads safely [E0277] test::<Receiver<i32>>(); - //~^ ERROR `std::sync::mpsc::Receiver<i32>: std::marker::Sync` is not satisfied + //~^ ERROR `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely [E0277] test::<Sender<i32>>(); - //~^ ERROR `std::sync::mpsc::Sender<i32>: std::marker::Sync` is not satisfied + //~^ ERROR `std::sync::mpsc::Sender<i32>` cannot be shared between threads safely [E0277] } diff --git a/src/test/compile-fail/phantom-oibit.rs b/src/test/compile-fail/phantom-oibit.rs index e36c4835ca1..51e7d5da98f 100644 --- a/src/test/compile-fail/phantom-oibit.rs +++ b/src/test/compile-fail/phantom-oibit.rs @@ -28,11 +28,13 @@ struct Nested<T>(T); fn is_zen<T: Zen>(_: T) {} fn not_sync<T>(x: Guard<T>) { - is_zen(x) //~ error: `T: std::marker::Sync` is not satisfied + is_zen(x) + //~^ ERROR `T` cannot be shared between threads safely [E0277] } fn nested_not_sync<T>(x: Nested<Guard<T>>) { - is_zen(x) //~ error: `T: std::marker::Sync` is not satisfied + is_zen(x) + //~^ ERROR `T` cannot be shared between threads safely [E0277] } fn main() {} diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs b/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs index cdf787a60ad..c829ba3dcc3 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs @@ -43,11 +43,11 @@ fn is_sync<T: Sync>() {} fn main() { is_sync::<MySync>(); is_sync::<MyNotSync>(); - //~^ ERROR `MyNotSync: std::marker::Sync` is not satisfied + //~^ ERROR `MyNotSync` cannot be shared between threads safely [E0277] is_sync::<MyTypeWUnsafe>(); - //~^ ERROR `std::cell::UnsafeCell<u8>: std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::UnsafeCell<u8>` cannot be shared between threads safely [E0277] is_sync::<MyTypeManaged>(); - //~^ ERROR `Managed: std::marker::Sync` is not satisfied + //~^ ERROR `Managed` cannot be shared between threads safely [E0277] } diff --git a/src/test/compile-fail/typeck-unsafe-always-share.rs b/src/test/compile-fail/typeck-unsafe-always-share.rs index f0172777cda..fcfc8574b21 100644 --- a/src/test/compile-fail/typeck-unsafe-always-share.rs +++ b/src/test/compile-fail/typeck-unsafe-always-share.rs @@ -27,16 +27,16 @@ fn test<T: Sync>(s: T) {} fn main() { let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0)}); test(us); - //~^ ERROR `std::cell::UnsafeCell<MySync<{integer}>>: std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::UnsafeCell<MySync<{integer}>>` cannot be shared between threads safely let uns = UnsafeCell::new(NoSync); test(uns); - //~^ ERROR `std::cell::UnsafeCell<NoSync>: std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::UnsafeCell<NoSync>` cannot be shared between threads safely [E0277] let ms = MySync{u: uns}; test(ms); - //~^ ERROR `std::cell::UnsafeCell<NoSync>: std::marker::Sync` is not satisfied + //~^ ERROR `std::cell::UnsafeCell<NoSync>` cannot be shared between threads safely [E0277] test(NoSync); - //~^ ERROR `NoSync: std::marker::Sync` is not satisfied + //~^ ERROR `NoSync` cannot be shared between threads safely [E0277] } |
