diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index c9273e0b8d5..68cb8ca39b4 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -136,18 +136,6 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> { fn visit_ty(&mut self, ty: &ast::Ty) { match ty.node { - ast::TyClosure(ref c) => { - // Careful, the bounds on a closure/proc are *not* within its binder. - visit::walk_ty_param_bounds_helper(self, &c.bounds); - visit::walk_lifetime_decls_helper(self, &c.lifetimes); - self.with(LateScope(&c.lifetimes, self.scope), |old_scope, this| { - this.check_lifetime_defs(old_scope, &c.lifetimes); - for argument in c.decl.inputs.iter() { - this.visit_ty(&*argument.ty) - } - visit::walk_fn_ret_ty(this, &c.decl.output); - }); - } ast::TyBareFn(ref c) => { visit::walk_lifetime_decls_helper(self, &c.lifetimes); self.with(LateScope(&c.lifetimes, self.scope), |old_scope, this| { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 2c2678c8dc6..a2c86c3cdb7 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -71,7 +71,7 @@ use syntax::ast::{PatRange, PatStruct, Path}; use syntax::ast::{PolyTraitRef, PrimTy, SelfExplicit}; use syntax::ast::{RegionTyParamBound, StructField}; use syntax::ast::{TraitRef, TraitTyParamBound}; -use syntax::ast::{Ty, TyBool, TyChar, TyClosure, TyF32}; +use syntax::ast::{Ty, TyBool, TyChar, TyF32}; use syntax::ast::{TyF64, TyFloat, TyI, TyI8, TyI16, TyI32, TyI64, TyInt, TyObjectSum}; use syntax::ast::{TyParam, TyParamBound, TyPath, TyPtr, TyPolyTraitRef, TyQPath}; use syntax::ast::{TyRptr, TyStr, TyU, TyU8, TyU16, TyU32, TyU64, TyUint}; @@ -3606,14 +3606,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { self.resolve_trait_reference(ty.id, &*qpath.trait_ref, TraitQPath); } - TyClosure(ref c) => { - self.resolve_type_parameter_bounds( - ty.id, - &c.bounds, - TraitBoundingTypeParameter); - visit::walk_ty(self, ty); - } - TyPolyTraitRef(ref bounds) => { self.resolve_type_parameter_bounds( ty.id, diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index c616f4feaff..bde834c2ff8 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1112,28 +1112,6 @@ pub fn ast_ty_to_ty<'tcx>( let bare_fn = ty_of_bare_fn(this, bf.unsafety, bf.abi, &*bf.decl); ty::mk_bare_fn(tcx, None, tcx.mk_bare_fn(bare_fn)) } - ast::TyClosure(ref f) => { - // Use corresponding trait store to figure out default bounds - // if none were specified. - let bounds = conv_existential_bounds(this, - rscope, - ast_ty.span, - None, - Vec::new(), - f.bounds.as_slice()); - let region_bound = bounds.region_bound; - let fn_decl = ty_of_closure(this, - f.unsafety, - f.onceness, - bounds, - ty::RegionTraitStore( - region_bound, - ast::MutMutable), - &*f.decl, - abi::Rust, - None); - ty::mk_closure(tcx, fn_decl) - } ast::TyPolyTraitRef(ref bounds) => { conv_ty_poly_trait_ref(this, rscope, ast_ty.span, bounds[]) } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e2ca4b1ecdb..e01dbac68ee 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1366,7 +1366,6 @@ impl Clean for ast::Ty { } } } - TyClosure(ref c) => Closure(box c.clean(cx)), TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)), TyParen(ref ty) => ty.clean(cx), TyQPath(ref qp) => qp.clean(cx), diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index c9d27e304ff..e779821342a 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1220,8 +1220,6 @@ pub enum Ty_ { TyPtr(MutTy), /// A reference (`&'a T` or `&'a mut T`) TyRptr(Option, MutTy), - /// A closure (e.g. `|uint| -> bool`) - TyClosure(P), /// A bare function (e.g. `fn(uint) -> bool`) TyBareFn(P), /// A tuple (`(A, B, C, D,...)`) diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index ce7b964959f..cf09e2777f7 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -859,9 +859,6 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> { fn visit_ty(&mut self, ty: &'ast Ty) { match ty.node { - TyClosure(ref fd) => { - self.visit_fn_decl(&*fd.decl); - } TyBareFn(ref fd) => { self.visit_fn_decl(&*fd.decl); } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f8ac34cfe29..cb6277069e1 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -364,12 +364,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { } fn visit_ty(&mut self, t: &ast::Ty) { - if let ast::TyClosure(ref closure) = t.node { - // this used to be blocked by a feature gate, but it should just - // be plain impossible right now - assert!(closure.onceness != ast::Once); - } - visit::walk_ty(self, t); } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 35b2e5dbc53..396b0033b81 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -414,17 +414,6 @@ pub fn noop_fold_ty(t: P, fld: &mut T) -> P { TyRptr(region, mt) => { TyRptr(fld.fold_opt_lifetime(region), fld.fold_mt(mt)) } - TyClosure(f) => { - TyClosure(f.map(|ClosureTy {unsafety, onceness, bounds, decl, lifetimes}| { - ClosureTy { - unsafety: unsafety, - onceness: onceness, - bounds: fld.fold_bounds(bounds), - decl: fld.fold_fn_decl(decl), - lifetimes: fld.fold_lifetime_defs(lifetimes) - } - })) - } TyBareFn(f) => { TyBareFn(f.map(|BareFnTy {lifetimes, unsafety, abi, decl}| BareFnTy { lifetimes: fld.fold_lifetime_defs(lifetimes), diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index cc67079e538..9bc91a95841 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -55,7 +55,7 @@ use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue}; use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef}; use ast::{TtDelimited, TtSequence, TtToken}; use ast::{TupleVariantKind, Ty, Ty_, TypeBinding}; -use ast::{TypeField, TyFixedLengthVec, TyClosure, TyBareFn}; +use ast::{TypeField, TyFixedLengthVec, TyBareFn}; use ast::{TyTypeof, TyInfer, TypeMethod}; use ast::{TyParam, TyParamBound, TyParen, TyPath, TyPolyTraitRef, TyPtr, TyQPath}; use ast::{TyRptr, TyTup, TyU32, TyVec, UnUniq}; @@ -1252,13 +1252,7 @@ impl<'a> Parser<'a> { variadic: false }); - TyClosure(P(ClosureTy { - unsafety: unsafety, - onceness: Many, - bounds: bounds, - decl: decl, - lifetimes: lifetime_defs, - })) + panic!("stub"); } pub fn parse_unsafety(&mut self) -> Unsafety { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 61b7aa408a8..e44cc2257c2 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -714,25 +714,6 @@ impl<'a> State<'a> { Some(&generics), None)); } - ast::TyClosure(ref f) => { - let generics = ast::Generics { - lifetimes: f.lifetimes.clone(), - ty_params: OwnedSlice::empty(), - where_clause: ast::WhereClause { - id: ast::DUMMY_NODE_ID, - predicates: Vec::new(), - }, - }; - try!(self.print_ty_fn(None, - Some('&'), - f.unsafety, - f.onceness, - &*f.decl, - None, - &f.bounds, - Some(&generics), - None)); - } ast::TyPath(ref path, _) => { try!(self.print_path(path, false)); } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 054a288a69e..737f1b73b32 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -404,14 +404,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) { visitor.visit_ty(&**tuple_element_type) } } - TyClosure(ref function_declaration) => { - for argument in function_declaration.decl.inputs.iter() { - visitor.visit_ty(&*argument.ty) - } - walk_fn_ret_ty(visitor, &function_declaration.decl.output); - walk_ty_param_bounds_helper(visitor, &function_declaration.bounds); - walk_lifetime_decls_helper(visitor, &function_declaration.lifetimes); - } TyBareFn(ref function_declaration) => { for argument in function_declaration.decl.inputs.iter() { visitor.visit_ty(&*argument.ty)