@@ -48,7 +48,7 @@ enum QueryResult<D: DepKind> {
4848
4949impl < K , D > QueryState < K , D >
5050where
51- K : Eq + Hash + Clone + Debug ,
51+ K : Eq + Hash + Copy + Debug ,
5252 D : DepKind ,
5353{
5454 pub fn all_inactive ( & self ) -> bool {
7777 for shard in shards. iter ( ) {
7878 for ( k, v) in shard. iter ( ) {
7979 if let QueryResult :: Started ( ref job) = * v {
80- let query = make_query ( qcx, k . clone ( ) ) ;
80+ let query = make_query ( qcx, * k ) ;
8181 jobs. insert ( job. id , QueryJobInfo { query, job : job. clone ( ) } ) ;
8282 }
8383 }
9191 // really hurt much.)
9292 for ( k, v) in self . active . try_lock ( ) ?. iter ( ) {
9393 if let QueryResult :: Started ( ref job) = * v {
94- let query = make_query ( qcx, k . clone ( ) ) ;
94+ let query = make_query ( qcx, * k ) ;
9595 jobs. insert ( job. id , QueryJobInfo { query, job : job. clone ( ) } ) ;
9696 }
9797 }
@@ -111,7 +111,7 @@ impl<K, D: DepKind> Default for QueryState<K, D> {
111111/// This will poison the relevant query if dropped.
112112struct JobOwner < ' tcx , K , D : DepKind >
113113where
114- K : Eq + Hash + Clone ,
114+ K : Eq + Hash + Copy ,
115115{
116116 state : & ' tcx QueryState < K , D > ,
117117 key : K ,
@@ -163,7 +163,7 @@ where
163163
164164impl < ' tcx , K , D : DepKind > JobOwner < ' tcx , K , D >
165165where
166- K : Eq + Hash + Clone ,
166+ K : Eq + Hash + Copy ,
167167{
168168 /// Either gets a `JobOwner` corresponding the query, allowing us to
169169 /// start executing the query, or returns with the result of the query.
@@ -195,7 +195,7 @@ where
195195 let job = qcx. current_query_job ( ) ;
196196 let job = QueryJob :: new ( id, span, job) ;
197197
198- let key = entry. key ( ) . clone ( ) ;
198+ let key = * entry. key ( ) ;
199199 entry. insert ( QueryResult :: Started ( job) ) ;
200200
201201 let owner = JobOwner { state, id, key } ;
@@ -274,7 +274,7 @@ where
274274
275275impl < ' tcx , K , D > Drop for JobOwner < ' tcx , K , D >
276276where
277- K : Eq + Hash + Clone ,
277+ K : Eq + Hash + Copy ,
278278 D : DepKind ,
279279{
280280 #[ inline( never) ]
@@ -291,7 +291,7 @@ where
291291 QueryResult :: Started ( job) => job,
292292 QueryResult :: Poisoned => panic ! ( ) ,
293293 } ;
294- shard. insert ( self . key . clone ( ) , QueryResult :: Poisoned ) ;
294+ shard. insert ( self . key , QueryResult :: Poisoned ) ;
295295 job
296296 } ;
297297 // Also signal the completion of the job, so waiters
@@ -310,7 +310,7 @@ pub(crate) struct CycleError<D: DepKind> {
310310/// The result of `try_start`.
311311enum TryGetJob < ' tcx , K , D >
312312where
313- K : Eq + Hash + Clone ,
313+ K : Eq + Hash + Copy ,
314314 D : DepKind ,
315315{
316316 /// The query is not yet started. Contains a guard to the cache eventually used to start it.
@@ -358,10 +358,9 @@ where
358358 Q : QueryConfig < Qcx > ,
359359 Qcx : QueryContext ,
360360{
361- match JobOwner :: < ' _ , Q :: Key , Qcx :: DepKind > :: try_start ( & qcx, state, span, key. clone ( ) ) {
361+ match JobOwner :: < ' _ , Q :: Key , Qcx :: DepKind > :: try_start ( & qcx, state, span, key) {
362362 TryGetJob :: NotYetStarted ( job) => {
363- let ( result, dep_node_index) =
364- execute_job :: < Q , Qcx > ( qcx, key. clone ( ) , dep_node, job. id ) ;
363+ let ( result, dep_node_index) = execute_job :: < Q , Qcx > ( qcx, key, dep_node, job. id ) ;
365364 if Q :: FEEDABLE {
366365 // We should not compute queries that also got a value via feeding.
367366 // This can't happen, as query feeding adds the very dependencies to the fed query
@@ -551,7 +550,7 @@ where
551550 let prof_timer = qcx. dep_context ( ) . profiler ( ) . query_provider ( ) ;
552551
553552 // The dep-graph for this computation is already in-place.
554- let result = dep_graph. with_ignore ( || Q :: compute ( qcx, key. clone ( ) ) ) ;
553+ let result = dep_graph. with_ignore ( || Q :: compute ( qcx, * key) ) ;
555554
556555 prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
557556
0 commit comments