@@ -22,7 +22,7 @@ use rustc_middle::mir::visit::Visitor as MirVisitor;
2222use rustc_middle:: mir:: { self , Local , Location } ;
2323use rustc_middle:: query:: TyCtxtAt ;
2424use rustc_middle:: ty:: adjustment:: { CustomCoerceUnsized , PointerCoercion } ;
25- use rustc_middle:: ty:: print:: with_no_trimmed_paths;
25+ use rustc_middle:: ty:: print:: { shrunk_instance_name , with_no_trimmed_paths} ;
2626use rustc_middle:: ty:: {
2727 self , GenericArgKind , GenericArgs , GenericParamDefKind , Instance , Ty , TyCtxt , TypeFoldable ,
2828 TypeVisitableExt , VtblEntry ,
@@ -34,7 +34,6 @@ use rustc_span::source_map::{dummy_spanned, respan, Spanned};
3434use rustc_span:: { ErrorGuaranteed , Span , DUMMY_SP } ;
3535use rustc_trait_selection:: traits;
3636use std:: ops:: Range ;
37- use std:: path:: PathBuf ;
3837
3938// From rustc_monomorphize/lib.rs
4039fn custom_coerce_unsize_info < ' tcx > (
@@ -126,7 +125,7 @@ pub fn collect_crate_mono_items(
126125 tcx. sess . time ( "monomorphization_collector_graph_walk" , || {
127126 par_for_each_in ( roots, |root| {
128127 let mut recursion_depths = DefIdMap :: default ( ) ;
129- let should_gen = match root {
128+ let should_gen = match * root {
130129 MonoItem :: Static ( def_id) => {
131130 let instance = Instance :: mono ( tcx, def_id) ;
132131 should_codegen_locally ( tcx, & instance)
@@ -137,7 +136,7 @@ pub fn collect_crate_mono_items(
137136 if should_gen {
138137 collect_items_rec (
139138 tcx,
140- dummy_spanned ( root) ,
139+ dummy_spanned ( * root) ,
141140 & visited,
142141 & mut recursion_depths,
143142 recursion_limit,
@@ -358,36 +357,6 @@ fn collect_items_rec<'tcx>(
358357 }
359358}
360359
361- /// Format instance name that is already known to be too long for rustc.
362- /// Show only the first 2 types if it is longer than 32 characters to avoid blasting
363- /// the user's terminal with thousands of lines of type-name.
364- ///
365- /// If the type name is longer than before+after, it will be written to a file.
366- fn shrunk_instance_name < ' tcx > (
367- tcx : TyCtxt < ' tcx > ,
368- instance : Instance < ' tcx > ,
369- ) -> ( String , Option < PathBuf > ) {
370- let s = instance. to_string ( ) ;
371-
372- // Only use the shrunk version if it's really shorter.
373- // This also avoids the case where before and after slices overlap.
374- if s. chars ( ) . nth ( 33 ) . is_some ( ) {
375- let shrunk = format ! ( "{}" , ty:: ShortInstance ( instance, 4 ) ) ;
376- if shrunk == s {
377- return ( s, None ) ;
378- }
379-
380- let path = tcx
381- . output_filenames ( ( ) )
382- . temp_path_ext ( "long-type.txt" , None ) ;
383- let written_to_path = std:: fs:: write ( & path, s) . ok ( ) . map ( |_| path) ;
384-
385- ( shrunk, written_to_path)
386- } else {
387- ( s, None )
388- }
389- }
390-
391360fn check_recursion_limit < ' tcx > (
392361 tcx : TyCtxt < ' tcx > ,
393362 instance : Instance < ' tcx > ,
0 commit comments