File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -793,8 +793,7 @@ impl<'tcx> TyCtxt<'tcx> {
793793 }
794794
795795 pub fn consider_optimizing < T : Fn ( ) -> String > ( self , msg : T ) -> bool {
796- let cname = self . crate_name ( LOCAL_CRATE ) ;
797- self . sess . consider_optimizing ( cname. as_str ( ) , msg)
796+ self . sess . consider_optimizing ( || self . crate_name ( LOCAL_CRATE ) , msg)
798797 }
799798
800799 /// Obtain all lang items of this crate and all dependencies (recursively)
Original file line number Diff line number Diff line change @@ -882,10 +882,14 @@ impl Session {
882882
883883 /// We want to know if we're allowed to do an optimization for crate foo from -z fuel=foo=n.
884884 /// This expends fuel if applicable, and records fuel if applicable.
885- pub fn consider_optimizing < T : Fn ( ) -> String > ( & self , crate_name : & str , msg : T ) -> bool {
885+ pub fn consider_optimizing (
886+ & self ,
887+ get_crate_name : impl Fn ( ) -> Symbol ,
888+ msg : impl Fn ( ) -> String ,
889+ ) -> bool {
886890 let mut ret = true ;
887891 if let Some ( ( ref c, _) ) = self . opts . unstable_opts . fuel {
888- if c == crate_name {
892+ if c == get_crate_name ( ) . as_str ( ) {
889893 assert_eq ! ( self . threads( ) , 1 ) ;
890894 let mut fuel = self . optimization_fuel . lock ( ) ;
891895 ret = fuel. remaining != 0 ;
@@ -903,7 +907,7 @@ impl Session {
903907 }
904908 }
905909 if let Some ( ref c) = self . opts . unstable_opts . print_fuel {
906- if c == crate_name {
910+ if c == get_crate_name ( ) . as_str ( ) {
907911 assert_eq ! ( self . threads( ) , 1 ) ;
908912 self . print_fuel . fetch_add ( 1 , SeqCst ) ;
909913 }
You can’t perform that action at this time.
0 commit comments