Restore movability to SMIR
This commit is contained in:
parent
fcb42b42d6
commit
15ccf2e7bd
@ -104,7 +104,7 @@ impl<'tcx> RustcInternal<'tcx> for RigidTy {
|
|||||||
RigidTy::Closure(def, args) => {
|
RigidTy::Closure(def, args) => {
|
||||||
rustc_ty::TyKind::Closure(def.0.internal(tables), args.internal(tables))
|
rustc_ty::TyKind::Closure(def.0.internal(tables), args.internal(tables))
|
||||||
}
|
}
|
||||||
RigidTy::Coroutine(def, args) => {
|
RigidTy::Coroutine(def, args, _mov) => {
|
||||||
rustc_ty::TyKind::Coroutine(def.0.internal(tables), args.internal(tables))
|
rustc_ty::TyKind::Coroutine(def.0.internal(tables), args.internal(tables))
|
||||||
}
|
}
|
||||||
RigidTy::CoroutineWitness(def, args) => {
|
RigidTy::CoroutineWitness(def, args) => {
|
||||||
|
@ -535,6 +535,7 @@ impl<'tcx> Stable<'tcx> for mir::AggregateKind<'tcx> {
|
|||||||
stable_mir::mir::AggregateKind::Coroutine(
|
stable_mir::mir::AggregateKind::Coroutine(
|
||||||
tables.coroutine_def(*def_id),
|
tables.coroutine_def(*def_id),
|
||||||
generic_arg.stable(tables),
|
generic_arg.stable(tables),
|
||||||
|
tables.tcx.movability(*def_id).stable(tables),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,6 +389,7 @@ impl<'tcx> Stable<'tcx> for ty::TyKind<'tcx> {
|
|||||||
ty::Coroutine(def_id, generic_args) => TyKind::RigidTy(RigidTy::Coroutine(
|
ty::Coroutine(def_id, generic_args) => TyKind::RigidTy(RigidTy::Coroutine(
|
||||||
tables.coroutine_def(*def_id),
|
tables.coroutine_def(*def_id),
|
||||||
generic_args.stable(tables),
|
generic_args.stable(tables),
|
||||||
|
tables.tcx.movability(*def_id).stable(tables),
|
||||||
)),
|
)),
|
||||||
ty::Never => TyKind::RigidTy(RigidTy::Never),
|
ty::Never => TyKind::RigidTy(RigidTy::Never),
|
||||||
ty::Tuple(fields) => {
|
ty::Tuple(fields) => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use crate::mir::pretty::{function_body, pretty_statement, pretty_terminator};
|
use crate::mir::pretty::{function_body, pretty_statement, pretty_terminator};
|
||||||
use crate::ty::{
|
use crate::ty::{
|
||||||
AdtDef, ClosureDef, Const, CoroutineDef, GenericArgs, Region, RigidTy, Ty, TyKind, VariantIdx,
|
AdtDef, ClosureDef, Const, CoroutineDef, GenericArgs, Movability, Region, RigidTy, Ty, TyKind,
|
||||||
|
VariantIdx,
|
||||||
};
|
};
|
||||||
use crate::{Error, Opaque, Span, Symbol};
|
use crate::{Error, Opaque, Span, Symbol};
|
||||||
use std::io;
|
use std::io;
|
||||||
@ -645,7 +646,9 @@ impl Rvalue {
|
|||||||
)),
|
)),
|
||||||
AggregateKind::Adt(def, _, ref args, _, _) => Ok(def.ty_with_args(args)),
|
AggregateKind::Adt(def, _, ref args, _, _) => Ok(def.ty_with_args(args)),
|
||||||
AggregateKind::Closure(def, ref args) => Ok(Ty::new_closure(def, args.clone())),
|
AggregateKind::Closure(def, ref args) => Ok(Ty::new_closure(def, args.clone())),
|
||||||
AggregateKind::Coroutine(def, ref args) => Ok(Ty::new_coroutine(def, args.clone())),
|
AggregateKind::Coroutine(def, ref args, mov) => {
|
||||||
|
Ok(Ty::new_coroutine(def, args.clone(), mov))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Rvalue::ShallowInitBox(_, ty) => Ok(Ty::new_box(*ty)),
|
Rvalue::ShallowInitBox(_, ty) => Ok(Ty::new_box(*ty)),
|
||||||
Rvalue::CopyForDeref(place) => place.ty(locals),
|
Rvalue::CopyForDeref(place) => place.ty(locals),
|
||||||
@ -659,7 +662,8 @@ pub enum AggregateKind {
|
|||||||
Tuple,
|
Tuple,
|
||||||
Adt(AdtDef, VariantIdx, GenericArgs, Option<UserTypeAnnotationIndex>, Option<FieldIdx>),
|
Adt(AdtDef, VariantIdx, GenericArgs, Option<UserTypeAnnotationIndex>, Option<FieldIdx>),
|
||||||
Closure(ClosureDef, GenericArgs),
|
Closure(ClosureDef, GenericArgs),
|
||||||
Coroutine(CoroutineDef, GenericArgs),
|
// FIXME(stable_mir): Movability here is redundant
|
||||||
|
Coroutine(CoroutineDef, GenericArgs, Movability),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
|
@ -443,7 +443,7 @@ pub fn pretty_ty(ty: TyKind) -> String {
|
|||||||
RigidTy::FnDef(_, _) => format!("{:#?}", rigid_ty),
|
RigidTy::FnDef(_, _) => format!("{:#?}", rigid_ty),
|
||||||
RigidTy::FnPtr(_) => format!("{:#?}", rigid_ty),
|
RigidTy::FnPtr(_) => format!("{:#?}", rigid_ty),
|
||||||
RigidTy::Closure(_, _) => format!("{:#?}", rigid_ty),
|
RigidTy::Closure(_, _) => format!("{:#?}", rigid_ty),
|
||||||
RigidTy::Coroutine(_, _) => format!("{:#?}", rigid_ty),
|
RigidTy::Coroutine(_, _, _) => format!("{:#?}", rigid_ty),
|
||||||
RigidTy::Dynamic(data, region, repr) => {
|
RigidTy::Dynamic(data, region, repr) => {
|
||||||
// FIXME: Fix binder printing, it looks ugly now
|
// FIXME: Fix binder printing, it looks ugly now
|
||||||
pretty.push_str("(");
|
pretty.push_str("(");
|
||||||
|
@ -58,8 +58,8 @@ impl Ty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new coroutine type.
|
/// Create a new coroutine type.
|
||||||
pub fn new_coroutine(def: CoroutineDef, args: GenericArgs) -> Ty {
|
pub fn new_coroutine(def: CoroutineDef, args: GenericArgs, mov: Movability) -> Ty {
|
||||||
Ty::from_rigid_kind(RigidTy::Coroutine(def, args))
|
Ty::from_rigid_kind(RigidTy::Coroutine(def, args, mov))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new box type that represents `Box<T>`, for the given inner type `T`.
|
/// Create a new box type that represents `Box<T>`, for the given inner type `T`.
|
||||||
@ -460,7 +460,8 @@ pub enum RigidTy {
|
|||||||
FnDef(FnDef, GenericArgs),
|
FnDef(FnDef, GenericArgs),
|
||||||
FnPtr(PolyFnSig),
|
FnPtr(PolyFnSig),
|
||||||
Closure(ClosureDef, GenericArgs),
|
Closure(ClosureDef, GenericArgs),
|
||||||
Coroutine(CoroutineDef, GenericArgs),
|
// FIXME(stable_mir): Movability here is redundant
|
||||||
|
Coroutine(CoroutineDef, GenericArgs, Movability),
|
||||||
Dynamic(Vec<Binder<ExistentialPredicate>>, Region, DynKind),
|
Dynamic(Vec<Binder<ExistentialPredicate>>, Region, DynKind),
|
||||||
Never,
|
Never,
|
||||||
Tuple(Vec<Ty>),
|
Tuple(Vec<Ty>),
|
||||||
|
@ -148,7 +148,7 @@ impl Visitable for RigidTy {
|
|||||||
RigidTy::FnDef(_, args) => args.visit(visitor),
|
RigidTy::FnDef(_, args) => args.visit(visitor),
|
||||||
RigidTy::FnPtr(sig) => sig.visit(visitor),
|
RigidTy::FnPtr(sig) => sig.visit(visitor),
|
||||||
RigidTy::Closure(_, args) => args.visit(visitor),
|
RigidTy::Closure(_, args) => args.visit(visitor),
|
||||||
RigidTy::Coroutine(_, args) => args.visit(visitor),
|
RigidTy::Coroutine(_, args, _) => args.visit(visitor),
|
||||||
RigidTy::CoroutineWitness(_, args) => args.visit(visitor),
|
RigidTy::CoroutineWitness(_, args) => args.visit(visitor),
|
||||||
RigidTy::Dynamic(pred, r, _) => {
|
RigidTy::Dynamic(pred, r, _) => {
|
||||||
pred.visit(visitor)?;
|
pred.visit(visitor)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user