1
Fork 0

librustc{, codegen_ssa,infer,mir_build}: don't clone types that are copy

This commit is contained in:
Matthias Krüger 2020-02-24 14:48:40 +01:00
parent 5ae4500eff
commit d4a005bd03
6 changed files with 6 additions and 6 deletions

View file

@ -1526,7 +1526,7 @@ impl<'tcx> GlobalCtxt<'tcx> {
ty::tls::with_related_context(tcx, |icx| { ty::tls::with_related_context(tcx, |icx| {
let new_icx = ty::tls::ImplicitCtxt { let new_icx = ty::tls::ImplicitCtxt {
tcx, tcx,
query: icx.query.clone(), query: icx.query,
diagnostics: icx.diagnostics, diagnostics: icx.diagnostics,
layout_depth: icx.layout_depth, layout_depth: icx.layout_depth,
task_deps: icx.task_deps, task_deps: icx.task_deps,

View file

@ -1447,7 +1447,7 @@ impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<TraitRef<'tcx>> {
impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<&TraitRef<'tcx>> { impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<&TraitRef<'tcx>> {
fn to_predicate(&self) -> Predicate<'tcx> { fn to_predicate(&self) -> Predicate<'tcx> {
ty::Predicate::Trait( ty::Predicate::Trait(
ty::Binder::dummy(ty::TraitPredicate { trait_ref: self.value.clone() }), ty::Binder::dummy(ty::TraitPredicate { trait_ref: *self.value }),
self.constness, self.constness,
) )
} }

View file

@ -173,7 +173,7 @@ impl<'tcx> QueryLatch<'tcx> {
return CycleError { usage, cycle }; return CycleError { usage, cycle };
} }
current_job = info.job.parent.clone(); current_job = info.job.parent;
} }
panic!("did not find a cycle") panic!("did not find a cycle")

View file

@ -31,7 +31,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
_ => { _ => {
let val = self.eval_mir_constant(constant)?; let val = self.eval_mir_constant(constant)?;
let ty = self.monomorphize(&constant.literal.ty); let ty = self.monomorphize(&constant.literal.ty);
Ok(OperandRef::from_const(bx, val.clone(), ty)) Ok(OperandRef::from_const(bx, val, ty))
} }
} }
} }

View file

@ -848,7 +848,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
for upper_bound in &upper_bounds { for upper_bound in &upper_bounds {
if let ty::RePlaceholder(p) = upper_bound.region { if let ty::RePlaceholder(p) = upper_bound.region {
if node_universe.cannot_name(p.universe) { if node_universe.cannot_name(p.universe) {
let origin = self.var_infos[node_idx].origin.clone(); let origin = self.var_infos[node_idx].origin;
errors.push(RegionResolutionError::UpperBoundUniverseConflict( errors.push(RegionResolutionError::UpperBoundUniverseConflict(
node_idx, node_idx,
origin, origin,

View file

@ -376,7 +376,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
TerminatorKind::Yield { TerminatorKind::Yield {
value, value,
resume, resume,
resume_arg: destination.clone(), resume_arg: *destination,
drop: cleanup, drop: cleanup,
}, },
); );