@@ -397,7 +397,7 @@ fn collect_items_rec<'tcx>(
397397 let instance = Instance :: mono ( tcx, def_id) ;
398398
399399 // Sanity check whether this ended up being collected accidentally
400- debug_assert ! ( should_codegen_locally( tcx, & instance) ) ;
400+ debug_assert ! ( should_codegen_locally( tcx, instance) ) ;
401401
402402 let DefKind :: Static { nested, .. } = tcx. def_kind ( def_id) else { bug ! ( ) } ;
403403 // Nested statics have no type.
@@ -429,7 +429,7 @@ fn collect_items_rec<'tcx>(
429429 }
430430 MonoItem :: Fn ( instance) => {
431431 // Sanity check whether this ended up being collected accidentally
432- debug_assert ! ( should_codegen_locally( tcx, & instance) ) ;
432+ debug_assert ! ( should_codegen_locally( tcx, instance) ) ;
433433
434434 // Keep track of the monomorphization recursion depth
435435 recursion_depth_reset = Some ( check_recursion_limit (
@@ -474,7 +474,7 @@ fn collect_items_rec<'tcx>(
474474 }
475475 hir:: InlineAsmOperand :: SymStatic { path : _, def_id } => {
476476 let instance = Instance :: mono ( tcx, * def_id) ;
477- if should_codegen_locally ( tcx, & instance) {
477+ if should_codegen_locally ( tcx, instance) {
478478 trace ! ( "collecting static {:?}" , def_id) ;
479479 used_items. push ( dummy_spanned ( MonoItem :: Static ( * def_id) ) ) ;
480480 }
@@ -557,7 +557,7 @@ fn collect_items_rec<'tcx>(
557557/// If the type name is longer than before+after, it will be written to a file.
558558fn shrunk_instance_name < ' tcx > (
559559 tcx : TyCtxt < ' tcx > ,
560- instance : & Instance < ' tcx > ,
560+ instance : Instance < ' tcx > ,
561561) -> ( String , Option < PathBuf > ) {
562562 let s = instance. to_string ( ) ;
563563
@@ -603,7 +603,7 @@ fn check_recursion_limit<'tcx>(
603603 if !recursion_limit. value_within_limit ( adjusted_recursion_depth) {
604604 let def_span = tcx. def_span ( def_id) ;
605605 let def_path_str = tcx. def_path_str ( def_id) ;
606- let ( shrunk, written_to_path) = shrunk_instance_name ( tcx, & instance) ;
606+ let ( shrunk, written_to_path) = shrunk_instance_name ( tcx, instance) ;
607607 let mut path = PathBuf :: new ( ) ;
608608 let was_written = if let Some ( written_to_path) = written_to_path {
609609 path = written_to_path;
@@ -645,7 +645,7 @@ fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) {
645645 //
646646 // Bail out in these cases to avoid that bad user experience.
647647 if !tcx. type_length_limit ( ) . value_within_limit ( type_length) {
648- let ( shrunk, written_to_path) = shrunk_instance_name ( tcx, & instance) ;
648+ let ( shrunk, written_to_path) = shrunk_instance_name ( tcx, instance) ;
649649 let span = tcx. def_span ( instance. def_id ( ) ) ;
650650 let mut path = PathBuf :: new ( ) ;
651651 let was_written = if let Some ( path2) = written_to_path {
@@ -892,7 +892,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
892892 if let ty:: Closure ( def_id, args) = * source_ty. kind ( ) {
893893 let instance =
894894 Instance :: resolve_closure ( self . tcx , def_id, args, ty:: ClosureKind :: FnOnce ) ;
895- if should_codegen_locally ( self . tcx , & instance) {
895+ if should_codegen_locally ( self . tcx , instance) {
896896 self . used_items . push ( create_fn_mono_item ( self . tcx , instance, span) ) ;
897897 }
898898 } else {
@@ -902,7 +902,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
902902 mir:: Rvalue :: ThreadLocalRef ( def_id) => {
903903 assert ! ( self . tcx. is_thread_local_static( def_id) ) ;
904904 let instance = Instance :: mono ( self . tcx , def_id) ;
905- if should_codegen_locally ( self . tcx , & instance) {
905+ if should_codegen_locally ( self . tcx , instance) {
906906 trace ! ( "collecting thread-local static {:?}" , def_id) ;
907907 self . used_items . push ( respan ( span, MonoItem :: Static ( def_id) ) ) ;
908908 }
@@ -929,7 +929,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
929929 let tcx = self . tcx ;
930930 let push_mono_lang_item = |this : & mut Self , lang_item : LangItem | {
931931 let instance = Instance :: mono ( tcx, tcx. require_lang_item ( lang_item, Some ( source) ) ) ;
932- if should_codegen_locally ( tcx, & instance) {
932+ if should_codegen_locally ( tcx, instance) {
933933 this. used_items . push ( create_fn_mono_item ( tcx, instance, source) ) ;
934934 }
935935 } ;
@@ -962,7 +962,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
962962 }
963963 mir:: InlineAsmOperand :: SymStatic { def_id } => {
964964 let instance = Instance :: mono ( self . tcx , def_id) ;
965- if should_codegen_locally ( self . tcx , & instance) {
965+ if should_codegen_locally ( self . tcx , instance) {
966966 trace ! ( "collecting asm sym static {:?}" , def_id) ;
967967 self . used_items . push ( respan ( source, MonoItem :: Static ( def_id) ) ) ;
968968 }
@@ -1051,7 +1051,7 @@ fn visit_instance_use<'tcx>(
10511051 output : & mut MonoItems < ' tcx > ,
10521052) {
10531053 debug ! ( "visit_item_use({:?}, is_direct_call={:?})" , instance, is_direct_call) ;
1054- if !should_codegen_locally ( tcx, & instance) {
1054+ if !should_codegen_locally ( tcx, instance) {
10551055 return ;
10561056 }
10571057 if let ty:: InstanceDef :: Intrinsic ( def_id) = instance. def {
@@ -1063,13 +1063,13 @@ fn visit_instance_use<'tcx>(
10631063 // codegen a call to that function without generating code for the function itself.
10641064 let def_id = tcx. lang_items ( ) . get ( LangItem :: PanicNounwind ) . unwrap ( ) ;
10651065 let panic_instance = Instance :: mono ( tcx, def_id) ;
1066- if should_codegen_locally ( tcx, & panic_instance) {
1066+ if should_codegen_locally ( tcx, panic_instance) {
10671067 output. push ( create_fn_mono_item ( tcx, panic_instance, source) ) ;
10681068 }
10691069 } else if tcx. has_attr ( def_id, sym:: rustc_intrinsic) {
10701070 // Codegen the fallback body of intrinsics with fallback bodies
10711071 let instance = ty:: Instance :: new ( def_id, instance. args ) ;
1072- if should_codegen_locally ( tcx, & instance) {
1072+ if should_codegen_locally ( tcx, instance) {
10731073 output. push ( create_fn_mono_item ( tcx, instance, source) ) ;
10741074 }
10751075 }
@@ -1107,7 +1107,7 @@ fn visit_instance_use<'tcx>(
11071107
11081108/// Returns `true` if we should codegen an instance in the local crate, or returns `false` if we
11091109/// can just link to the upstream crate and therefore don't need a mono item.
1110- pub ( crate ) fn should_codegen_locally < ' tcx > ( tcx : TyCtxt < ' tcx > , instance : & Instance < ' tcx > ) -> bool {
1110+ pub ( crate ) fn should_codegen_locally < ' tcx > ( tcx : TyCtxt < ' tcx > , instance : Instance < ' tcx > ) -> bool {
11111111 let Some ( def_id) = instance. def . def_id_if_not_guaranteed_local_codegen ( ) else {
11121112 return true ;
11131113 } ;
@@ -1304,7 +1304,7 @@ fn create_mono_items_for_vtable_methods<'tcx>(
13041304 None
13051305 }
13061306 VtblEntry :: Method ( instance) => {
1307- Some ( * instance) . filter ( |instance| should_codegen_locally ( tcx, instance) )
1307+ Some ( * instance) . filter ( |instance| should_codegen_locally ( tcx, * instance) )
13081308 }
13091309 } )
13101310 . map ( |item| create_fn_mono_item ( tcx, item, source) ) ;
@@ -1321,7 +1321,7 @@ fn collect_alloc<'tcx>(tcx: TyCtxt<'tcx>, alloc_id: AllocId, output: &mut MonoIt
13211321 GlobalAlloc :: Static ( def_id) => {
13221322 assert ! ( !tcx. is_thread_local_static( def_id) ) ;
13231323 let instance = Instance :: mono ( tcx, def_id) ;
1324- if should_codegen_locally ( tcx, & instance) {
1324+ if should_codegen_locally ( tcx, instance) {
13251325 trace ! ( "collecting static {:?}" , def_id) ;
13261326 output. push ( dummy_spanned ( MonoItem :: Static ( def_id) ) ) ;
13271327 }
@@ -1339,7 +1339,7 @@ fn collect_alloc<'tcx>(tcx: TyCtxt<'tcx>, alloc_id: AllocId, output: &mut MonoIt
13391339 }
13401340 }
13411341 GlobalAlloc :: Function ( fn_instance) => {
1342- if should_codegen_locally ( tcx, & fn_instance) {
1342+ if should_codegen_locally ( tcx, fn_instance) {
13431343 trace ! ( "collecting {:?} with {:#?}" , alloc_id, fn_instance) ;
13441344 output. push ( create_fn_mono_item ( tcx, fn_instance, DUMMY_SP ) ) ;
13451345 }
@@ -1474,7 +1474,7 @@ fn visit_mentioned_item<'tcx>(
14741474 if let ty:: Closure ( def_id, args) = * source_ty. kind ( ) {
14751475 let instance =
14761476 Instance :: resolve_closure ( tcx, def_id, args, ty:: ClosureKind :: FnOnce ) ;
1477- if should_codegen_locally ( tcx, & instance) {
1477+ if should_codegen_locally ( tcx, instance) {
14781478 output. push ( create_fn_mono_item ( tcx, instance, span) ) ;
14791479 }
14801480 } else {
@@ -1736,7 +1736,7 @@ fn create_mono_items_for_default_impls<'tcx>(
17361736 let instance = ty:: Instance :: expect_resolve ( tcx, param_env, method. def_id , args) ;
17371737
17381738 let mono_item = create_fn_mono_item ( tcx, instance, DUMMY_SP ) ;
1739- if mono_item. node . is_instantiable ( tcx) && should_codegen_locally ( tcx, & instance) {
1739+ if mono_item. node . is_instantiable ( tcx) && should_codegen_locally ( tcx, instance) {
17401740 output. push ( mono_item) ;
17411741 }
17421742 }
0 commit comments