@@ -2,7 +2,7 @@ use crate::callee::{self, DeferredCallResolution};
22use crate :: errors:: CtorIsPrivate ;
33use crate :: method:: { self , MethodCallee , SelfSource } ;
44use crate :: rvalue_scopes;
5- use crate :: { BreakableCtxt , Diverges , Expectation , FnCtxt , RawTy } ;
5+ use crate :: { BreakableCtxt , Diverges , Expectation , FnCtxt , LoweredTy } ;
66use rustc_data_structures:: captures:: Captures ;
77use rustc_data_structures:: fx:: FxHashSet ;
88use rustc_errors:: { Applicability , Diagnostic , ErrorGuaranteed , MultiSpan , StashKey } ;
@@ -373,14 +373,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
373373 }
374374 }
375375
376- pub fn handle_raw_ty ( & self , span : Span , ty : Ty < ' tcx > ) -> RawTy < ' tcx > {
377- RawTy { raw : ty, normalized : self . normalize ( span, ty) }
378- }
379-
380- pub fn to_ty ( & self , ast_t : & hir:: Ty < ' tcx > ) -> RawTy < ' tcx > {
376+ pub fn to_ty ( & self , ast_t : & hir:: Ty < ' tcx > ) -> LoweredTy < ' tcx > {
381377 let t = self . astconv ( ) . ast_ty_to_ty ( ast_t) ;
382378 self . register_wf_obligation ( t. into ( ) , ast_t. span , traits:: WellFormed ( None ) ) ;
383- self . handle_raw_ty ( ast_t. span , t)
379+ LoweredTy :: from_raw ( self , ast_t. span , t)
384380 }
385381
386382 pub fn to_ty_saving_user_provided_ty ( & self , ast_ty : & hir:: Ty < ' tcx > ) -> Ty < ' tcx > {
@@ -396,7 +392,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
396392 ty. normalized
397393 }
398394
399- pub ( super ) fn user_args_for_adt ( ty : RawTy < ' tcx > ) -> UserArgs < ' tcx > {
395+ pub ( super ) fn user_args_for_adt ( ty : LoweredTy < ' tcx > ) -> UserArgs < ' tcx > {
400396 match ( ty. raw . kind ( ) , ty. normalized . kind ( ) ) {
401397 ( ty:: Adt ( _, args) , _) => UserArgs { args, user_self_ty : None } ,
402398 ( _, ty:: Adt ( adt, args) ) => UserArgs {
@@ -801,7 +797,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
801797 hir_id : hir:: HirId ,
802798 span : Span ,
803799 args : Option < & ' tcx [ hir:: Expr < ' tcx > ] > ,
804- ) -> ( Res , Option < RawTy < ' tcx > > , & ' tcx [ hir:: PathSegment < ' tcx > ] ) {
800+ ) -> ( Res , Option < LoweredTy < ' tcx > > , & ' tcx [ hir:: PathSegment < ' tcx > ] ) {
805801 debug ! (
806802 "resolve_ty_and_res_fully_qualified_call: qpath={:?} hir_id={:?} span={:?}" ,
807803 qpath, hir_id, span
@@ -825,7 +821,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
825821 // We manually call `register_wf_obligation` in the success path
826822 // below.
827823 let ty = self . astconv ( ) . ast_ty_to_ty_in_path ( qself) ;
828- ( self . handle_raw_ty ( span, ty) , qself, segment)
824+ ( LoweredTy :: from_raw ( self , span, ty) , qself, segment)
829825 }
830826 QPath :: LangItem ( ..) => {
831827 bug ! ( "`resolve_ty_and_res_fully_qualified_call` called on `LangItem`" )
@@ -1074,7 +1070,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10741070 pub fn instantiate_value_path (
10751071 & self ,
10761072 segments : & ' tcx [ hir:: PathSegment < ' tcx > ] ,
1077- self_ty : Option < RawTy < ' tcx > > ,
1073+ self_ty : Option < LoweredTy < ' tcx > > ,
10781074 res : Res ,
10791075 span : Span ,
10801076 hir_id : hir:: HirId ,
@@ -1201,8 +1197,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12011197 path_segs. last ( ) . is_some_and ( |PathSeg ( def_id, _) | tcx. generics_of ( * def_id) . has_self ) ;
12021198
12031199 let ( res, self_ctor_args) = if let Res :: SelfCtor ( impl_def_id) = res {
1204- let ty =
1205- self . handle_raw_ty ( span, tcx. at ( span) . type_of ( impl_def_id) . instantiate_identity ( ) ) ;
1200+ let ty = LoweredTy :: from_raw (
1201+ self ,
1202+ span,
1203+ tcx. at ( span) . type_of ( impl_def_id) . instantiate_identity ( ) ,
1204+ ) ;
12061205 match ty. normalized . ty_adt_def ( ) {
12071206 Some ( adt_def) if adt_def. has_ctor ( ) => {
12081207 let ( ctor_kind, ctor_def_id) = adt_def. non_enum_variant ( ) . ctor . unwrap ( ) ;
0 commit comments