Skip to content

Commit aa53d09

Browse files
committed
new struct substsref
1 parent c751c7a commit aa53d09

File tree

26 files changed

+94
-69
lines changed

26 files changed

+94
-69
lines changed

src/librustc/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
824824
if !has_default {
825825
break;
826826
}
827-
if self.tcx.type_of(def_id).subst(self.tcx, substs) != actual {
827+
if self.tcx.type_of(def_id).subst(self.tcx, &substs) != actual {
828828
break;
829829
}
830830
num_supplied_defaults += 1;

src/librustc/infer/opaque_types/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
408408
substs,
409409
item_def_id: _,
410410
}) => {
411-
for k in substs {
411+
for k in substs.iter() {
412412
match k.unpack() {
413413
UnpackedKind::Lifetime(lt) => bound_region(lt),
414414
UnpackedKind::Type(ty) => types.push(ty),
@@ -653,7 +653,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx>
653653
},
654654
));
655655

656-
self.tcx.mk_closure(def_id, ty::ClosureSubsts { substs })
656+
self.tcx.mk_closure(def_id, ty::ClosureSubsts { substs: substs.into() })
657657
}
658658

659659
_ => ty.super_fold_with(self),

src/librustc/infer/outlives/obligations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ where
431431
if approx_env_bounds.is_empty() && trait_bounds.is_empty() && needs_infer {
432432
debug!("projection_must_outlive: no declared bounds");
433433

434-
for k in projection_ty.substs {
434+
for k in projection_ty.substs.iter() {
435435
match k.unpack() {
436436
UnpackedKind::Lifetime(lt) => {
437437
self.delegate.push_sub_region_constraint(origin.clone(), region, lt);

src/librustc/infer/outlives/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
248248
debug!("projection_bounds(projection_ty={:?})", projection_ty);
249249
let tcx = self.tcx;
250250
self.region_bounds_declared_on_associated_item(projection_ty.item_def_id)
251-
.map(move |r| r.subst(tcx, projection_ty.substs))
251+
.map(move |r| r.subst(tcx, &projection_ty.substs))
252252
}
253253

254254
/// Given the `DefId` of an associated item, returns any region

src/librustc/mir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,7 +2320,7 @@ impl<'tcx> Operand<'tcx> {
23202320
substs: SubstsRef<'tcx>,
23212321
span: Span,
23222322
) -> Self {
2323-
let ty = tcx.type_of(def_id).subst(tcx, substs);
2323+
let ty = tcx.type_of(def_id).subst(tcx, &substs);
23242324
Operand::Constant(box Constant {
23252325
span,
23262326
ty,
@@ -2539,7 +2539,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
25392539
ty::tls::with(|tcx| {
25402540
let substs = tcx.lift(&substs).expect("could not lift for printing");
25412541
FmtPrinter::new(tcx, f, Namespace::ValueNS)
2542-
.print_def_path(variant_def.def_id, substs)?;
2542+
.print_def_path(variant_def.def_id, &substs)?;
25432543
Ok(())
25442544
})?;
25452545

src/librustc/mir/tcx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'tcx> Rvalue<'tcx> {
195195
tcx.mk_tup(ops.iter().map(|op| op.ty(local_decls, tcx)))
196196
}
197197
AggregateKind::Adt(def, _, substs, _, _) => {
198-
tcx.type_of(def.did).subst(tcx, substs)
198+
tcx.type_of(def.did).subst(tcx, &substs)
199199
}
200200
AggregateKind::Closure(did, substs) => {
201201
tcx.mk_closure(did, substs)

src/librustc/traits/codegen/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
9696
value,
9797
param_env,
9898
);
99-
let substituted = value.subst(self, param_substs);
99+
let substituted = value.subst(self, &param_substs);
100100
self.normalize_erasing_regions(param_env, substituted)
101101
}
102102
}

src/librustc/traits/coherence.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ fn with_fresh_ty_vars<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, '
9898

9999
let header = ty::ImplHeader {
100100
impl_def_id,
101-
self_ty: tcx.type_of(impl_def_id).subst(tcx, impl_substs),
102-
trait_ref: tcx.impl_trait_ref(impl_def_id).subst(tcx, impl_substs),
103-
predicates: tcx.predicates_of(impl_def_id).instantiate(tcx, impl_substs).predicates,
101+
self_ty: tcx.type_of(impl_def_id).subst(tcx, &impl_substs),
102+
trait_ref: tcx.impl_trait_ref(impl_def_id).subst(tcx, &impl_substs),
103+
predicates: tcx.predicates_of(impl_def_id).instantiate(tcx, impl_substs.into()).predicates,
104104
};
105105

106106
let Normalized { value: mut header, obligations } =

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
305305
let impl_trait_ref = tcx
306306
.impl_trait_ref(def_id)
307307
.unwrap()
308-
.subst(tcx, impl_substs);
308+
.subst(tcx, &impl_substs);
309309

310310
let impl_self_ty = impl_trait_ref.self_ty();
311311

src/librustc/traits/object_safety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
415415
}
416416
});
417417

418-
let result = receiver_ty.subst(self, substs);
418+
let result = receiver_ty.subst(self, &substs);
419419
debug!("receiver_for_self_ty({:?}, {:?}, {:?}) = {:?}",
420420
receiver_ty, self_ty, method_def_id, result);
421421
result

0 commit comments

Comments
 (0)