@@ -17,13 +17,14 @@ use tracing::instrument;
1717
1818use  crate :: thir:: pattern:: pat_from_hir; 
1919
20+ /// Query implementation for [`TyCtxt::thir_body`]. 
2021pub ( crate )  fn  thir_body ( 
2122    tcx :  TyCtxt < ' _ > , 
2223    owner_def :  LocalDefId , 
2324)  -> Result < ( & Steal < Thir < ' _ > > ,  ExprId ) ,  ErrorGuaranteed >  { 
2425    let  hir = tcx. hir ( ) ; 
2526    let  body = hir. body_owned_by ( owner_def) ; 
26-     let  mut  cx = Cx :: new ( tcx,  owner_def) ; 
27+     let  mut  cx = ThirBuildCx :: new ( tcx,  owner_def) ; 
2728    if  let  Some ( reported)  = cx. typeck_results . tainted_by_errors  { 
2829        return  Err ( reported) ; 
2930    } 
@@ -51,8 +52,10 @@ pub(crate) fn thir_body(
5152    Ok ( ( tcx. alloc_steal_thir ( cx. thir ) ,  expr) ) 
5253} 
5354
54- struct  Cx < ' tcx >  { 
55+ /// Context for lowering HIR to THIR for a single function body (or other kind of body). 
56+ struct  ThirBuildCx < ' tcx >  { 
5557    tcx :  TyCtxt < ' tcx > , 
58+     /// The THIR data that this context is building. 
5659thir :  Thir < ' tcx > , 
5760
5861    typing_env :  ty:: TypingEnv < ' tcx > , 
@@ -68,8 +71,8 @@ struct Cx<'tcx> {
6871body_owner :  DefId , 
6972} 
7073
71- impl < ' tcx >  Cx < ' tcx >  { 
72-     fn  new ( tcx :  TyCtxt < ' tcx > ,  def :  LocalDefId )  -> Cx < ' tcx >  { 
74+ impl < ' tcx >  ThirBuildCx < ' tcx >  { 
75+     fn  new ( tcx :  TyCtxt < ' tcx > ,  def :  LocalDefId )  -> Self  { 
7376        let  typeck_results = tcx. typeck ( def) ; 
7477        let  hir = tcx. hir ( ) ; 
7578        let  hir_id = tcx. local_def_id_to_hir_id ( def) ; 
@@ -93,7 +96,7 @@ impl<'tcx> Cx<'tcx> {
9396            BodyTy :: Const ( typeck_results. node_type ( hir_id) ) 
9497        } ; 
9598
96-         Cx  { 
99+         Self  { 
97100            tcx, 
98101            thir :  Thir :: new ( body_type) , 
99102            // FIXME(#132279): We're in a body, we should use a typing 
0 commit comments