2015-03-05 21:20:02 +00:00
|
|
|
// Ensure that OIBIT checks `T` when it encounters a `PhantomData<T>` field, instead of checking
|
2017-12-02 19:15:03 +00:00
|
|
|
// the `PhantomData<T>` type itself (which almost always implements an auto trait)
|
2015-03-05 21:20:02 +00:00
|
|
|
|
2020-11-23 03:54:31 +00:00
|
|
|
#![feature(auto_traits)]
|
2015-03-05 21:20:02 +00:00
|
|
|
|
2015-04-18 05:12:20 +00:00
|
|
|
use std::marker::{PhantomData};
|
2015-03-05 21:20:02 +00:00
|
|
|
|
2017-12-03 12:56:53 +00:00
|
|
|
unsafe auto trait Zen {}
|
2015-03-05 21:20:02 +00:00
|
|
|
|
|
|
|
unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
|
|
|
|
|
|
|
|
struct Guard<'a, T: 'a> {
|
|
|
|
_marker: PhantomData<&'a T>,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Nested<T>(T);
|
|
|
|
|
|
|
|
fn is_zen<T: Zen>(_: T) {}
|
|
|
|
|
|
|
|
fn not_sync<T>(x: Guard<T>) {
|
2018-02-11 05:01:49 +00:00
|
|
|
is_zen(x)
|
|
|
|
//~^ ERROR `T` cannot be shared between threads safely [E0277]
|
2015-03-05 21:20:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn nested_not_sync<T>(x: Nested<Guard<T>>) {
|
2018-02-11 05:01:49 +00:00
|
|
|
is_zen(x)
|
|
|
|
//~^ ERROR `T` cannot be shared between threads safely [E0277]
|
2015-03-05 21:20:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|