@@ -10,8 +10,8 @@ use crate::mir::mono::{Instance, InstanceDef, StaticDef};
1010use crate :: mir:: Body ;
1111use crate :: ty:: {
1212 AdtDef , AdtKind , Allocation , ClosureDef , ClosureKind , Const , FnDef , GenericArgs ,
13- GenericPredicates , Generics , ImplDef , ImplTrait , LineInfo , RigidTy , Span , TraitDecl , TraitDef ,
14- Ty , TyKind ,
13+ GenericPredicates , Generics , ImplDef , ImplTrait , LineInfo , PolyFnSig , RigidTy , Span , TraitDecl ,
14+ TraitDef , Ty , TyKind ,
1515} ;
1616use crate :: {
1717 mir, Crate , CrateItem , CrateItems , DefId , Error , Filename , ImplTraitDecls , ItemKind , Symbol ,
@@ -24,7 +24,11 @@ pub trait Context {
2424 fn entry_fn ( & self ) -> Option < CrateItem > ;
2525 /// Retrieve all items of the local crate that have a MIR associated with them.
2626 fn all_local_items ( & self ) -> CrateItems ;
27+ /// Retrieve the body of a function.
28+ /// This function will panic if the body is not available.
2729 fn mir_body ( & self , item : DefId ) -> mir:: Body ;
30+ /// Check whether the body of a function is available.
31+ fn has_body ( & self , item : DefId ) -> bool ;
2832 fn all_trait_decls ( & self ) -> TraitDecls ;
2933 fn trait_decl ( & self , trait_def : & TraitDef ) -> TraitDecl ;
3034 fn all_trait_impls ( & self ) -> ImplTraitDecls ;
@@ -64,6 +68,9 @@ pub trait Context {
6468 /// Returns if the ADT is a box.
6569 fn adt_is_box ( & self , def : AdtDef ) -> bool ;
6670
71+ /// Retrieve the function signature for the given generic arguments.
72+ fn fn_sig ( & self , def : FnDef , args : & GenericArgs ) -> PolyFnSig ;
73+
6774 /// Evaluate constant as a target usize.
6875 fn eval_target_usize ( & self , cnst : & Const ) -> Result < u64 , Error > ;
6976
@@ -85,8 +92,7 @@ pub trait Context {
8592 /// Obtain the representation of a type.
8693 fn ty_kind ( & self , ty : Ty ) -> TyKind ;
8794
88- /// Get the body of an Instance.
89- /// FIXME: Monomorphize the body.
95+ /// Get the body of an Instance which is already monomorphized.
9096 fn instance_body ( & self , instance : InstanceDef ) -> Option < Body > ;
9197
9298 /// Get the instance type with generic substitutions applied and lifetimes erased.
@@ -98,6 +104,9 @@ pub trait Context {
98104 /// Get the instance mangled name.
99105 fn instance_mangled_name ( & self , instance : InstanceDef ) -> Symbol ;
100106
107+ /// Check if this is an empty DropGlue shim.
108+ fn is_empty_drop_shim ( & self , def : InstanceDef ) -> bool ;
109+
101110 /// Convert a non-generic crate item into an instance.
102111 /// This function will panic if the item is generic.
103112 fn mono_instance ( & self , item : CrateItem ) -> Instance ;
0 commit comments