@@ -2,7 +2,7 @@ use crate::callee::{self, DeferredCallResolution};
2
2
use crate :: errors:: CtorIsPrivate ;
3
3
use crate :: method:: { self , MethodCallee , SelfSource } ;
4
4
use crate :: rvalue_scopes;
5
- use crate :: { BreakableCtxt , Diverges , Expectation , FnCtxt , RawTy } ;
5
+ use crate :: { BreakableCtxt , Diverges , Expectation , FnCtxt , LoweredTy } ;
6
6
use rustc_data_structures:: captures:: Captures ;
7
7
use rustc_data_structures:: fx:: FxHashSet ;
8
8
use rustc_errors:: { Applicability , Diagnostic , ErrorGuaranteed , MultiSpan , StashKey } ;
@@ -373,14 +373,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
373
373
}
374
374
}
375
375
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 > {
381
377
let t = self . astconv ( ) . ast_ty_to_ty ( ast_t) ;
382
378
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)
384
380
}
385
381
386
382
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> {
396
392
ty. normalized
397
393
}
398
394
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 > {
400
396
match ( ty. raw . kind ( ) , ty. normalized . kind ( ) ) {
401
397
( ty:: Adt ( _, args) , _) => UserArgs { args, user_self_ty : None } ,
402
398
( _, ty:: Adt ( adt, args) ) => UserArgs {
@@ -801,7 +797,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
801
797
hir_id : hir:: HirId ,
802
798
span : Span ,
803
799
args : Option < & ' tcx [ hir:: Expr < ' tcx > ] > ,
804
- ) -> ( Res , Option < RawTy < ' tcx > > , & ' tcx [ hir:: PathSegment < ' tcx > ] ) {
800
+ ) -> ( Res , Option < LoweredTy < ' tcx > > , & ' tcx [ hir:: PathSegment < ' tcx > ] ) {
805
801
debug ! (
806
802
"resolve_ty_and_res_fully_qualified_call: qpath={:?} hir_id={:?} span={:?}" ,
807
803
qpath, hir_id, span
@@ -825,7 +821,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
825
821
// We manually call `register_wf_obligation` in the success path
826
822
// below.
827
823
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)
829
825
}
830
826
QPath :: LangItem ( ..) => {
831
827
bug ! ( "`resolve_ty_and_res_fully_qualified_call` called on `LangItem`" )
@@ -1074,7 +1070,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1074
1070
pub fn instantiate_value_path (
1075
1071
& self ,
1076
1072
segments : & ' tcx [ hir:: PathSegment < ' tcx > ] ,
1077
- self_ty : Option < RawTy < ' tcx > > ,
1073
+ self_ty : Option < LoweredTy < ' tcx > > ,
1078
1074
res : Res ,
1079
1075
span : Span ,
1080
1076
hir_id : hir:: HirId ,
@@ -1201,8 +1197,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1201
1197
path_segs. last ( ) . is_some_and ( |PathSeg ( def_id, _) | tcx. generics_of ( * def_id) . has_self ) ;
1202
1198
1203
1199
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
+ ) ;
1206
1205
match ty. normalized . ty_adt_def ( ) {
1207
1206
Some ( adt_def) if adt_def. has_ctor ( ) => {
1208
1207
let ( ctor_kind, ctor_def_id) = adt_def. non_enum_variant ( ) . ctor . unwrap ( ) ;
0 commit comments