@@ -28,7 +28,7 @@ use crate::tokenstream::TokenTree;
28
28
use errors:: { DiagnosticBuilder , Handler } ;
29
29
use rustc_data_structures:: fx:: FxHashMap ;
30
30
use rustc_target:: spec:: abi:: Abi ;
31
- use syntax_pos:: { Span , DUMMY_SP } ;
31
+ use syntax_pos:: { Span , DUMMY_SP , symbols } ;
32
32
use log:: debug;
33
33
34
34
use std:: env;
@@ -1366,7 +1366,7 @@ impl<'a> Context<'a> {
1366
1366
}
1367
1367
} else if n == "doc" {
1368
1368
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 ( symbols :: include) ) {
1370
1370
gate_feature ! ( self , external_doc, attr. span,
1371
1371
"#[doc(include = \" ...\" )] is experimental"
1372
1372
) ;
@@ -1667,33 +1667,33 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
1667
1667
// check for gated attributes
1668
1668
self . context . check_attribute ( attr, false ) ;
1669
1669
1670
- if attr. check_name ( " doc" ) {
1670
+ if attr. check_name ( symbols :: doc) {
1671
1671
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 ( symbols :: cfg) {
1673
1673
gate_feature_post ! ( & self , doc_cfg, attr. span,
1674
1674
"#[doc(cfg(...))] is experimental"
1675
1675
) ;
1676
- } else if content. iter ( ) . any ( |c| c. check_name ( " masked" ) ) {
1676
+ } else if content. iter ( ) . any ( |c| c. check_name ( symbols :: masked) ) {
1677
1677
gate_feature_post ! ( & self , doc_masked, attr. span,
1678
1678
"#[doc(masked)] is experimental"
1679
1679
) ;
1680
- } else if content. iter ( ) . any ( |c| c. check_name ( " spotlight" ) ) {
1680
+ } else if content. iter ( ) . any ( |c| c. check_name ( symbols :: spotlight) ) {
1681
1681
gate_feature_post ! ( & self , doc_spotlight, attr. span,
1682
1682
"#[doc(spotlight)] is experimental"
1683
1683
) ;
1684
- } else if content. iter ( ) . any ( |c| c. check_name ( " alias" ) ) {
1684
+ } else if content. iter ( ) . any ( |c| c. check_name ( symbols :: alias) ) {
1685
1685
gate_feature_post ! ( & self , doc_alias, attr. span,
1686
1686
"#[doc(alias = \" ...\" )] is experimental"
1687
1687
) ;
1688
- } else if content. iter ( ) . any ( |c| c. check_name ( " keyword" ) ) {
1688
+ } else if content. iter ( ) . any ( |c| c. check_name ( symbols :: keyword) ) {
1689
1689
gate_feature_post ! ( & self , doc_keyword, attr. span,
1690
1690
"#[doc(keyword = \" ...\" )] is experimental"
1691
1691
) ;
1692
1692
}
1693
1693
}
1694
1694
}
1695
1695
1696
- match BUILTIN_ATTRIBUTES . iter ( ) . find ( |( name, ..) | attr. path == name) {
1696
+ match BUILTIN_ATTRIBUTES . iter ( ) . find ( |( name, ..) | attr. path == * name) {
1697
1697
Some ( & ( name, _, template, _) ) => self . check_builtin_attribute ( attr, name, template) ,
1698
1698
None => if let Some ( TokenTree :: Token ( _, token:: Eq ) ) = attr. tokens . trees ( ) . next ( ) {
1699
1699
// All key-value attributes are restricted to meta-item syntax.
@@ -1748,7 +1748,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
1748
1748
ast:: ItemKind :: Struct ( ..) => {
1749
1749
for attr in attr:: filter_by_name ( & i. attrs [ ..] , "repr" ) {
1750
1750
for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
1751
- if item. check_name ( " simd" ) {
1751
+ if item. check_name ( symbols :: simd) {
1752
1752
gate_feature_post ! ( & self , repr_simd, attr. span,
1753
1753
"SIMD types are experimental and possibly buggy" ) ;
1754
1754
}
@@ -1759,7 +1759,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
1759
1759
ast:: ItemKind :: Enum ( ..) => {
1760
1760
for attr in attr:: filter_by_name ( & i. attrs [ ..] , "repr" ) {
1761
1761
for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
1762
- if item. check_name ( " align" ) {
1762
+ if item. check_name ( symbols :: align) {
1763
1763
gate_feature_post ! ( & self , repr_align_enum, attr. span,
1764
1764
"`#[repr(align(x))]` on enums is experimental" ) ;
1765
1765
}
@@ -2083,7 +2083,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
2083
2083
// Process the edition umbrella feature-gates first, to ensure
2084
2084
// `edition_enabled_features` is completed before it's queried.
2085
2085
for attr in krate_attrs {
2086
- if !attr. check_name ( " feature" ) {
2086
+ if !attr. check_name ( symbols :: feature) {
2087
2087
continue
2088
2088
}
2089
2089
@@ -2128,7 +2128,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
2128
2128
}
2129
2129
2130
2130
for attr in krate_attrs {
2131
- if !attr. check_name ( " feature" ) {
2131
+ if !attr. check_name ( symbols :: feature) {
2132
2132
continue
2133
2133
}
2134
2134
@@ -2258,7 +2258,7 @@ fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate,
2258
2258
} ;
2259
2259
if !allow_features {
2260
2260
for attr in & krate. attrs {
2261
- if attr. check_name ( " feature" ) {
2261
+ if attr. check_name ( symbols :: feature) {
2262
2262
let release_channel = option_env ! ( "CFG_RELEASE_CHANNEL" ) . unwrap_or ( "(unknown)" ) ;
2263
2263
span_err ! ( span_handler, attr. span, E0554 ,
2264
2264
"#![feature] may not be used on the {} release channel" ,
0 commit comments