@@ -16,7 +16,7 @@ use rustc_middle::mir::ConstraintCategory;
16
16
use rustc_middle:: ty:: query:: Providers ;
17
17
use rustc_middle:: ty:: trait_def:: TraitSpecializationKind ;
18
18
use rustc_middle:: ty:: {
19
- self , ir:: TypeVisitor , AdtKind , DefIdTree , GenericParamDefKind , Ty , TyCtxt , TypeFoldable ,
19
+ self , ir:: TypeVisitor , AdtKind , GenericParamDefKind , Ty , TyCtxt , TypeFoldable ,
20
20
TypeSuperVisitable ,
21
21
} ;
22
22
use rustc_middle:: ty:: { GenericArgKind , InternalSubsts } ;
@@ -277,56 +277,6 @@ fn check_trait_item(tcx: TyCtxt<'_>, trait_item: &hir::TraitItem<'_>) {
277
277
} ;
278
278
check_object_unsafe_self_trait_by_name ( tcx, trait_item) ;
279
279
check_associated_item ( tcx, def_id, span, method_sig) ;
280
-
281
- let encl_trait_def_id = tcx. local_parent ( def_id) ;
282
- let encl_trait = tcx. hir ( ) . expect_item ( encl_trait_def_id) ;
283
- let encl_trait_def_id = encl_trait. owner_id . to_def_id ( ) ;
284
- let fn_lang_item_name = if Some ( encl_trait_def_id) == tcx. lang_items ( ) . fn_trait ( ) {
285
- Some ( "fn" )
286
- } else if Some ( encl_trait_def_id) == tcx. lang_items ( ) . fn_mut_trait ( ) {
287
- Some ( "fn_mut" )
288
- } else {
289
- None
290
- } ;
291
-
292
- if let ( Some ( fn_lang_item_name) , "call" ) =
293
- ( fn_lang_item_name, trait_item. ident . name . to_ident_string ( ) . as_str ( ) )
294
- {
295
- // We are looking at the `call` function of the `fn` or `fn_mut` lang item.
296
- // Do some rudimentary sanity checking to avoid an ICE later (issue #83471).
297
- if let Some ( hir:: FnSig { decl, span, .. } ) = method_sig {
298
- if let [ self_ty, _] = decl. inputs {
299
- if !matches ! ( self_ty. kind, hir:: TyKind :: Ref ( _, _) ) {
300
- tcx. sess
301
- . struct_span_err (
302
- self_ty. span ,
303
- & format ! (
304
- "first argument of `call` in `{fn_lang_item_name}` lang item must be a reference" ,
305
- ) ,
306
- )
307
- . emit ( ) ;
308
- }
309
- } else {
310
- tcx. sess
311
- . struct_span_err (
312
- * span,
313
- & format ! (
314
- "`call` function in `{fn_lang_item_name}` lang item takes exactly two arguments" ,
315
- ) ,
316
- )
317
- . emit ( ) ;
318
- }
319
- } else {
320
- tcx. sess
321
- . struct_span_err (
322
- trait_item. span ,
323
- & format ! (
324
- "`call` trait item in `{fn_lang_item_name}` lang item must be a function" ,
325
- ) ,
326
- )
327
- . emit ( ) ;
328
- }
329
- }
330
280
}
331
281
332
282
/// Require that the user writes where clauses on GATs for the implicit
0 commit comments