forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ignore/keep-wasm32 where appropriate.
- Loading branch information
Showing
7 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters