Skip to content

Commit 84fcaf1

Browse files
committed
---
yaml --- r: 228685 b: refs/heads/try c: 1e2677b h: refs/heads/master i: 228683: f693fd5 v: v3
1 parent 245f78b commit 84fcaf1

File tree

31 files changed

+257
-160
lines changed

31 files changed

+257
-160
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 69d62e04e524d4b202b7fdce791e1418a4adbb38
4+
refs/heads/try: 1e2677be72e2b0c180ed1be38d1868b4829ad530
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc/metadata/tyencode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ pub fn enc_ty<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>, t: Ty<'tcx>) {
143143
enc_substs(w, cx, substs);
144144
mywrite!(w, "]");
145145
}
146-
ty::TyClosure(def, substs, ref tys) => {
146+
ty::TyClosure(def, ref substs) => {
147147
mywrite!(w, "k[{}|", (cx.ds)(def));
148-
enc_substs(w, cx, substs);
149-
for ty in tys {
148+
enc_substs(w, cx, &substs.func_substs);
149+
for ty in &substs.upvar_tys {
150150
enc_ty(w, cx, ty);
151151
}
152152
mywrite!(w, ".");

branches/try/src/librustc/middle/fast_reject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn simplify_type(tcx: &ty::ctxt,
7676
Err(msg) => tcx.sess.fatal(&msg),
7777
}
7878
}
79-
ty::TyClosure(def_id, _, _) => {
79+
ty::TyClosure(def_id, _) => {
8080
Some(ClosureSimplifiedType(def_id))
8181
}
8282
ty::TyTuple(ref tys) => {

branches/try/src/librustc/middle/implicator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use util::nodemap::FnvHashSet;
2828
pub enum Implication<'tcx> {
2929
RegionSubRegion(Option<Ty<'tcx>>, ty::Region, ty::Region),
3030
RegionSubGeneric(Option<Ty<'tcx>>, ty::Region, GenericKind<'tcx>),
31-
RegionSubClosure(Option<Ty<'tcx>>, ty::Region, ast::DefId, &'tcx Substs<'tcx>),
31+
RegionSubClosure(Option<Ty<'tcx>>, ty::Region, ast::DefId, &'tcx ty::ClosureSubsts<'tcx>),
3232
Predicate(ast::DefId, ty::Predicate<'tcx>),
3333
}
3434

@@ -96,7 +96,7 @@ impl<'a, 'tcx> Implicator<'a, 'tcx> {
9696
// No borrowed content reachable here.
9797
}
9898

99-
ty::TyClosure(def_id, substs, _) => {
99+
ty::TyClosure(def_id, ref substs) => {
100100
// TODO remove RegionSubClosure
101101
let &(r_a, opt_ty) = self.stack.last().unwrap();
102102
self.out.push(Implication::RegionSubClosure(opt_ty, r_a, def_id, substs));

branches/try/src/librustc/middle/infer/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,17 +1374,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13741374
}
13751375

13761376
pub fn closure_type(&self,
1377-
def_id: ast::DefId,
1378-
substs: &subst::Substs<'tcx>)
1379-
-> ty::ClosureTy<'tcx>
1377+
def_id: ast::DefId,
1378+
substs: &ty::ClosureSubsts<'tcx>)
1379+
-> ty::ClosureTy<'tcx>
13801380
{
1381-
13821381
let closure_ty = self.tables
13831382
.borrow()
13841383
.closure_tys
13851384
.get(&def_id)
13861385
.unwrap()
1387-
.subst(self.tcx, substs);
1386+
.subst(self.tcx, &substs.func_substs);
13881387

13891388
if self.normalize {
13901389
normalize_associated_type(&self.tcx, &closure_ty)
@@ -1395,7 +1394,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13951394

13961395
pub fn closure_upvars(&self,
13971396
def_id: ast::DefId,
1398-
substs: &Substs<'tcx>)
1397+
substs: &ty::ClosureSubsts<'tcx>)
13991398
-> Option<Vec<ty::ClosureUpvar<'tcx>>>
14001399
{
14011400
let result = ty::ctxt::closure_upvars(self, def_id, substs);

branches/try/src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
14931493
fn fn_ret(&self, id: NodeId) -> ty::PolyFnOutput<'tcx> {
14941494
let fn_ty = self.ir.tcx.node_id_to_type(id);
14951495
match fn_ty.sty {
1496-
ty::TyClosure(closure_def_id, substs, _) =>
1496+
ty::TyClosure(closure_def_id, ref substs) =>
14971497
self.ir.tcx.closure_type(closure_def_id, substs).sig.output(),
14981498
_ => fn_ty.fn_ret()
14991499
}

branches/try/src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
584584
def::DefUpvar(var_id, fn_node_id) => {
585585
let ty = try!(self.node_ty(fn_node_id));
586586
match ty.sty {
587-
ty::TyClosure(closure_id, _, _) => {
587+
ty::TyClosure(closure_id, _) => {
588588
match self.typer.closure_kind(closure_id) {
589589
Some(kind) => {
590590
self.cat_upvar(id, span, var_id, fn_node_id, kind)

branches/try/src/librustc/middle/traits/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ pub struct VtableImplData<'tcx, N> {
270270
#[derive(Clone, PartialEq, Eq)]
271271
pub struct VtableClosureData<'tcx, N> {
272272
pub closure_def_id: ast::DefId,
273-
pub substs: subst::Substs<'tcx>,
274-
pub upvar_tys: Vec<Ty<'tcx>>,
273+
pub substs: ty::ClosureSubsts<'tcx>,
275274
/// Nested obligations. This can be non-empty if the closure
276275
/// signature contains associated types.
277276
pub nested: Vec<N>
@@ -550,7 +549,6 @@ impl<'tcx, N> Vtable<'tcx, N> {
550549
closure_def_id: c.closure_def_id,
551550
substs: c.substs,
552551
nested: c.nested.into_iter().map(f).collect(),
553-
upvar_tys: c.upvar_tys,
554552
})
555553
}
556554
}

branches/try/src/librustc/middle/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn consider_unification_despite_ambiguity<'cx,'tcx>(selcx: &mut SelectionContext
154154
debug!("consider_unification_despite_ambiguity: self_ty.sty={:?}",
155155
self_ty.sty);
156156
match self_ty.sty {
157-
ty::TyClosure(closure_def_id, substs, _) => {
157+
ty::TyClosure(closure_def_id, ref substs) => {
158158
let closure_typer = selcx.closure_typer();
159159
let closure_type = closure_typer.closure_type(closure_def_id, substs);
160160
let ty::Binder((_, ret_type)) =

branches/try/src/librustc/middle/traits/select.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ enum SelectionCandidate<'tcx> {
201201

202202
/// Implementation of a `Fn`-family trait by one of the
203203
/// anonymous types generated for a `||` expression.
204-
ClosureCandidate(/* closure */ ast::DefId, &'tcx Substs<'tcx>, &'tcx Vec<Ty<'tcx>>),
204+
ClosureCandidate(/* closure */ ast::DefId, &'tcx ty::ClosureSubsts<'tcx>),
205205

206206
/// Implementation of a `Fn`-family trait by one of the anonymous
207207
/// types generated for a fn pointer type (e.g., `fn(int)->int`)
@@ -348,7 +348,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
348348
// lifetimes can appear inside the self-type.
349349
let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
350350
let (closure_def_id, substs) = match self_ty.sty {
351-
ty::TyClosure(id, ref substs, _) => (id, substs.clone()),
351+
ty::TyClosure(id, ref substs) => (id, substs),
352352
_ => { return; }
353353
};
354354
assert!(!substs.has_escaping_regions());
@@ -1142,8 +1142,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11421142
// touch bound regions, they just capture the in-scope
11431143
// type/region parameters
11441144
let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
1145-
let (closure_def_id, substs, upvar_tys) = match self_ty.sty {
1146-
ty::TyClosure(id, substs, ref upvar_tys) => (id, substs, upvar_tys),
1145+
let (closure_def_id, substs) = match self_ty.sty {
1146+
ty::TyClosure(id, ref substs) => (id, substs),
11471147
ty::TyInfer(ty::TyVar(_)) => {
11481148
debug!("assemble_unboxed_closure_candidates: ambiguous self-type");
11491149
candidates.ambiguous = true;
@@ -1161,7 +1161,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11611161
Some(closure_kind) => {
11621162
debug!("assemble_unboxed_candidates: closure_kind = {:?}", closure_kind);
11631163
if closure_kind.extends(kind) {
1164-
candidates.vec.push(ClosureCandidate(closure_def_id, substs, upvar_tys));
1164+
candidates.vec.push(ClosureCandidate(closure_def_id, substs));
11651165
}
11661166
}
11671167
None => {
@@ -1703,7 +1703,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17031703
// (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
17041704
ty::TyTuple(ref tys) => ok_if(tys.clone()),
17051705

1706-
ty::TyClosure(def_id, substs, _) => {
1706+
ty::TyClosure(def_id, ref substs) => {
17071707
// FIXME -- This case is tricky. In the case of by-ref
17081708
// closures particularly, we need the results of
17091709
// inference to decide how to reflect the type of each
@@ -1865,7 +1865,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
18651865
Some(tys.clone())
18661866
}
18671867

1868-
ty::TyClosure(def_id, substs, _) => {
1868+
ty::TyClosure(def_id, ref substs) => {
18691869
assert_eq!(def_id.krate, ast::LOCAL_CRATE);
18701870

18711871
// TODO
@@ -2015,10 +2015,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
20152015
Ok(VtableImpl(vtable_impl))
20162016
}
20172017

2018-
ClosureCandidate(closure_def_id, substs, upvar_tys) => {
2018+
ClosureCandidate(closure_def_id, substs) => {
20192019
let vtable_closure =
2020-
try!(self.confirm_closure_candidate(obligation, closure_def_id,
2021-
&substs, upvar_tys));
2020+
try!(self.confirm_closure_candidate(obligation, closure_def_id, substs));
20222021
Ok(VtableClosure(vtable_closure))
20232022
}
20242023

@@ -2367,8 +2366,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
23672366
fn confirm_closure_candidate(&mut self,
23682367
obligation: &TraitObligation<'tcx>,
23692368
closure_def_id: ast::DefId,
2370-
substs: &Substs<'tcx>,
2371-
upvar_tys: &'tcx Vec<Ty<'tcx>>)
2369+
substs: &ty::ClosureSubsts<'tcx>)
23722370
-> Result<VtableClosureData<'tcx, PredicateObligation<'tcx>>,
23732371
SelectionError<'tcx>>
23742372
{
@@ -2394,7 +2392,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
23942392
Ok(VtableClosureData {
23952393
closure_def_id: closure_def_id,
23962394
substs: substs.clone(),
2397-
upvar_tys: upvar_tys.clone(),
23982395
nested: obligations
23992396
})
24002397
}
@@ -2856,7 +2853,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
28562853
fn closure_trait_ref_unnormalized(&mut self,
28572854
obligation: &TraitObligation<'tcx>,
28582855
closure_def_id: ast::DefId,
2859-
substs: &Substs<'tcx>)
2856+
substs: &ty::ClosureSubsts<'tcx>)
28602857
-> ty::PolyTraitRef<'tcx>
28612858
{
28622859
let closure_type = self.infcx.closure_type(closure_def_id, substs);
@@ -2878,7 +2875,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
28782875
fn closure_trait_ref(&mut self,
28792876
obligation: &TraitObligation<'tcx>,
28802877
closure_def_id: ast::DefId,
2881-
substs: &Substs<'tcx>)
2878+
substs: &ty::ClosureSubsts<'tcx>)
28822879
-> Normalized<'tcx, ty::PolyTraitRef<'tcx>>
28832880
{
28842881
let trait_ref = self.closure_trait_ref_unnormalized(

0 commit comments

Comments
 (0)