Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f977bed

Browse files
committedNov 19, 2013
libsyntax: Remove ~fn() from the language
1 parent ba739b2 commit f977bed

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed
 

‎src/libsyntax/parse/obsolete.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ pub enum ObsoleteSyntax {
4141
ObsoleteLoopAsContinue,
4242
ObsoleteEnumWildcard,
4343
ObsoleteStructWildcard,
44-
ObsoleteVecDotDotWildcard
44+
ObsoleteVecDotDotWildcard,
45+
ObsoleteBoxedClosure,
4546
}
4647

4748
impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -128,6 +129,11 @@ impl ParserObsoleteMethods for Parser {
128129
"vec slice wildcard",
129130
"use `..` instead of `.._` for matching slices"
130131
),
132+
ObsoleteBoxedClosure => (
133+
"managed or owned closure",
134+
"managed closures have been removed and owned closures are \
135+
now written `proc()`"
136+
),
131137
};
132138

133139
self.report(sp, kind, kind_str, desc);

‎src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,15 +1273,17 @@ impl Parser {
12731273
pub fn parse_box_or_uniq_pointee(&self,
12741274
sigil: ast::Sigil,
12751275
ctor: &fn(v: mt) -> ty_) -> ty_ {
1276-
// ~'foo fn() or ~fn() are parsed directly as fn types:
1276+
// ~'foo fn() or ~fn() are parsed directly as obsolete fn types:
12771277
match *self.token {
12781278
token::LIFETIME(*) => {
12791279
let lifetime = self.parse_lifetime();
1280+
self.obsolete(*self.last_span, ObsoleteBoxedClosure);
12801281
return self.parse_ty_closure(Some(sigil), Some(lifetime));
12811282
}
12821283

1283-
token::IDENT(*) => {
1284+
token::IDENT(*) if sigil == ast::BorrowedSigil => {
12841285
if self.token_is_old_style_closure_keyword() {
1286+
self.obsolete(*self.last_span, ObsoleteBoxedClosure);
12851287
return self.parse_ty_closure(Some(sigil), None);
12861288
}
12871289
}

‎src/test/compile-fail/issue-8615.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎src/test/compile-fail/once-cant-call-twice-on-heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extern mod extra;
1616
use extra::arc;
1717
use std::util;
1818

19-
fn foo(blk: ~once fn()) {
19+
fn foo(blk: proc()) {
2020
blk();
2121
blk(); //~ ERROR use of moved value
2222
}

‎src/test/run-pass/once-move-out-on-heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern mod extra;
1717
use extra::arc;
1818
use std::util;
1919

20-
fn foo(blk: ~once fn()) {
20+
fn foo(blk: proc()) {
2121
blk();
2222
}
2323

0 commit comments

Comments
 (0)