File tree 3 files changed +15
-0
lines changed
rustc_smir/src/rustc_smir
3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,12 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
341
341
instance. ty ( tables. tcx , ParamEnv :: reveal_all ( ) ) . stable ( & mut * tables)
342
342
}
343
343
344
+ fn instance_args ( & self , def : InstanceDef ) -> GenericArgs {
345
+ let mut tables = self . 0 . borrow_mut ( ) ;
346
+ let instance = tables. instances [ def] ;
347
+ instance. args . stable ( & mut * tables)
348
+ }
349
+
344
350
fn instance_abi ( & self , def : InstanceDef ) -> Result < FnAbi , Error > {
345
351
let mut tables = self . 0 . borrow_mut ( ) ;
346
352
let instance = tables. instances [ def] ;
Original file line number Diff line number Diff line change @@ -125,6 +125,9 @@ pub trait Context {
125
125
/// Get the instance type with generic substitutions applied and lifetimes erased.
126
126
fn instance_ty ( & self , instance : InstanceDef ) -> Ty ;
127
127
128
+ /// Get the instantiation types.
129
+ fn instance_args ( & self , def : InstanceDef ) -> GenericArgs ;
130
+
128
131
/// Get the instance.
129
132
fn instance_def_id ( & self , instance : InstanceDef ) -> DefId ;
130
133
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ pub enum InstanceKind {
35
35
}
36
36
37
37
impl Instance {
38
+ /// Get the arguments this instance was instantiated with.
39
+ pub fn args ( & self ) -> GenericArgs {
40
+ with ( |cx| cx. instance_args ( self . def ) )
41
+ }
42
+
38
43
/// Get the body of an Instance. The body will be eagerly monomorphized.
39
44
pub fn body ( & self ) -> Option < Body > {
40
45
with ( |context| context. instance_body ( self . def ) )
@@ -148,6 +153,7 @@ impl Debug for Instance {
148
153
f. debug_struct ( "Instance" )
149
154
. field ( "kind" , & self . kind )
150
155
. field ( "def" , & self . mangled_name ( ) )
156
+ . field ( "args" , & self . args ( ) )
151
157
. finish ( )
152
158
}
153
159
}
You can’t perform that action at this time.
0 commit comments