File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed
rustc_smir/src/rustc_smir Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,12 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
335335 instance. ty ( tables. tcx , ParamEnv :: reveal_all ( ) ) . stable ( & mut * tables)
336336 }
337337
338+ fn instance_args ( & self , def : InstanceDef ) -> GenericArgs {
339+ let mut tables = self . 0 . borrow_mut ( ) ;
340+ let instance = tables. instances [ def] ;
341+ instance. args . stable ( & mut * tables)
342+ }
343+
338344 fn instance_def_id ( & self , def : InstanceDef ) -> stable_mir:: DefId {
339345 let mut tables = self . 0 . borrow_mut ( ) ;
340346 let def_id = tables. instances [ def] . def_id ( ) ;
Original file line number Diff line number Diff line change @@ -124,6 +124,9 @@ pub trait Context {
124124 /// Get the instance type with generic substitutions applied and lifetimes erased.
125125 fn instance_ty ( & self , instance : InstanceDef ) -> Ty ;
126126
127+ /// Get the instantiation types.
128+ fn instance_args ( & self , def : InstanceDef ) -> GenericArgs ;
129+
127130 /// Get the instance.
128131 fn instance_def_id ( & self , instance : InstanceDef ) -> DefId ;
129132
Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ pub enum InstanceKind {
3434}
3535
3636impl Instance {
37+ /// Get the arguments this instance was instantiated with.
38+ pub fn args ( & self ) -> GenericArgs {
39+ with ( |cx| cx. instance_args ( self . def ) )
40+ }
41+
3742 /// Get the body of an Instance. The body will be eagerly monomorphized.
3843 pub fn body ( & self ) -> Option < Body > {
3944 with ( |context| context. instance_body ( self . def ) )
@@ -142,6 +147,7 @@ impl Debug for Instance {
142147 f. debug_struct ( "Instance" )
143148 . field ( "kind" , & self . kind )
144149 . field ( "def" , & self . mangled_name ( ) )
150+ . field ( "args" , & self . args ( ) )
145151 . finish ( )
146152 }
147153}
You can’t perform that action at this time.
0 commit comments