Skip to content

Commit 7118e33

Browse files
committed
Remove private methods from TyCtxt impl block: rustc::ty::print::pretty.
1 parent 640cae2 commit 7118e33

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/librustc/ty/print/pretty.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,34 +1036,34 @@ impl<F> FmtPrinter<'a, 'tcx, F> {
10361036
}
10371037
}
10381038

1039-
impl TyCtxt<'t> {
1040-
// HACK(eddyb) get rid of `def_path_str` and/or pass `Namespace` explicitly always
1041-
// (but also some things just print a `DefId` generally so maybe we need this?)
1042-
fn guess_def_namespace(self, def_id: DefId) -> Namespace {
1043-
match self.def_key(def_id).disambiguated_data.data {
1044-
DefPathData::TypeNs(..) | DefPathData::CrateRoot | DefPathData::ImplTrait => {
1045-
Namespace::TypeNS
1046-
}
1039+
// HACK(eddyb) get rid of `def_path_str` and/or pass `Namespace` explicitly always
1040+
// (but also some things just print a `DefId` generally so maybe we need this?)
1041+
fn guess_def_namespace(tcx: TyCtxt<'_>, def_id: DefId) -> Namespace {
1042+
match tcx.def_key(def_id).disambiguated_data.data {
1043+
DefPathData::TypeNs(..) | DefPathData::CrateRoot | DefPathData::ImplTrait => {
1044+
Namespace::TypeNS
1045+
}
10471046

1048-
DefPathData::ValueNs(..)
1049-
| DefPathData::AnonConst
1050-
| DefPathData::ClosureExpr
1051-
| DefPathData::Ctor => Namespace::ValueNS,
1047+
DefPathData::ValueNs(..)
1048+
| DefPathData::AnonConst
1049+
| DefPathData::ClosureExpr
1050+
| DefPathData::Ctor => Namespace::ValueNS,
10521051

1053-
DefPathData::MacroNs(..) => Namespace::MacroNS,
1052+
DefPathData::MacroNs(..) => Namespace::MacroNS,
10541053

1055-
_ => Namespace::TypeNS,
1056-
}
1054+
_ => Namespace::TypeNS,
10571055
}
1056+
}
10581057

1058+
impl TyCtxt<'t> {
10591059
/// Returns a string identifying this `DefId`. This string is
10601060
/// suitable for user output.
10611061
pub fn def_path_str(self, def_id: DefId) -> String {
10621062
self.def_path_str_with_substs(def_id, &[])
10631063
}
10641064

10651065
pub fn def_path_str_with_substs(self, def_id: DefId, substs: &'t [GenericArg<'t>]) -> String {
1066-
let ns = self.guess_def_namespace(def_id);
1066+
let ns = guess_def_namespace(self, def_id);
10671067
debug!("def_path_str: def_id={:?}, ns={:?}", def_id, ns);
10681068
let mut s = String::new();
10691069
let _ = FmtPrinter::new(self, &mut s, ns).print_def_path(def_id, substs);

0 commit comments

Comments
 (0)