libsyntax: Remove ~fn()
from the language
This commit is contained in:
parent
ba739b2135
commit
f977bedafd
5 changed files with 13 additions and 19 deletions
|
@ -41,7 +41,8 @@ pub enum ObsoleteSyntax {
|
||||||
ObsoleteLoopAsContinue,
|
ObsoleteLoopAsContinue,
|
||||||
ObsoleteEnumWildcard,
|
ObsoleteEnumWildcard,
|
||||||
ObsoleteStructWildcard,
|
ObsoleteStructWildcard,
|
||||||
ObsoleteVecDotDotWildcard
|
ObsoleteVecDotDotWildcard,
|
||||||
|
ObsoleteBoxedClosure,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl to_bytes::IterBytes for ObsoleteSyntax {
|
impl to_bytes::IterBytes for ObsoleteSyntax {
|
||||||
|
@ -128,6 +129,11 @@ impl ParserObsoleteMethods for Parser {
|
||||||
"vec slice wildcard",
|
"vec slice wildcard",
|
||||||
"use `..` instead of `.._` for matching slices"
|
"use `..` instead of `.._` for matching slices"
|
||||||
),
|
),
|
||||||
|
ObsoleteBoxedClosure => (
|
||||||
|
"managed or owned closure",
|
||||||
|
"managed closures have been removed and owned closures are \
|
||||||
|
now written `proc()`"
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
self.report(sp, kind, kind_str, desc);
|
self.report(sp, kind, kind_str, desc);
|
||||||
|
|
|
@ -1273,15 +1273,17 @@ impl Parser {
|
||||||
pub fn parse_box_or_uniq_pointee(&self,
|
pub fn parse_box_or_uniq_pointee(&self,
|
||||||
sigil: ast::Sigil,
|
sigil: ast::Sigil,
|
||||||
ctor: &fn(v: mt) -> ty_) -> ty_ {
|
ctor: &fn(v: mt) -> ty_) -> ty_ {
|
||||||
// ~'foo fn() or ~fn() are parsed directly as fn types:
|
// ~'foo fn() or ~fn() are parsed directly as obsolete fn types:
|
||||||
match *self.token {
|
match *self.token {
|
||||||
token::LIFETIME(*) => {
|
token::LIFETIME(*) => {
|
||||||
let lifetime = self.parse_lifetime();
|
let lifetime = self.parse_lifetime();
|
||||||
|
self.obsolete(*self.last_span, ObsoleteBoxedClosure);
|
||||||
return self.parse_ty_closure(Some(sigil), Some(lifetime));
|
return self.parse_ty_closure(Some(sigil), Some(lifetime));
|
||||||
}
|
}
|
||||||
|
|
||||||
token::IDENT(*) => {
|
token::IDENT(*) if sigil == ast::BorrowedSigil => {
|
||||||
if self.token_is_old_style_closure_keyword() {
|
if self.token_is_old_style_closure_keyword() {
|
||||||
|
self.obsolete(*self.last_span, ObsoleteBoxedClosure);
|
||||||
return self.parse_ty_closure(Some(sigil), None);
|
return self.parse_ty_closure(Some(sigil), None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let _: @'static whatever fn(); //~ ERROR expected `fn`, found `whatever`
|
|
||||||
let _: @'static fn();
|
|
||||||
}
|
|
|
@ -16,7 +16,7 @@ extern mod extra;
|
||||||
use extra::arc;
|
use extra::arc;
|
||||||
use std::util;
|
use std::util;
|
||||||
|
|
||||||
fn foo(blk: ~once fn()) {
|
fn foo(blk: proc()) {
|
||||||
blk();
|
blk();
|
||||||
blk(); //~ ERROR use of moved value
|
blk(); //~ ERROR use of moved value
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ extern mod extra;
|
||||||
use extra::arc;
|
use extra::arc;
|
||||||
use std::util;
|
use std::util;
|
||||||
|
|
||||||
fn foo(blk: ~once fn()) {
|
fn foo(blk: proc()) {
|
||||||
blk();
|
blk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue