Skip to content

Commit

Permalink
Rollup merge of #108101 - matthiaskrgr:noclonecopy, r=compiler-errors
Browse files Browse the repository at this point in the history
don't clone types that are copy
  • Loading branch information
Dylan-DPC committed Feb 16, 2023
2 parents 323e5e8 + e087f61 commit ef0b121
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,7 @@ fn method_autoderef_steps<'tcx>(
.by_ref()
.map(|(ty, d)| {
let step = CandidateStep {
self_ty: infcx
.make_query_response_ignoring_pending_obligations(inference_vars.clone(), ty),
self_ty: infcx.make_query_response_ignoring_pending_obligations(inference_vars, ty),
autoderefs: d,
from_unsafe_deref: reached_raw_pointer,
unsize: false,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_query_system/src/query/caches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ where
let mut lock = self.cache.lock();
// We may be overwriting another value. This is all right, since the dep-graph
// will check that the fingerprint matches.
lock.insert(key, (value.clone(), index));
lock.insert(key, (value, index));
value
}

Expand Down Expand Up @@ -153,7 +153,7 @@ where

#[inline]
fn complete(&self, _key: (), value: V, index: DepNodeIndex) -> Self::Stored {
*self.cache.lock() = Some((value.clone(), index));
*self.cache.lock() = Some((value, index));
value
}

Expand Down Expand Up @@ -283,7 +283,7 @@ where
let mut lock = self.cache.get_shard_by_hash(key.index() as u64).lock();
#[cfg(not(parallel_compiler))]
let mut lock = self.cache.lock();
lock.insert(key, (value.clone(), index));
lock.insert(key, (value, index));
value
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/solve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
response.value.certainty == Certainty::Yes
&& response.has_no_inference_or_external_constraints()
}) {
return Ok(response.clone());
return Ok(*response);
}

let certainty = candidates.iter().fold(Certainty::AMBIGUOUS, |certainty, response| {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/object_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ fn virtual_call_violation_for_method<'tcx>(
return false;
}

contains_illegal_self_type_reference(tcx, trait_def_id, pred.clone())
contains_illegal_self_type_reference(tcx, trait_def_id, pred)
}) {
return Some(MethodViolationCode::WhereClauseReferencesSelf);
}
Expand Down

0 comments on commit ef0b121

Please sign in to comment.