@@ -35,7 +35,7 @@ use rustc_trait_selection::traits::query::method_autoderef::{
3535 CandidateStep , MethodAutoderefBadTy , MethodAutoderefStepsResult ,
3636} ;
3737use rustc_trait_selection:: traits:: { self , ObligationCause , ObligationCtxt } ;
38- use smallvec:: { SmallVec , smallvec } ;
38+ use smallvec:: SmallVec ;
3939use tracing:: { debug, instrument} ;
4040
4141use self :: CandidateKind :: * ;
@@ -98,7 +98,7 @@ impl<'a, 'tcx> Deref for ProbeContext<'a, 'tcx> {
9898pub ( crate ) struct Candidate < ' tcx > {
9999 pub ( crate ) item : ty:: AssocItem ,
100100 pub ( crate ) kind : CandidateKind < ' tcx > ,
101- pub ( crate ) import_ids : SmallVec < [ LocalDefId ; 1 ] > ,
101+ pub ( crate ) import_ids : & ' tcx [ LocalDefId ] ,
102102}
103103
104104#[ derive( Debug , Clone ) ]
@@ -205,7 +205,7 @@ impl PickConstraintsForShadowed {
205205pub ( crate ) struct Pick < ' tcx > {
206206 pub item : ty:: AssocItem ,
207207 pub kind : PickKind < ' tcx > ,
208- pub import_ids : SmallVec < [ LocalDefId ; 1 ] > ,
208+ pub import_ids : & ' tcx [ LocalDefId ] ,
209209
210210 /// Indicates that the source expression should be autoderef'd N times
211211 /// ```ignore (not-rust)
@@ -571,7 +571,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
571571 ty:: Binder :: dummy ( trait_ref) ,
572572 false ,
573573 ) ,
574- import_ids : smallvec ! [ ] ,
574+ import_ids : & [ ] ,
575575 } ,
576576 false ,
577577 ) ;
@@ -943,7 +943,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
943943 Candidate {
944944 item,
945945 kind : InherentImplCandidate { impl_def_id, receiver_steps } ,
946- import_ids : smallvec ! [ ] ,
946+ import_ids : & [ ] ,
947947 } ,
948948 true ,
949949 ) ;
@@ -976,11 +976,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
976976 traits:: supertraits ( self . tcx , trait_ref) ,
977977 |this, new_trait_ref, item| {
978978 this. push_candidate (
979- Candidate {
980- item,
981- kind : ObjectCandidate ( new_trait_ref) ,
982- import_ids : smallvec ! [ ] ,
983- } ,
979+ Candidate { item, kind : ObjectCandidate ( new_trait_ref) , import_ids : & [ ] } ,
984980 true ,
985981 ) ;
986982 } ,
@@ -1015,11 +1011,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10151011
10161012 self . assemble_candidates_for_bounds ( bounds, |this, poly_trait_ref, item| {
10171013 this. push_candidate (
1018- Candidate {
1019- item,
1020- kind : WhereClauseCandidate ( poly_trait_ref) ,
1021- import_ids : smallvec ! [ ] ,
1022- } ,
1014+ Candidate { item, kind : WhereClauseCandidate ( poly_trait_ref) , import_ids : & [ ] } ,
10231015 true ,
10241016 ) ;
10251017 } ) ;
@@ -1069,11 +1061,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10691061 let mut duplicates = FxHashSet :: default ( ) ;
10701062 for trait_info in suggest:: all_traits ( self . tcx ) {
10711063 if duplicates. insert ( trait_info. def_id ) {
1072- self . assemble_extension_candidates_for_trait (
1073- & smallvec ! [ ] ,
1074- trait_info. def_id ,
1075- false ,
1076- ) ;
1064+ self . assemble_extension_candidates_for_trait ( & [ ] , trait_info. def_id , false ) ;
10771065 }
10781066 }
10791067 }
@@ -1097,7 +1085,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10971085 #[ instrument( level = "debug" , skip( self ) ) ]
10981086 fn assemble_extension_candidates_for_trait (
10991087 & mut self ,
1100- import_ids : & SmallVec < [ LocalDefId ; 1 ] > ,
1088+ import_ids : & ' tcx [ LocalDefId ] ,
11011089 trait_def_id : DefId ,
11021090 lint_ambiguous : bool ,
11031091 ) {
@@ -1120,7 +1108,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
11201108 self . push_candidate (
11211109 Candidate {
11221110 item,
1123- import_ids : import_ids . clone ( ) ,
1111+ import_ids,
11241112 kind : TraitCandidate ( bound_trait_ref, lint_ambiguous) ,
11251113 } ,
11261114 false ,
@@ -1143,7 +1131,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
11431131 self . push_candidate (
11441132 Candidate {
11451133 item,
1146- import_ids : import_ids . clone ( ) ,
1134+ import_ids,
11471135 kind : TraitCandidate ( ty:: Binder :: dummy ( trait_ref) , lint_ambiguous) ,
11481136 } ,
11491137 false ,
@@ -2329,7 +2317,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
23292317 Some ( Pick {
23302318 item : probes[ 0 ] . 0 . item ,
23312319 kind : TraitPick ( lint_ambiguous) ,
2332- import_ids : probes[ 0 ] . 0 . import_ids . clone ( ) ,
2320+ import_ids : probes[ 0 ] . 0 . import_ids ,
23332321 autoderefs : 0 ,
23342322 autoref_or_ptr_adjustment : None ,
23352323 self_ty,
@@ -2406,7 +2394,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
24062394 Some ( Pick {
24072395 item : child_candidate. item ,
24082396 kind : TraitPick ( lint_ambiguous) ,
2409- import_ids : child_candidate. import_ids . clone ( ) ,
2397+ import_ids : child_candidate. import_ids ,
24102398 autoderefs : 0 ,
24112399 autoref_or_ptr_adjustment : None ,
24122400 self_ty,
@@ -2683,7 +2671,7 @@ impl<'tcx> Candidate<'tcx> {
26832671 WhereClausePick ( trait_ref)
26842672 }
26852673 } ,
2686- import_ids : self . import_ids . clone ( ) ,
2674+ import_ids : self . import_ids ,
26872675 autoderefs : 0 ,
26882676 autoref_or_ptr_adjustment : None ,
26892677 self_ty,
0 commit comments