Skip to content

Commit 921ba5a

Browse files
committed
Don't use NoSend/NoSync in tests
1 parent 094397a commit 921ba5a

19 files changed

+59
-41
lines changed

src/test/compile-fail/issue-17718-static-sync.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::marker;
11+
#![feature(optin_builtin_traits)]
1212

13-
struct Foo { marker: marker::NoSync }
13+
use std::marker::Sync;
14+
15+
struct Foo;
16+
impl !Sync for Foo {}
1417

1518
static FOO: usize = 3;
16-
static BAR: Foo = Foo { marker: marker::NoSync };
19+
static BAR: Foo = Foo;
1720
//~^ ERROR: the trait `core::marker::Sync` is not implemented
1821

1922
fn main() {}

src/test/compile-fail/issue-7013.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ struct A {
3535
fn main() {
3636
let a = A {v: box B{v: None} as Box<Foo+Send>};
3737
//~^ ERROR the trait `core::marker::Send` is not implemented
38-
//~^^ ERROR the trait `core::marker::Send` is not implemented
3938
}

src/test/compile-fail/kindck-nonsendable-1.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ fn main() {
1919
let x = Rc::new(3us);
2020
bar(move|| foo(x));
2121
//~^ ERROR `core::marker::Send` is not implemented
22-
//~^^ ERROR `core::marker::Send` is not implemented
2322
}
2423

src/test/compile-fail/marker-no-send.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-stage1
12+
// ignore-stage2
13+
// ignore-stage3
14+
1115
use std::marker;
1216

1317
fn foo<P:Send>(p: P) { }

src/test/compile-fail/marker-no-share.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-stage1
12+
// ignore-stage2
13+
// ignore-stage3
14+
1115
use std::marker;
1216

1317
fn foo<P: Sync>(p: P) { }

src/test/compile-fail/mutable-enum-indirect.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111
// Tests that an `&` pointer to something inherently mutable is itself
1212
// to be considered mutable.
1313

14-
use std::marker;
14+
#![feature(optin_builtin_traits)]
1515

16-
enum Foo { A(marker::NoSync) }
16+
use std::marker::Sync;
17+
18+
struct NoSync;
19+
impl !Sync for NoSync {}
20+
21+
enum Foo { A(NoSync) }
1722

1823
fn bar<T: Sync>(_: T) {}
1924

2025
fn main() {
21-
let x = Foo::A(marker::NoSync);
26+
let x = Foo::A(NoSync);
2227
bar(&x); //~ ERROR the trait `core::marker::Sync` is not implemented
2328
}

src/test/compile-fail/no-send-res-ports.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ fn main() {
3737

3838
Thread::spawn(move|| {
3939
//~^ ERROR `core::marker::Send` is not implemented
40-
//~^^ ERROR `core::marker::Send` is not implemented
4140
let y = x;
4241
println!("{:?}", y);
4342
});

src/test/compile-fail/no_send-enum.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::marker;
11+
#![feature(optin_builtin_traits)]
12+
13+
use std::marker::Send;
14+
15+
struct NoSend;
16+
impl !Send for NoSend {}
1217

1318
enum Foo {
14-
A(marker::NoSend)
19+
A(NoSend)
1520
}
1621

1722
fn bar<T: Send>(_: T) {}
1823

1924
fn main() {
20-
let x = Foo::A(marker::NoSend);
25+
let x = Foo::A(NoSend);
2126
bar(x);
2227
//~^ ERROR `core::marker::Send` is not implemented
2328
}

src/test/compile-fail/no_send-rc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ fn main() {
1616
let x = Rc::new(5is);
1717
bar(x);
1818
//~^ ERROR `core::marker::Send` is not implemented
19-
//~^^ ERROR `core::marker::Send` is not implemented
2019
}

src/test/compile-fail/no_send-struct.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::marker;
11+
#![feature(optin_builtin_traits)]
12+
13+
use std::marker::Send;
1214

1315
struct Foo {
1416
a: isize,
15-
ns: marker::NoSend
1617
}
1718

19+
impl !Send for Foo {}
20+
1821
fn bar<T: Send>(_: T) {}
1922

2023
fn main() {
21-
let x = Foo { a: 5, ns: marker::NoSend };
24+
let x = Foo { a: 5 };
2225
bar(x);
2326
//~^ ERROR the trait `core::marker::Send` is not implemented
2427
}

src/test/compile-fail/no_share-enum.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::marker;
11+
#![feature(optin_builtin_traits)]
1212

13-
enum Foo { A(marker::NoSync) }
13+
use std::marker::Sync;
14+
15+
struct NoSync;
16+
impl !Sync for NoSync {}
17+
18+
enum Foo { A(NoSync) }
1419

1520
fn bar<T: Sync>(_: T) {}
1621

1722
fn main() {
18-
let x = Foo::A(marker::NoSync);
23+
let x = Foo::A(NoSync);
1924
bar(x);
2025
//~^ ERROR the trait `core::marker::Sync` is not implemented
2126
}

src/test/compile-fail/no_share-rc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ fn main() {
1717
let x = Rc::new(RefCell::new(5is));
1818
bar(x);
1919
//~^ ERROR the trait `core::marker::Sync` is not implemented
20-
//~^^ ERROR the trait `core::marker::Sync` is not implemented
2120
}

src/test/compile-fail/no_share-struct.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::marker;
11+
#![feature(optin_builtin_traits)]
1212

13-
struct Foo { a: isize, m: marker::NoSync }
13+
use std::marker::Sync;
14+
15+
struct Foo { a: isize }
16+
impl !Sync for Foo {}
1417

1518
fn bar<T: Sync>(_: T) {}
1619

1720
fn main() {
18-
let x = Foo { a: 5, m: marker::NoSync };
21+
let x = Foo { a: 5 };
1922
bar(x);
2023
//~^ ERROR the trait `core::marker::Sync` is not implemented
2124
}

src/test/compile-fail/task-rng-isnt-sendable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ fn test_send<S: Send>() {}
1717
pub fn main() {
1818
test_send::<rand::ThreadRng>();
1919
//~^ ERROR `core::marker::Send` is not implemented
20-
//~^^ ERROR `core::marker::Send` is not implemented
2120
}

src/test/compile-fail/typeck-unsafe-always-share.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,33 @@
1010

1111
// Verify that UnsafeCell is *always* sync regardless if `T` is sync.
1212

13-
// ignore-tidy-linelength
13+
#![feature(optin_builtin_traits)]
1414

1515
use std::cell::UnsafeCell;
16-
use std::marker;
16+
use std::marker::Sync;
1717

1818
struct MySync<T> {
1919
u: UnsafeCell<T>
2020
}
2121

22-
struct NoSync {
23-
m: marker::NoSync
24-
}
25-
26-
fn test<T: Sync>(s: T){
22+
struct NoSync;
23+
impl !Sync for NoSync {}
2724

28-
}
25+
fn test<T: Sync>(s: T) {}
2926

3027
fn main() {
3128
let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0is)});
3229
test(us);
3330
//~^ ERROR `core::marker::Sync` is not implemented
3431

