]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/cache.rs
🚨 fix unsoundness in bootstrap cache code
[rust.git] / src / bootstrap / cache.rs
index be5c9bb07880891cbe23550c952f2aed26a93c9a..05f25af68ea8fe5985e11370df9bbe03c2951e01 100644 (file)
@@ -89,16 +89,16 @@ fn hash<H: Hasher>(&self, state: &mut H) {
 
 impl<T: Internable + Deref> Deref for Interned<T> {
     type Target = T::Target;
-    fn deref(&self) -> &'static Self::Target {
+    fn deref(&self) -> &Self::Target {
         let l = T::intern_cache().lock().unwrap();
-        unsafe { mem::transmute::<&Self::Target, &'static Self::Target>(l.get(*self)) }
+        unsafe { mem::transmute::<&Self::Target, &Self::Target>(l.get(*self)) }
     }
 }
 
 impl<T: Internable + AsRef<U>, U: ?Sized> AsRef<U> for Interned<T> {
-    fn as_ref(&self) -> &'static U {
+    fn as_ref(&self) -> &U {
         let l = T::intern_cache().lock().unwrap();
-        unsafe { mem::transmute::<&U, &'static U>(l.get(*self).as_ref()) }
+        unsafe { mem::transmute::<&U, &U>(l.get(*self).as_ref()) }
     }
 }