@@ -49,7 +49,7 @@ enum QueryResult<D: DepKind> {
49
49
50
50
impl < K , D > QueryState < K , D >
51
51
where
52
- K : Eq + Hash + Clone + Debug ,
52
+ K : Eq + Hash + Copy + Debug ,
53
53
D : DepKind ,
54
54
{
55
55
pub fn all_inactive ( & self ) -> bool {
78
78
for shard in shards. iter ( ) {
79
79
for ( k, v) in shard. iter ( ) {
80
80
if let QueryResult :: Started ( ref job) = * v {
81
- let query = make_query ( qcx, k . clone ( ) ) ;
81
+ let query = make_query ( qcx, * k ) ;
82
82
jobs. insert ( job. id , QueryJobInfo { query, job : job. clone ( ) } ) ;
83
83
}
84
84
}
92
92
// really hurt much.)
93
93
for ( k, v) in self . active . try_lock ( ) ?. iter ( ) {
94
94
if let QueryResult :: Started ( ref job) = * v {
95
- let query = make_query ( qcx, k . clone ( ) ) ;
95
+ let query = make_query ( qcx, * k ) ;
96
96
jobs. insert ( job. id , QueryJobInfo { query, job : job. clone ( ) } ) ;
97
97
}
98
98
}
@@ -112,7 +112,7 @@ impl<K, D: DepKind> Default for QueryState<K, D> {
112
112
/// This will poison the relevant query if dropped.
113
113
struct JobOwner < ' tcx , K , D : DepKind >
114
114
where
115
- K : Eq + Hash + Clone ,
115
+ K : Eq + Hash + Copy ,
116
116
{
117
117
state : & ' tcx QueryState < K , D > ,
118
118
key : K ,
@@ -164,7 +164,7 @@ where
164
164
165
165
impl < ' tcx , K , D : DepKind > JobOwner < ' tcx , K , D >
166
166
where
167
- K : Eq + Hash + Clone ,
167
+ K : Eq + Hash + Copy ,
168
168
{
169
169
/// Either gets a `JobOwner` corresponding the query, allowing us to
170
170
/// start executing the query, or returns with the result of the query.
@@ -196,7 +196,7 @@ where
196
196
let job = qcx. current_query_job ( ) ;
197
197
let job = QueryJob :: new ( id, span, job) ;
198
198
199
- let key = entry. key ( ) . clone ( ) ;
199
+ let key = * entry. key ( ) ;
200
200
entry. insert ( QueryResult :: Started ( job) ) ;
201
201
202
202
let owner = JobOwner { state, id, key } ;
@@ -275,7 +275,7 @@ where
275
275
276
276
impl < ' tcx , K , D > Drop for JobOwner < ' tcx , K , D >
277
277
where
278
- K : Eq + Hash + Clone ,
278
+ K : Eq + Hash + Copy ,
279
279
D : DepKind ,
280
280
{
281
281
#[ inline( never) ]
@@ -292,7 +292,7 @@ where
292
292
QueryResult :: Started ( job) => job,
293
293
QueryResult :: Poisoned => panic ! ( ) ,
294
294
} ;
295
- shard. insert ( self . key . clone ( ) , QueryResult :: Poisoned ) ;
295
+ shard. insert ( self . key , QueryResult :: Poisoned ) ;
296
296
job
297
297
} ;
298
298
// Also signal the completion of the job, so waiters
@@ -311,7 +311,7 @@ pub(crate) struct CycleError<D: DepKind> {
311
311
/// The result of `try_start`.
312
312
enum TryGetJob < ' tcx , K , D >
313
313
where
314
- K : Eq + Hash + Clone ,
314
+ K : Eq + Hash + Copy ,
315
315
D : DepKind ,
316
316
{
317
317
/// The query is not yet started. Contains a guard to the cache eventually used to start it.
@@ -359,10 +359,9 @@ where
359
359
Q : QueryConfig < Qcx > ,
360
360
Qcx : QueryContext ,
361
361
{
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) {
363
363
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 ) ;
366
365
if Q :: FEEDABLE {
367
366
// We may have put a value inside the cache from inside the execution.
368
367
// Verify that it has the same hash as what we have now, to ensure consistency.
@@ -547,7 +546,7 @@ where
547
546
let prof_timer = qcx. dep_context ( ) . profiler ( ) . query_provider ( ) ;
548
547
549
548
// 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) ) ;
551
550
552
551
prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
553
552
0 commit comments