From f564d7abba53648a92b2d1f654d920cf78afc0c6 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 8 Feb 2021 17:20:41 -0500 Subject: [PATCH] Switch query descriptions to just String In practice we never used the borrowed variant anyway. --- compiler/rustc_macros/src/query.rs | 4 ++-- compiler/rustc_middle/src/query/mod.rs | 1 - compiler/rustc_middle/src/ty/query/mod.rs | 1 - compiler/rustc_middle/src/ty/query/plumbing.rs | 4 ++-- compiler/rustc_query_system/src/query/config.rs | 3 +-- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_macros/src/query.rs b/compiler/rustc_macros/src/query.rs index cff8e983318..bd20c7689ea 100644 --- a/compiler/rustc_macros/src/query.rs +++ b/compiler/rustc_macros/src/query.rs @@ -417,8 +417,8 @@ fn cache_on_disk( fn describe( #tcx: TyCtxt<'tcx>, #key: #arg, - ) -> Cow<'static, str> { - ::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc).into()) + ) -> String { + ::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc)) } }; diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index ca528b2f091..f3f3368b090 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -13,7 +13,6 @@ use rustc_query_system::query::QueryDescription; use rustc_span::symbol::Symbol; -use std::borrow::Cow; fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String { if def_id.is_top_level_module() { diff --git a/compiler/rustc_middle/src/ty/query/mod.rs b/compiler/rustc_middle/src/ty/query/mod.rs index f580cb14dc9..804c045a690 100644 --- a/compiler/rustc_middle/src/ty/query/mod.rs +++ b/compiler/rustc_middle/src/ty/query/mod.rs @@ -53,7 +53,6 @@ use rustc_attr as attr; use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; -use std::borrow::Cow; use std::collections::BTreeMap; use std::ops::Deref; use std::path::PathBuf; diff --git a/compiler/rustc_middle/src/ty/query/plumbing.rs b/compiler/rustc_middle/src/ty/query/plumbing.rs index d0730bd121c..46addcdaead 100644 --- a/compiler/rustc_middle/src/ty/query/plumbing.rs +++ b/compiler/rustc_middle/src/ty/query/plumbing.rs @@ -277,14 +277,14 @@ pub fn name(&self) -> &'static str { } } - pub fn describe(&self, tcx: TyCtxt<$tcx>) -> Cow<'static, str> { + pub fn describe(&self, tcx: TyCtxt<$tcx>) -> String { let (r, name) = match *self { $(Query::$name(key) => { (queries::$name::describe(tcx, key), stringify!($name)) })* }; if tcx.sess.verbose() { - format!("{} [{}]", r, name).into() + format!("{} [{}]", r, name) } else { r } diff --git a/compiler/rustc_query_system/src/query/config.rs b/compiler/rustc_query_system/src/query/config.rs index 0f0684b3547..94e906fc433 100644 --- a/compiler/rustc_query_system/src/query/config.rs +++ b/compiler/rustc_query_system/src/query/config.rs @@ -7,7 +7,6 @@ use crate::query::{QueryContext, QueryState}; use rustc_data_structures::fingerprint::Fingerprint; -use std::borrow::Cow; use std::fmt::Debug; use std::hash::Hash; @@ -95,7 +94,7 @@ fn hash_result( } pub trait QueryDescription: QueryAccessors { - fn describe(tcx: CTX, key: Self::Key) -> Cow<'static, str>; + fn describe(tcx: CTX, key: Self::Key) -> String; #[inline] fn cache_on_disk(_: CTX, _: &Self::Key, _: Option<&Self::Value>) -> bool {