@@ -4,8 +4,8 @@ use rustc_ast::{LitIntType, LitKind, MetaItemLit};
44use rustc_attr_ir:: lang_items:: LangItem ;
55use rustc_attr_ir:: target:: GenericParamKind ;
66use rustc_attr_ir:: {
7- BorrowckGraphvizFormatKind , CguFields , CguKind , DivergingBlockBehavior ,
8- DivergingFallbackBehavior , RustcCleanAttribute , RustcCleanQueries , RustcMirKind ,
7+ BorrowckGraphvizFormatKind , CguFields , CguKind , RustcCleanAttribute , RustcCleanQueries ,
8+ RustcMirKind ,
99} ;
1010use rustc_data_structures:: fx:: FxHashMap ;
1111use rustc_feature:: AttributeStability ;
@@ -397,79 +397,6 @@ impl NoArgsAttributeParser for RustcCaptureAnalysisParser {
397397 const CREATE : fn ( Span ) -> AttributeKind = |_| AttributeKind :: RustcCaptureAnalysis ;
398398}
399399
400- pub ( crate ) struct RustcNeverTypeOptionsParser ;
401-
402- impl SingleAttributeParser for RustcNeverTypeOptionsParser {
403- const PATH : & [ Symbol ] = & [ sym:: rustc_never_type_options] ;
404- const ALLOWED_TARGETS : AllowedTargets < ' _ > = AllowedTargets :: AllowList ( & [ Allow ( Target :: Crate ) ] ) ;
405- const TEMPLATE : AttributeTemplate = template ! ( List : & [
406- r#"fallback = "unit", "never", "no""# ,
407- r#"diverging_block_default = "unit", "never""# ,
408- ] ) ;
409- const STABILITY : AttributeStability = unstable ! (
410- rustc_attrs,
411- "`rustc_never_type_options` is used to experiment with never type fallback and work on never type stabilization"
412- ) ;
413-
414- fn convert ( cx : & mut AcceptContext < ' _ , ' _ > , args : & ArgParser ) -> Option < AttributeKind > {
415- let list = cx. expect_list ( args, cx. attr_span ) ?;
416-
417- let mut fallback = None :: < Ident > ;
418- let mut diverging_block_default = None :: < Ident > ;
419-
420- for arg in list. mixed ( ) {
421- let Some ( ( ident, arg) ) = cx. expect_name_value ( arg, arg. span ( ) , None ) else {
422- continue ;
423- } ;
424-
425- let res = match ident. name {
426- sym:: fallback => & mut fallback,
427- sym:: diverging_block_default => & mut diverging_block_default,
428- _ => {
429- cx. adcx ( ) . expected_specific_argument (
430- ident. span ,
431- & [ sym:: fallback, sym:: diverging_block_default] ,
432- ) ;
433- continue ;
434- }
435- } ;
436-
437- let field = cx. expect_string_literal ( arg) ?;
438-
439- if res. is_some ( ) {
440- cx. adcx ( ) . duplicate_key ( ident. span , ident. name ) ;
441- continue ;
442- }
443-
444- * res = Some ( Ident { name : field, span : arg. value_span } ) ;
445- }
446-
447- let fallback = match fallback {
448- None => None ,
449- Some ( Ident { name : sym:: unit, .. } ) => Some ( DivergingFallbackBehavior :: ToUnit ) ,
450- Some ( Ident { name : sym:: never, .. } ) => Some ( DivergingFallbackBehavior :: ToNever ) ,
451- Some ( Ident { name : sym:: no, .. } ) => Some ( DivergingFallbackBehavior :: NoFallback ) ,
452- Some ( Ident { span, .. } ) => {
453- cx. adcx ( )
454- . expected_specific_argument_strings ( span, & [ sym:: unit, sym:: never, sym:: no] ) ;
455- return None ;
456- }
457- } ;
458-
459- let diverging_block_default = match diverging_block_default {
460- None => None ,
461- Some ( Ident { name : sym:: unit, .. } ) => Some ( DivergingBlockBehavior :: Unit ) ,
462- Some ( Ident { name : sym:: never, .. } ) => Some ( DivergingBlockBehavior :: Never ) ,
463- Some ( Ident { span, .. } ) => {
464- cx. adcx ( ) . expected_specific_argument_strings ( span, & [ sym:: unit, sym:: no] ) ;
465- return None ;
466- }
467- } ;
468-
469- Some ( AttributeKind :: RustcNeverTypeOptions { fallback, diverging_block_default } )
470- }
471- }
472-
473400pub ( crate ) struct RustcTrivialFieldReadsParser ;
474401
475402impl NoArgsAttributeParser for RustcTrivialFieldReadsParser {
0 commit comments