@@ -2,7 +2,7 @@ use std::fmt::{self, Write};
22use std:: mem:: { self , discriminant} ;
33
44use rustc_data_structures:: stable_hasher:: { Hash64 , HashStable , StableHasher } ;
5- use rustc_hir:: def_id:: CrateNum ;
5+ use rustc_hir:: def_id:: { CrateNum , DefId } ;
66use rustc_hir:: definitions:: { DefPathData , DisambiguatedDefPathData } ;
77use rustc_middle:: bug;
88use rustc_middle:: ty:: print:: { PrettyPrinter , Print , PrintError , Printer } ;
@@ -378,6 +378,33 @@ impl<'tcx> Printer<'tcx> for SymbolPrinter<'tcx> {
378378 Ok ( ( ) )
379379 }
380380 }
381+
382+ fn print_impl_path (
383+ & mut self ,
384+ impl_def_id : DefId ,
385+ args : & ' tcx [ GenericArg < ' tcx > ] ,
386+ mut self_ty : Ty < ' tcx > ,
387+ mut impl_trait_ref : Option < ty:: TraitRef < ' tcx > > ,
388+ ) -> Result < ( ) , PrintError > {
389+ let mut typing_env = ty:: TypingEnv :: post_analysis ( self . tcx , impl_def_id) ;
390+ if !args. is_empty ( ) {
391+ typing_env. param_env =
392+ ty:: EarlyBinder :: bind ( typing_env. param_env ) . instantiate ( self . tcx , args) ;
393+ }
394+
395+ match & mut impl_trait_ref {
396+ Some ( impl_trait_ref) => {
397+ assert_eq ! ( impl_trait_ref. self_ty( ) , self_ty) ;
398+ * impl_trait_ref = self . tcx . normalize_erasing_regions ( typing_env, * impl_trait_ref) ;
399+ self_ty = impl_trait_ref. self_ty ( ) ;
400+ }
401+ None => {
402+ self_ty = self . tcx . normalize_erasing_regions ( typing_env, self_ty) ;
403+ }
404+ }
405+
406+ self . default_print_impl_path ( impl_def_id, args, self_ty, impl_trait_ref)
407+ }
381408}
382409
383410impl < ' tcx > PrettyPrinter < ' tcx > for SymbolPrinter < ' tcx > {
0 commit comments