From 5a57f46cbc4dc1e84553b0c3093912dc3955bfe9 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 5 Sep 2019 10:36:30 +1000 Subject: [PATCH] Store `InternedString`s in `AssertModuleSource::available_cgus`. --- src/librustc_incremental/assert_module_sources.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 046fdc72270..e08eeaf8575 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -27,7 +27,7 @@ use rustc::ty::TyCtxt; use std::collections::BTreeSet; use syntax::ast; -use syntax::symbol::{Symbol, sym}; +use syntax::symbol::{InternedString, Symbol, sym}; use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED, ATTR_EXPECTED_CGU_REUSE}; @@ -45,8 +45,8 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) { .collect_and_partition_mono_items(LOCAL_CRATE) .1 .iter() - .map(|cgu| format!("{}", cgu.name())) - .collect::>(); + .map(|cgu| *cgu.name()) + .collect::>(); let ams = AssertModuleSource { tcx, @@ -61,7 +61,7 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) { struct AssertModuleSource<'tcx> { tcx: TyCtxt<'tcx>, - available_cgus: BTreeSet, + available_cgus: BTreeSet, } impl AssertModuleSource<'tcx> { @@ -127,7 +127,7 @@ fn check_attr(&self, attr: &ast::Attribute) { debug!("mapping '{}' to cgu name '{}'", self.field(attr, MODULE), cgu_name); - if !self.available_cgus.contains(&cgu_name.as_str()[..]) { + if !self.available_cgus.contains(&cgu_name) { self.tcx.sess.span_err(attr.span, &format!("no module named `{}` (mangled: {}). \ Available modules: {}", @@ -135,7 +135,7 @@ fn check_attr(&self, attr: &ast::Attribute) { cgu_name, self.available_cgus .iter() - .cloned() + .map(|cgu| cgu.as_str().to_string()) .collect::>() .join(", "))); }