Skip to content

Commit 0859451

Browse files
committed
Auto merge of #68580 - Mark-Simulacrum:rollup-r80xhus, r=Mark-Simulacrum
Rollup of 3 pull requests Successful merges: - #68459 (don't clone types that are copy, round two.) - #68576 (update miri) - #68579 (Update cargo) Failed merges: r? @ghost
2 parents 8a79d08 + b0f5f67 commit 0859451

File tree

58 files changed

+157
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+157
-194
lines changed

src/librustc/infer/fudge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn const_vars_since_snapshot<'tcx>(
1919
(
2020
range.start..range.end,
2121
(range.start.index..range.end.index)
22-
.map(|index| table.probe_value(ConstVid::from_index(index)).origin.clone())
22+
.map(|index| table.probe_value(ConstVid::from_index(index)).origin)
2323
.collect(),
2424
)
2525
}

src/librustc/infer/lexical_region_resolve/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
611611

612612
errors.push(RegionResolutionError::GenericBoundFailure(
613613
verify.origin.clone(),
614-
verify.kind.clone(),
614+
verify.kind,
615615
sub,
616616
));
617617
}
@@ -761,7 +761,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
761761

762762
for upper_bound in &upper_bounds {
763763
if !self.region_rels.is_subregion_of(effective_lower_bound, upper_bound.region) {
764-
let origin = self.var_infos[node_idx].origin.clone();
764+
let origin = self.var_infos[node_idx].origin;
765765
debug!(
766766
"region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
767767
sup: {:?}",

src/librustc/infer/region_constraints/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
832832
(
833833
range.clone(),
834834
(range.start.index()..range.end.index())
835-
.map(|index| self.var_infos[ty::RegionVid::from(index)].origin.clone())
835+
.map(|index| self.var_infos[ty::RegionVid::from(index)].origin)
836836
.collect(),
837837
)
838838
}

src/librustc/infer/type_variable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
306306
(
307307
range.start.vid..range.end.vid,
308308
(range.start.vid.index..range.end.vid.index)
309-
.map(|index| self.values.get(index as usize).origin.clone())
309+
.map(|index| self.values.get(index as usize).origin)
310310
.collect(),
311311
)
312312
}

src/librustc/mir/mod.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ impl<'tcx> Operand<'tcx> {
19881988
pub fn to_copy(&self) -> Self {
19891989
match *self {
19901990
Operand::Copy(_) | Operand::Constant(_) => self.clone(),
1991-
Operand::Move(ref place) => Operand::Copy(place.clone()),
1991+
Operand::Move(place) => Operand::Copy(place),
19921992
}
19931993
}
19941994
}
@@ -2462,11 +2462,15 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
24622462
let projs: Vec<_> = self
24632463
.projs
24642464
.iter()
2465-
.map(|elem| match elem {
2465+
.map(|&elem| match elem {
24662466
Deref => Deref,
2467-
Field(f, ()) => Field(f.clone(), ()),
2467+
Field(f, ()) => Field(f, ()),
24682468
Index(()) => Index(()),
2469-
elem => elem.clone(),
2469+
Downcast(symbol, variantidx) => Downcast(symbol, variantidx),
2470+
ConstantIndex { offset, min_length, from_end } => {
2471+
ConstantIndex { offset, min_length, from_end }
2472+
}
2473+
Subslice { from, to, from_end } => Subslice { from, to, from_end },
24702474
})
24712475
.collect();
24722476

@@ -2862,11 +2866,15 @@ impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx> {
28622866
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
28632867
use crate::mir::ProjectionElem::*;
28642868

2865-
match self {
2869+
match *self {
28662870
Deref => Deref,
2867-
Field(f, ty) => Field(*f, ty.fold_with(folder)),
2871+
Field(f, ty) => Field(f, ty.fold_with(folder)),
28682872
Index(v) => Index(v.fold_with(folder)),
2869-
elem => elem.clone(),
2873+
Downcast(symbol, variantidx) => Downcast(symbol, variantidx),
2874+
ConstantIndex { offset, min_length, from_end } => {
2875+
ConstantIndex { offset, min_length, from_end }
2876+
}
2877+
Subslice { from, to, from_end } => Subslice { from, to, from_end },
28702878
}
28712879
}
28722880

@@ -2911,7 +2919,7 @@ impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C> {
29112919
impl<'tcx> TypeFoldable<'tcx> for Constant<'tcx> {
29122920
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
29132921
Constant {
2914-
span: self.span.clone(),
2922+
span: self.span,
29152923
user_ty: self.user_ty.fold_with(folder),
29162924
literal: self.literal.fold_with(folder),
29172925
}

src/librustc/mir/mono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl<'tcx> CodegenUnit<'tcx> {
362362
}
363363

364364
pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx>) -> DepNode {
365-
DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name().clone()))
365+
DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name()))
366366
}
367367
}
368368

