@@ -1036,34 +1036,34 @@ impl<F> FmtPrinter<'a, 'tcx, F> {
1036
1036
}
1037
1037
}
1038
1038
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
+ }
1047
1046
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 ,
1052
1051
1053
- DefPathData :: MacroNs ( ..) => Namespace :: MacroNS ,
1052
+ DefPathData :: MacroNs ( ..) => Namespace :: MacroNS ,
1054
1053
1055
- _ => Namespace :: TypeNS ,
1056
- }
1054
+ _ => Namespace :: TypeNS ,
1057
1055
}
1056
+ }
1058
1057
1058
+ impl TyCtxt < ' t > {
1059
1059
/// Returns a string identifying this `DefId`. This string is
1060
1060
/// suitable for user output.
1061
1061
pub fn def_path_str ( self , def_id : DefId ) -> String {
1062
1062
self . def_path_str_with_substs ( def_id, & [ ] )
1063
1063
}
1064
1064
1065
1065
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) ;
1067
1067
debug ! ( "def_path_str: def_id={:?}, ns={:?}" , def_id, ns) ;
1068
1068
let mut s = String :: new ( ) ;
1069
1069
let _ = FmtPrinter :: new ( self , & mut s, ns) . print_def_path ( def_id, substs) ;
0 commit comments