@@ -8,7 +8,7 @@ use rustc_semver::RustcVersion;
88
99use super :: CAST_SLICE_DIFFERENT_SIZES ;
1010
11- pub ( super ) fn check ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > , msrv : & Option < RustcVersion > ) {
11+ pub ( super ) fn check < ' tcx > ( cx : & LateContext < ' tcx > , expr : & Expr < ' tcx > , msrv : & Option < RustcVersion > ) {
1212 // suggestion is invalid if `ptr::slice_from_raw_parts` does not exist
1313 if !meets_msrv ( msrv. as_ref ( ) , & msrvs:: PTR_SLICE_RAW_PARTS ) {
1414 return ;
@@ -102,21 +102,20 @@ fn get_raw_slice_ty_mut(ty: Ty<'_>) -> Option<TypeAndMut<'_>> {
102102 }
103103}
104104
105- struct CastChainInfo < ' expr , ' tcx > {
105+ struct CastChainInfo < ' tcx > {
106106 /// The left most part of the cast chain, or in other words, the first cast in the chain
107107 /// Used for diagnostics
108- left_cast : & ' expr Expr < ' expr > ,
108+ left_cast : & ' tcx Expr < ' tcx > ,
109109 /// The starting type of the cast chain
110110 start_ty : TypeAndMut < ' tcx > ,
111111 /// The final type of the cast chain
112112 end_ty : TypeAndMut < ' tcx > ,
113113}
114114
115- // FIXME(asquared31415): unbounded recursion linear with the number of casts in an expression
116115/// Returns a `CastChainInfo` with the left-most cast in the chain and the original ptr T and final
117116/// ptr U if the expression is composed of casts.
118117/// Returns None if the expr is not a Cast
119- fn expr_cast_chain_tys < ' tcx , ' expr > ( cx : & LateContext < ' tcx > , expr : & Expr < ' expr > ) -> Option < CastChainInfo < ' expr , ' tcx > > {
118+ fn expr_cast_chain_tys < ' tcx > ( cx : & LateContext < ' tcx > , expr : & Expr < ' tcx > ) -> Option < CastChainInfo < ' tcx > > {
120119 if let ExprKind :: Cast ( cast_expr, _cast_to_hir_ty) = expr. peel_blocks ( ) . kind {
121120 let cast_to = cx. typeck_results ( ) . expr_ty ( expr) ;
122121 let to_slice_ty = get_raw_slice_ty_mut ( cast_to) ?;
0 commit comments