Skip to content

Commit 36931ce

Browse files
committed
Auto merge of rust-lang#81901 - Mark-Simulacrum:use-string-not-cow, r=jackh726
Switch query descriptions to just String In practice we never used the borrowed variant anyway.
2 parents a270444 + f564d7a commit 36931ce

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

compiler/rustc_macros/src/query.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ fn add_query_description_impl(
417417
fn describe(
418418
#tcx: TyCtxt<'tcx>,
419419
#key: #arg,
420-
) -> Cow<'static, str> {
421-
::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc).into())
420+
) -> String {
421+
::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc))
422422
}
423423
};
424424

compiler/rustc_middle/src/query/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
1313
use rustc_query_system::query::QueryDescription;
1414

1515
use rustc_span::symbol::Symbol;
16-
use std::borrow::Cow;
1716

1817
fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
1918
if def_id.is_top_level_module() {

compiler/rustc_middle/src/ty/query/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ use rustc_ast as ast;
5353
use rustc_attr as attr;
5454
use rustc_span::symbol::Symbol;
5555
use rustc_span::{Span, DUMMY_SP};
56-
use std::borrow::Cow;
5756
use std::collections::BTreeMap;
5857
use std::ops::Deref;
5958
use std::path::PathBuf;

compiler/rustc_middle/src/ty/query/plumbing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,14 @@ macro_rules! define_queries {
277277
}
278278
}
279279

280-
pub fn describe(&self, tcx: TyCtxt<$tcx>) -> Cow<'static, str> {
280+
pub fn describe(&self, tcx: TyCtxt<$tcx>) -> String {
281281
let (r, name) = match *self {
282282
$(Query::$name(key) => {
283283
(queries::$name::describe(tcx, key), stringify!($name))
284284
})*
285285
};
286286
if tcx.sess.verbose() {
287-
format!("{} [{}]", r, name).into()
287+
format!("{} [{}]", r, name)
288288
} else {
289289
r
290290
}

compiler/rustc_query_system/src/query/config.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::query::plumbing::CycleError;
77
use crate::query::{QueryContext, QueryState};
88

99
use rustc_data_structures::fingerprint::Fingerprint;
10-
use std::borrow::Cow;
1110
use std::fmt::Debug;
1211
use std::hash::Hash;
1312

@@ -95,7 +94,7 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig {
9594
}
9695

9796
pub trait QueryDescription<CTX: QueryContext>: QueryAccessors<CTX> {
98-
fn describe(tcx: CTX, key: Self::Key) -> Cow<'static, str>;
97+
fn describe(tcx: CTX, key: Self::Key) -> String;
9998

10099
#[inline]
101100
fn cache_on_disk(_: CTX, _: &Self::Key, _: Option<&Self::Value>) -> bool {

0 commit comments

Comments
 (0)