@@ -27,7 +27,7 @@ use rustc::mir::mono::CodegenUnitNameBuilder;
2727use rustc:: ty:: TyCtxt ;
2828use std:: collections:: BTreeSet ;
2929use syntax:: ast;
30- use syntax:: symbol:: { Symbol , sym} ;
30+ use syntax:: symbol:: { InternedString , Symbol , sym} ;
3131use rustc:: ich:: { ATTR_PARTITION_REUSED , ATTR_PARTITION_CODEGENED ,
3232 ATTR_EXPECTED_CGU_REUSE } ;
3333
@@ -45,8 +45,8 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) {
4545 . collect_and_partition_mono_items ( LOCAL_CRATE )
4646 . 1
4747 . iter ( )
48- . map ( |cgu| format ! ( "{}" , cgu. name( ) ) )
49- . collect :: < BTreeSet < String > > ( ) ;
48+ . map ( |cgu| * cgu. name ( ) )
49+ . collect :: < BTreeSet < InternedString > > ( ) ;
5050
5151 let ams = AssertModuleSource {
5252 tcx,
@@ -61,7 +61,7 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) {
6161
6262struct AssertModuleSource < ' tcx > {
6363 tcx : TyCtxt < ' tcx > ,
64- available_cgus : BTreeSet < String > ,
64+ available_cgus : BTreeSet < InternedString > ,
6565}
6666
6767impl AssertModuleSource < ' tcx > {
@@ -127,15 +127,15 @@ impl AssertModuleSource<'tcx> {
127127
128128 debug ! ( "mapping '{}' to cgu name '{}'" , self . field( attr, MODULE ) , cgu_name) ;
129129
130- if !self . available_cgus . contains ( & cgu_name. as_str ( ) [ .. ] ) {
130+ if !self . available_cgus . contains ( & cgu_name) {
131131 self . tcx . sess . span_err ( attr. span ,
132132 & format ! ( "no module named `{}` (mangled: {}). \
133133 Available modules: {}",
134134 user_path,
135135 cgu_name,
136136 self . available_cgus
137137 . iter( )
138- . cloned ( )
138+ . map ( |cgu| cgu . as_str ( ) . to_string ( ) )
139139 . collect:: <Vec <_>>( )
140140 . join( ", " ) ) ) ;
141141 }
0 commit comments