]> git.lizzy.rs Git - rust.git/blob - src/test/ui/phantom-auto-trait.stderr
Point at `impl` and type defs introducing requirements on E0277
[rust.git] / src / test / ui / phantom-auto-trait.stderr
1 error[E0277]: `T` cannot be shared between threads safely
2   --> $DIR/phantom-auto-trait.rs:21:12
3    |
4 LL | fn is_zen<T: Zen>(_: T) {}
5    |              --- required by this bound in `is_zen`
6 ...
7 LL |     is_zen(x)
8    |            ^ `T` cannot be shared between threads safely
9    |
10 note: required because of the requirements on the impl of `Zen` for `&T`
11   --> $DIR/phantom-auto-trait.rs:10:24
12    |
13 LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
14    |                        ^^^     ^^^^^
15    = note: required because it appears within the type `PhantomData<&T>`
16 note: required because it appears within the type `Guard<'_, T>`
17   --> $DIR/phantom-auto-trait.rs:12:8
18    |
19 LL | struct Guard<'a, T: 'a> {
20    |        ^^^^^
21 help: consider restricting type parameter `T`
22    |
23 LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) {
24    |              ^^^^^^^^^^^^^^^^^^^
25
26 error[E0277]: `T` cannot be shared between threads safely
27   --> $DIR/phantom-auto-trait.rs:26:12
28    |
29 LL | fn is_zen<T: Zen>(_: T) {}
30    |              --- required by this bound in `is_zen`
31 ...
32 LL |     is_zen(x)
33    |            ^ `T` cannot be shared between threads safely
34    |
35 note: required because of the requirements on the impl of `Zen` for `&T`
36   --> $DIR/phantom-auto-trait.rs:10:24
37    |
38 LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
39    |                        ^^^     ^^^^^
40    = note: required because it appears within the type `PhantomData<&T>`
41 note: required because it appears within the type `Guard<'_, T>`
42   --> $DIR/phantom-auto-trait.rs:12:8
43    |
44 LL | struct Guard<'a, T: 'a> {
45    |        ^^^^^
46 note: required because it appears within the type `Nested<Guard<'_, T>>`
47   --> $DIR/phantom-auto-trait.rs:16:8
48    |
49 LL | struct Nested<T>(T);
50    |        ^^^^^^
51 help: consider restricting type parameter `T`
52    |
53 LL | fn nested_not_sync<T: std::marker::Sync>(x: Nested<Guard<T>>) {
54    |                     ^^^^^^^^^^^^^^^^^^^
55
56 error: aborting due to 2 previous errors
57
58 For more information about this error, try `rustc --explain E0277`.