Skip to content

Commit 1f8e1d8

Browse files
committed
remove ClosureSubsts with SubstsRef
1 parent eab060f commit 1f8e1d8

File tree

20 files changed

+37
-29
lines changed

20 files changed

+37
-29
lines changed

src/librustc/infer/opaque_types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
896896
}
897897
}));
898898

899-
self.tcx.mk_closure(def_id, ty::ClosureSubsts { substs })
899+
self.tcx.mk_closure(def_id, substs)
900900
}
901901

902902
ty::Generator(def_id, substs, movability) => {

src/librustc/middle/mem_categorization.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
745745
// During upvar inference we may not know the
746746
// closure kind, just use the LATTICE_BOTTOM value.
747747
Some(infcx) =>
748-
infcx.closure_kind(closure_def_id, ty::ClosureSubsts::from_ref(closure_substs))
748+
infcx.closure_kind(closure_def_id,
749+
ty::ClosureSubsts::from_ref(closure_substs))
749750
.unwrap_or(ty::ClosureKind::LATTICE_BOTTOM),
750751

751752
None =>

src/librustc/mir/tcx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'tcx> Rvalue<'tcx> {
218218
tcx.type_of(def.did).subst(tcx, substs)
219219
}
220220
AggregateKind::Closure(did, substs) => {
221-
tcx.mk_closure(did, substs)
221+
tcx.mk_closure(did, &substs.substs)
222222
}
223223
AggregateKind::Generator(did, substs, movability) => {
224224
tcx.mk_generator(did, substs, movability)

src/librustc/traits/select.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
20512051
"assemble_unboxed_candidates: kind={:?} obligation={:?}",
20522052
kind, obligation
20532053
);
2054-
match self.infcx.closure_kind(closure_def_id, closure_substs) {
2054+
match self.infcx.closure_kind(closure_def_id,
2055+
ty::ClosureSubsts::from_ref(closure_substs)) {
20552056
Some(closure_kind) => {
20562057
debug!(
20572058
"assemble_unboxed_candidates: closure_kind = {:?}",
@@ -3375,7 +3376,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
33753376
obligations.push(Obligation::new(
33763377
obligation.cause.clone(),
33773378
obligation.param_env,
3378-
ty::Predicate::ClosureKind(closure_def_id, ty::ClosureSubsts::from_ref(substs.clone()), kind),
3379+
ty::Predicate::ClosureKind(closure_def_id,
3380+
ty::ClosureSubsts::from_ref(substs.clone()), kind),
33793381
));
33803382
}
33813383

@@ -3876,7 +3878,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
38763878
"closure_trait_ref_unnormalized(obligation={:?}, closure_def_id={:?}, substs={:?})",
38773879
obligation, closure_def_id, substs,
38783880
);
3879-
let closure_type = self.infcx.closure_sig(closure_def_id, substs);
3881+
let closure_type = self.infcx.closure_sig(closure_def_id,
3882+
ty::ClosureSubsts::from_ref(substs));
38803883

38813884
debug!(
38823885
"closure_trait_ref_unnormalized: closure_type = {:?}",

src/librustc/ty/subst.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ impl<'a, 'tcx> InternalSubsts<'tcx> {
402402
) -> impl Iterator<Item = Ty<'a>> + 'a {
403403
let SplitClosureSubsts { upvar_kinds, .. } = self.split(def_id, tcx);
404404
upvar_kinds.iter().map(|t| {
405-
if let UnpackedKind::Type(ty) = t.unpack() {
405+
if let GenericArgKind::Type(ty) = t.unpack() {
406406
ty
407407
} else {
408408
bug!("upvar should be type")

src/librustc_codegen_ssa/mir/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,8 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
615615
};
616616

617617
let (def_id, upvar_substs) = match closure_layout.ty.kind {
618-
ty::Closure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs)),
618+
ty::Closure(def_id, substs) => (def_id,
619+
UpvarSubsts::Closure(rustc::ty::ClosureSubsts::from_ref(substs))),
619620
ty::Generator(def_id, substs, _) => (def_id, UpvarSubsts::Generator(substs)),
620621
_ => bug!("upvar debuginfo with non-closure arg0 type `{}`", closure_layout.ty)
621622
};

src/librustc_codegen_ssa/mir/rvalue.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
201201
match operand.layout.ty.kind {
202202
ty::Closure(def_id, substs) => {
203203
let instance = Instance::resolve_closure(
204-
bx.cx().tcx(), def_id, substs, ty::ClosureKind::FnOnce);
204+
bx.cx().tcx(), def_id,
205+
rustc::ty::ClosureSubsts::from_ref(substs),
206+
ty::ClosureKind::FnOnce);
205207
OperandValue::Immediate(bx.cx().get_fn(instance))
206208
}
207209
_ => {

src/librustc_codegen_utils/symbol_names/legacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
224224
ty::Opaque(def_id, substs) |
225225
ty::Projection(ty::ProjectionTy { item_def_id: def_id, substs }) |
226226
ty::UnnormalizedProjection(ty::ProjectionTy { item_def_id: def_id, substs }) |
227-
ty::Closure(def_id, ty::ClosureSubsts { substs }) |
227+
ty::Closure(def_id, substs) |
228228
ty::Generator(def_id, ty::GeneratorSubsts { substs }, _) => {
229229
self.print_def_path(def_id, substs)
230230
}

src/librustc_codegen_utils/symbol_names/v0.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
414414
ty::Opaque(def_id, substs) |
415415
ty::Projection(ty::ProjectionTy { item_def_id: def_id, substs }) |
416416
ty::UnnormalizedProjection(ty::ProjectionTy { item_def_id: def_id, substs }) |
417-
ty::Closure(def_id, ty::ClosureSubsts { substs }) |
417+
ty::Closure(def_id, substs) |
418418
ty::Generator(def_id, ty::GeneratorSubsts { substs }, _) => {
419419
self = self.print_def_path(def_id, substs)?;
420420
}

src/librustc_mir/borrow_check/nll/universal_regions.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,8 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
509509
.replace_free_regions_with_nll_infer_vars(FR, &defining_ty);
510510

511511
match defining_ty.kind {
512-
ty::Closure(def_id, substs) => DefiningTy::Closure(def_id, substs),
512+
ty::Closure(def_id, substs) => DefiningTy::Closure(def_id,
513+
rustc::ty::ClosureSubsts::from_ref(substs)),
513514
ty::Generator(def_id, substs, movability) => {
514515
DefiningTy::Generator(def_id, substs, movability)
515516
}
@@ -584,7 +585,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
584585
assert_eq!(self.mir_def_id, def_id);
585586
let closure_sig = substs.closure_sig_ty(def_id, tcx).fn_sig(tcx);
586587
let inputs_and_output = closure_sig.inputs_and_output();
587-
let closure_ty = tcx.closure_env_ty(def_id, substs).unwrap();
588+
let closure_ty = tcx.closure_env_ty(def_id, substs.substs).unwrap();
588589
ty::Binder::fuse(
589590
closure_ty,
590591
inputs_and_output,

0 commit comments

Comments
 (0)