@@ -10,8 +10,8 @@ use crate::mir::mono::{Instance, InstanceDef, StaticDef};
10
10
use crate :: mir:: Body ;
11
11
use crate :: ty:: {
12
12
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 ,
15
15
} ;
16
16
use crate :: {
17
17
mir, Crate , CrateItem , CrateItems , DefId , Error , Filename , ImplTraitDecls , ItemKind , Symbol ,
@@ -24,7 +24,11 @@ pub trait Context {
24
24
fn entry_fn ( & self ) -> Option < CrateItem > ;
25
25
/// Retrieve all items of the local crate that have a MIR associated with them.
26
26
fn all_local_items ( & self ) -> CrateItems ;
27
+ /// Retrieve the body of a function.
28
+ /// This function will panic if the body is not available.
27
29
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 ;
28
32
fn all_trait_decls ( & self ) -> TraitDecls ;
29
33
fn trait_decl ( & self , trait_def : & TraitDef ) -> TraitDecl ;
30
34
fn all_trait_impls ( & self ) -> ImplTraitDecls ;
@@ -64,6 +68,9 @@ pub trait Context {
64
68
/// Returns if the ADT is a box.
65
69
fn adt_is_box ( & self , def : AdtDef ) -> bool ;
66
70
71
+ /// Retrieve the function signature for the given generic arguments.
72
+ fn fn_sig ( & self , def : FnDef , args : & GenericArgs ) -> PolyFnSig ;
73
+
67
74
/// Evaluate constant as a target usize.
68
75
fn eval_target_usize ( & self , cnst : & Const ) -> Result < u64 , Error > ;
69
76
@@ -85,8 +92,7 @@ pub trait Context {
85
92
/// Obtain the representation of a type.
86
93
fn ty_kind ( & self , ty : Ty ) -> TyKind ;
87
94
88
- /// Get the body of an Instance.
89
- /// FIXME: Monomorphize the body.
95
+ /// Get the body of an Instance which is already monomorphized.
90
96
fn instance_body ( & self , instance : InstanceDef ) -> Option < Body > ;
91
97
92
98
/// Get the instance type with generic substitutions applied and lifetimes erased.
@@ -98,6 +104,9 @@ pub trait Context {
98
104
/// Get the instance mangled name.
99
105
fn instance_mangled_name ( & self , instance : InstanceDef ) -> Symbol ;
100
106
107
+ /// Check if this is an empty DropGlue shim.
108
+ fn is_empty_drop_shim ( & self , def : InstanceDef ) -> bool ;
109
+
101
110
/// Convert a non-generic crate item into an instance.
102
111
/// This function will panic if the item is generic.
103
112
fn mono_instance ( & self , item : CrateItem ) -> Instance ;
0 commit comments