mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Switch query descriptions to just String
In practice we never used the borrowed variant anyway.
This commit is contained in:
parent
921ec4b3fc
commit
f564d7abba
@ -417,8 +417,8 @@ fn add_query_description_impl(
|
|||||||
fn describe(
|
fn describe(
|
||||||
#tcx: TyCtxt<'tcx>,
|
#tcx: TyCtxt<'tcx>,
|
||||||
#key: #arg,
|
#key: #arg,
|
||||||
) -> Cow<'static, str> {
|
) -> String {
|
||||||
::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc).into())
|
::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
|
|||||||
use rustc_query_system::query::QueryDescription;
|
use rustc_query_system::query::QueryDescription;
|
||||||
|
|
||||||
use rustc_span::symbol::Symbol;
|
use rustc_span::symbol::Symbol;
|
||||||
use std::borrow::Cow;
|
|
||||||
|
|
||||||
fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
|
fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
|
||||||
if def_id.is_top_level_module() {
|
if def_id.is_top_level_module() {
|
||||||
|
@ -53,7 +53,6 @@ use rustc_ast as ast;
|
|||||||
use rustc_attr as attr;
|
use rustc_attr as attr;
|
||||||
use rustc_span::symbol::Symbol;
|
use rustc_span::symbol::Symbol;
|
||||||
use rustc_span::{Span, DUMMY_SP};
|
use rustc_span::{Span, DUMMY_SP};
|
||||||
use std::borrow::Cow;
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -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 {
|
let (r, name) = match *self {
|
||||||
$(Query::$name(key) => {
|
$(Query::$name(key) => {
|
||||||
(queries::$name::describe(tcx, key), stringify!($name))
|
(queries::$name::describe(tcx, key), stringify!($name))
|
||||||
})*
|
})*
|
||||||
};
|
};
|
||||||
if tcx.sess.verbose() {
|
if tcx.sess.verbose() {
|
||||||
format!("{} [{}]", r, name).into()
|
format!("{} [{}]", r, name)
|
||||||
} else {
|
} else {
|
||||||
r
|
r
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ use crate::query::plumbing::CycleError;
|
|||||||
use crate::query::{QueryContext, QueryState};
|
use crate::query::{QueryContext, QueryState};
|
||||||
|
|
||||||
use rustc_data_structures::fingerprint::Fingerprint;
|
use rustc_data_structures::fingerprint::Fingerprint;
|
||||||
use std::borrow::Cow;
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait QueryDescription<CTX: QueryContext>: QueryAccessors<CTX> {
|
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]
|
#[inline]
|
||||||
fn cache_on_disk(_: CTX, _: &Self::Key, _: Option<&Self::Value>) -> bool {
|
fn cache_on_disk(_: CTX, _: &Self::Key, _: Option<&Self::Value>) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user