File: phantom-auto-trait.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (68 lines) | stat: -rw-r--r-- 2,479 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
error[E0277]: `T` cannot be shared between threads safely
  --> $DIR/phantom-auto-trait.rs:21:12
   |
LL |     is_zen(x)
   |     ------ ^ `T` cannot be shared between threads safely
   |     |
   |     required by a bound introduced by this call
   |
note: required for `&T` to implement `Zen`
  --> $DIR/phantom-auto-trait.rs:10:24
   |
LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
   |                        ^^^     ^^^^^          ---- unsatisfied trait bound introduced here
note: required because it appears within the type `PhantomData<&T>`
  --> $SRC_DIR/core/src/marker.rs:LL:COL
note: required because it appears within the type `Guard<'_, T>`
  --> $DIR/phantom-auto-trait.rs:12:8
   |
LL | struct Guard<'a, T: 'a> {
   |        ^^^^^
note: required by a bound in `is_zen`
  --> $DIR/phantom-auto-trait.rs:18:14
   |
LL | fn is_zen<T: Zen>(_: T) {}
   |              ^^^ required by this bound in `is_zen`
help: consider restricting type parameter `T` with trait `Sync`
   |
LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) {
   |              +++++++++++++++++++

error[E0277]: `T` cannot be shared between threads safely
  --> $DIR/phantom-auto-trait.rs:26:12
   |
LL |     is_zen(x)
   |     ------ ^ `T` cannot be shared between threads safely
   |     |
   |     required by a bound introduced by this call
   |
note: required for `&T` to implement `Zen`
  --> $DIR/phantom-auto-trait.rs:10:24
   |
LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
   |                        ^^^     ^^^^^          ---- unsatisfied trait bound introduced here
note: required because it appears within the type `PhantomData<&T>`
  --> $SRC_DIR/core/src/marker.rs:LL:COL
note: required because it appears within the type `Guard<'_, T>`
  --> $DIR/phantom-auto-trait.rs:12:8
   |
LL | struct Guard<'a, T: 'a> {
   |        ^^^^^
note: required because it appears within the type `Nested<Guard<'_, T>>`
  --> $DIR/phantom-auto-trait.rs:16:8
   |
LL | struct Nested<T>(T);
   |        ^^^^^^
note: required by a bound in `is_zen`
  --> $DIR/phantom-auto-trait.rs:18:14
   |
LL | fn is_zen<T: Zen>(_: T) {}
   |              ^^^ required by this bound in `is_zen`
help: consider restricting type parameter `T` with trait `Sync`
   |
LL | fn nested_not_sync<T: std::marker::Sync>(x: Nested<Guard<T>>) {
   |                     +++++++++++++++++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.