@@ -572,7 +572,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
572
572
}
573
573
574
574
fn assemble_inherent_candidates ( & mut self ) {
575
- let steps = self . steps . clone ( ) ;
575
+ let steps = Lrc :: clone ( & self . steps ) ;
576
576
for step in steps. iter ( ) {
577
577
self . assemble_probe ( & step. self_ty ) ;
578
578
}
@@ -635,87 +635,51 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
635
635
self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
636
636
}
637
637
ty:: Slice ( _) => {
638
- let lang_def_id = lang_items. slice_impl ( ) ;
639
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
640
-
641
- let lang_def_id = lang_items. slice_u8_impl ( ) ;
642
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
643
-
644
- let lang_def_id = lang_items. slice_alloc_impl ( ) ;
645
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
646
-
647
- let lang_def_id = lang_items. slice_u8_alloc_impl ( ) ;
648
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
649
- }
650
- ty:: RawPtr ( ty:: TypeAndMut { ty : _, mutbl : hir:: Mutability :: Not } ) => {
651
- let lang_def_id = lang_items. const_ptr_impl ( ) ;
652
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
653
- }
654
- ty:: RawPtr ( ty:: TypeAndMut { ty : _, mutbl : hir:: Mutability :: Mut } ) => {
655
- let lang_def_id = lang_items. mut_ptr_impl ( ) ;
656
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
657
- }
658
- ty:: Int ( ast:: IntTy :: I8 ) => {
659
- let lang_def_id = lang_items. i8_impl ( ) ;
660
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
661
- }
662
- ty:: Int ( ast:: IntTy :: I16 ) => {
663
- let lang_def_id = lang_items. i16_impl ( ) ;
664
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
665
- }
666
- ty:: Int ( ast:: IntTy :: I32 ) => {
667
- let lang_def_id = lang_items. i32_impl ( ) ;
668
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
669
- }
670
- ty:: Int ( ast:: IntTy :: I64 ) => {
671
- let lang_def_id = lang_items. i64_impl ( ) ;
672
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
673
- }
674
- ty:: Int ( ast:: IntTy :: I128 ) => {
675
- let lang_def_id = lang_items. i128_impl ( ) ;
676
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
677
- }
678
- ty:: Int ( ast:: IntTy :: Isize ) => {
679
- let lang_def_id = lang_items. isize_impl ( ) ;
680
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
681
- }
682
- ty:: Uint ( ast:: UintTy :: U8 ) => {
683
- let lang_def_id = lang_items. u8_impl ( ) ;
684
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
685
- }
686
- ty:: Uint ( ast:: UintTy :: U16 ) => {
687
- let lang_def_id = lang_items. u16_impl ( ) ;
688
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
689
- }
690
- ty:: Uint ( ast:: UintTy :: U32 ) => {
691
- let lang_def_id = lang_items. u32_impl ( ) ;
692
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
693
- }
694
- ty:: Uint ( ast:: UintTy :: U64 ) => {
695
- let lang_def_id = lang_items. u64_impl ( ) ;
696
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
638
+ for & lang_def_id in & [
639
+ lang_items. slice_impl ( ) ,
640
+ lang_items. slice_u8_impl ( ) ,
641
+ lang_items. slice_alloc_impl ( ) ,
642
+ lang_items. slice_u8_alloc_impl ( ) ,
643
+ ] {
644
+ self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
645
+ }
697
646
}
698
- ty:: Uint ( ast:: UintTy :: U128 ) => {
699
- let lang_def_id = lang_items. u128_impl ( ) ;
647
+ ty:: RawPtr ( ty:: TypeAndMut { ty : _, mutbl } ) => {
648
+ let lang_def_id = match mutbl {
649
+ hir:: Mutability :: Not => lang_items. const_ptr_impl ( ) ,
650
+ hir:: Mutability :: Mut => lang_items. mut_ptr_impl ( ) ,
651
+ } ;
700
652
self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
701
653
}
702
- ty:: Uint ( ast:: UintTy :: Usize ) => {
703
- let lang_def_id = lang_items. usize_impl ( ) ;
654
+ ty:: Int ( i) => {
655
+ let lang_def_id = match i {
656
+ ast:: IntTy :: I8 => lang_items. i8_impl ( ) ,
657
+ ast:: IntTy :: I16 => lang_items. i16_impl ( ) ,
658
+ ast:: IntTy :: I32 => lang_items. i32_impl ( ) ,
659
+ ast:: IntTy :: I64 => lang_items. i64_impl ( ) ,
660
+ ast:: IntTy :: I128 => lang_items. i128_impl ( ) ,
661
+ ast:: IntTy :: Isize => lang_items. isize_impl ( ) ,
662
+ } ;
704
663
self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
705
664
}
706
- ty:: Float ( ast:: FloatTy :: F32 ) => {
707
- let lang_def_id = lang_items. f32_impl ( ) ;
708
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
709
-
710
- let lang_def_id = lang_items. f32_runtime_impl ( ) ;
665
+ ty:: Uint ( i) => {
666
+ let lang_def_id = match i {
667
+ ast:: UintTy :: U8 => lang_items. u8_impl ( ) ,
668
+ ast:: UintTy :: U16 => lang_items. u16_impl ( ) ,
669
+ ast:: UintTy :: U32 => lang_items. u32_impl ( ) ,
670
+ ast:: UintTy :: U64 => lang_items. u64_impl ( ) ,
671
+ ast:: UintTy :: U128 => lang_items. u128_impl ( ) ,
672
+ ast:: UintTy :: Usize => lang_items. usize_impl ( ) ,
673
+ } ;
711
674
self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
712
675
}
713
- ty:: Float ( ast:: FloatTy :: F64 ) => {
714
- let lang_def_id = lang_items. f64_impl ( ) ;
715
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
716
-
717
- let lang_def_id = lang_items. f64_runtime_impl ( ) ;
718
- self . assemble_inherent_impl_for_primitive ( lang_def_id) ;
676
+ ty:: Float ( f) => {
677
+ let ( lang_def_id1, lang_def_id2) = match f {
678
+ ast:: FloatTy :: F32 => ( lang_items. f32_impl ( ) , lang_items. f32_runtime_impl ( ) ) ,
679
+ ast:: FloatTy :: F64 => ( lang_items. f64_impl ( ) , lang_items. f64_runtime_impl ( ) ) ,
680
+ } ;
681
+ self . assemble_inherent_impl_for_primitive ( lang_def_id1) ;
682
+ self . assemble_inherent_impl_for_primitive ( lang_def_id2) ;
719
683
}
720
684
_ => { }
721
685
}
0 commit comments