@@ -27,7 +27,7 @@ use rustc::mir::mono::CodegenUnitNameBuilder;
27
27
use rustc:: ty:: TyCtxt ;
28
28
use std:: collections:: BTreeSet ;
29
29
use syntax:: ast;
30
- use syntax:: symbol:: { Symbol , sym} ;
30
+ use syntax:: symbol:: { InternedString , Symbol , sym} ;
31
31
use rustc:: ich:: { ATTR_PARTITION_REUSED , ATTR_PARTITION_CODEGENED ,
32
32
ATTR_EXPECTED_CGU_REUSE } ;
33
33
@@ -45,8 +45,8 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) {
45
45
. collect_and_partition_mono_items ( LOCAL_CRATE )
46
46
. 1
47
47
. iter ( )
48
- . map ( |cgu| format ! ( "{}" , cgu. name( ) ) )
49
- . collect :: < BTreeSet < String > > ( ) ;
48
+ . map ( |cgu| * cgu. name ( ) )
49
+ . collect :: < BTreeSet < InternedString > > ( ) ;
50
50
51
51
let ams = AssertModuleSource {
52
52
tcx,
@@ -61,7 +61,7 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) {
61
61
62
62
struct AssertModuleSource < ' tcx > {
63
63
tcx : TyCtxt < ' tcx > ,
64
- available_cgus : BTreeSet < String > ,
64
+ available_cgus : BTreeSet < InternedString > ,
65
65
}
66
66
67
67
impl AssertModuleSource < ' tcx > {
@@ -127,15 +127,15 @@ impl AssertModuleSource<'tcx> {
127
127
128
128
debug ! ( "mapping '{}' to cgu name '{}'" , self . field( attr, MODULE ) , cgu_name) ;
129
129
130
- if !self . available_cgus . contains ( & cgu_name. as_str ( ) [ .. ] ) {
130
+ if !self . available_cgus . contains ( & cgu_name) {
131
131
self . tcx . sess . span_err ( attr. span ,
132
132
& format ! ( "no module named `{}` (mangled: {}). \
133
133
Available modules: {}",
134
134
user_path,
135
135
cgu_name,
136
136
self . available_cgus
137
137
. iter( )
138
- . cloned ( )
138
+ . map ( |cgu| cgu . as_str ( ) . to_string ( ) )
139
139
. collect:: <Vec <_>>( )
140
140
. join( ", " ) ) ) ;
141
141
}
0 commit comments