remove TyClosure
This commit is contained in:
parent
5f7f2c9a05
commit
714a5b7f5e
@ -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| {
|
||||
|
@ -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,
|
||||
|
@ -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[])
|
||||
}
|
||||
|
@ -1366,7 +1366,6 @@ impl Clean<Type> 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),
|
||||
|
@ -1220,8 +1220,6 @@ pub enum Ty_ {
|
||||
TyPtr(MutTy),
|
||||
/// A reference (`&'a T` or `&'a mut T`)
|
||||
TyRptr(Option<Lifetime>, MutTy),
|
||||
/// A closure (e.g. `|uint| -> bool`)
|
||||
TyClosure(P<ClosureTy>),
|
||||
/// A bare function (e.g. `fn(uint) -> bool`)
|
||||
TyBareFn(P<BareFnTy>),
|
||||
/// A tuple (`(A, B, C, D,...)`)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -414,17 +414,6 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> {
|
||||
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),
|
||||
|
@ -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 {
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user