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