From aec5a484812e2e6d0077a960997f1f51f18c1c8a Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Fri, 21 Dec 2018 17:31:33 +0200 Subject: rustc: move <...>-less impl path special-case to pretty_path_qualified. --- src/librustc_codegen_utils/symbol_names.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/librustc_codegen_utils') diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 4c7b00ae078..0ea141b6574 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -416,16 +416,24 @@ impl Printer for SymbolPath { self: &mut PrintCx<'_, '_, 'tcx, Self>, self_ty: Ty<'tcx>, trait_ref: Option>, + ns: Namespace, ) -> Self::Path { + // HACK(eddyb) avoid `keep_within_component` for the cases + // that print without `<...>` around `self_ty`. + match self_ty.sty { + ty::Adt(..) | ty::Foreign(_) | + ty::Bool | ty::Char | ty::Str | + ty::Int(_) | ty::Uint(_) | ty::Float(_) if trait_ref.is_none() => { + return self.pretty_path_qualified(self_ty, trait_ref, ns); + } + _ => {} + } + let kept_within_component = mem::replace(&mut self.printer.keep_within_component, true); - let r = self.pretty_path_qualified(self_ty, trait_ref); + let r = self.pretty_path_qualified(self_ty, trait_ref, ns); self.printer.keep_within_component = kept_within_component; r } - fn path_impl(self: &mut PrintCx<'_, '_, '_, Self>, text: &str) -> Self::Path { - self.printer.write_str(text)?; - Ok(PrettyPath { empty: false }) - } fn path_append( self: &mut PrintCx<'_, '_, '_, Self>, _: Self::Path, -- cgit 1.4.1-3-g733a5