Skip to content

Commit

Permalink
Use ignore/keep-wasm32 where appropriate.
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jun 29, 2019
1 parent b2aeb0f commit 6d4c642
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/test/ui/imports/empty-extern-arg-wasm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// compile-flags: --extern std=
// error-pattern: can't find crate for `std`
// only-wasm32

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/imports/empty-extern-arg-wasm.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error: extern location for std does not exist:

error[E0463]: can't find crate for `std`
|
= note: the `wasm32-unknown-unknown` target may not be installed

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
1 change: 1 addition & 0 deletions src/test/ui/imports/empty-extern-arg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// compile-flags: --extern std=
// error-pattern: can't find crate for `std`
// ignore-wasm32

fn main() {}
30 changes: 30 additions & 0 deletions src/test/ui/thread-local/issue-43733-2-wasm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// only-wasm32

#![feature(cfg_target_thread_local, thread_local_internals)]

// On platforms *without* `#[thread_local]`, use
// a custom non-`Sync` type to fake the same error.
#[cfg(not(target_thread_local))]
struct Key<T> {
_data: std::cell::UnsafeCell<Option<T>>,
_flag: std::cell::Cell<()>,
}

#[cfg(not(target_thread_local))]
impl<T> Key<T> {
const fn new() -> Self {
Key {
_data: std::cell::UnsafeCell::new(None),
_flag: std::cell::Cell::new(()),
}
}
}

#[cfg(target_thread_local)]
use std::thread::__FastLocalKeyInner as Key;

static __KEY: Key<()> = Key::new();
//~^ ERROR `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads
//~| ERROR cannot be shared between threads safely [E0277]

fn main() {}
23 changes: 23 additions & 0 deletions src/test/ui/thread-local/issue-43733-2-wasm.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error[E0277]: `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
--> $DIR/issue-43733-2-wasm.rs:26:1
|
LL | static __KEY: Key<()> = Key::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
|
= help: within `Key<()>`, the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell<std::option::Option<()>>`
= note: required because it appears within the type `Key<()>`
= note: shared static variables must have a type that implements `Sync`

error[E0277]: `std::cell::Cell<()>` cannot be shared between threads safely
--> $DIR/issue-43733-2-wasm.rs:26:1
|
LL | static __KEY: Key<()> = Key::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::Cell<()>` cannot be shared between threads safely
|
= help: within `Key<()>`, the trait `std::marker::Sync` is not implemented for `std::cell::Cell<()>`
= note: required because it appears within the type `Key<()>`
= note: shared static variables must have a type that implements `Sync`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
2 changes: 2 additions & 0 deletions src/test/ui/thread-local/issue-43733-2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore-wasm32

#![feature(cfg_target_thread_local, thread_local_internals)]

// On platforms *without* `#[thread_local]`, use
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/thread-local/issue-43733-2.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: `std::cell::Cell<std::thread::local::fast::DtorState>` cannot be shared between threads safely
--> $DIR/issue-43733-2.rs:24:1
--> $DIR/issue-43733-2.rs:26:1
|
LL | static __KEY: Key<()> = Key::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::Cell<std::thread::local::fast::DtorState>` cannot be shared between threads safely
Expand All @@ -9,7 +9,7 @@ LL | static __KEY: Key<()> = Key::new();
= note: shared static variables must have a type that implements `Sync`

error[E0277]: `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
--> $DIR/issue-43733-2.rs:24:1
--> $DIR/issue-43733-2.rs:26:1
|
LL | static __KEY: Key<()> = Key::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
Expand Down

0 comments on commit 6d4c642

Please sign in to comment.