src/librustc/traits/auto_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ impl AutoTraitFinder<'tcx> {
535535
}
536536

537537
while !vid_map.is_empty() {
538-
let target = vid_map.keys().next().expect("Keys somehow empty").clone();
538+
let target = *vid_map.keys().next().expect("Keys somehow empty");
539539
let deps = vid_map.remove(&target).expect("Entry somehow missing");
540540

541541
for smaller in deps.smaller.iter() {

src/librustc/traits/error_reporting/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
5454
span,
5555
predicates
5656
.iter()
57-
.map(|predicate| ErrorDescriptor {
58-
predicate: predicate.clone(),
59-
index: None,
60-
})
57+
.map(|&predicate| ErrorDescriptor { predicate, index: None })
6158
.collect(),
6259
)
6360
})
@@ -73,7 +70,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
7370
}
7471

7572
error_map.entry(span).or_default().push(ErrorDescriptor {
76-
predicate: error.obligation.predicate.clone(),
73+
predicate: error.obligation.predicate,
7774
index: Some(index),
7875
});
7976

@@ -137,7 +134,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
137134
}
138135
};
139136

140-
for implication in super::elaborate_predicates(self.tcx, vec![cond.clone()]) {
137+
for implication in super::elaborate_predicates(self.tcx, vec![*cond]) {
141138
if let ty::Predicate::Trait(implication, _) = implication {
142139
let error = error.to_poly_trait_ref();
143140
let implication = implication.to_poly_trait_ref();

src/librustc/traits/project.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
377377
let normalized_ty = normalize_projection_type(
378378
self.selcx,
379379
self.param_env,
380-
data.clone(),
380+
*data,
381381
self.cause.clone(),
382382
self.depth,
383383
&mut self.obligations,
@@ -433,7 +433,7 @@ pub fn normalize_projection_type<'a, 'b, 'tcx>(
433433
opt_normalize_projection_type(
434434
selcx,
435435
param_env,
436-
projection_ty.clone(),
436+
projection_ty,
437437
cause.clone(),
438438
depth,
439439
obligations,

src/librustc/traits/select.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
20682068
}
20692069
}
20702070

2071-
_ => candidates.vec.push(AutoImplCandidate(def_id.clone())),
2071+
_ => candidates.vec.push(AutoImplCandidate(def_id)),
20722072
}
20732073
}
20742074

@@ -2132,10 +2132,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
21322132
// but `Foo` is declared as `trait Foo: Bar<u32>`.
21332133
let upcast_trait_refs = util::supertraits(self.tcx(), poly_trait_ref)
21342134
.filter(|upcast_trait_ref| {
2135-
self.infcx.probe(|_| {
2136-
let upcast_trait_ref = upcast_trait_ref.clone();
2137-
self.match_poly_trait_ref(obligation, upcast_trait_ref).is_ok()
2138-
})
2135+
self.infcx
2136+
.probe(|_| self.match_poly_trait_ref(obligation, *upcast_trait_ref).is_ok())
21392137
})
21402138
.count();
21412139

@@ -2243,7 +2241,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
22432241
let def_id = obligation.predicate.def_id();
22442242

22452243
if self.tcx().is_trait_alias(def_id) {
2246-
candidates.vec.push(TraitAliasCandidate(def_id.clone()));
2244+
candidates.vec.push(TraitAliasCandidate(def_id));
22472245
}
22482246

22492247
Ok(())
@@ -3249,7 +3247,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
32493247
obligation_trait_ref: ty::PolyTraitRef<'tcx>,
32503248
expected_trait_ref: ty::PolyTraitRef<'tcx>,
32513249
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
3252-
let obligation_trait_ref = obligation_trait_ref.clone();
32533250
self.infcx
32543251
.at(&obligation_cause, obligation_param_env)
32553252
.sup(obligation_trait_ref, expected_trait_ref)

0 commit comments

Comments
 (0)