Skip to content

Commit 5a57f46

Browse files
committed
Store InternedStrings in AssertModuleSource::available_cgus.
1 parent c36d7d4 commit 5a57f46

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustc_incremental/assert_module_sources.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc::mir::mono::CodegenUnitNameBuilder;
2727
use rustc::ty::TyCtxt;
2828
use std::collections::BTreeSet;
2929
use syntax::ast;
30-
use syntax::symbol::{Symbol, sym};
30+
use syntax::symbol::{InternedString, Symbol, sym};
3131
use 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

6262
struct AssertModuleSource<'tcx> {
6363
tcx: TyCtxt<'tcx>,
64-
available_cgus: BTreeSet<String>,
64+
available_cgus: BTreeSet<InternedString>,
6565
}
6666

6767
impl 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

Comments
 (0)