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 @@ -341,6 +341,12 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
341341        instance. ty ( tables. tcx ,  ParamEnv :: reveal_all ( ) ) . stable ( & mut  * tables) 
342342    } 
343343
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+ 
344350    fn  instance_abi ( & self ,  def :  InstanceDef )  -> Result < FnAbi ,  Error >  { 
345351        let  mut  tables = self . 0 . borrow_mut ( ) ; 
346352        let  instance = tables. instances [ def] ; 
Original file line number Diff line number Diff line change @@ -125,6 +125,9 @@ pub trait Context {
125125    /// Get the instance type with generic substitutions applied and lifetimes erased. 
126126     fn  instance_ty ( & self ,  instance :  InstanceDef )  -> Ty ; 
127127
128+     /// Get the instantiation types. 
129+      fn  instance_args ( & self ,  def :  InstanceDef )  -> GenericArgs ; 
130+ 
128131    /// Get the instance. 
129132     fn  instance_def_id ( & self ,  instance :  InstanceDef )  -> DefId ; 
130133
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ pub enum InstanceKind {
3535} 
3636
3737impl  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+ 
3843    /// Get the body of an Instance. The body will be eagerly monomorphized. 
3944     pub  fn  body ( & self )  -> Option < Body >  { 
4045        with ( |context| context. instance_body ( self . def ) ) 
@@ -148,6 +153,7 @@ impl Debug for Instance {
148153        f. debug_struct ( "Instance" ) 
149154            . field ( "kind" ,  & self . kind ) 
150155            . field ( "def" ,  & self . mangled_name ( ) ) 
156+             . field ( "args" ,  & self . args ( ) ) 
151157            . finish ( ) 
152158    } 
153159} 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments