implement Lift for Arc

This commit is contained in:
Niko Matsakis 2019-06-18 08:15:27 -04:00
parent e6b6873525
commit e39f66a859

View File

@ -15,6 +15,7 @@ use crate::mir::interpret;
use std::fmt;
use std::rc::Rc;
use std::sync::Arc;
impl fmt::Debug for ty::GenericParamDef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@ -385,6 +386,13 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Rc<T> {
}
}
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Arc<T> {
type Lifted = Arc<T::Lifted>;
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
tcx.lift(&**self).map(Arc::new)
}
}
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] {
type Lifted = Vec<T::Lifted>;
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {