Skip to content

Commit

Permalink
Auto merge of #81901 - Mark-Simulacrum:use-string-not-cow, r=jackh726
Browse files Browse the repository at this point in the history
Switch query descriptions to just String

In practice we never used the borrowed variant anyway.
  • Loading branch information
bors committed Feb 9, 2021
2 parents a270444 + f564d7a commit 36931ce
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_macros/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
};

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_query_system/src/query/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 36931ce

Please sign in to comment.