File tree Expand file tree Collapse file tree 7 files changed +72
-2
lines changed Expand file tree Collapse file tree 7 files changed +72
-2
lines changed Original file line number Diff line number Diff line change
1
+ // compile-flags: --extern std=
2
+ // error-pattern: can't find crate for `std`
3
+ // only-wasm32
4
+
5
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: extern location for std does not exist:
2
+
3
+ error[E0463]: can't find crate for `std`
4
+ |
5
+ = note: the `wasm32-unknown-unknown` target may not be installed
6
+
7
+ error: aborting due to 2 previous errors
8
+
9
+ For more information about this error, try `rustc --explain E0463`.
Original file line number Diff line number Diff line change 1
1
// compile-flags: --extern std=
2
2
// error-pattern: can't find crate for `std`
3
+ // ignore-wasm32
3
4
4
5
fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // only-wasm32
2
+
3
+ #![ feature( cfg_target_thread_local, thread_local_internals) ]
4
+
5
+ // On platforms *without* `#[thread_local]`, use
6
+ // a custom non-`Sync` type to fake the same error.
7
+ #[ cfg( not( target_thread_local) ) ]
8
+ struct Key < T > {
9
+ _data : std:: cell:: UnsafeCell < Option < T > > ,
10
+ _flag : std:: cell:: Cell < ( ) > ,
11
+ }
12
+
13
+ #[ cfg( not( target_thread_local) ) ]
14
+ impl < T > Key < T > {
15
+ const fn new ( ) -> Self {
16
+ Key {
17
+ _data : std:: cell:: UnsafeCell :: new ( None ) ,
18
+ _flag : std:: cell:: Cell :: new ( ( ) ) ,
19
+ }
20
+ }
21
+ }
22
+
23
+ #[ cfg( target_thread_local) ]
24
+ use std:: thread:: __FastLocalKeyInner as Key ;
25
+
26
+ static __KEY: Key < ( ) > = Key :: new ( ) ;
27
+ //~^ ERROR `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads
28
+ //~| ERROR cannot be shared between threads safely [E0277]
29
+
30
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0277]: `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
2
+ --> $DIR/issue-43733-2-wasm.rs:26:1
3
+ |
4
+ LL | static __KEY: Key<()> = Key::new();
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
6
+ |
7
+ = help: within `Key<()>`, the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell<std::option::Option<()>>`
8
+ = note: required because it appears within the type `Key<()>`
9
+ = note: shared static variables must have a type that implements `Sync`
10
+
11
+ error[E0277]: `std::cell::Cell<()>` cannot be shared between threads safely
12
+ --> $DIR/issue-43733-2-wasm.rs:26:1
13
+ |
14
+ LL | static __KEY: Key<()> = Key::new();
15
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::Cell<()>` cannot be shared between threads safely
16
+ |
17
+ = help: within `Key<()>`, the trait `std::marker::Sync` is not implemented for `std::cell::Cell<()>`
18
+ = note: required because it appears within the type `Key<()>`
19
+ = note: shared static variables must have a type that implements `Sync`
20
+
21
+ error: aborting due to 2 previous errors
22
+
23
+ For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
1
+ // ignore-wasm32
2
+
1
3
#![ feature( cfg_target_thread_local, thread_local_internals) ]
2
4
3
5
// On platforms *without* `#[thread_local]`, use
Original file line number Diff line number Diff line change 1
1
error[E0277]: `std::cell::Cell<std::thread::local::fast::DtorState>` cannot be shared between threads safely
2
- --> $DIR/issue-43733-2.rs:24 :1
2
+ --> $DIR/issue-43733-2.rs:26 :1
3
3
|
4
4
LL | static __KEY: Key<()> = Key::new();
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::Cell<std::thread::local::fast::DtorState>` cannot be shared between threads safely
@@ -9,7 +9,7 @@ LL | static __KEY: Key<()> = Key::new();
9
9
= note: shared static variables must have a type that implements `Sync`
10
10
11
11
error[E0277]: `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
12
- --> $DIR/issue-43733-2.rs:24 :1
12
+ --> $DIR/issue-43733-2.rs:26 :1
13
13
|
14
14
LL | static __KEY: Key<()> = Key::new();
15
15
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
You can’t perform that action at this time.
0 commit comments