1 #![allow(unreachable_code)]
3 use std::marker::PhantomData;
8 _phantom: PhantomData<T>,
10 impl<T> Deref for Guard<T> {
12 fn deref(&self) -> &T {
17 pub struct DirectDeref<T>(T);
18 impl<T> Deref for DirectDeref<Arc<T>> {
20 fn deref(&self) -> &T {
26 type Guard: Deref<Target = T>;
27 fn load(&self) -> Self::Guard {
31 impl<T, A: Access<T>, P: Deref<Target = A>> Access<T> for P {
32 //~^ NOTE: required for `Arc<ArcSwapAny<Arc<usize>>>` to implement `Access<_>`
33 //~| NOTE unsatisfied trait bound introduced here
34 type Guard = A::Guard;
36 impl<T> Access<T> for ArcSwapAny<T> {
37 //~^ NOTE: multiple `impl`s satisfying `ArcSwapAny<Arc<usize>>: Access<_>` found
38 type Guard = Guard<T>;
40 impl<T> Access<T> for ArcSwapAny<Arc<T>> {
41 type Guard = DirectDeref<Arc<T>>;
44 pub struct ArcSwapAny<T> {
45 _phantom_arc: PhantomData<T>,
49 let s: Arc<ArcSwapAny<Arc<usize>>> = unimplemented!();
50 let guard: Guard<Arc<usize>> = s.load();
51 //~^ ERROR: type annotations needed
52 //~| HELP: try using a fully qualified path to specify the expected types