diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-12-21 17:31:33 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-03-15 13:25:10 +0200 |
| commit | aec5a484812e2e6d0077a960997f1f51f18c1c8a (patch) | |
| tree | 0cb68f70bb7d1b6d2ce8fd418679af95070d1eab /src/librustc_codegen_utils | |
| parent | a15bfc6f483c552f793932f7ac7fcbb69d187681 (diff) | |
| download | rust-aec5a484812e2e6d0077a960997f1f51f18c1c8a.tar.gz rust-aec5a484812e2e6d0077a960997f1f51f18c1c8a.zip | |
rustc: move <...>-less impl path special-case to pretty_path_qualified.
Diffstat (limited to 'src/librustc_codegen_utils')
| -rw-r--r-- | src/librustc_codegen_utils/symbol_names.rs | 18 |
1 files changed, 13 insertions, 5 deletions
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<ty::TraitRef<'tcx>>, + 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, |
