Auto merge of #81901 - Mark-Simulacrum:use-string-not-cow, r=jackh726

Switch query descriptions to just String

In practice we never used the borrowed variant anyway.
This commit is contained in:
bors 2021-02-09 03:06:42 +00:00
commit 36931ce3d9
5 changed files with 5 additions and 8 deletions

View File

@ -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))
}
};

View File

@ -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() {

View File

@ -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;

View File

@ -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
}

View File

@ -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<CTX: QueryContext>: QueryAccessors<CTX> {
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 {