@@ -31,10 +31,6 @@ use syntax::symbol::{Symbol, sym};
31
31
use rustc:: ich:: { ATTR_PARTITION_REUSED , ATTR_PARTITION_CODEGENED ,
32
32
ATTR_EXPECTED_CGU_REUSE } ;
33
33
34
- const MODULE : Symbol = sym:: module;
35
- const CFG : Symbol = sym:: cfg;
36
- const KIND : Symbol = sym:: kind;
37
-
38
34
pub fn assert_module_sources ( tcx : TyCtxt < ' _ > ) {
39
35
tcx. dep_graph . with_ignore ( || {
40
36
if tcx. sess . opts . incremental . is_none ( ) {
@@ -71,7 +67,7 @@ impl AssertModuleSource<'tcx> {
71
67
} else if attr. check_name ( ATTR_PARTITION_CODEGENED ) {
72
68
( CguReuse :: No , ComparisonKind :: Exact )
73
69
} else if attr. check_name ( ATTR_EXPECTED_CGU_REUSE ) {
74
- match & self . field ( attr, KIND ) . as_str ( ) [ .. ] {
70
+ match & * self . field ( attr, sym :: kind ) . as_str ( ) {
75
71
"no" => ( CguReuse :: No , ComparisonKind :: Exact ) ,
76
72
"pre-lto" => ( CguReuse :: PreLto , ComparisonKind :: Exact ) ,
77
73
"post-lto" => ( CguReuse :: PostLto , ComparisonKind :: Exact ) ,
@@ -98,8 +94,8 @@ impl AssertModuleSource<'tcx> {
98
94
return ;
99
95
}
100
96
101
- let user_path = self . field ( attr, MODULE ) . as_str ( ) . to_string ( ) ;
102
- let crate_name = self . tcx . crate_name ( LOCAL_CRATE ) . as_str ( ) . to_string ( ) ;
97
+ let user_path = self . field ( attr, sym :: module ) . to_string ( ) ;
98
+ let crate_name = self . tcx . crate_name ( LOCAL_CRATE ) . to_string ( ) ;
103
99
104
100
if !user_path. starts_with ( & crate_name) {
105
101
let msg = format ! ( "Found malformed codegen unit name `{}`. \
@@ -125,7 +121,7 @@ impl AssertModuleSource<'tcx> {
125
121
cgu_path_components,
126
122
cgu_special_suffix) ;
127
123
128
- debug ! ( "mapping '{}' to cgu name '{}'" , self . field( attr, MODULE ) , cgu_name) ;
124
+ debug ! ( "mapping '{}' to cgu name '{}'" , self . field( attr, sym :: module ) , cgu_name) ;
129
125
130
126
if !self . available_cgus . contains ( & cgu_name) {
131
127
self . tcx . sess . span_err ( attr. span ,
@@ -135,7 +131,7 @@ impl AssertModuleSource<'tcx> {
135
131
cgu_name,
136
132
self . available_cgus
137
133
. iter( )
138
- . map( |cgu| cgu. as_str ( ) . to_string( ) )
134
+ . map( |cgu| cgu. to_string( ) )
139
135
. collect:: <Vec <_>>( )
140
136
. join( ", " ) ) ) ;
141
137
}
@@ -169,7 +165,7 @@ impl AssertModuleSource<'tcx> {
169
165
/// cfg flag called `foo`.
170
166
fn check_config ( & self , attr : & ast:: Attribute ) -> bool {
171
167
let config = & self . tcx . sess . parse_sess . config ;
172
- let value = self . field ( attr, CFG ) ;
168
+ let value = self . field ( attr, sym :: cfg ) ;
173
169
debug ! ( "check_config(config={:?}, value={:?})" , config, value) ;
174
170
if config. iter ( ) . any ( |& ( name, _) | name == value) {
175
171
debug ! ( "check_config: matched" ) ;
0 commit comments