@@ -17,7 +17,6 @@ use rustc_attr_ir::{
1717 OptimizeAttr , ReprAttr , RustcAssertVarianceKind , find_attr,
1818} ;
1919use rustc_attr_parsing:: AttributeParser ;
20- use rustc_data_structures:: thin_vec:: ThinVec ;
2120use rustc_errors:: { DiagCtxtHandle , IntoDiagArg } ;
2221use rustc_feature:: BUILTIN_ATTRIBUTE_SET ;
2322use rustc_hir:: def:: DefKind ;
@@ -40,7 +39,7 @@ use rustc_middle::ty::error::{ExpectedFound, TypeError};
4039use rustc_middle:: ty:: { self , TyCtxt , TypingMode , Unnormalized , Variance } ;
4140use rustc_session:: diagnostics:: feature_err;
4241use rustc_span:: edition:: Edition ;
43- use rustc_span:: { DUMMY_SP , Ident , Span , Symbol , bug, kw, span_bug, sym} ;
42+ use rustc_span:: { DUMMY_SP , Span , Symbol , bug, kw, span_bug, sym} ;
4443use rustc_structures:: CrateType ;
4544use rustc_trait_selection:: error_reporting:: InferCtxtErrorExt ;
4645use rustc_trait_selection:: infer:: { TyCtxtInferExt , ValuePairs } ;
@@ -205,9 +204,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
205204 AttributeKind :: MayDangle ( attr_span) => self . check_may_dangle ( hir_id, * attr_span) ,
206205 AttributeKind :: Doc ( attr) => self . check_doc_attrs ( attr, hir_id, target) ,
207206 AttributeKind :: EiiImpl ( eii_impl) => self . check_eii_impl ( eii_impl) ,
208- AttributeKind :: RustcMustImplementOneOf { attr_span, fn_names } => {
209- self . check_rustc_must_implement_one_of ( * attr_span, fn_names, hir_id, target)
210- }
211207 AttributeKind :: OnUnimplemented { directive } => {
212208 self . check_diagnostic_on_unimplemented ( hir_id, directive. as_deref ( ) )
213209 }
@@ -363,6 +359,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
363359 AttributeKind :: RustcMacroTransparency ( _) => ( ) ,
364360 AttributeKind :: RustcMain => ( ) ,
365361 AttributeKind :: RustcMir ( _) => ( ) ,
362+ AttributeKind :: RustcMustImplementOneOf { .. } => ( ) ,
366363 AttributeKind :: RustcMustMatchExhaustively ( ..) => ( ) ,
367364 AttributeKind :: RustcNeverReturnsNullPtr => ( ) ,
368365 AttributeKind :: RustcNoImplicitAutorefs => ( ) ,
@@ -460,56 +457,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
460457 } )
461458 }
462459
463- fn check_rustc_must_implement_one_of (
464- & self ,
465- attr_span : Span ,
466- list : & ThinVec < Ident > ,
467- hir_id : HirId ,
468- target : Target ,
469- ) {
470- // Ignoring invalid targets because TyCtxt::associated_items emits bug if the target isn't valid
471- // the parser has already produced an error for the target being invalid
472- if !matches ! ( target, Target :: Trait ) {
473- return ;
474- }
475-
476- let def_id = hir_id. owner . def_id ;
477-
478- let items = self . tcx . associated_items ( def_id) ;
479- // Check that all arguments of `#[rustc_must_implement_one_of]` reference
480- // functions in the trait with default implementations
481- for ident in list {
482- let item = items
483- . filter_by_name_unhygienic ( ident. name )
484- . find ( |item| item. ident ( self . tcx ) == * ident) ;
485-
486- match item {
487- Some ( item) if matches ! ( item. kind, ty:: AssocKind :: Fn { .. } ) => {
488- if !item. defaultness ( self . tcx ) . has_value ( ) {
489- self . tcx . dcx ( ) . emit_err (
490- diagnostics:: FunctionNotHaveDefaultImplementation {
491- span : self . tcx . def_span ( item. def_id ) ,
492- note_span : attr_span,
493- } ,
494- ) ;
495- }
496- }
497- Some ( item) => {
498- self . dcx ( ) . emit_err ( diagnostics:: MustImplementNotFunction {
499- span : self . tcx . def_span ( item. def_id ) ,
500- span_note : diagnostics:: MustImplementNotFunctionSpanNote {
501- span : attr_span,
502- } ,
503- note : diagnostics:: MustImplementNotFunctionNote { } ,
504- } ) ;
505- }
506- None => {
507- self . dcx ( ) . emit_err ( diagnostics:: FunctionNotFoundInTrait { span : ident. span } ) ;
508- }
509- }
510- }
511- }
512-
513460 /// Checks that each externally implementable item (EII) implementation uses `unsafe`
514461 /// exactly when its declaration requires it.
515462 fn check_eii_impl ( & self , eii_impl : & EiiImpl ) {
0 commit comments