@@ -8,7 +8,7 @@ use rustc_semver::RustcVersion;
8
8
9
9
use super :: CAST_SLICE_DIFFERENT_SIZES ;
10
10
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 > ) {
12
12
// suggestion is invalid if `ptr::slice_from_raw_parts` does not exist
13
13
if !meets_msrv ( msrv. as_ref ( ) , & msrvs:: PTR_SLICE_RAW_PARTS ) {
14
14
return ;
@@ -102,21 +102,20 @@ fn get_raw_slice_ty_mut(ty: Ty<'_>) -> Option<TypeAndMut<'_>> {
102
102
}
103
103
}
104
104
105
- struct CastChainInfo < ' expr , ' tcx > {
105
+ struct CastChainInfo < ' tcx > {
106
106
/// The left most part of the cast chain, or in other words, the first cast in the chain
107
107
/// Used for diagnostics
108
- left_cast : & ' expr Expr < ' expr > ,
108
+ left_cast : & ' tcx Expr < ' tcx > ,
109
109
/// The starting type of the cast chain
110
110
start_ty : TypeAndMut < ' tcx > ,
111
111
/// The final type of the cast chain
112
112
end_ty : TypeAndMut < ' tcx > ,
113
113
}
114
114
115
- // FIXME(asquared31415): unbounded recursion linear with the number of casts in an expression
116
115
/// Returns a `CastChainInfo` with the left-most cast in the chain and the original ptr T and final
117
116
/// ptr U if the expression is composed of casts.
118
117
/// 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 > > {
120
119
if let ExprKind :: Cast ( cast_expr, _cast_to_hir_ty) = expr. peel_blocks ( ) . kind {
121
120
let cast_to = cx. typeck_results ( ) . expr_ty ( expr) ;
122
121
let to_slice_ty = get_raw_slice_ty_mut ( cast_to) ?;
0 commit comments