@@ -28,7 +28,7 @@ use crate::tokenstream::TokenTree;
2828use errors:: { DiagnosticBuilder , Handler } ;
2929use rustc_data_structures:: fx:: FxHashMap ;
3030use rustc_target:: spec:: abi:: Abi ;
31- use syntax_pos:: { Span , DUMMY_SP } ;
31+ use syntax_pos:: { Span , DUMMY_SP , symbols } ;
3232use log:: debug;
3333
3434use std:: env;
@@ -1366,7 +1366,7 @@ impl<'a> Context<'a> {
13661366 }
13671367 } else if n == "doc" {
13681368 if let Some ( content) = attr. meta_item_list ( ) {
1369- if content. iter ( ) . any ( |c| c. check_name ( " include" ) ) {
1369+ if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: include) ) {
13701370 gate_feature ! ( self , external_doc, attr. span,
13711371 "#[doc(include = \" ...\" )] is experimental"
13721372 ) ;
@@ -1648,33 +1648,33 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
16481648 // check for gated attributes
16491649 self . context . check_attribute ( attr, false ) ;
16501650
1651- if attr. check_name ( " doc" ) {
1651+ if attr. check_name_symbol ( symbols :: doc) {
16521652 if let Some ( content) = attr. meta_item_list ( ) {
1653- if content. len ( ) == 1 && content[ 0 ] . check_name ( " cfg" ) {
1653+ if content. len ( ) == 1 && content[ 0 ] . check_name_symbol ( symbols :: cfg) {
16541654 gate_feature_post ! ( & self , doc_cfg, attr. span,
16551655 "#[doc(cfg(...))] is experimental"
16561656 ) ;
1657- } else if content. iter ( ) . any ( |c| c. check_name ( " masked" ) ) {
1657+ } else if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: masked) ) {
16581658 gate_feature_post ! ( & self , doc_masked, attr. span,
16591659 "#[doc(masked)] is experimental"
16601660 ) ;
1661- } else if content. iter ( ) . any ( |c| c. check_name ( " spotlight" ) ) {
1661+ } else if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: spotlight) ) {
16621662 gate_feature_post ! ( & self , doc_spotlight, attr. span,
16631663 "#[doc(spotlight)] is experimental"
16641664 ) ;
1665- } else if content. iter ( ) . any ( |c| c. check_name ( " alias" ) ) {
1665+ } else if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: alias) ) {
16661666 gate_feature_post ! ( & self , doc_alias, attr. span,
16671667 "#[doc(alias = \" ...\" )] is experimental"
16681668 ) ;
1669- } else if content. iter ( ) . any ( |c| c. check_name ( " keyword" ) ) {
1669+ } else if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: keyword) ) {
16701670 gate_feature_post ! ( & self , doc_keyword, attr. span,
16711671 "#[doc(keyword = \" ...\" )] is experimental"
16721672 ) ;
16731673 }
16741674 }
16751675 }
16761676
1677- match BUILTIN_ATTRIBUTES . iter ( ) . find ( |( name, ..) | attr. path == name) {
1677+ match BUILTIN_ATTRIBUTES . iter ( ) . find ( |( name, ..) | attr. path == * name) {
16781678 Some ( & ( name, _, template, _) ) => self . check_builtin_attribute ( attr, name, template) ,
16791679 None => if let Some ( TokenTree :: Token ( _, token:: Eq ) ) = attr. tokens . trees ( ) . next ( ) {
16801680 // All key-value attributes are restricted to meta-item syntax.
@@ -1727,7 +1727,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
17271727 ast:: ItemKind :: Struct ( ..) => {
17281728 for attr in attr:: filter_by_name ( & i. attrs [ ..] , "repr" ) {
17291729 for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
1730- if item. check_name ( " simd" ) {
1730+ if item. check_name_symbol ( symbols :: simd) {
17311731 gate_feature_post ! ( & self , repr_simd, attr. span,
17321732 "SIMD types are experimental and possibly buggy" ) ;
17331733 }
@@ -1738,7 +1738,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
17381738 ast:: ItemKind :: Enum ( ..) => {
17391739 for attr in attr:: filter_by_name ( & i. attrs [ ..] , "repr" ) {
17401740 for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
1741- if item. check_name ( " align" ) {
1741+ if item. check_name_symbol ( symbols :: align) {
17421742 gate_feature_post ! ( & self , repr_align_enum, attr. span,
17431743 "`#[repr(align(x))]` on enums is experimental" ) ;
17441744 }
@@ -2062,7 +2062,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
20622062 // Process the edition umbrella feature-gates first, to ensure
20632063 // `edition_enabled_features` is completed before it's queried.
20642064 for attr in krate_attrs {
2065- if !attr. check_name ( " feature" ) {
2065+ if !attr. check_name_symbol ( symbols :: feature) {
20662066 continue
20672067 }
20682068
@@ -2107,7 +2107,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
21072107 }
21082108
21092109 for attr in krate_attrs {
2110- if !attr. check_name ( " feature" ) {
2110+ if !attr. check_name_symbol ( symbols :: feature) {
21112111 continue
21122112 }
21132113
@@ -2237,7 +2237,7 @@ fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate,
22372237 } ;
22382238 if !allow_features {
22392239 for attr in & krate. attrs {
2240- if attr. check_name ( " feature" ) {
2240+ if attr. check_name_symbol ( symbols :: feature) {
22412241 let release_channel = option_env ! ( "CFG_RELEASE_CHANNEL" ) . unwrap_or ( "(unknown)" ) ;
22422242 span_err ! ( span_handler, attr. span, E0554 ,
22432243 "#![feature] may not be used on the {} release channel" ,
0 commit comments