35-
let uns = UnsafeCell::new(NoSync{m: marker::NoSync});
32+
let uns = UnsafeCell::new(NoSync);
3633
test(uns);
3734
//~^ ERROR `core::marker::Sync` is not implemented
3835

3936
let ms = MySync{u: uns};
4037
test(ms);
4138
//~^ ERROR `core::marker::Sync` is not implemented
4239

43-
let ns = NoSync{m: marker::NoSync};
44-
test(ns);
40+
test(NoSync);
4541
//~^ ERROR `core::marker::Sync` is not implemented
4642
}

src/test/compile-fail/unique-unique-kind.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ fn main() {
1919
let i = box Rc::new(100is);
2020
f(i);
2121
//~^ ERROR `core::marker::Send` is not implemented
22-
//~^^ ERROR `core::marker::Send` is not implemented
2322
}

src/test/compile-fail/unsendable-class.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ fn main() {
3131
let cat = "kitty".to_string();
3232
let (tx, _) = channel();
3333
//~^ ERROR `core::marker::Send` is not implemented
34-
//~^^ ERROR `core::marker::Send` is not implemented
3534
tx.send(foo(42, Rc::new(cat)));
3635
}

src/test/run-pass/coherence-negative-impls-safe.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ use std::marker::Send;
1414

1515
struct TestType;
1616

17-
unsafe impl Send for TestType {}
18-
1917
impl !Send for TestType {}
2018

2119
fn main() {}

src/test/run-pass/syntax-trait-polarity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ impl TestType {}
1818

1919
trait TestTrait {}
2020

21-
unsafe impl !Send for TestType {}
21+
impl !Send for TestType {}
2222
impl !TestTrait for TestType {}
2323

2424
struct TestType2<T>;
2525

2626
impl<T> TestType2<T> {}
2727

28-
unsafe impl<T> !Send for TestType2<T> {}
28+
impl<T> !Send for TestType2<T> {}
2929
impl<T> !TestTrait for TestType2<T> {}
3030

3131
fn main() {}

0 commit comments

Comments
 (0)