@@ -36,7 +36,7 @@ use rustc_trait_selection::traits::query::method_autoderef::{
3636 CandidateStep , MethodAutoderefBadTy , MethodAutoderefStepsResult ,
3737} ;
3838use rustc_trait_selection:: traits:: { self , ObligationCause , ObligationCtxt } ;
39- use smallvec:: { SmallVec , smallvec } ;
39+ use smallvec:: SmallVec ;
4040use tracing:: { debug, instrument} ;
4141
4242use self :: CandidateKind :: * ;
@@ -99,7 +99,7 @@ impl<'a, 'tcx> Deref for ProbeContext<'a, 'tcx> {
9999pub ( crate ) struct Candidate < ' tcx > {
100100 pub ( crate ) item : ty:: AssocItem ,
101101 pub ( crate ) kind : CandidateKind < ' tcx > ,
102- pub ( crate ) import_ids : SmallVec < [ LocalDefId ; 1 ] > ,
102+ pub ( crate ) import_ids : & ' tcx [ LocalDefId ] ,
103103}
104104
105105#[ derive( Debug , Clone ) ]
@@ -206,7 +206,7 @@ impl PickConstraintsForShadowed {
206206pub ( crate ) struct Pick < ' tcx > {
207207 pub item : ty:: AssocItem ,
208208 pub kind : PickKind < ' tcx > ,
209- pub import_ids : SmallVec < [ LocalDefId ; 1 ] > ,
209+ pub import_ids : & ' tcx [ LocalDefId ] ,
210210
211211 /// Indicates that the source expression should be autoderef'd N times
212212 /// ```ignore (not-rust)
@@ -574,7 +574,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
574574 ty:: Binder :: dummy ( trait_ref) ,
575575 false ,
576576 ) ,
577- import_ids : smallvec ! [ ] ,
577+ import_ids : & [ ] ,
578578 } ,
579579 false ,
580580 ) ;
@@ -946,7 +946,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
946946 Candidate {
947947 item,
948948 kind : InherentImplCandidate { impl_def_id, receiver_steps } ,
949- import_ids : smallvec ! [ ] ,
949+ import_ids : & [ ] ,
950950 } ,
951951 true ,
952952 ) ;
@@ -979,11 +979,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
979979 traits:: supertraits ( self . tcx , trait_ref) ,
980980 |this, new_trait_ref, item| {
981981 this. push_candidate (
982- Candidate {
983- item,
984- kind : ObjectCandidate ( new_trait_ref) ,
985- import_ids : smallvec ! [ ] ,
986- } ,
982+ Candidate { item, kind : ObjectCandidate ( new_trait_ref) , import_ids : & [ ] } ,
987983 true ,
988984 ) ;
989985 } ,
@@ -1018,11 +1014,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10181014
10191015 self . assemble_candidates_for_bounds ( bounds, |this, poly_trait_ref, item| {
10201016 this. push_candidate (
1021- Candidate {
1022- item,
1023- kind : WhereClauseCandidate ( poly_trait_ref) ,
1024- import_ids : smallvec ! [ ] ,
1025- } ,
1017+ Candidate { item, kind : WhereClauseCandidate ( poly_trait_ref) , import_ids : & [ ] } ,
10261018 true ,
10271019 ) ;
10281020 } ) ;
@@ -1072,11 +1064,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10721064 let mut duplicates = FxHashSet :: default ( ) ;
10731065 for trait_info in suggest:: all_traits ( self . tcx ) {
10741066 if duplicates. insert ( trait_info. def_id ) {
1075- self . assemble_extension_candidates_for_trait (
1076- & smallvec ! [ ] ,
1077- trait_info. def_id ,
1078- false ,
1079- ) ;
1067+ self . assemble_extension_candidates_for_trait ( & [ ] , trait_info. def_id , false ) ;
10801068 }
10811069 }
10821070 }
@@ -1100,7 +1088,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
11001088 #[ instrument( level = "debug" , skip( self ) ) ]
11011089 fn assemble_extension_candidates_for_trait (
11021090 & mut self ,
1103- import_ids : & SmallVec < [ LocalDefId ; 1 ] > ,
1091+ import_ids : & ' tcx [ LocalDefId ] ,
11041092 trait_def_id : DefId ,
11051093 lint_ambiguous : bool ,
11061094 ) {
@@ -1123,7 +1111,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
11231111 self . push_candidate (
11241112 Candidate {
11251113 item,
1126- import_ids : import_ids . clone ( ) ,
1114+ import_ids,
11271115 kind : TraitCandidate ( bound_trait_ref, lint_ambiguous) ,
11281116 } ,
11291117 false ,
@@ -1146,7 +1134,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
11461134 self . push_candidate (
11471135 Candidate {
11481136 item,
1149- import_ids : import_ids . clone ( ) ,
1137+ import_ids,
11501138 kind : TraitCandidate ( ty:: Binder :: dummy ( trait_ref) , lint_ambiguous) ,
11511139 } ,
11521140 false ,
@@ -2353,7 +2341,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
23532341 Some ( Pick {
23542342 item : probes[ 0 ] . 0 . item ,
23552343 kind : TraitPick ( lint_ambiguous) ,
2356- import_ids : probes[ 0 ] . 0 . import_ids . clone ( ) ,
2344+ import_ids : probes[ 0 ] . 0 . import_ids ,
23572345 autoderefs : 0 ,
23582346 autoref_or_ptr_adjustment : None ,
23592347 self_ty,
@@ -2430,7 +2418,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
24302418 Some ( Pick {
24312419 item : child_candidate. item ,
24322420 kind : TraitPick ( lint_ambiguous) ,
2433- import_ids : child_candidate. import_ids . clone ( ) ,
2421+ import_ids : child_candidate. import_ids ,
24342422 autoderefs : 0 ,
24352423 autoref_or_ptr_adjustment : None ,
24362424 self_ty,
@@ -2707,7 +2695,7 @@ impl<'tcx> Candidate<'tcx> {
27072695 WhereClausePick ( trait_ref)
27082696 }
27092697 } ,
2710- import_ids : self . import_ids . clone ( ) ,
2698+ import_ids : self . import_ids ,
27112699 autoderefs : 0 ,
27122700 autoref_or_ptr_adjustment : None ,
27132701 self_ty,
0 commit comments