Skip to content

Commit 19d4e1d

Browse files
authored
Rollup merge of #75210 - nnethercote:change-type-of-available_cgus, r=ecstatic-morse
Change the type of `AssertModuleSource::available_cgus`. It's currently a `BTreeSet<Symbol>`, which is a strange type. The `BTreeSet` suggests that element order is important, but `Symbol` is a type whose ordering isn't useful to humans. The ordering of the collection only manifests in an obscure error message ("no module named `...`") that doesn't appear in any tests. This commit changes the `Symbol` to a `String`, which is more typical.
2 parents f49e473 + ebbf07a commit 19d4e1d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/librustc_incremental/assert_module_sources.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) {
3939
.collect_and_partition_mono_items(LOCAL_CRATE)
4040
.1
4141
.iter()
42-
.map(|cgu| cgu.name())
43-
.collect::<BTreeSet<Symbol>>();
42+
.map(|cgu| cgu.name().to_string())
43+
.collect::<BTreeSet<String>>();
4444

4545
let ams = AssertModuleSource { tcx, available_cgus };
4646

@@ -52,7 +52,7 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) {
5252

5353
struct AssertModuleSource<'tcx> {
5454
tcx: TyCtxt<'tcx>,
55-
available_cgus: BTreeSet<Symbol>,
55+
available_cgus: BTreeSet<String>,
5656
}
5757

5858
impl AssertModuleSource<'tcx> {
@@ -121,12 +121,11 @@ impl AssertModuleSource<'tcx> {
121121

122122
debug!("mapping '{}' to cgu name '{}'", self.field(attr, sym::module), cgu_name);
123123

124-
if !self.available_cgus.contains(&cgu_name) {
124+
if !self.available_cgus.contains(&*cgu_name.as_str()) {
125125
self.tcx.sess.span_err(
126126
attr.span,
127127
&format!(
128-
"no module named `{}` (mangled: {}). \
129-
Available modules: {}",
128+
"no module named `{}` (mangled: {}). Available modules: {}",
130129
user_path,
131130
cgu_name,
132131
self.available_cgus

0 commit comments

Comments
 (0)