@@ -1998,16 +1998,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
1998
1998
}
1999
1999
}
2000
2000
2001
- /// Lower a type from the HIR to our internal notion of a type.
2002
- pub fn lower_ty ( & self , hir_ty : & hir:: Ty < ' tcx > ) -> Ty < ' tcx > {
2003
- self . lower_ty_common ( hir_ty, false , false )
2004
- }
2005
-
2006
- /// Lower a type inside of a path from the HIR to our internal notion of a type.
2007
- pub fn lower_ty_in_path ( & self , hir_ty : & hir:: Ty < ' tcx > ) -> Ty < ' tcx > {
2008
- self . lower_ty_common ( hir_ty, false , true )
2009
- }
2010
-
2011
2001
fn lower_delegation_ty ( & self , idx : hir:: InferDelegationKind ) -> Ty < ' tcx > {
2012
2002
let delegation_sig = self . tcx ( ) . inherit_sig_for_delegation_item ( self . item_def_id ( ) ) ;
2013
2003
match idx {
@@ -2025,7 +2015,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2025
2015
/// 2. `in_path`: Whether the type appears inside of a path.
2026
2016
/// Used to provide correct diagnostics for bare trait object types.
2027
2017
#[ instrument( level = "debug" , skip( self ) , ret) ]
2028
- fn lower_ty_common ( & self , hir_ty : & hir:: Ty < ' tcx > , borrowed : bool , in_path : bool ) -> Ty < ' tcx > {
2018
+ pub fn lower_ty ( & self , hir_ty : & hir:: Ty < ' tcx > ) -> Ty < ' tcx > {
2029
2019
let tcx = self . tcx ( ) ;
2030
2020
2031
2021
let result_ty = match & hir_ty. kind {
@@ -2035,7 +2025,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2035
2025
hir:: TyKind :: Ref ( region, mt) => {
2036
2026
let r = self . lower_lifetime ( region, RegionInferReason :: Reference ) ;
2037
2027
debug ! ( ?r) ;
2038
- let t = self . lower_ty_common ( mt. ty , true , false ) ;
2028
+ let t = self . lower_ty ( mt. ty ) ;
2039
2029
Ty :: new_ref ( tcx, r, t, mt. mutbl )
2040
2030
}
2041
2031
hir:: TyKind :: Never => tcx. types . never ,
@@ -2064,20 +2054,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2064
2054
)
2065
2055
}
2066
2056
hir:: TyKind :: TraitObject ( bounds, lifetime, repr) => {
2067
- self . prohibit_or_lint_bare_trait_object_ty ( hir_ty, in_path ) ;
2057
+ self . prohibit_or_lint_bare_trait_object_ty ( hir_ty) ;
2068
2058
2069
2059
let repr = match repr {
2070
2060
TraitObjectSyntax :: Dyn | TraitObjectSyntax :: None => ty:: Dyn ,
2071
2061
TraitObjectSyntax :: DynStar => ty:: DynStar ,
2072
2062
} ;
2073
- self . lower_trait_object_ty (
2074
- hir_ty. span ,
2075
- hir_ty. hir_id ,
2076
- bounds,
2077
- lifetime,
2078
- borrowed,
2079
- repr,
2080
- )
2063
+ self . lower_trait_object_ty ( hir_ty. span , hir_ty. hir_id , bounds, lifetime, repr)
2081
2064
}
2082
2065
hir:: TyKind :: Path ( hir:: QPath :: Resolved ( maybe_qself, path) ) => {
2083
2066
debug ! ( ?maybe_qself, ?path) ;
@@ -2105,7 +2088,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2105
2088
}
2106
2089
hir:: TyKind :: Path ( hir:: QPath :: TypeRelative ( qself, segment) ) => {
2107
2090
debug ! ( ?qself, ?segment) ;
2108
- let ty = self . lower_ty_common ( qself, false , true ) ;
2091
+ let ty = self . lower_ty ( qself) ;
2109
2092
self . lower_assoc_path ( hir_ty. hir_id , hir_ty. span , ty, qself, segment, false )
2110
2093
. map ( |( ty, _, _) | ty)
2111
2094
. unwrap_or_else ( |guar| Ty :: new_error ( tcx, guar) )
0 commit comments