@@ -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 ) ;
@@ -1667,33 +1667,33 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
16671667 // check for gated attributes
16681668 self . context . check_attribute ( attr, false ) ;
16691669
1670- if attr. check_name ( " doc" ) {
1670+ if attr. check_name_symbol ( symbols :: doc) {
16711671 if let Some ( content) = attr. meta_item_list ( ) {
1672- if content. len ( ) == 1 && content[ 0 ] . check_name ( " cfg" ) {
1672+ if content. len ( ) == 1 && content[ 0 ] . check_name_symbol ( symbols :: cfg) {
16731673 gate_feature_post ! ( & self , doc_cfg, attr. span,
16741674 "#[doc(cfg(...))] is experimental"
16751675 ) ;
1676- } else if content. iter ( ) . any ( |c| c. check_name ( " masked" ) ) {
1676+ } else if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: masked) ) {
16771677 gate_feature_post ! ( & self , doc_masked, attr. span,
16781678 "#[doc(masked)] is experimental"
16791679 ) ;
1680- } else if content. iter ( ) . any ( |c| c. check_name ( " spotlight" ) ) {
1680+ } else if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: spotlight) ) {
16811681 gate_feature_post ! ( & self , doc_spotlight, attr. span,
16821682 "#[doc(spotlight)] is experimental"
16831683 ) ;
1684- } else if content. iter ( ) . any ( |c| c. check_name ( " alias" ) ) {
1684+ } else if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: alias) ) {
16851685 gate_feature_post ! ( & self , doc_alias, attr. span,
16861686 "#[doc(alias = \" ...\" )] is experimental"
16871687 ) ;
1688- } else if content. iter ( ) . any ( |c| c. check_name ( " keyword" ) ) {
1688+ } else if content. iter ( ) . any ( |c| c. check_name_symbol ( symbols :: keyword) ) {
16891689 gate_feature_post ! ( & self , doc_keyword, attr. span,
16901690 "#[doc(keyword = \" ...\" )] is experimental"
16911691 ) ;
16921692 }
16931693 }
16941694 }
16951695
1696- match BUILTIN_ATTRIBUTES . iter ( ) . find ( |( name, ..) | attr. path == name) {
1696+ match BUILTIN_ATTRIBUTES . iter ( ) . find ( |( name, ..) | attr. path == * name) {
16971697 Some ( & ( name, _, template, _) ) => self . check_builtin_attribute ( attr, name, template) ,
16981698 None => if let Some ( TokenTree :: Token ( _, token:: Eq ) ) = attr. tokens . trees ( ) . next ( ) {
16991699 // All key-value attributes are restricted to meta-item syntax.
@@ -1748,7 +1748,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
17481748 ast:: ItemKind :: Struct ( ..) => {
17491749 for attr in attr:: filter_by_name ( & i. attrs [ ..] , "repr" ) {
17501750 for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
1751- if item. check_name ( " simd" ) {
1751+ if item. check_name_symbol ( symbols :: simd) {
17521752 gate_feature_post ! ( & self , repr_simd, attr. span,
17531753 "SIMD types are experimental and possibly buggy" ) ;
17541754 }
@@ -1759,7 +1759,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
17591759 ast:: ItemKind :: Enum ( ..) => {
17601760 for attr in attr:: filter_by_name ( & i. attrs [ ..] , "repr" ) {
17611761 for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
1762- if item. check_name ( " align" ) {
1762+ if item. check_name_symbol ( symbols :: align) {
17631763 gate_feature_post ! ( & self , repr_align_enum, attr. span,
17641764 "`#[repr(align(x))]` on enums is experimental" ) ;
17651765 }
@@ -2083,7 +2083,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
20832083 // Process the edition umbrella feature-gates first, to ensure
20842084 // `edition_enabled_features` is completed before it's queried.
20852085 for attr in krate_attrs {
2086- if !attr. check_name ( " feature" ) {
2086+ if !attr. check_name_symbol ( symbols :: feature) {
20872087 continue
20882088 }
20892089
@@ -2128,7 +2128,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
21282128 }
21292129
21302130 for attr in krate_attrs {
2131- if !attr. check_name ( " feature" ) {
2131+ if !attr. check_name_symbol ( symbols :: feature) {
21322132 continue
21332133 }
21342134
@@ -2258,7 +2258,7 @@ fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate,
22582258 } ;
22592259 if !allow_features {
22602260 for attr in & krate. attrs {
2261- if attr. check_name ( " feature" ) {
2261+ if attr. check_name_symbol ( symbols :: feature) {
22622262 let release_channel = option_env ! ( "CFG_RELEASE_CHANNEL" ) . unwrap_or ( "(unknown)" ) ;
22632263 span_err ! ( span_handler, attr. span, E0554 ,
22642264 "#![feature] may not be used on the {} release channel" ,
0 commit comments