1 // Ensure that auto trait checks `T` when it encounters a `PhantomData<T>` field, instead of
2 // checking the `PhantomData<T>` type itself (which almost always implements an auto trait).
4 #![feature(auto_traits)]
6 use std::marker::{PhantomData};
8 unsafe auto trait Zen {}
10 unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
12 struct Guard<'a, T: 'a> {
13 _marker: PhantomData<&'a T>,
18 fn is_zen<T: Zen>(_: T) {}
20 fn not_sync<T>(x: Guard<T>) {
22 //~^ ERROR `T` cannot be shared between threads safely [E0277]
25 fn nested_not_sync<T>(x: Nested<Guard<T>>) {
27 //~^ ERROR `T` cannot be shared between threads safely [E0277]