Skip to content

Commit a171ec3

Browse files
committed
Move describe_as_module from rustc_middle::print to rustc:middle::query.
That way it doesn't need to be exported.
1 parent 1e67915 commit a171ec3

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

compiler/rustc_middle/src/query/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ use crate::traits::{
135135
};
136136
use crate::ty::fast_reject::SimplifiedType;
137137
use crate::ty::layout::ValidityRequirement;
138-
use crate::ty::print::{PrintTraitRefExt, describe_as_module};
138+
use crate::ty::print::PrintTraitRefExt;
139139
use crate::ty::util::AlwaysRequiresDrop;
140140
use crate::ty::{
141141
self, CrateInherentImpls, GenericArg, GenericArgsRef, PseudoCanonicalInput, SizedTraitKind, Ty,
@@ -2731,3 +2731,12 @@ rustc_queries! {
27312731

27322732
rustc_with_all_queries! { define_callbacks! }
27332733
rustc_feedable_queries! { define_feedable! }
2734+
2735+
fn describe_as_module(def_id: impl Into<LocalDefId>, tcx: TyCtxt<'_>) -> String {
2736+
let def_id = def_id.into();
2737+
if def_id.is_top_level_module() {
2738+
"top-level module".to_string()
2739+
} else {
2740+
format!("module `{}`", tcx.def_path_str(def_id))
2741+
}
2742+
}

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use hir::def::Namespace;
22
use rustc_data_structures::fx::FxHashSet;
33
use rustc_data_structures::sso::SsoHashSet;
44
use rustc_hir as hir;
5-
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
5+
use rustc_hir::def_id::{CrateNum, DefId};
66
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
77
use tracing::{debug, instrument, trace};
88

@@ -396,16 +396,6 @@ impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for ty::Const<'tcx> {
396396
}
397397
}
398398

399-
// This is only used by query descriptions
400-
pub fn describe_as_module(def_id: impl Into<LocalDefId>, tcx: TyCtxt<'_>) -> String {
401-
let def_id = def_id.into();
402-
if def_id.is_top_level_module() {
403-
"top-level module".to_string()
404-
} else {
405-
format!("module `{}`", tcx.def_path_str(def_id))
406-
}
407-
}
408-
409399
impl<T> rustc_type_ir::ir_print::IrPrint<T> for TyCtxt<'_>
410400
where
411401
T: Copy + for<'a, 'tcx> Lift<TyCtxt<'tcx>, Lifted: Print<'tcx, FmtPrinter<'a, 'tcx>>>,

0 commit comments

Comments
 (0)