@@ -719,7 +719,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<ExprFnSig<'t
719
719
let output = bounds
720
720
. projection_bounds ( )
721
721
. find ( |p| lang_items. fn_once_output ( ) . is_some_and ( |id| id == p. item_def_id ( ) ) )
722
- . map ( |p| p. map_bound ( |p| p. term . as_type ( ) . unwrap ( ) ) ) ;
722
+ . map ( |p| p. map_bound ( |p| p. term . expect_type ( ) ) ) ;
723
723
Some ( ExprFnSig :: Trait ( bound. map_bound ( |b| b. args . type_at ( 0 ) ) , output, None ) )
724
724
} ,
725
725
_ => None ,
@@ -1236,48 +1236,6 @@ impl<'tcx> InteriorMut<'tcx> {
1236
1236
}
1237
1237
}
1238
1238
1239
- /// Check if given type has inner mutability such as [`std::cell::Cell`] or [`std::cell::RefCell`]
1240
- /// etc.
1241
- pub fn is_interior_mut_ty < ' tcx > ( cx : & LateContext < ' tcx > , ty : Ty < ' tcx > ) -> bool {
1242
- match * ty. kind ( ) {
1243
- ty:: Ref ( _, inner_ty, mutbl) => mutbl == Mutability :: Mut || is_interior_mut_ty ( cx, inner_ty) ,
1244
- ty:: Slice ( inner_ty) => is_interior_mut_ty ( cx, inner_ty) ,
1245
- ty:: Array ( inner_ty, size) => {
1246
- size. try_eval_target_usize ( cx. tcx , cx. param_env ) != Some ( 0 ) && is_interior_mut_ty ( cx, inner_ty)
1247
- } ,
1248
- ty:: Tuple ( fields) => fields. iter ( ) . any ( |ty| is_interior_mut_ty ( cx, ty) ) ,
1249
- ty:: Adt ( def, args) => {
1250
- // Special case for collections in `std` who's impl of `Hash` or `Ord` delegates to
1251
- // that of their type parameters. Note: we don't include `HashSet` and `HashMap`
1252
- // because they have no impl for `Hash` or `Ord`.
1253
- let def_id = def. did ( ) ;
1254
- let is_std_collection = [
1255
- sym:: Option ,
1256
- sym:: Result ,
1257
- sym:: LinkedList ,
1258
- sym:: Vec ,
1259
- sym:: VecDeque ,
1260
- sym:: BTreeMap ,
1261
- sym:: BTreeSet ,
1262
- sym:: Rc ,
1263
- sym:: Arc ,
1264
- ]
1265
- . iter ( )
1266
- . any ( |diag_item| cx. tcx . is_diagnostic_item ( * diag_item, def_id) ) ;
1267
- let is_box = Some ( def_id) == cx. tcx . lang_items ( ) . owned_box ( ) ;
1268
- if is_std_collection || is_box {
1269
- // The type is mutable if any of its type parameters are
1270
- args. types ( ) . any ( |ty| is_interior_mut_ty ( cx, ty) )
1271
- } else {
1272
- !ty. has_escaping_bound_vars ( )
1273
- && cx. tcx . layout_of ( cx. param_env . and ( ty) ) . is_ok ( )
1274
- && !ty. is_freeze ( cx. tcx , cx. param_env )
1275
- }
1276
- } ,
1277
- _ => false ,
1278
- }
1279
- }
1280
-
1281
1239
pub fn make_normalized_projection_with_regions < ' tcx > (
1282
1240
tcx : TyCtxt < ' tcx > ,
1283
1241
param_env : ParamEnv < ' tcx > ,
0 commit comments