@@ -49,7 +49,7 @@ enum QueryResult<D: DepKind> {
4949
5050impl < K , D > QueryState < K , D >
5151where
52- K : Eq + Hash + Clone + Debug ,
52+ K : Eq + Hash + Copy + Debug ,
5353 D : DepKind ,
5454{
5555 pub fn all_inactive ( & self ) -> bool {
7878 for shard in shards. iter ( ) {
7979 for ( k, v) in shard. iter ( ) {
8080 if let QueryResult :: Started ( ref job) = * v {
81- let query = make_query ( qcx, k . clone ( ) ) ;
81+ let query = make_query ( qcx, * k ) ;
8282 jobs. insert ( job. id , QueryJobInfo { query, job : job. clone ( ) } ) ;
8383 }
8484 }
9292 // really hurt much.)
9393 for ( k, v) in self . active . try_lock ( ) ?. iter ( ) {
9494 if let QueryResult :: Started ( ref job) = * v {
95- let query = make_query ( qcx, k . clone ( ) ) ;
95+ let query = make_query ( qcx, * k ) ;
9696 jobs. insert ( job. id , QueryJobInfo { query, job : job. clone ( ) } ) ;
9797 }
9898 }
@@ -112,7 +112,7 @@ impl<K, D: DepKind> Default for QueryState<K, D> {
112112/// This will poison the relevant query if dropped.
113113struct JobOwner < ' tcx , K , D : DepKind >
114114where
115- K : Eq + Hash + Clone ,
115+ K : Eq + Hash + Copy ,
116116{
117117 state : & ' tcx QueryState < K , D > ,
118118 key : K ,
@@ -164,7 +164,7 @@ where
164164
165165impl < ' tcx , K , D : DepKind > JobOwner < ' tcx , K , D >
166166where
167- K : Eq + Hash + Clone ,
167+ K : Eq + Hash + Copy ,
168168{
169169 /// Either gets a `JobOwner` corresponding the query, allowing us to
170170 /// start executing the query, or returns with the result of the query.
@@ -196,7 +196,7 @@ where
196196 let job = qcx. current_query_job ( ) ;
197197 let job = QueryJob :: new ( id, span, job) ;
198198
199- let key = entry. key ( ) . clone ( ) ;
199+ let key = * entry. key ( ) ;
200200 entry. insert ( QueryResult :: Started ( job) ) ;
201201
202202 let owner = JobOwner { state, id, key } ;
@@ -275,7 +275,7 @@ where
275275
276276impl < ' tcx , K , D > Drop for JobOwner < ' tcx , K , D >
277277where
278- K : Eq + Hash + Clone ,
278+ K : Eq + Hash + Copy ,
279279 D : DepKind ,
280280{
281281 #[ inline( never) ]
@@ -292,7 +292,7 @@ where
292292 QueryResult :: Started ( job) => job,
293293 QueryResult :: Poisoned => panic ! ( ) ,
294294 } ;
295- shard. insert ( self . key . clone ( ) , QueryResult :: Poisoned ) ;
295+ shard. insert ( self . key , QueryResult :: Poisoned ) ;
296296 job
297297 } ;
298298 // Also signal the completion of the job, so waiters
@@ -311,7 +311,7 @@ pub(crate) struct CycleError<D: DepKind> {
311311/// The result of `try_start`.
312312enum TryGetJob < ' tcx , K , D >
313313where
314- K : Eq + Hash + Clone ,
314+ K : Eq + Hash + Copy ,
315315 D : DepKind ,
316316{
317317 /// The query is not yet started. Contains a guard to the cache eventually used to start it.
@@ -359,10 +359,9 @@ where
359359 Q : QueryConfig < Qcx > ,
360360 Qcx : QueryContext ,
361361{
362- match JobOwner :: < ' _ , Q :: Key , Qcx :: DepKind > :: try_start ( & qcx, state, span, key. clone ( ) ) {
362+ match JobOwner :: < ' _ , Q :: Key , Qcx :: DepKind > :: try_start ( & qcx, state, span, key) {
363363 TryGetJob :: NotYetStarted ( job) => {
364- let ( result, dep_node_index) =
365- execute_job :: < Q , Qcx > ( qcx, key. clone ( ) , dep_node, job. id ) ;
364+ let ( result, dep_node_index) = execute_job :: < Q , Qcx > ( qcx, key, dep_node, job. id ) ;
366365 if Q :: FEEDABLE {
367366 // We may have put a value inside the cache from inside the execution.
368367 // Verify that it has the same hash as what we have now, to ensure consistency.
@@ -547,7 +546,7 @@ where
547546 let prof_timer = qcx. dep_context ( ) . profiler ( ) . query_provider ( ) ;
548547
549548 // The dep-graph for this computation is already in-place.
550- let result = dep_graph. with_ignore ( || Q :: compute ( qcx, key. clone ( ) ) ) ;
549+ let result = dep_graph. with_ignore ( || Q :: compute ( qcx, * key) ) ;
551550
552551 prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
553552
0 commit comments