Skip to content

Commit 714a5b7

Browse files
author
Jorge Aparicio
committed
remove TyClosure
1 parent 5f7f2c9 commit 714a5b7

File tree

11 files changed

+3
-101
lines changed

11 files changed

+3
-101
lines changed

src/librustc/middle/resolve_lifetime.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,6 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
136136

137137
fn visit_ty(&mut self, ty: &ast::Ty) {
138138
match ty.node {
139-
ast::TyClosure(ref c) => {
140-
// Careful, the bounds on a closure/proc are *not* within its binder.
141-
visit::walk_ty_param_bounds_helper(self, &c.bounds);
142-
visit::walk_lifetime_decls_helper(self, &c.lifetimes);
143-
self.with(LateScope(&c.lifetimes, self.scope), |old_scope, this| {
144-
this.check_lifetime_defs(old_scope, &c.lifetimes);
145-
for argument in c.decl.inputs.iter() {
146-
this.visit_ty(&*argument.ty)
147-
}
148-
visit::walk_fn_ret_ty(this, &c.decl.output);
149-
});
150-
}
151139
ast::TyBareFn(ref c) => {
152140
visit::walk_lifetime_decls_helper(self, &c.lifetimes);
153141
self.with(LateScope(&c.lifetimes, self.scope), |old_scope, this| {

src/librustc_resolve/lib.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use syntax::ast::{PatRange, PatStruct, Path};
7171
use syntax::ast::{PolyTraitRef, PrimTy, SelfExplicit};
7272
use syntax::ast::{RegionTyParamBound, StructField};
7373
use syntax::ast::{TraitRef, TraitTyParamBound};
74-
use syntax::ast::{Ty, TyBool, TyChar, TyClosure, TyF32};
74+
use syntax::ast::{Ty, TyBool, TyChar, TyF32};
7575
use syntax::ast::{TyF64, TyFloat, TyI, TyI8, TyI16, TyI32, TyI64, TyInt, TyObjectSum};
7676
use syntax::ast::{TyParam, TyParamBound, TyPath, TyPtr, TyPolyTraitRef, TyQPath};
7777
use syntax::ast::{TyRptr, TyStr, TyU, TyU8, TyU16, TyU32, TyU64, TyUint};
@@ -3606,14 +3606,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
36063606
self.resolve_trait_reference(ty.id, &*qpath.trait_ref, TraitQPath);
36073607
}
36083608

3609-
TyClosure(ref c) => {
3610-
self.resolve_type_parameter_bounds(
3611-
ty.id,
3612-
&c.bounds,
3613-
TraitBoundingTypeParameter);
3614-
visit::walk_ty(self, ty);
3615-
}
3616-
36173609
TyPolyTraitRef(ref bounds) => {
36183610
self.resolve_type_parameter_bounds(
36193611
ty.id,

src/librustc_typeck/astconv.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,28 +1112,6 @@ pub fn ast_ty_to_ty<'tcx>(
11121112
let bare_fn = ty_of_bare_fn(this, bf.unsafety, bf.abi, &*bf.decl);
11131113
ty::mk_bare_fn(tcx, None, tcx.mk_bare_fn(bare_fn))
11141114
}
1115-
ast::TyClosure(ref f) => {
1116-
// Use corresponding trait store to figure out default bounds
1117-
// if none were specified.
1118-
let bounds = conv_existential_bounds(this,
1119-
rscope,
1120-
ast_ty.span,
1121-
None,
1122-
Vec::new(),
1123-
f.bounds.as_slice());
1124-
let region_bound = bounds.region_bound;
1125-
let fn_decl = ty_of_closure(this,
1126-
f.unsafety,
1127-
f.onceness,
1128-
bounds,
1129-
ty::RegionTraitStore(
1130-
region_bound,
1131-
ast::MutMutable),
1132-
&*f.decl,
1133-
abi::Rust,
1134-
None);
1135-
ty::mk_closure(tcx, fn_decl)
1136-
}
11371115
ast::TyPolyTraitRef(ref bounds) => {
11381116
conv_ty_poly_trait_ref(this, rscope, ast_ty.span, bounds[])
11391117
}

src/librustdoc/clean/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,6 @@ impl Clean<Type> for ast::Ty {
13661366
}
13671367
}
13681368
}
1369-
TyClosure(ref c) => Closure(box c.clean(cx)),
13701369
TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
13711370
TyParen(ref ty) => ty.clean(cx),
13721371
TyQPath(ref qp) => qp.clean(cx),

src/libsyntax/ast.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,6 @@ pub enum Ty_ {
12201220
TyPtr(MutTy),
12211221
/// A reference (`&'a T` or `&'a mut T`)
12221222
TyRptr(Option<Lifetime>, MutTy),
1223-
/// A closure (e.g. `|uint| -> bool`)
1224-
TyClosure(P<ClosureTy>),
12251223
/// A bare function (e.g. `fn(uint) -> bool`)
12261224
TyBareFn(P<BareFnTy>),
12271225
/// A tuple (`(A, B, C, D,...)`)

src/libsyntax/ast_map/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -859,9 +859,6 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
859859

860860
fn visit_ty(&mut self, ty: &'ast Ty) {
861861
match ty.node {
862-
TyClosure(ref fd) => {
863-
self.visit_fn_decl(&*fd.decl);
864-
}
865862
TyBareFn(ref fd) => {
866863
self.visit_fn_decl(&*fd.decl);
867864
}

src/libsyntax/feature_gate.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
364364
}
365365

366366
fn visit_ty(&mut self, t: &ast::Ty) {
367-
if let ast::TyClosure(ref closure) = t.node {
368-
// this used to be blocked by a feature gate, but it should just
369-
// be plain impossible right now
370-
assert!(closure.onceness != ast::Once);
371-
}
372-
373367
visit::walk_ty(self, t);
374368
}
375369

src/libsyntax/fold.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,17 +414,6 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> {
414414
TyRptr(region, mt) => {
415415
TyRptr(fld.fold_opt_lifetime(region), fld.fold_mt(mt))
416416
}
417-
TyClosure(f) => {
418-
TyClosure(f.map(|ClosureTy {unsafety, onceness, bounds, decl, lifetimes}| {
419-
ClosureTy {
420-
unsafety: unsafety,
421-
onceness: onceness,
422-
bounds: fld.fold_bounds(bounds),
423-
decl: fld.fold_fn_decl(decl),
424-
lifetimes: fld.fold_lifetime_defs(lifetimes)
425-
}
426-
}))
427-
}
428417
TyBareFn(f) => {
429418
TyBareFn(f.map(|BareFnTy {lifetimes, unsafety, abi, decl}| BareFnTy {
430419
lifetimes: fld.fold_lifetime_defs(lifetimes),

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue};
5555
use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef};
5656
use ast::{TtDelimited, TtSequence, TtToken};
5757
use ast::{TupleVariantKind, Ty, Ty_, TypeBinding};
58-
use ast::{TypeField, TyFixedLengthVec, TyClosure, TyBareFn};
58+
use ast::{TypeField, TyFixedLengthVec, TyBareFn};
5959
use ast::{TyTypeof, TyInfer, TypeMethod};
6060
use ast::{TyParam, TyParamBound, TyParen, TyPath, TyPolyTraitRef, TyPtr, TyQPath};
6161
use ast::{TyRptr, TyTup, TyU32, TyVec, UnUniq};
@@ -1252,13 +1252,7 @@ impl<'a> Parser<'a> {
12521252
variadic: false
12531253
});
12541254

1255-
TyClosure(P(ClosureTy {
1256-
unsafety: unsafety,
1257-
onceness: Many,
1258-
bounds: bounds,
1259-
decl: decl,
1260-
lifetimes: lifetime_defs,
1261-
}))
1255+
panic!("stub");
12621256
}
12631257

12641258
pub fn parse_unsafety(&mut self) -> Unsafety {

src/libsyntax/print/pprust.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -714,25 +714,6 @@ impl<'a> State<'a> {
714714
Some(&generics),
715715
None));
716716
}
717-
ast::TyClosure(ref f) => {
718-
let generics = ast::Generics {
719-
lifetimes: f.lifetimes.clone(),
720-
ty_params: OwnedSlice::empty(),
721-
where_clause: ast::WhereClause {
722-
id: ast::DUMMY_NODE_ID,
723-
predicates: Vec::new(),
724-
},
725-
};
726-
try!(self.print_ty_fn(None,
727-
Some('&'),
728-
f.unsafety,
729-
f.onceness,
730-
&*f.decl,
731-
None,
732-
&f.bounds,
733-
Some(&generics),
734-
None));
735-
}
736717
ast::TyPath(ref path, _) => {
737718
try!(self.print_path(path, false));
738719
}

src/libsyntax/visit.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
404404
visitor.visit_ty(&**tuple_element_type)
405405
}
406406
}
407-
TyClosure(ref function_declaration) => {
408-
for argument in function_declaration.decl.inputs.iter() {
409-
visitor.visit_ty(&*argument.ty)
410-
}
411-
walk_fn_ret_ty(visitor, &function_declaration.decl.output);
412-
walk_ty_param_bounds_helper(visitor, &function_declaration.bounds);
413-
walk_lifetime_decls_helper(visitor, &function_declaration.lifetimes);
414-
}
415407
TyBareFn(ref function_declaration) => {
416408
for argument in function_declaration.decl.inputs.iter() {
417409
visitor.visit_ty(&*argument.ty)

0 commit comments

Comments
 (0)