File tree 2 files changed +8
-5
lines changed
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> {
793
793
}
794
794
795
795
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)
798
797
}
799
798
800
799
/// 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 {
882
882
883
883
/// We want to know if we're allowed to do an optimization for crate foo from -z fuel=foo=n.
884
884
/// 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 {
886
890
let mut ret = true ;
887
891
if let Some ( ( ref c, _) ) = self . opts . unstable_opts . fuel {
888
- if c == crate_name {
892
+ if c == get_crate_name ( ) . as_str ( ) {
889
893
assert_eq ! ( self . threads( ) , 1 ) ;
890
894
let mut fuel = self . optimization_fuel . lock ( ) ;
891
895
ret = fuel. remaining != 0 ;
@@ -903,7 +907,7 @@ impl Session {
903
907
}
904
908
}
905
909
if let Some ( ref c) = self . opts . unstable_opts . print_fuel {
906
- if c == crate_name {
910
+ if c == get_crate_name ( ) . as_str ( ) {
907
911
assert_eq ! ( self . threads( ) , 1 ) ;
908
912
self . print_fuel . fetch_add ( 1 , SeqCst ) ;
909
913
}
You can’t perform that action at this time.
0 commit comments