Switch query descriptions to just String

In practice we never used the borrowed variant anyway.
This commit is contained in:
Mark Rousskov 2021-02-08 17:20:41 -05:00
parent 921ec4b3fc
commit f564d7abba
5 changed files with 5 additions and 8 deletions

View File

@ -417,8 +417,8 @@ fn add_query_description_impl(
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_hir::def_id::{CrateNum, DefId, LocalDefId};
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_ast as ast;
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 @@ macro_rules! define_queries {
}
}
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::plumbing::CycleError;
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 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig {
}
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 {