diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-01-24 22:06:31 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-01-26 04:15:09 +0200 |
| commit | 50a370aa2d98ea2f50153a3007734f8d6fb473e0 (patch) | |
| tree | 8b80d4193c5090ec464125a152bb83029473602b /src/libsyntax | |
| parent | ab9c773cdb17404dd5982add2980a35921b844b8 (diff) | |
| download | rust-50a370aa2d98ea2f50153a3007734f8d6fb473e0.tar.gz rust-50a370aa2d98ea2f50153a3007734f8d6fb473e0.zip | |
Remove dead code related to old closures.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 95 |
2 files changed, 11 insertions, 94 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 909a719c691..233197ccb5b 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1237,16 +1237,6 @@ impl fmt::Display for Onceness { } } -/// Represents the type of a closure -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] -pub struct ClosureTy { - pub lifetimes: Vec<LifetimeDef>, - pub unsafety: Unsafety, - pub onceness: Onceness, - pub decl: P<FnDecl>, - pub bounds: TyParamBounds, -} - #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] pub struct BareFnTy { pub unsafety: Unsafety, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 7cbc701995e..d06ac50920e 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -703,14 +703,11 @@ impl<'a> State<'a> { predicates: Vec::new(), }, }; - try!(self.print_ty_fn(Some(f.abi), - None, + try!(self.print_ty_fn(f.abi, f.unsafety, - ast::Many, &*f.decl, None, - &OwnedSlice::empty(), - Some(&generics), + &generics, None)); } ast::TyPath(ref path, _) => { @@ -1215,14 +1212,11 @@ impl<'a> State<'a> { try!(self.hardbreak_if_not_bol()); try!(self.maybe_print_comment(m.span.lo)); try!(self.print_outer_attributes(&m.attrs[])); - try!(self.print_ty_fn(None, - None, + try!(self.print_ty_fn(m.abi, m.unsafety, - ast::Many, &*m.decl, Some(m.ident), - &OwnedSlice::empty(), - Some(&m.generics), + &m.generics, Some(&m.explicit_self.node))); word(&mut self.s, ";") } @@ -2300,7 +2294,7 @@ impl<'a> State<'a> { opt_explicit_self: Option<&ast::ExplicitSelf_>, vis: ast::Visibility) -> IoResult<()> { try!(self.head("")); - try!(self.print_fn_header_info(opt_explicit_self, unsafety, abi, vis)); + try!(self.print_fn_header_info(unsafety, abi, vis)); try!(self.nbsp()); try!(self.print_ident(name)); try!(self.print_generics(generics)); @@ -2396,31 +2390,6 @@ impl<'a> State<'a> { } } - pub fn print_proc_args(&mut self, decl: &ast::FnDecl) -> IoResult<()> { - try!(word(&mut self.s, "proc")); - try!(word(&mut self.s, "(")); - try!(self.print_fn_args(decl, None)); - try!(word(&mut self.s, ")")); - - if let ast::DefaultReturn(..) = decl.output { - return Ok(()); - } - - try!(self.space_if_not_bol()); - try!(self.word_space("->")); - match decl.output { - ast::Return(ref ty) => { - try!(self.print_type(&**ty)); - self.maybe_print_comment(ty.span.lo) - } - ast::DefaultReturn(..) => unreachable!(), - ast::NoReturn(span) => { - try!(self.word_nbsp("!")); - self.maybe_print_comment(span.lo) - } - } - } - pub fn print_bounds(&mut self, prefix: &str, bounds: &[ast::TyParamBound]) @@ -2696,31 +2665,15 @@ impl<'a> State<'a> { } pub fn print_ty_fn(&mut self, - opt_abi: Option<abi::Abi>, - opt_sigil: Option<char>, + abi: abi::Abi, unsafety: ast::Unsafety, - onceness: ast::Onceness, decl: &ast::FnDecl, id: Option<ast::Ident>, - bounds: &OwnedSlice<ast::TyParamBound>, - generics: Option<&ast::Generics>, + generics: &ast::Generics, opt_explicit_self: Option<&ast::ExplicitSelf_>) -> IoResult<()> { try!(self.ibox(indent_unit)); - - // Duplicates the logic in `print_fn_header_info()`. This is because that - // function prints the sigil in the wrong place. That should be fixed. - if opt_sigil == Some('~') && onceness == ast::Once { - try!(word(&mut self.s, "proc")); - } else if opt_sigil == Some('&') { - try!(self.print_unsafety(unsafety)); - try!(self.print_extern_opt_abi(opt_abi)); - } else { - assert!(opt_sigil.is_none()); - try!(self.print_unsafety(unsafety)); - try!(self.print_opt_abi_and_extern_if_nondefault(opt_abi)); - try!(word(&mut self.s, "fn")); - } + try!(self.print_fn_header_info(Some(unsafety), abi, ast::Inherited)); match id { Some(id) => { @@ -2730,35 +2683,10 @@ impl<'a> State<'a> { _ => () } - match generics { Some(g) => try!(self.print_generics(g)), _ => () } + try!(self.print_generics(generics)); try!(zerobreak(&mut self.s)); - - if opt_sigil == Some('&') { - try!(word(&mut self.s, "|")); - } else { - try!(self.popen()); - } - - try!(self.print_fn_args(decl, opt_explicit_self)); - - if opt_sigil == Some('&') { - try!(word(&mut self.s, "|")); - } else { - if decl.variadic { - try!(word(&mut self.s, ", ...")); - } - try!(self.pclose()); - } - - try!(self.print_bounds(":", &bounds[])); - - try!(self.print_fn_output(decl)); - - match generics { - Some(generics) => try!(self.print_where_clause(generics)), - None => {} - } - + try!(self.print_fn_args_and_ret(decl, opt_explicit_self)); + try!(self.print_where_clause(generics)); self.end() } @@ -3015,7 +2943,6 @@ impl<'a> State<'a> { } pub fn print_fn_header_info(&mut self, - _opt_explicit_self: Option<&ast::ExplicitSelf_>, opt_unsafety: Option<ast::Unsafety>, abi: abi::Abi, vis: ast::Visibility) -> IoResult<()> { |
