libs: add Deref, DerefMut impls for references, fixing a bug in compiler in the process that was blocking this.

Fixes #18621.
This commit is contained in:
Niko Matsakis 2014-11-06 17:34:33 -05:00
parent e84e7a00dd
commit f2aaed8338
6 changed files with 78 additions and 8 deletions

View file

@ -166,7 +166,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
// additional reference of either kind.
if self.inner().strong.load(atomic::SeqCst) != 1 ||
self.inner().weak.load(atomic::SeqCst) != 1 {
*self = Arc::new(self.deref().clone())
*self = Arc::new((**self).clone())
}
// This unsafety is ok because we're guaranteed that the pointer
// returned is the *only* pointer that will ever be returned to T. Our